API One Doc

Image Generation

Submit image generation tasks via a unified interface. Supports nano-banana-2, nano-banana-pro, and gpt-image-2, with both synchronous and asynchronous modes.

Submit image generation tasks via a unified interface. Supports nano-banana-2, nano-banana-pro, and gpt-image-2 models, with both synchronous and asynchronous modes.

  • Base URL: https://apione.org
  • Endpoint: POST /v1/images/generations
  • Authentication: Authorization: Bearer sk-xxxxxxxxxxxx
  • Result Query (async): GET /v1/api/result?id={task_id} (see Async Result Query)

Sync vs Async Mode

The async field in the request body controls the return mode:

asyncBehaviorResponse
Not set / false (default)Sync: connection held until generation completesStandard OpenAI image response {created, data:[{url}]}
trueAsync: immediately returns task ID, generates in background{code:200, data:[{status:"submitted", task_id}]}

Async Submission Response (all models)

{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
    }
  ]
}

After getting task_id, poll GET /v1/api/result?id={task_id}; retrieve the image URL from results[].url when status=succeeded. Generated image links are valid for 24 hours — save them promptly.

Models

nano-banana-2

Fast 4K image generation. Supports text-to-image and image-to-image, up to 4K output, up to 14 reference images, extreme aspect ratios, and Google Search enhancement.

curl --request POST \
  --url https://apione.org/v1/images/generations \
  --header 'Authorization: Bearer sk-xxxxxxxxxxxx' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "nano-banana-2",
    "prompt": "Cyberpunk cityscape at night with neon lights",
    "size": "16:9",
    "resolution": "2K",
    "n": 1
  }'

Key Parameters: size (aspect ratio), resolution (0.5K/1K/2K/4K), n (1~4), image_urls (up to 14), google_search, async

nano-banana-pro

High-quality professional image generation. Async processing, supports inpainting via mask_url, up to 4K output.

curl --request POST \
  --url https://apione.org/v1/images/generations \
  --header 'Authorization: Bearer sk-xxxxxxxxxxxx' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "nano-banana-pro",
    "prompt": "A bamboo forest path under moonlight",
    "size": "1:1",
    "resolution": "1K",
    "n": 1
  }'

Key Parameters: size, resolution (1K/2K/4K), image_urls (up to 14), mask_url (inpainting), async

gpt-image-2

OpenAI-compatible protocol. Supports text-to-image and image-to-image, 15 aspect ratios, up to 16 reference images (URL and base64 mixed), billed by resolution tier (1K/2K/4K).

curl --request POST \
  --url https://apione.org/v1/images/generations \
  --header 'Authorization: Bearer sk-xxxxxxxxxxxx' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gpt-image-2",
    "prompt": "A ginger cat sitting on a windowsill watching the sunset, watercolor style",
    "n": 1,
    "size": "16:9",
    "resolution": "2k"
  }'

Key Parameters: size (15 aspect ratios or pixel dimensions like 1881x836), resolution (1k/2k/4k), image_urls (up to 16), async

Common Error Codes

HTTPtypeDescription
400invalid_request_errorInvalid request parameters (e.g. unsupported size / resolution)
401authentication_errorAuthentication failed, check API Key
402payment_requiredInsufficient balance
429rate_limit_errorToo many requests, retry later
500server_errorInternal server error

On this page