Skip to main content
POST
/
v1beta
/
models
/
{model}
:generateContent
curl --request POST \
  --url https://api.getinfinityblue.com/v1beta/models/{model}:generateContent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "Draw a cat sitting on a rooftop under moonlight"
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "TEXT",
      "IMAGE"
    ],
    "imageConfig": {
      "aspectRatio": "16:9",
      "imageSize": "4K"
    }
  }
}
'
{
  "candidates": [
    {
      "content": {
        "role": "<string>",
        "parts": [
          {}
        ]
      },
      "finishReason": "<string>",
      "safetyRatings": [
        {}
      ]
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 123,
    "candidatesTokenCount": 123,
    "totalTokenCount": 123
  }
}

Models you can use

Model IDNotes
nanobananaStandard — balanced speed and quality
nanobanana_proHigh-quality — ideal for product images and precise style unification
nanobanana_22nd generation — budget tier only supports the OpenAI chat format (see separate endpoint)

Multiple reference images

Append multiple inline_data objects consecutively inside contents[].parts. Each object holds the Base64 data of one reference image, enabling multi-reference input.

Resolution configuration

Inside generationConfig.imageConfig:
  • aspectRatio: 1:1, 3:4, 4:3, 9:16, 16:9
  • imageSize: 1K, 2K, 4K

Thinking content

Set generationConfig.thinkingConfig.includeThoughts: true to include the model’s reasoning trace in the response.

Authorizations

Authorization
string
header
required

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

Path Parameters

model
string
required

NanoBanana model ID, e.g. nanobanana_pro. Accepted values: nanobanana, nanobanana_pro.

Body

application/json

NanoBanana native-format image generation/editing request body.

contents
object[]
required

A list of conversation turns. Typically one user message; its parts array can contain a text prompt and one or more reference images.

generationConfig
object
required

Generation configuration controlling output modalities, image dimensions, and optional thinking content.

Response

Image generated successfully

NanoBanana native-format response body.

candidates
object[]

List of generated candidate results.

usageMetadata
object

Token usage statistics.