Skip to main content
AI

Async Image Generation

Updated: 2026-04-29

This document explains how to use the async image task endpoint to call NanoBanana model and gpt-image-2, including request flow, Parameters, responses, billing detail rules and differences between the two model families.

1. Endpoint Overview

1.1 Submit Async Image Task

POST /v1/images/tasks

supports:

  • task_type = text2image
  • task_type = image2image

1.2 Query Async Image Task

GET /v1/images/tasks/{task_id}

1.3 Details

Authorization: Bearer sk-***
Content-Type: application/json

2. Model

2.1 NanoBanana

upstream Nano Model:

ModelNote
NanoBananaNanoBanana Model
NanoBanana2-0.5KNanoBanana2, 0.5K
NanoBanana2-1KNanoBanana2, 1K
NanoBanana2-2KNanoBanana2, 2K
NanoBanana2-4KNanoBanana2, 4K
NanoBananaPro-1KNanoBanana Pro, 1K
NanoBananaPro-2KNanoBanana Pro, 2K
NanoBananaPro-4KNanoBanana Pro, 4K
NanoBananaPro-8KNanoBanana Pro, 8K

Note: Whether the user can call Model, the platform Whether and billing detail Model.

2.2 gpt-image-2

ModelNote
gpt-image-2size + quality + n Parameters billing detail image model

3. Request Parameters

These fields apply to NanoBanana and gpt-image-2.

ParametersTypeRequiredNote
modelstringYesModel,NanoBanana2-0.5K, gpt-image-2
promptstringYesimage generation or editing prompt
task_typestringNotext2image or image2image. pass, Whether image
imagestring / fileRequiredreference. JSON pass an image URL;
imagesstring[]Requiredmultiple reference images URL, recommended field
sizestringModelsize.gpt-image-2 Required, supported values: see gpt-image-2size options; NanoBanana prefer using aspect_ratio controlRatio
aspect_ratiostringmodel-dependent optional valuesNanoBanana, NanoBananaPro-*, NanoBanana2-* supports, NanoBanana Capability;gpt-image-2 does not support
qualitystringNoquality.gpt-image-2 supported values: see gpt-image-2quality options; NanoBanana model tier
nintegerNogeneration. default 1. gpt-image-2 1-8; NanoBanana does not support
output_formatstringOptional valuescontrol image type. Nano supported values: see NanoBanana Capability;gpt-image-2 supported values: see gpt-image-2output_format options

3.1 reference pass

recommended Field:

{
"image": "https://example.com/input.png"
}
{
"images": [
"https://example.com/a.png",
"https://example.com/b.png"
]
}

do not reference Field. compatibility Field, reference. For new integrations, use image or images.

Task type Rules:

  • image: text2image processing
  • image/images/ multipart image file:image2image processing
  • pass task_type, value

4. NanoBanana Parameters

NanoBanana use async image task Structure.

4.1 JSON

{
"model": "NanoBanana2-0.5K",
"task_type": "text2image",
"prompt": "A small red cube on a clean white desk, minimal product photo, soft daylight",
"aspect_ratio": "1:1",
"output_format": "png",
"n": 1,
"response_format": "url"
}

4.2 JSON

{
"model": "NanoBanana2-0.5K",
"task_type": "image2image",
"prompt": "Turn the reference image into a clean product render",
"image": "https://example.com/input.png",
"aspect_ratio": "16:9",
"output_format": "jpeg",
"n": 1,
"response_format": "url"
}

4.3 Parameter Constraints

ParametersNanoBanana Rules
modelpass Nano Model
promptRequired
task_typetext2image/image2image, the platform
aspect_ratiorecommended to use; control output aspect ratio. value 1:1, 16:9, 9:16, 4:3, 3:4, supported range upstream model
output_formatrecommended to use; control image type.NanoBanana supports png/jpeg/webp; NanoBananaPro-*, NanoBanana2-* supports png/jpeg
sizeNanoBanana controlParameters; pass in, upstreamcompatibilityCapabilityprocessing
qualityNanoBanana the platform billing detail; model tier
nOptional values; default 1. billing detail generation, value upstreamconstraints
response_formatrecommended url
image Fielduse for single-image input image, use for multi-image input images; multipart passfile use image
NanoBanana capability options

