Skip to main content
POST

Models you can use

Image configuration

Pass Google extension parameters through the extra_body field:

Response format

The image is embedded in choices[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

Authorization
string
header
required

Bearer token authentication, format: Authorization: Bearer sk-xxxxxx. Get your API key in the console.

Body

application/json

NanoBanana OpenAI chat-format image generation request body.

model
string
required

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.

Examples:

"nanobanana_pro"

"nanobanana_2"

messages
object[]
required

Conversation messages containing the image generation prompt.

stream
boolean
default:false

Whether to stream the response. Set to false for image generation.

extra_body
object

Extension parameters. Pass image configuration (aspect ratio and resolution) via google.image_config.

Response

Image generated successfully

NanoBanana OpenAI chat-format response body. The image is embedded in the message content as a Markdown inline image.

id
string

Unique identifier for this request.

Example:

"chatcmpl-20251211160744809365000fdOhL0KY"

model
string

The model that processed the request.

Example:

"nanobanana_pro"

object
string

Object type.

Example:

"chat.completion"

created
integer

Unix timestamp (seconds) of creation.

Example:

1765440499

choices
object[]

List of generated results.

usage
object

Token usage statistics.