Native OpenAI Format
Endpoint
POST /v1/chat/completions
Header Parameters
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
Authorization | string | No | Bearer {your_token} |
Request Body Parameters
| Field | Type | Required | Title | Description |
|---|---|---|---|---|
model | string | Yes | Model name | Optional values:NanoBanana, NanoBananaPro-1K, NanoBananaPro-2K, NanoBananaPro-4K, NanoBanana2-0.5K, NanoBanana2-1K, NanoBanana2-2K, NanoBanana2-4K |
--aspect_ratio | string | Yes | aspect ratio | Optional values:1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9 |
--output_format | string | Yes | image type | Optional values:"jpeg", "png", "webp" |
messages | array | No | Example field | Appears in a request example; no separate field description is provided. |
extra_body | object | No | Example field | Appears in a request example; no separate field description is provided. |
stream | boolean | No | Example field | Appears in a request example; no separate field description is provided. |
Request Examples
{
"model": "NanoBananaPro-1K",
"messages": [
{
"role": "user",
"content": "a cute cat"
}
],
"extra_body": {
"google": {
"image_config": {
"aspect_ratio": "16:9"
}
}
},
"stream": true
}
curl -X POST "{BASE_URL}/v1/chat/completions" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{"model": "NanoBananaPro-1K",
"messages": [{"role": "user",
"content": "a cute cat"}],
"extra_body": {"google": {"image_config": {"aspect_ratio": "16:9"}}},
"stream": true}'
{
"model": "NanoBananaPro-1K",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": ", generation, "
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/xxxxxxx.jpg"
}
}
]
}
],
"extra_body": {
"google": {
"image_config": {
"aspect_ratio": "16:9"
}
}
},
"stream": true
}
curl -X POST "{BASE_URL}/v1/chat/completions" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{"model": "NanoBananaPro-1K",
"messages": [{"role": "user",
"content": [{"type": "text",
"text": ", generation, "},
{"type": "image_url",
"image_url": {"url": "https://example.com/xxxxxxx.jpg"}}]}],
"extra_body": {"google": {"image_config": {"aspect_ratio": "16:9"}}},
"stream": true}'
Response Fields
| Field | Type | Required | Title | Description |
|---|
Response Examples
generationSuccess
{
"id": "chatcmpl_3a72451d018247b6a14adb45275c2433",
"object": "chat.completion.chunk",
"created": 1773835762,
"model": "NanoBananaPro-8K",
"choices": [
{
"index": 0,
"delta": {
"role": "assistant",
"content": "https://xxx.xxx.cn/output/38fa5bcb-d055-40b0-9f04-5ef259c9131c-u2_307ace79-d89b-4075-9e71-8180774947c4.jpeg"
},
"finish_reason": "stop"
}
],
"media": {
"outputs": [
"https://xxx.xxx.cn/output/38fa5bcb-d055-40b0-9f04-5ef259c9131c-u2_307ace79-d89b-4075-9e71-8180774947c4.jpeg"
]
}
}