Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/generateTask/nano-banana | Create generation task |
| GET | /api/v1/statusTask/nano-banana | 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
Example
Text-to-ImageResponse
POST /api/v1/generateTask/nano-banana
ReturnstaskId on success for subsequent status queries.
Success:
GET /api/v1/statusTask/nano-banana
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
- Generation time: Average ~15-20 seconds. Submit task, wait 10 seconds, then poll every 3 seconds.
- Fast and affordable: Nano Banana excels at speed and cost-effectiveness, ideal for rapid prototyping and batch generation.
- 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. - Aspect ratio selection:
1:1: Square, for avatars and social media3:2/4:3: Landscape, for traditional photos2:3/3:4: Portrait, for mobile screens16:9/21:9: Ultra-wide, for banners and backgroundsauto: Automatically select best ratio
- Format selection:
png: Lossless, supports transparency, larger file size (default)jpeg: Lossy compression, smaller file, good for fast transfer
- Multiple references:
image-to-imagemode supports up to 5 reference images, model combines all styles and content. - Image formats:
image_urlssupports JPG, PNG, WebP, max 10MB per image.