Краткий вывод
- Use POST /v1/images/generations with the Nano Banana 2 model id documented by ToAPIs.
- Supports prompt generation and reference_images for ad, e-commerce, social, and batch creative assets.
- The workflow is async: submit the task, receive a task id, then poll the image task status endpoint.
- Official comparison pricing is roughly $0.04 / $0.05 / $0.088 per image for 1K / 2K / 4K; ToAPIs currently shows $0.025 / $0.030 / $0.040 per image on the landing comparison, with final billing based on account pricing.
- At the ToAPIs 1K listed rate of $0.025 per image, a $10 top-up is roughly 400 additional 1K images; at the 4K listed rate of $0.040 per image, it is roughly 250 4K images.
Ключевые параметры
- model | string | обяз. | nano_banana_2 | - | Use the Nano Banana 2 model id shown in ToAPIs docs or pricing.
- prompt | string | обяз. | - | - | Primary image generation prompt.
- size | string | опц. | 1:1 | 1:1 | 16:9 | 9:16 | 4:3 | 3:4 | Output aspect ratio; available values follow docs and model capability.
- resolution | string | опц. | 1K | 1K | 2K | 4K | Output resolution tier, affecting per-image price and generation cost.
- reference_images | string[] | опц. | - | URL array | Reference image URL array for guided generation and style/subject control.
- response_format | string | опц. | url | url | b64_json | Response format; URL is recommended for most workflows.
Частые ошибки
- 400 invalid_request_error: триггер=Missing model/prompt or invalid resolution, aspect ratio, or reference image fields.; исправление=Validate model, prompt, size, resolution, and reference_images against ToAPIs docs.; повтор=Retry only after correcting the payload.
- 401 authentication_error: триггер=Missing Authorization header or invalid API key.; исправление=Verify bearer token format and key scope.; повтор=Retry after fixing authentication.
- 429 rate_limit_exceeded: триггер=Request rate, concurrency, or current credits hit limits.; исправление=Apply exponential backoff, reduce concurrency, and check account credits.; повтор=Use 1s/2s/4s backoff with jitter; queue requests if it persists.
