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

# gemini-3-pro-image

> 使用 Gemini 模型生成图片。



## OpenAPI

````yaml zh/api-reference/model-api/google/openapi/gemini-3-pro-image/openapi.yaml POST /v1beta/models/gemini-3-pro-image:generateContent
openapi: 3.1.0
info:
  title: Gemini 3 Pro Image
  description: 通过 Anyfast 代理调用 Google Gemini 3 Pro Image
  version: 1.0.0
servers:
  - url: https://www.anyfast.ai
security: []
paths:
  /v1beta/models/gemini-3-pro-image:generateContent:
    post:
      summary: 图片生成
      description: 使用 Gemini 模型生成图片。
      operationId: Gemini3ProImageGenerateImageZh
      parameters:
        - name: key
          in: query
          description: API 密钥
          required: true
          schema:
            type: string
          example: YOUR_API_KEY
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - contents
                - generationConfig
              properties:
                contents:
                  type: array
                  description: >
                    对话轮次数组。每轮包含 role 和 parts。 part 可以是文本提示词或 inline_data
                    图片（base64）。 如需使用参考图，在同一个 parts 数组中同时传入 text 和 inline_data。
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                        enum:
                          - user
                          - model
                        example: user
                      parts:
                        type: array
                        description: |
                          内容片段列表。在同一个数组中组合 text 和 inline_data 可以同时发送提示词和参考图片。
                        items:
                          type: object
                          properties:
                            text:
                              type: string
                              description: 文本提示词
                              example: >-
                                Hi, this is a picture of me. Can you add a llama
                                next to me?
                            inline_data:
                              type: object
                              description: |
                                参考图，以 base64 编码。 将 `data` 替换为实际的 base64 图片数据。
                              properties:
                                mime_type:
                                  type: string
                                  description: >-
                                    图片的 MIME
                                    类型。支持：image/jpeg、image/png、image/webp
                                  enum:
                                    - image/jpeg
                                    - image/png
                                    - image/webp
                                  example: image/jpeg
                                data:
                                  type: string
                                  description: >
                                    Base64 编码的图片数据。将你的 base64 字符串粘贴至此。 示例：使用
                                    `base64 image.jpg` 或在线工具转换图片。
                                  example: >-
                                    iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==
                  example:
                    - role: user
                      parts:
                        - text: >-
                            Hi, this is a picture of me. Can you add a llama
                            next to me?
                        - inline_data:
                            mime_type: image/jpeg
                            data: >-
                              iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==
                generationConfig:
                  type: object
                  required:
                    - responseModalities
                  properties:
                    responseModalities:
                      type: array
                      description: >
                        输出模态。使用 ["IMAGE"] 仅输出图片， 或 ["TEXT", "IMAGE"]
                        同时返回文字说明和图片。
                      items:
                        type: string
                        enum:
                          - TEXT
                          - IMAGE
                      example:
                        - TEXT
                        - IMAGE
                    imageConfig:
                      type: object
                      description: 图片生成配置
                      properties:
                        aspectRatio:
                          type: string
                          description: |
                            目标宽高比
                          enum:
                            - '1:1'
                            - '4:3'
                            - '3:4'
                            - '16:9'
                            - '9:16'
                          example: '9:16'
                        imageSize:
                          type: string
                          description: |
                            图片分辨率。1K ≈ 1024px，2K ≈ 2048px，4K ≈ 4096px（按长边）。
                          enum:
                            - 1K
                            - 2K
                            - 4K
                          example: 1K
      responses:
        '200':
          description: 图片生成成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateContentResponse'
              example:
                candidates:
                  - content:
                      role: model
                      parts:
                        - text: Here is the image with a llama added next to you.
                        - inline_data:
                            mime_type: image/jpeg
                            data: >-
                              iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==
                    finishReason: STOP
                usageMetadata:
                  promptTokenCount: 10
                  candidatesTokenCount: 1
                  totalTokenCount: 11
        '400':
          description: 请求参数有误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: 未授权
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: 请求频率超限
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    GenerateContentResponse:
      type: object
      properties:
        candidates:
          type: array
          items:
            type: object
            properties:
              content:
                type: object
                properties:
                  parts:
                    type: array
                    items:
                      type: object
                      properties:
                        text:
                          type: string
                          description: 文字说明（当 responseModalities 包含 TEXT 时返回）
                        inline_data:
                          type: object
                          description: 生成的图片数据
                          properties:
                            mime_type:
                              type: string
                              example: image/jpeg
                            data:
                              type: string
                              description: Base64 编码的生成图片
                              example: >-
                                iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==
                  role:
                    type: string
                    example: model
              finishReason:
                type: string
                enum:
                  - STOP
                  - MAX_TOKENS
                  - SAFETY
                  - RECITATION
                  - OTHER
                example: STOP
        usageMetadata:
          type: object
          properties:
            promptTokenCount:
              type: integer
            candidatesTokenCount:
              type: integer
            totalTokenCount:
              type: integer
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
            status:
              type: string

````