# Native Gemini format

`POST /v1beta/models/{model}:generateContent`

Gemini image generation

**Calling through the OpenAI chat endpoint**: the Nano Banana model family can also be called via `POST /v1/chat/completions` (OpenAI format), with image parameters in `extra_body.google.image_config` (`aspect_ratio`, `image_size`).

## Authorizations

Bearer authentication — send `Authorization: Bearer <token>`.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `model` | path | string | yes | Model name |

## Request Body (application/json)

```json
{
  "type": "object",
  "properties": {
    "contents": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string"
          },
          "parts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "text": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "generationConfig": {
      "type": "object",
      "properties": {
        "thinkingConfig": {
          "type": "object",
          "properties": {
            "includeThoughts": {
              "type": "boolean",
              "description": "Whether to return thinking content"
            }
          },
          "required": [
            "includeThoughts"
          ]
        },
        "responseModalities": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "imageConfig": {
          "type": "object",
          "properties": {
            "aspectRatio": {
              "type": "string"
            },
            "imageSize": {
              "type": "string"
            }
          },
          "required": [
            "aspectRatio",
            "imageSize"
          ]
        }
      },
      "required": [
        "responseModalities",
        "imageConfig"
      ]
    }
  },
  "required": [
    "contents",
    "generationConfig"
  ]
}
```

## Responses

### 200 — Success

```json
{
  "type": "object",
  "properties": {
    "candidates": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "content": {
            "type": "object",
            "properties": {
              "role": {
                "type": "string"
              },
              "parts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "finishReason": {
            "type": "string"
          },
          "safetyRatings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {}
            }
          }
        }
      }
    },
    "usageMetadata": {
      "type": "object",
      "properties": {
        "promptTokenCount": {
          "type": "integer"
        },
        "candidatesTokenCount": {
          "type": "integer"
        },
        "totalTokenCount": {
          "type": "integer"
        }
      }
    }
  }
}
```
