Gemini / Nano Banana Images
Gemini Image Edit with JSON
Edit using public image URLs or image data URLs, with one image or an ordered images array.
Updated
/v1/images/editsModel and response format
These are JuheNext compatibility rules for gemini-nano-banana-2.1-bs. Use https://api.juhenextvip.com with the endpoint paths shown below. Check the corresponding documentation for other image models.
- Returns one stored image URL. Download that URL without an API key. A download failure is not a reason to resubmit generation.
- One upstream generation submission per request; paid POST requests are not automatically retried.
- Default reference limits are 14 images and 40 MB of original bytes combined; platform or account limits may be tighter. Supported PNG/JPEG/WebP images must be readable.
Resolution and aspect ratio
Dimensions select a resolution tier and composition; exact pixels are not promised. Read the actual output dimensions. The compatibility layer does not resize or crop the result.
| Input | Example | Mapped result |
|---|---|---|
| size | auto | Default 1K; text-only defaults to 1:1, references let upstream choose |
| size | 1536x1024 | 1K / 3:2 |
| size | 1920x1080 | 2K / 16:9 |
| size | 1600x1000 | 2K / 3:2 (nearest) |
| size | 4096x2304 | Still 2K / 16:9, not 4K |
Single-turn input and reference limits
- Images generation is text-only; use edits for references. Chat uses only the last user message and does not restore previous images.
- URL references must be publicly accessible; private addresses are rejected. Replace example.com URLs and Base64 placeholders. Do not put API keys in image URLs.
- n, response_format, quality, mask, input_fidelity, background, output_format, and output_compression are ignored. They do not enable multiple images, Base64, transparency, or format conversion.
- The default whole-request limit is 64 MB including Base64 and JSON overhead. The original-image limit is not the final encoded request size.
Usage, errors, and saving results
- usage / usageMetadata is returned only when provided upstream. Images use input_tokens/output_tokens; Chat uses prompt_tokens/completion_tokens. Missing usage is not a zero-cost statement.
- 400 usually means invalid parameters or model capabilities; 401 is authentication; 413 is request size; 429 is capacity or rate limiting. Upstream rejection, timeout, no valid image, or storage failure may return 500. Keep the request ID and error for diagnosis.
- Generation can take time. Chat stream=true starts only after successful generation and storage, without waiting-period progress. Read SSE through data: [DONE]; do not parse the entire stream as one JSON object.
- URLs are not permanent archives: cleanup or signature changes can invalidate them. Download promptly and preserve id, sig, and the original query string.
Parameters
| Parameter | Type / location | Description |
|---|---|---|
modelRequired | stringbody | Public model ID. The example uses gemini-nano-banana-2.1-bs; availability depends on your key. |
promptRequired | stringbody | Non-empty prompt, up to 12,000 characters. |
imageOptional | string | objectbody | One public URL, image data URL, or {"url":"..."}. Do not combine with images or image[]. |
imagesOptional | arraybody | Ordered reference images, each a public URL/data URL string or {"url":"..."}. A non-empty reference image field is required. |
sizeOptional | stringbody | auto or positive WIDTHxHEIGHT. Long edge ≤1536 requests 1K; >1536 requests 2K. The nearest supported aspect ratio is used; exact pixels are not guaranteed. 1K, 2K, 4K, and 16:9 are not valid size values. |
n / response_format / quality / mask / input_fidelity / background / output_format / output_compressionOptional | ignoredbody | These parameters are ignored. One request generates one image. Images and Chat return a URL regardless of b64_json, transparency, or output format settings. mask is not a reference image. |