Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/generateTask/nano-banana-2 | Create generation task |
| GET | /api/v1/statusTask/nano-banana-2 | Query task status |
Authentication
All requests require an API Key in the header:Request Body
Parameters
async (polling) or callback (webhook)
Callback URL, required when request_type=callback (conditional)
Routing strategy: auto, value, or official
Model input parameters
text-to-image— Generate from text descriptionimage-to-image— Generate with reference images (up to 14)
Example
Text-to-ImageResponse
POST /api/v1/generateTask/nano-banana-2
ReturnstaskId on success for subsequent status queries.
Success:
GET /api/v1/statusTask/nano-banana-2
Query task execution status and results viataskId.
Status Response Fields
Unique task identifier.
Current task state:
pending, processing, success, or failed.JSON string containing
resultUrls array. Only present on success. Parse with JSON.parse().Error code. Only present when
state is failed. See Error Codes.Human-readable error message. Only present when
state is failed.Task creation timestamp (Unix milliseconds).
Task completion timestamp (Unix milliseconds).
Processing duration in milliseconds.
Error Codes
| Code | Description |
|---|---|
| 400 | Invalid parameters or request error |
| 401 | Invalid or missing API Key |
| 429 | Rate limit exceeded |
| Fail Code | Description |
|---|---|
CONTENT_VIOLATION | Content violates safety guidelines |
INVALID_IMAGE_URL | Cannot access provided image URL |
Rate Limits
| Limit | Value |
|---|---|
| Requests | 10000 / minute |
| Concurrent tasks | 1000 |
429 error. Wait and retry.
Tips
- Prompt length: Nano Banana 2 supports up to 20,000 characters (vs 5,000 in Nano Banana), suitable for detailed descriptions.
- Resolution: Choose
1K,2K, or4Kfor output resolution; parameter is case-insensitive (e.g.2kor2Kboth valid). - Aspect ratio: Full set includes
1:1,1:4,1:8,3:2,2:3,3:4,4:3,4:5,5:4,8:1,9:16,16:9,21:9, andauto. Some providers may not support all ratios; unsupported values are omitted for that provider. - Output format: Use
pngfor lossless/transparency, orjpeg/jpgfor smaller files (jpg is normalized to jpeg). - Image-to-image: Up to 14 reference image URLs when
modeisimage-to-image. - Callback mode: For high-concurrency scenarios, use
callbackmode to avoid frequent polling. - Image expiration: Result URLs are valid for 15 days. Download and store important outputs promptly.
- Content moderation: Prompts must comply with content safety guidelines. Violations return
CONTENT_VIOLATION. - google_search: Optional boolean; when supported by the provider, enables Google search for context. Default
false.
Related
- Nano Banana — Previous generation (shorter prompt, no resolution)
- Pricing
- Error Codes