4.4 NanoBanana Capability

Modelaspect_ratiooutput_format
NanoBananasupportssupports png/jpeg/webp
NanoBananaPro-*supportssupports png/jpeg
NanoBanana2-*supportssupports png/jpeg

4.5 billing detail

NanoBanana Model billing detail, generation n or upstreamreturn result.

aspect_ratio and output_format controlgeneration, and the platform billing detail; Nano model tier model pricing.

NanoBanana2-0.5K, the platform pricing and.

If NanoBanana Model, requires model pricing.

5. gpt-image-2 Parameters

gpt-image-2 useParameters billing detail.size YesRequired Parameters;quality and n defaultvalue;output_format control image type; does not support aspect_ratio.

5.1 JSON

{
"model": "gpt-image-2",
"task_type": "text2image",
"prompt": "A small blue glass sphere on a clean white desk, minimal product photo, soft daylight",
"size": "1024x768",
"quality": "low",
"output_format": "webp",
"n": 1,
"response_format": "url"
}

5.2 JSON

{
"model": "gpt-image-2",
"task_type": "image2image",
"prompt": "Keep the product shape, change the background to a bright studio scene",
"image": "https://example.com/input.png",
"size": "1024x1024",
"quality": "medium",
"output_format": "png",
"n": 1,
"response_format": "url"
}

5.3 multipart

curl -X POST "{BASE_URL}/v1/images/tasks" \
-H "Authorization: Bearer sk-***" \
-F "model=gpt-image-2" \
-F "task_type=image2image" \
-F "prompt=Keep the subject, make it a clean studio product photo" \
-F "size=1024x1024" \
-F "quality=medium" \
-F "output_format=png" \
-F "n=1" \
-F "response_format=url" \
-F "image=@/path/to/input.png"

5.4 Parameter Constraints

ParametersRules
sizeRequired, must be gpt-image-2size options value
aspect_ratiodoes not support; use size control sizeandRatio
qualityOptional values, default medium, supported values: see gpt-image-2 quality options
output_formatOptional values, supported values: see gpt-image-2output_format options
nOptional values, default 1, range 1-8
response_formatrecommended url
task_typetext2image/image2image, the platform
GPT Image 2 quality options

quality supportsvalue:

value
lowlow
mediummedium
highhigh
GPT Image 2 output format options

output_format supportsvalue:

value
png
jpeg
webp
GPT Image 2 size options

5.5 gpt-image-2 size options

gpt-image-2 size control sizeandRatio, does not support pass aspect_ratio. quality pass low, medium, high; n generation.

SizeRatioOrientation
1024x7684:3Landscape1K
768x10243:4Portrait1K
1344x10244:3Landscape1K
1024x13443:4Portrait1K
1280x10245:4Landscape1K
1024x12804:5Portrait1K
1360x76816:9Landscape1K
768x13609:16Portrait1K
1536x86416:9Landscape1K
864x15369:16Portrait1K
1024x10241:1Square1K
1536x10243:2Landscape1K
1024x15362:3Portrait1K
2048x10242:1Landscape1K
1024x20481:2Portrait1K
2016x86421:9Landscape1K
864x20169:21Portrait1K
1920x108016:9Landscape2K
1080x19209:16Portrait2K
1536x15361:1Square2K
2048x13603:2 approximatelyLandscape2K
1360x20482:3 approximatelyPortrait2K
2048x15364:3Landscape2K
1536x20483:4Portrait2K
2160x14403:2Landscape2K
1440x21602:3Portrait2K
2048x115216:9Landscape2K
1152x20489:16Portrait2K
2688x13442:1Landscape2K
1344x26881:2Portrait2K
2688x115221:9Landscape2K
1152x26889:21Portrait2K
2560x144016:9Landscape2K
1440x25609:16Portrait2K
2048x20481:1Square4K
2560x20485:4Landscape2K
2048x25604:5Portrait2K
2880x28801:1Square4K
3264x24484:3Landscape4K
2448x32643:4Portrait4K
3504x23363:2Landscape4K
2336x35042:3Portrait4K
3840x19202:1Landscape4K
1920x38401:2Portrait4K
3840x164821:9 approximatelyLandscape4K
1648x38409:21 approximatelyPortrait4K
3840x216016:9Landscape4K
2160x38409:16Portrait4K

