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:
async | Behavior | Response |
|---|---|---|
Not set / false (default) | Sync: connection held until generation completes | Standard OpenAI image response {created, data:[{url}]} |
true | Async: 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, pollGET /v1/api/result?id={task_id}; retrieve the image URL fromresults[].urlwhenstatus=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
| HTTP | type | Description |
|---|---|---|
| 400 | invalid_request_error | Invalid request parameters (e.g. unsupported size / resolution) |
| 401 | authentication_error | Authentication failed, check API Key |
| 402 | payment_required | Insufficient balance |
| 429 | rate_limit_error | Too many requests, retry later |
| 500 | server_error | Internal server error |