Skip to main content

Documentation Index

Fetch the complete documentation index at: https://apixo.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Nano Banana is a fast Google image model for lightweight image generation and reference-guided image editing. Use this page when you are ready to call the API after trying the model in the APIXO playground.
CapabilityValue
Model IDnano-banana
Modestext-to-image, image-to-image
Prompt length1-5000 characters
Reference images1-5 URLs for image-to-image
Aspect ratios1:1, 4:3, 3:4, 3:2, 2:3, 4:5, 5:4, 9:16, 16:9, 21:9, auto
Output formatspng, jpeg

Endpoint and authentication

Base URL:
https://api.apixo.ai/api/v1
MethodEndpointPurpose
POST/generateTask/nano-bananaSubmit a generation task
GET/statusTask/nano-banana?taskId={taskId}Poll task status and retrieve results
All requests require your APIXO API key:
Authorization: Bearer YOUR_API_KEY
Submit requests also require:
Content-Type: application/json

Copy-paste async quickstart

This minimal request submits a text-to-image task and returns a taskId.
curl -X POST "https://api.apixo.ai/api/v1/generateTask/nano-banana" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-image",
      "prompt": "a cozy cyberpunk cafe with neon lights",
      "aspect_ratio": "3:2",
      "output_format": "png"
    }
  }'
Successful response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
Save the taskId; you need it to poll for the final result.

Poll for result

curl -X GET "https://api.apixo.ai/api/v1/statusTask/nano-banana?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
Processing response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing",
    "createTime": 1767965610929
  }
}
Success response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://r2.apixo.ai/xxx.png\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965630929,
    "costTime": 20000
  }
}
Failed response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "CONTENT_VIOLATION",
    "failMsg": "Content does not meet safety guidelines",
    "createTime": 1767965610929,
    "completeTime": 1767965620132
  }
}
Parse resultJson after state becomes success:
const payload = JSON.parse(data.resultJson);
const imageUrls = payload.resultUrls;

Request body

Text-to-image

{
  "request_type": "async",
  "input": {
    "mode": "text-to-image",
    "prompt": "a fox in watercolor style",
    "aspect_ratio": "16:9",
    "output_format": "png"
  }
}

Image-to-image

{
  "request_type": "async",
  "input": {
    "mode": "image-to-image",
    "prompt": "make this scene look like sunrise with warm golden light",
    "image_urls": [
      "https://example.com/source.png"
    ],
    "aspect_ratio": "4:5",
    "output_format": "jpeg"
  }
}

Parameters

request_type
string
default:"async"
required
Result delivery mode. Use async for polling with statusTask, or callback for webhook delivery.
callback_url
string
Required when request_type is callback. Must be a public HTTPS URL that can receive the final task payload. See Webhooks.
input
object
required
Nano Banana input parameters.

Response format

Submit task response

POST /generateTask/nano-banana returns a task ID when the task is accepted:
code
integer
API status code. 200 means the task was accepted.
message
string
Human-readable status message.
data.taskId
string
Unique task identifier used with the status endpoint.

Status response fields

taskId
string
Unique task identifier.
state
string
Current task state: pending, processing, success, or failed.
resultJson
string
JSON string containing the generated image URLs. Present when state is success.
failCode
string
Machine-readable failure code. Present when state is failed.
failMsg
string
Human-readable failure message. Present when state is failed.
createTime
integer
Task creation timestamp in Unix milliseconds.
completeTime
integer
Task completion timestamp in Unix milliseconds. Present after completion.
costTime
integer
Processing duration in milliseconds. Nano Banana normalizes provider timing to milliseconds.

Webhook callback mode

Use callback mode when your backend should receive the final result automatically instead of polling.
curl -X POST "https://api.apixo.ai/api/v1/generateTask/nano-banana" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/webhooks/apixo",
    "input": {
      "mode": "image-to-image",
      "prompt": "make this product photo brighter while keeping the object unchanged",
      "image_urls": [
        "https://example.com/product.png"
      ],
      "aspect_ratio": "1:1",
      "output_format": "png"
    }
  }'
See Webhooks for delivery requirements and retry behavior.

Billing

Nano Banana is billed per generated image. The public APIXO price is currently a single flat price for this model.
ModeAPIXO priceMarket price
Default$0.03 / image$0.04 / image
For current route and market comparison pricing, see Pricing.

Latency and polling

Actual latency may vary by prompt complexity, reference image availability, provider route, and current queue load.
Typical generation timeRecommended first pollPoll interval
15s-20s10s after task creation3s
For high-concurrency production workloads, use callback mode to avoid frequent polling. Result URLs are intended for retrieval after completion; download and store important outputs promptly.
Rate limits and concurrency can vary by account, API key, and route. If you receive 429, slow down requests and retry with backoff. For account-level details, see System APIs.

Errors and troubleshooting

HTTP errors

CodeMeaningWhat to do
400Invalid request body, mode, parameter, balance, or image URL shapeFix the request before retrying
401Missing or invalid API keyCheck the Authorization header
402Insufficient balance or quotaAdd balance or switch account/key
403Key or route cannot access the modelCheck permissions and route strategy
429Rate limit or concurrency limit reachedRetry with exponential backoff
500Server errorRetry with backoff
502Upstream provider errorRetry with backoff
504Upstream timeoutRetry or use callback mode for long-running jobs

Task failure codes

Fail codeMeaningWhat to do
CONTENT_VIOLATIONPrompt or reference image failed safety checksChange the prompt or input image
INVALID_IMAGE_URLA reference image URL could not be fetched or decodedUse a public, direct image URL
INVALID_PARAMETERA model parameter is unsupported or malformedCheck mode, prompt, aspect_ratio, image_urls, and output_format
INSUFFICIENT_BALANCEThe account does not have enough balance for the taskAdd balance before retrying
UPSTREAM_ERRORProvider-side failureRetry with backoff or try another route
TIMEOUTGeneration did not finish in timeRetry, reduce input complexity, or use callback mode
See Error Codes for the full error reference.