> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yingtu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini 3 Pro Image examples

> Generate a 4K Nano Banana Pro image, queue long-running work, and process its large Gemini-native response.

## Generate a 4K image

<CodeGroup>
  ```bash cURL theme={"system"}
  curl 'https://api.yingtu.ai/v1beta/models/gemini-3-pro-image:generateContent' \
    -H 'Authorization: Bearer YOUR_YINGTU_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
      "contents": [{
        "role": "user",
        "parts": [{"text": "A premium watch campaign image with precise reflections"}]
      }],
      "generationConfig": {
        "responseModalities": ["TEXT", "IMAGE"],
        "imageConfig": {"aspectRatio": "1:1", "imageSize": "4K"}
      }
    }'
  ```

  ```python Python theme={"system"}
  import os
  import requests

  response = requests.post(
      "https://api.yingtu.ai/v1beta/models/gemini-3-pro-image:generateContent",
      headers={"Authorization": f"Bearer {os.environ['YINGTU_API_KEY']}"},
      json={
          "contents": [{"role": "user", "parts": [
              {"text": "A premium watch campaign image with precise reflections"}
          ]}],
          "generationConfig": {
              "responseModalities": ["TEXT", "IMAGE"],
              "imageConfig": {"aspectRatio": "1:1", "imageSize": "4K"},
          },
      },
      timeout=300,
  )
  response.raise_for_status()
  result = response.json()
  ```
</CodeGroup>

The verified response returned a 4096 × 4096 JPEG:

```json theme={"system"}
{
  "candidates": [{
    "content": {
      "role": "model",
      "parts": [{
        "inlineData": {"mimeType": "image/jpeg", "data": "BASE64_IMAGE_DATA"}
      }]
    },
    "finishReason": "STOP",
    "index": 0
  }],
  "usageMetadata": {
    "promptTokenCount": 35,
    "candidatesTokenCount": 2086,
    "thoughtsTokenCount": 120,
    "totalTokenCount": 2241
  },
  "modelVersion": "gemini-3-pro-image",
  "responseId": "response_example"
}
```

## Queue premium work

For job queues or short proxy timeouts, send the body to
`:asyncGenerateContent`. The verified 1K task returned HTTP `202`, completed
after six polls, and exposed the final JPEG under `result`.

```bash theme={"system"}
curl 'https://api.yingtu.ai/v1beta/models/gemini-3-pro-image:asyncGenerateContent' \
  -H 'Authorization: Bearer YOUR_YINGTU_API_KEY' \
  -H 'Content-Type: application/json' \
  -d @request.json
```

Decode the returned image using `inlineData.mimeType`. Avoid printing the
Base64 field or storing it in application logs.

## Test this model online

The interactive panel is fixed to `gemini-3-pro-image:generateContent`. Start
with its 1K request, enter a development key, and use **Try it** on this page.

<Warning>Pro requests are billable. Mintlify shows the entered key in its generated cURL; do not share authenticated screenshots.</Warning>


## OpenAPI

````yaml openapi-models/gemini-3-pro-image.json POST /v1beta/models/gemini-3-pro-image:generateContent
openapi: 3.1.0
info:
  title: YingTu gemini-3-pro-image API
  version: 1.0.0
  description: Model-fixed synchronous image generation and editing for gemini-3-pro-image.
servers:
  - url: https://api.yingtu.ai
    description: YingTu API
security: []
tags:
  - name: Synchronous generation
    description: Wait for a complete Gemini response in one HTTP request.
  - name: Asynchronous tasks
    description: >-
      Submit image work, then retrieve the task until it reaches a terminal
      state.
