Gemini 3 Pro Image (Nano Banana Pro) API

Google's Nano Banana Pro generates images with thinking and high-fidelity text rendering. 1K and 2K share a rate, with a separate tier for 4K.

POST /v1beta/models/gemini-3-pro-image-preview:generateContent

gemini-3-pro-image-preview: Native content generation, required fields, nested response schema and a fictional example.

Basic request

Required parameters: contents

Available parameters: contents, systemInstruction, generationConfig

Request parameters

ParameterTypeRequiredDescription
contentsarrayYesConversation contents.
systemInstructionobjectNoOptional system instructions.
generationConfigobjectNoOptional generation settings; limits are model-specific.
## Usage and response conventions - Follow required fields and the nested schema. Optional settings without a documented numeric default use the current model default. - Context, output budgets and media constraints differ by model. Unverified limits are not universal guarantees. - An absent value differs from a reported zero. Read status, content and usage as actually returned. - Replace example.invalid addresses with readable media you are authorized to use. - Save generated files promptly; result links need not remain available indefinitely. ## Reference Terminology: [Google Image Generation](https://ai.google.dev/gemini-api/docs/image-generation). Use this page's platform base URL and exact model identifier for requests. Reviewed: 2026-11-07. ## Complete nested field reference Array elements use []. Required flags apply only when the enclosing object or content-block variant is used. Response fields can be absent or null as described; false does not imply a fabricated zero. ### Request headers | Field path | Type | Required in its object | Meaning | |---|---|---|---| | `Content-Type` | string | Yes | JSON request-body content type. | ### Request body | Field path | Type | Required in its object | Meaning | |---|---|---|---| | `contents` | array[object] | Yes | Conversation contents. | | `contents[].role` | string | No | Message role. Values: user, model | | `contents[].parts` | array[object] | Yes | Ordered content parts; at least one is required. | | `contents[].parts[].text` | string | No | Text content. | | `contents[].parts[].inlineData` | object | No | Inline media. | | `contents[].parts[].inlineData.mimeType` | string | No | Media MIME type. | | `contents[].parts[].inlineData.data` | string | No | Base64 media data without a data: prefix. | | `contents[].parts[].fileData` | object | No | Readable media file. | | `contents[].parts[].fileData.mimeType` | string | No | Media MIME type. | | `contents[].parts[].fileData.fileUri` | string | No | File URI accepted by this interface. | | `systemInstruction` | object | No | Optional system instructions. | | `systemInstruction.parts` | array[object] | No | Ordered content parts; at least one is required. | | `systemInstruction.parts[].text` | string | No | Text content. | | `generationConfig` | object | No | Optional generation settings; limits are model-specific. | | `generationConfig.maxOutputTokens` | integer | No | Maximum output budget supported by the model. Minimum: 1 | | `generationConfig.responseModalities` | array[string] | No | Requested output modalities. Values: TEXT, IMAGE | | `generationConfig.imageConfig` | object | No | Optional image configuration; omitted fields use model defaults. | | `generationConfig.imageConfig.aspectRatio` | string | No | Aspect ratio supported by the model. | ### Response 200 | Field path | Type | Required in its object | Meaning | |---|---|---|---| | `candidates` | array[object] | No | Generated candidates; inspect feedback when no candidate is returned. | | `candidates[].index` | integer | No | Candidate index. | | `candidates[].content` | object | No | Output content. | | `candidates[].content.role` | string | No | Message role. | | `candidates[].content.parts` | array[object] | Yes | Ordered content parts; at least one is required. | | `candidates[].content.parts[].text` | string | No | Text content. | | `candidates[].content.parts[].inlineData` | object | No | Inline media. | | `candidates[].content.parts[].inlineData.mimeType` | string | No | Media MIME type. | | `candidates[].content.parts[].inlineData.data` | string | No | Base64 media data without a data: prefix. | | `candidates[].content.parts[].fileData` | object | No | Readable media file. | | `candidates[].content.parts[].fileData.mimeType` | string | No | Media MIME type. | | `candidates[].content.parts[].fileData.fileUri` | string | No | File URI accepted by this interface. | | `candidates[].finishReason` | string | No | Finish reason. | | `candidates[].safetyRatings` | array[object] | No | Safety feedback. | | `candidates[].safetyRatings[].category` | string | No | Feedback category. | | `candidates[].safetyRatings[].probability` | string | No | Feedback level. | | `usageMetadata` | object | No | Reported usage; reasoning and cache values are breakdowns. | | `usageMetadata.promptTokenCount` | integer | No | Input tokens. | | `usageMetadata.candidatesTokenCount` | integer | No | Candidate output tokens. | | `usageMetadata.thoughtsTokenCount` | integer | No | Reasoning tokens. | | `usageMetadata.cachedContentTokenCount` | integer | No | Cached input tokens. | | `usageMetadata.totalTokenCount` | integer | No | Reported total tokens. | | `modelVersion` | string | No | Model version reported by the service. | | `responseId` | string | No | Opaque response identifier. | | `promptFeedback` | object | No | Prompt feedback. | | `promptFeedback.blockReason` | string | No | Content-block reason. | ### Error response structure | Field path | Type | Required in its object | Meaning | |---|---|---|---| | `error` | object | No | Error details for this request. | | `error.message` | string | No | Message content or a readable error explanation, according to its enclosing object. | | `error.type` | string | No | Type discriminator; use the values documented for the enclosing object. | | `error.code` | string | No | Error code; it may be empty. |

Request example

curl --request POST https://api.router.ai/v1beta/models/gemini-3-pro-image-preview:generateContent \
  --header "Authorization: Bearer $API_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "A fictional blue paper boat on a plain white background."
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "TEXT",
      "IMAGE"
    ]
  }
}'