Nano Banana 2 API
Generate one image asynchronously per request. Supports text-to-image and image-to-image generation with your Seevio API key.
POST https://api.seevio.ai/v1/images/generationsCapabilities
| Feature | Supported values |
|---|---|
| Generation modes | text-to-image, image-to-image |
| Output resolution | 1K, 2K, 4K |
| Aspect ratio | auto, 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 5:4, 4:5, 21:9, 4:1, 1:4, 8:1, 1:8 |
| Reference images | Public HTTPS PNG / JPEG / WebP URLs. Image-to-image requires 1–14 images, each up to 30 MB. Text-to-image requires an empty array. |
| Prompt | Required non-empty prompt, up to 20000 characters. |
| Output format | png, jpg |
Pricing & credits
Each image costs 4 credits, including all supported resolutions and formats. Credits are reserved on acceptance, settled on success and refunded on failure. Generation times out after 30 minutes; refund_failed means refund recovery is pending.
Request idempotency is not supported. Each valid POST creates a new billable task. If a submission outcome is uncertain, query the returned taskId; retrying POST can create another task.
Authentication
Create an API key in the dashboard. The complete key is shown only once. Keep it on your server and send it as a Bearer token on every request.
Base URL
https://api.seevio.aiAuthorization: Bearer sk_live_your_api_key
Content-Type: application/jsonSet the SEEVIO_API_KEY environment variable before running these examples. JavaScript examples run on your server with Node.js; Python examples use the requests package.
Request body
| Field | Type | Required | Description & constraints |
|---|---|---|---|
model | string | Yes | Model ID. To use Nano Banana 2, set this field to nano-banana-2. |
callback_url | string | No | Public HTTPS endpoint for completion and failure POST callbacks. Private networks and localhost are not allowed. Example: https://example.com/webhooks/seevio |
input | object | Yes | Generation settings. Must contain a non-empty prompt. |
Input parameters
| Field | Type | Required | Default | Description & constraints |
|---|---|---|---|---|
input.prompt | string | Yes | — | Required non-empty prompt, up to 20000 characters. Example: A minimalist ceramic teapot on a stone pedestal, soft studio lighting |
input.generation_type | string | No | text-to-image | For image editing, set generation_type to image-to-image and provide image_urls. All other parameters use the same contract. Supported values text-to-image | image-to-image |
input.image_urls | string[] | Conditional | [] | Public HTTPS PNG / JPEG / WebP URLs. Image-to-image requires 1–14 images, each up to 30 MB. Text-to-image requires an empty array. Example: ["https://example.com/teapot.png"] |
input.aspect_ratio | string | No | auto | Aspect ratio Supported values auto | 1:1 | 16:9 | 9:16 | 4:3 | 3:4 | 3:2 | 2:3 | 5:4 | 4:5 | 21:9 | 4:1 | 1:4 | 8:1 | 1:8Example: 1:1 |
input.resolution | string | No | 2K | Use one of the supported output resolutions listed here. Supported values 1K | 2K | 4KExample: 2K |
input.output_format | string | No | png | Supported values png | jpgExample: png |
Aspect ratio defaults to auto. Unknown fields, including output quantity, are rejected. Each request generates exactly one image.
Quickstart
Submit this minimal request, save the returned taskId, then use the task query example below. The credits value in the create response is the reserved amount.
curl --fail-with-body https://api.seevio.ai/v1/images/generations \
-H "Authorization: Bearer $SEEVIO_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "nano-banana-2",
"input": {
"prompt": "A minimalist ceramic teapot on a stone pedestal, soft studio lighting",
"aspect_ratio": "1:1",
"resolution": "2K",
"output_format": "png",
"generation_type": "text-to-image"
}
}'Create task response example
{
"taskId": "3f2aK9mR7xQp4TnZ8bLc6YwH",
"credits": 4
}Text to image
Generate one image asynchronously per request. Supports text-to-image and image-to-image generation with your Seevio API key.
curl --fail-with-body https://api.seevio.ai/v1/images/generations \
-H "Authorization: Bearer $SEEVIO_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "nano-banana-2",
"input": {
"prompt": "A minimalist ceramic teapot on a stone pedestal, soft studio lighting",
"aspect_ratio": "1:1",
"resolution": "2K",
"output_format": "png",
"generation_type": "text-to-image"
}
}'Image to image
For image editing, set generation_type to image-to-image and provide image_urls. All other parameters use the same contract.
Replace example.com media URLs with your own publicly accessible HTTPS files. The sample URLs illustrate the request shape and are not downloadable sample assets.
curl --fail-with-body https://api.seevio.ai/v1/images/generations \
-H "Authorization: Bearer $SEEVIO_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "nano-banana-2",
"input": {
"prompt": "Change the teapot to matte sage green. Preserve its shape and the studio lighting.",
"aspect_ratio": "1:1",
"resolution": "2K",
"output_format": "png",
"generation_type": "image-to-image",
"image_urls": [
"https://example.com/teapot.png"
]
}
}'Query a task
GET https://api.seevio.ai/v1/tasks/{taskId}Replace the example ID with the taskId returned by creation. Queries only return tasks owned by the API key's user; inaccessible or unknown IDs return HTTP 404.
Poll every 10–20 seconds as a starting point, back off on HTTP 429 and stop when the status is completed or failed. Prefer webhooks for production. Each code example below performs one query.
curl --fail-with-body https://api.seevio.ai/v1/tasks/3f2aK9mR7xQp4TnZ8bLc6YwH \
-H "Authorization: Bearer $SEEVIO_API_KEY"| Status | Allowed values and requirements |
|---|---|
| queued | Accepted and waiting for submission. |
| generating | Generation is in progress. |
| completed | Terminal success. Download data.results before expiry. |
| failed | Terminal failure. Inspect failed_reason and billing_status. |
| Field | Type | Allowed values and requirements |
|---|---|---|
| id | string | Task identifier. This is taskId from the create response. |
| created_at | number | Task creation time as Unix seconds. |
| model | string | The public model ID used for this task. |
| billing_status | string | reserved, charged, refunded or refund_failed. |
| credits | number | Credits reserved for this task. This value is retained after a refund; inspect billing_status to determine the billing outcome. |
| failed_reason | string | null | Failure reason on failed tasks; null otherwise. Failed query responses omit data. |
| data | object | Present on non-failed task queries. Contains output and processing details. |
| data.results | string[] | Image URL array; empty before completion and after expiry. |
| data.image_expires_at | string | null | Image expiry time in ISO 8601 format, or null until available. |
| data.processing_time | number | null | Provider processing duration in seconds when available, otherwise null. |
Queued
{
"id": "3f2aK9mR7xQp4TnZ8bLc6YwH",
"created_at": 1789171200,
"model": "nano-banana-2",
"credits": 4,
"status": "queued",
"billing_status": "reserved",
"failed_reason": null,
"data": {
"results": [],
"image_expires_at": null,
"processing_time": null
}
}Completed
{
"id": "3f2aK9mR7xQp4TnZ8bLc6YwH",
"created_at": 1789171200,
"model": "nano-banana-2",
"credits": 4,
"status": "completed",
"billing_status": "charged",
"failed_reason": null,
"data": {
"results": [
"https://cdn.seevio.ai/api/images/example.png"
],
"image_expires_at": "2026-10-12T00:00:00.000Z",
"processing_time": 12
}
}Failed
When the query returns status=failed, generation has ended unsuccessfully. Read failed_reason for the cause and billing_status for the refund outcome. In this example, refunded means the credits were returned. credits retains the original reserved amount, and the response does not include data.
{
"id": "3f2aK9mR7xQp4TnZ8bLc6YwH",
"created_at": 1789171200,
"model": "nano-banana-2",
"credits": 4,
"status": "failed",
"billing_status": "refunded",
"failed_reason": "Image generation failed."
}Result links are provided for 30 days after storage. After expiry, results is empty.
Webhooks
Set callback_url in the create request to receive a JSON POST when the task completes or fails. Return a 2xx response within 15 seconds. Failed deliveries are retried; process repeated deliveries idempotently by task ID.
Your callback endpoint must accept POST requests with a JSON request body (Content-Type: application/json).
Create a task with a callback
curl --fail-with-body https://api.seevio.ai/v1/images/generations \
-H "Authorization: Bearer $SEEVIO_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "nano-banana-2",
"input": {
"prompt": "A minimalist ceramic teapot on a stone pedestal, soft studio lighting",
"aspect_ratio": "1:1",
"resolution": "2K",
"output_format": "png",
"generation_type": "text-to-image"
},
"callback_url": "https://example.com/webhooks/seevio"
}'Callbacks use the task query response structure; refunded failure notifications also include top-level credits_refunded. Use id to identify the task and status to distinguish completed from failed. Notifications may repeat: process them idempotently by id and status. Callbacks are unsigned; verify the task with the authenticated query endpoint. Delivery failure does not refund a successful task.
Task completed: successful callback payload
created_at is the event creation time; task_created_at is the task creation time in Unix seconds. Examples show the recommended fields; responses may contain additional fields.
{
"id": "3f2aK9mR7xQp4TnZ8bLc6YwH",
"created_at": 1789171212,
"model": "nano-banana-2",
"credits": 4,
"status": "completed",
"billing_status": "charged",
"failed_reason": null,
"data": {
"results": [
"https://cdn.seevio.ai/api/images/example.png"
],
"image_expires_at": "2026-10-12T00:00:00.000Z",
"processing_time": 12
},
"task_created_at": 1789171200
}Task failed: failure callback payload
{
"id": "3f2aK9mR7xQp4TnZ8bLc6YwH",
"created_at": 1789171212,
"model": "nano-banana-2",
"credits": 4,
"status": "failed",
"billing_status": "refunded",
"failed_reason": "Image generation failed.",
"task_created_at": 1789171200,
"credits_refunded": 4
}Receiver example
export async function POST(request: Request) {
const callbackData = await request.json();
if (callbackData.status === "completed") {
const imageUrls = callbackData.data.results;
// Save the image URLs and mark this task as completed in your application.
console.log(callbackData.id, imageUrls);
}
if (callbackData.status === "failed") {
const { failed_reason, credits_refunded } = callbackData;
// Record the failure reason and refunded credits for this task.
console.error(callbackData.id, failed_reason, credits_refunded);
}
return new Response(null, { status: 200 });
}This Next.js example reads the JSON callback body and handles completed and failed tasks directly. Add persistence and task-ID deduplication for your application; queue slow work before acknowledging the callback.
Errors
HTTP errors have an error object with code and message. A successfully accepted task can still fail later; query the task or handle its failure callback.
{
"error": {
"code": "invalid_request",
"message": "input.prompt is required."
}
}| HTTP | Field | What to do |
|---|---|---|
| 400 | invalid_request | Fix the JSON, missing prompt, parameter range or media URL before retrying. |
| 401 | invalid_api_key | Check the Bearer token and whether the API key is active. |
| 402 | insufficient_credits | Add credits or reduce the task cost. The response may include required and available amounts. |
| 403 | forbidden | Check the account-level restriction described in the error message. |
| 404 | not_found | Check the task ID and that the key belongs to the task's user. |
| 429 | rate_limited | Wait for the Retry-After interval before retrying. |
| 500 | internal_error | Inspect the error message and API logs. Retry cautiously; resubmitting a create request can create another billable task. |
Errors use error.code and error.message: 400 invalid_request, 401 invalid_api_key, 402 insufficient_credits, 403 forbidden, 404 not_found, 429 rate_limited, 500 internal_error. Insufficient provider balance is not a customer 402 error.
Rate limits
Create tasks: each API key allows up to 100 requests per minute by default. Custom rate limits are not currently available.
Query tasks: each API key allows up to 120 requests per minute by default. Query requests and task creation requests are counted separately.
Image and video creation requests share the same API key rate limit.
HTTP 429 includes Retry-After: 60 for creation and Retry-After: 5 for queries. Use backoff and avoid polling more frequently than necessary.
HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Retry-After: 60{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded."
}
}