paths:
  /v1beta/models/gemini-3-pro-image:generateContent:
    post:
      tags:
        - Synchronous generation
      summary: Generate an image with gemini-3-pro-image
      description: >-
        Generate or edit an image with the fixed YingTu model ID
        gemini-3-pro-image.
      operationId: generateImageSynchronously_gemini_3_pro_image
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlaygroundGenerateImageRequest'
            examples:
              textToImage:
                summary: Generate a 2K landscape image
                value:
                  contents:
                    - role: user
                      parts:
                        - text: >-
                            A single yellow ceramic banana on a matte white
                            background, soft studio lighting, no text.
                  generationConfig:
                    responseModalities:
                      - TEXT
                      - IMAGE
                    imageConfig:
                      aspectRatio: '1:1'
                      imageSize: 4K
      responses:
        '200':
          description: Complete Gemini response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateContentResponse'
              examples:
                verifiedImageResult:
                  summary: Representative completed image response
                  value:
                    candidates:
                      - content:
                          role: model
                          parts:
                            - inlineData:
                                mimeType: image/jpeg
                                data: BASE64_IMAGE_DATA
                        finishReason: STOP
                        index: 0
                    usageMetadata:
                      promptTokenCount: 37
                      candidatesTokenCount: 1846
                      totalTokenCount: 1883
                      promptTokensDetails:
                        - modality: TEXT
                          tokenCount: 37
                      candidatesTokensDetails:
                        - modality: IMAGE
                          tokenCount: 1680
                    modelVersion: gemini-3-pro-image
                    responseId: response_example
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/ServerError'
      security:
        - BearerAuth: []
