EccoAPIeccoapi
POST/api/v1/nanobanana2/generate

Image Editing (2)

Edit and transform existing images using Nano Banana 2. Supports up to 14 reference images for editing, style transfer, and multi-image composition.

Overview

Provide one or more reference images alongside a text prompt to guide edits. You can use base64-encoded images, image URLs, or a combination of both. The model supports up to 14 reference images per request (10 object references + 4 character references), enabling complex multi-image compositions and style transfers.

Request Parameters

ParameterTypeRequiredDescription
promptstringYesDescribe the desired edits to apply
imageBase64arrayAltArray of base64-encoded reference images (up to 14)
imageUrlsarrayAltArray of reference image URLs (up to 14)
imageSizestringNo"1K" (default), "2K", or "4K"
aspectRatiostringNoOutput aspect ratio. Default: "1:1"
temperaturenumberNoControls randomness (0-2). Recommended: 1.0 for image generation.
thinkingConfigobjectNoEnables reasoning pass for better reference adherence. Example: {"includeThoughts": true}
mediaResolutionstringNoInput image fidelity: "MEDIA_RESOLUTION_LOW", "MEDIA_RESOLUTION_MEDIUM", or "MEDIA_RESOLUTION_HIGH".
responseModalitiesarrayNoResponse types. Default: ["TEXT", "IMAGE"].
safetySettingsarrayNoSafety filter thresholds. Allowed thresholds: BLOCK_LOW_AND_ABOVE, BLOCK_MEDIUM_AND_ABOVE, BLOCK_ONLY_HIGH.

At least one of imageBase64 or imageUrls is required for image editing.

Example Request

bash
curl -X POST https://eccoapi.com/api/v1/nanobanana2/generate \
  -H "Authorization: Bearer nk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Change the car color to blue and add rain to the scene",
    "imageUrls": ["https://example.com/red-car.jpg"],
    "imageSize": "2K",
    "aspectRatio": "16:9"
  }'

Multi-Image Example

Combine multiple reference images into a single scene or apply the style of one image to another.

bash
curl -X POST https://eccoapi.com/api/v1/nanobanana2/generate \
  -H "Authorization: Bearer nk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Create a scene where these two characters are having a picnic in a park",
    "imageUrls": [
      "https://example.com/character1.jpg",
      "https://example.com/character2.jpg"
    ],
    "imageSize": "2K",
    "aspectRatio": "16:9"
  }'

Response

json
{
  "code": 200,
  "msg": "Success",
  "data": {
    "assetUrl": "https://<signed-url>",
    "candidates": [{
      "content": {
        "parts": [{
          "inlineData": {
            "mimeType": "image/png",
            "assetUrl": "https://<signed-url>",
            "assetKey": "user/<userId>/nanobanana2/....png"
          }
        }]
      }
    }]
  },
  "meta": {
    "model": "nanobanana2",
    "cost": 0.075,
    "remaining_credits": 9.925,
    "settings": {
      "aspectRatio": "16:9",
      "imageSize": "2K"
    }
  }
}