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": "Draw a cat sitting on a rooftop under moonlight"
}
],
"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": "Invalid size. Supported sizes are 1024x1024, 1536x1024, 1024x1536.",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}{
"error": {
"message": "Invalid size. Supported sizes are 1024x1024, 1536x1024, 1024x1536.",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}{
"error": {
"message": "Invalid size. Supported sizes are 1024x1024, 1536x1024, 1024x1536.",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}{
"error": {
"message": "Invalid size. Supported sizes are 1024x1024, 1536x1024, 1024x1536.",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}NanoBanana OpenAI chat format
Generate images via the OpenAI chat endpoint — ideal for the budget tier and OpenAI SDK users
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": "Draw a cat sitting on a rooftop under moonlight"
}
],
"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": "Invalid size. Supported sizes are 1024x1024, 1536x1024, 1024x1536.",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}{
"error": {
"message": "Invalid size. Supported sizes are 1024x1024, 1536x1024, 1024x1536.",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}{
"error": {
"message": "Invalid size. Supported sizes are 1024x1024, 1536x1024, 1024x1536.",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}{
"error": {
"message": "Invalid size. Supported sizes are 1024x1024, 1536x1024, 1024x1536.",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}Models you can use
| Model ID | Notes |
|---|---|
nanobanana | Standard version |
nanobanana_pro | High-quality version |
nanobanana_2 | 2nd generation — budget tier only, this format exclusively |
Image configuration
Pass Google extension parameters through theextra_body field:
{
"extra_body": {
"google": {
"image_config": {
"aspect_ratio": "16:9",
"image_size": "2K"
}
}
}
}
Response format
The image is embedded inchoices[0].message.content as Markdown:

Relationship to the chat endpoint
The path/v1/chat/completions is shared with the chat completions
endpoint. This page specifically describes the image-generation
behavior and the unique extra_body parameters when model is a
NanoBanana ID.Authorizations
Body
NanoBanana OpenAI chat-format image generation request body.
NanoBanana model ID. Options: nanobanana, nanobanana_pro,
nanobanana_2. The budget-tier nanobanana_2 only supports this
format and cannot be used with the Gemini native endpoint.
"nanobanana_pro"
"nanobanana_2"
Conversation messages containing the image generation prompt.
Show child attributes
Show child attributes
Whether to stream the response. Set to false for image generation.
Extension parameters. Pass image configuration (aspect ratio and
resolution) via google.image_config.
Show child attributes
Show child attributes
Response
Image generated successfully
NanoBanana OpenAI chat-format response body. The image is embedded in the message content as a Markdown inline image.
Unique identifier for this request.
"chatcmpl-20251211160744809365000fdOhL0KY"
The model that processed the request.
"nanobanana_pro"
Object type.
"chat.completion"
Unix timestamp (seconds) of creation.
1765440499
List of generated results.
Show child attributes
Show child attributes
Token usage statistics.
Show child attributes
Show child attributes