components:
  schemas:
    PlaygroundGenerateImageRequest:
      title: Image request
      type: object
      required:
        - contents
      properties:
        contents:
          title: Prompt and input
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/PlaygroundRequestContent'
          description: Prompt and optional source image.
        generationConfig:
          $ref: '#/components/schemas/PlaygroundGenerationConfig'
          title: Output settings
    GenerateContentResponse:
      type: object
      required:
        - candidates
      properties:
        candidates:
          type: array
          items:
            $ref: '#/components/schemas/Candidate'
        usageMetadata:
          $ref: '#/components/schemas/UsageMetadata'
        modelVersion:
          type: string
          description: The model version that produced the response.
          example: gemini-3-pro-image
        responseId:
          type: string
          description: Provider response identifier.
          example: response_example
        createTime:
          type: string
          format: date-time
          description: Creation time when supplied by the selected model channel.
    PlaygroundRequestContent:
      title: Message
      type: object
      required:
        - parts
      properties:
        parts:
          title: Prompt or source image
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/PlaygroundRequestPart'
          description: Start with text; add an image to edit.
        role:
          title: Role
          type: string
          enum:
            - user
          example: user
          x-default: user
          description: Request sender.
    PlaygroundGenerationConfig:
      title: Output settings
      type: object
      properties:
        responseModalities:
          title: Response type
          type: array
          minItems: 1
          uniqueItems: true
          items:
            type: string
            enum:
              - TEXT
              - IMAGE
          example:
            - TEXT
            - IMAGE
          x-default:
            - TEXT
            - IMAGE
          description: Include IMAGE.
        imageConfig:
          $ref: '#/components/schemas/PlaygroundImageConfig'
          title: Image settings
        candidateCount:
          title: Number of outputs
          type: integer
          enum:
            - 1
          description: Use one output.
    Candidate:
      type: object
      required:
        - content
      properties:
        content:
          $ref: '#/components/schemas/ResponseContent'
        finishReason:
          type: string
          example: STOP
        index:
          type: integer
          minimum: 0
          example: 0
    UsageMetadata:
      type: object
      properties:
        promptTokenCount:
          type: integer
          minimum: 0
        candidatesTokenCount:
          type: integer
          minimum: 0
        totalTokenCount:
          type: integer
          minimum: 0
        thoughtsTokenCount:
          type: integer
          minimum: 0
        promptTokensDetails:
          type: array
          items:
            $ref: '#/components/schemas/ModalityTokenCount'
        candidatesTokensDetails:
          type: array
          items:
            $ref: '#/components/schemas/ModalityTokenCount'
        serviceTier:
          type: string
        trafficType:
          type: string
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    PlaygroundRequestPart:
      title: Input part
      description: Choose text or a source image.
      oneOf:
        - $ref: '#/components/schemas/PlaygroundTextPart'
        - $ref: '#/components/schemas/PlaygroundInlineImagePart'
    PlaygroundImageConfig:
      title: Image settings
      type: object
      properties:
        aspectRatio:
          title: Aspect ratio
          type: string
          enum:
            - '1:1'
            - '2:3'
            - '3:2'
            - '3:4'
            - '4:3'
            - '4:5'
            - '5:4'
            - '9:16'
            - '16:9'
            - '21:9'
          example: '1:1'
          x-default: '1:1'
          description: Output shape.
        imageSize:
          title: Image size
          type: string
          enum:
            - 1K
            - 2K
            - 4K
          example: 4K
          x-default: 4K
          description: Output resolution.
    ResponseContent:
      type: object
      required:
        - parts
      properties:
        role:
          type: string
          const: model
        parts:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/ResponsePart'
    ModalityTokenCount:
      type: object
      required:
        - modality
        - tokenCount
      properties:
        modality:
          type: string
          example: IMAGE
        tokenCount:
          type: integer
          minimum: 0
    ErrorObject:
      type: object
      required:
        - message
        - type
      properties:
        message:
          type: string
        type:
          type: string
          example: invalid_request_error
        code:
          type:
            - string
            - 'null'
    PlaygroundTextPart:
      title: Text prompt
      type: object
      required:
        - text
      properties:
        text:
          title: Prompt
          type: string
          example: >-
            A single yellow ceramic banana on a matte white background, soft
            studio lighting, no text.
          x-default: >-
            A single yellow ceramic banana on a matte white background, soft
            studio lighting, no text.
          description: Prompt or edit instruction.
    PlaygroundInlineImagePart:
      title: Source image
      type: object
      required:
        - inlineData
      properties:
        inlineData:
          $ref: '#/components/schemas/PlaygroundInlineImage'
          title: Source image
    ResponsePart:
      type: object
      properties:
        text:
          type: string
        inlineData:
          $ref: '#/components/schemas/InlineData'
        fileData:
          $ref: '#/components/schemas/FileData'
        functionCall:
          $ref: '#/components/schemas/FunctionCall'
        functionResponse:
          $ref: '#/components/schemas/FunctionResponse'
        executableCode:
          $ref: '#/components/schemas/ExecutableCode'
        codeExecutionResult:
          $ref: '#/components/schemas/CodeExecutionResult'
        thought:
          type: boolean
        thoughtSignature:
          type: string
          format: byte
        partMetadata:
          type: object
          additionalProperties: true
        mediaResolution:
          type: object
          additionalProperties: true
        videoMetadata:
          type: object
          additionalProperties: true
      description: >-
        A Gemini response Part. Part data fields are mutually exclusive in the
        Gemini protocol.
    PlaygroundInlineImage:
      title: Inline image
      type: object
      required:
        - mimeType
        - data
      properties:
        mimeType:
          title: Image MIME type
          type: string
          enum:
            - image/png
            - image/jpeg
            - image/webp
          example: image/png
          description: Match the source bytes.
        data:
          title: Image Base64
          type: string
          example: BASE64_SOURCE_IMAGE
          description: Raw Base64; omit the data URL prefix.
    InlineData:
      title: Inline image
      type: object
      required:
        - mimeType
        - data
      properties:
        mimeType:
          title: Image MIME type
          type: string
          enum:
            - image/png
            - image/jpeg
            - image/webp
          example: image/png
        data:
          title: Image Base64
          type: string
          description: Raw Base64 without a data URL prefix.
          example: BASE64_IMAGE_DATA
    FileData:
      type: object
      required:
        - fileUri
      properties:
        mimeType:
          type: string
          description: Optional IANA MIME type.
        fileUri:
          type: string
          description: URI of a Gemini File API resource.
    FunctionCall:
      type: object
      required:
        - name
        - args
      properties:
        id:
          type: string
        name:
          type: string
        args:
          type: object
          additionalProperties: true
    FunctionResponse:
      type: object
      required:
        - name
        - response
      properties:
        id:
          type: string
        name:
          type: string
        response:
          type: object
          additionalProperties: true
    ExecutableCode:
      type: object
      required:
        - language
        - code
      properties:
        language:
          type: string
        code:
          type: string
    CodeExecutionResult:
      type: object
      required:
        - outcome
        - output
      properties:
        outcome:
          type: string
        output:
          type: string
  responses:
    BadRequest:
      description: Invalid model, field, or parameter value
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing or invalid YingTu API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    RateLimited:
      description: Rate limit exceeded
      headers:
        Retry-After:
          description: Seconds to wait before retrying when supplied.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ServerError:
      description: The request could not be completed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: YingTu API key.

````