curl --request POST \
--url https://api.getinfinityblue.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "nanobanana_pro",
"stream": false,
"messages": [
{
"role": "user",
"content": "画一只猫,坐在月光下的屋顶上"
}
],
"extra_body": {
"google": {
"image_config": {
"aspect_ratio": "16:9",
"image_size": "2K"
}
}
}
}
'{
"id": "chatcmpl-20251211160744809365000fdOhL0KY",
"model": "nanobanana_pro",
"object": "chat.completion",
"created": 1765440499,
"choices": [
{
"index": 123,
"message": {
"role": "assistant",
"content": ""
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}{
"error": {
"message": "无效的尺寸。支持的尺寸为 1024x1024、1536x1024、1024x1536。",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}{
"error": {
"message": "无效的尺寸。支持的尺寸为 1024x1024、1536x1024、1024x1536。",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}{
"error": {
"message": "无效的尺寸。支持的尺寸为 1024x1024、1536x1024、1024x1536。",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}{
"error": {
"message": "无效的尺寸。支持的尺寸为 1024x1024、1536x1024、1024x1536。",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}Nano Banana
NanoBanana OpenAI 聊天格式
通过 OpenAI 聊天接口调用 NanoBanana,适合特价分组及 OpenAI SDK 用户
POST
/
v1
/
chat
/
completions
curl --request POST \
--url https://api.getinfinityblue.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "nanobanana_pro",
"stream": false,
"messages": [
{
"role": "user",
"content": "画一只猫,坐在月光下的屋顶上"
}
],
"extra_body": {
"google": {
"image_config": {
"aspect_ratio": "16:9",
"image_size": "2K"
}
}
}
}
'{
"id": "chatcmpl-20251211160744809365000fdOhL0KY",
"model": "nanobanana_pro",
"object": "chat.completion",
"created": 1765440499,
"choices": [
{
"index": 123,
"message": {
"role": "assistant",
"content": ""
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}{
"error": {
"message": "无效的尺寸。支持的尺寸为 1024x1024、1536x1024、1024x1536。",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}{
"error": {
"message": "无效的尺寸。支持的尺寸为 1024x1024、1536x1024、1024x1536。",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}{
"error": {
"message": "无效的尺寸。支持的尺寸为 1024x1024、1536x1024、1024x1536。",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}{
"error": {
"message": "无效的尺寸。支持的尺寸为 1024x1024、1536x1024、1024x1536。",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}可使用的模型
| 模型 ID | 说明 |
|---|---|
nanobanana | 标准版 |
nanobanana_pro | 高质量版 |
nanobanana_2 | 第二代,特价分组专用,仅支持此格式 |
图像配置
通过请求体的extra_body 字段传入 Google 扩展参数:
{
"extra_body": {
"google": {
"image_config": {
"aspect_ratio": "16:9",
"image_size": "2K"
}
}
}
}
响应格式
图像以 Markdown 内嵌于choices[0].message.content:

与聊天接口的关系
路径/v1/chat/completions 被聊天补全接口共用;此处专门描述
model 为 NanoBanana ID 时的图像生成行为与特有的 extra_body 参数。授权
请求体
application/json
NanoBanana OpenAI 聊天格式图像生成请求体。
NanoBanana 模型 ID。可选值:nanobanana、nanobanana_pro、nanobanana_2。
特价分组的 nanobanana_2 仅支持此格式,不支持 Gemini 原生格式。
示例:
"nanobanana_pro"
"nanobanana_2"
对话消息列表,包含用户的图像生成提示。
Show child attributes
Show child attributes
是否流式返回。图像生成通常设为 false。
扩展参数,通过 google.image_config 传入图像配置(宽高比和分辨率)。
Show child attributes
Show child attributes
响应
成功生成图像
NanoBanana OpenAI 聊天格式响应体。图像以 Markdown 内嵌于消息内容中。