6. submitresponses

submitSuccess returntaskobject.

{
"task_id": "task_xxx",
"status": "succeeded",
"progress": "100%",
"result_url": "https://example.com/result.png",
"metadata": {
"task_type": "text2image",
"result_count": 1
},
"error": null
}

Field Reference:

FieldNote
task_idthe platformtask ID, query
statusqueued, processing, succeeded, failed
progresstask,0%, 50%, 100%
result_urloneresult URL
metadata.task_typeTask type
metadata.result_countresult
metadata.result_urlsresult return URL array
errorFailed Error, Success null

7. queryresponses

curl "{BASE_URL}/v1/images/tasks/task_xxx" \
-H "Authorization: Bearer sk-***"

Successresponses:

{
"code": "success",
"message": "",
"data": {
"task_id": "task_xxx",
"status": "succeeded",
"progress": "100%",
"result_url": "https://example.com/result.png",
"metadata": {
"task_type": "text2image",
"result_count": 1
},
"error": null
}
}

recommended poll 2-5. task succeeded or failed poll.

8. curl Example

8.1 NanoBanana

curl -X POST "{BASE_URL}/v1/images/tasks" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{"model": "NanoBanana2-0.5K",
"task_type": "text2image",
"prompt": "A small red cube on a clean white desk, minimal product photo, soft daylight",
"aspect_ratio": "1:1",
"output_format": "png",
"n": 1,
"response_format": "url"}'

8.2 gpt-image-2

curl -X POST "{BASE_URL}/v1/images/tasks" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-image-2",
"task_type": "text2image",
"prompt": "A small blue glass sphere on a clean white desk, minimal product photo, soft daylight",
"size": "1024x768",
"quality": "low",
"output_format": "webp",
"n": 1,
"response_format": "url"}'

8.3 Query Task

curl "{BASE_URL}/v1/images/tasks/task_xxx" \
-H "Authorization: Bearer sk-***"

9. NanoBanana and gpt-image-2

NanoBananagpt-image-2
ModellistModel, Pro andResolution tierModel
NanoBanana2-0.5Kgpt-image-2
Billing modeModel * generationsize + quality Parameters billing detail *n
Ratiocontrolsupports aspect_ratio, 1:1,2:3,3:2,3:4,4:3,4:5,5:4,9:16,16:9,21:9does not support aspect_ratio; use size, 1024x768, 1024x1024
formatcontrolNanoBanana supports png/jpeg/webp; NanoBananaPro-*, NanoBanana2-* supports png/jpegsupports png/jpeg/webp
sizecontrolParameters; model tierand aspect_ratioRequired, gpt-image-2size options
qualitythe platform billing detail; model tierOptional values, default medium, and billing detail
nOptional values, default 1, value upstreamconstraintsOptional values, default 1, range 1-8
response_formatrecommended urlrecommended url
use for single-image input image, use for multi-image input images, passreference /editingPathuse for single-image input image, use for multi-image input images, passreference /editingPath

10. Details

  1. use POST /v1/images/tasks submit task.
  2. return task_id.
  3. use GET /v1/images/tasks/{task_id} polltask.
  4. status = succeeded read result_url.