> ## 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-2.0-flash

> 使用 Gemini 模型编辑图片。



## OpenAPI

````yaml zh/api-reference/model-api/google/openapi/gemini-2-0-flash/openapi.yaml POST /v1beta/models/gemini-2.0-flash:generateContent
openapi: 3.1.0
info:
  title: Gemini 2.0 Flash
  description: 通过 Anyfast 代理调用 Google Gemini 2.0 Flash
  version: 1.0.0
servers:
  - url: https://www.anyfast.ai
security: []
paths:
  /v1beta/models/gemini-2.0-flash:generateContent:
    post:
      summary: 图片编辑
      description: 使用 Gemini 模型编辑图片。
      operationId: Gemini20FlashEditImage
      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: 对话内容数组，包含编辑指令和待编辑图片。
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                        enum:
                          - user
                          - model
                        example: user
                      parts:
                        type: array
                        items:
                          type: object
                          properties:
                            text:
                              type: string
                              description: 编辑指令
                            inline_data:
                              type: object
                              properties:
                                mime_type:
                                  type: string
                                  description: 图片 MIME 类型（如 image/png）
                                  example: image/png
                                data:
                                  type: string
                                  description: Base64 编码的图片数据
                  example:
                    - role: user
                      parts:
                        - text: 把背景换成蓝天白云
                        - inline_data:
                            mime_type: image/png
                            data: BASE64_IMAGE_DATA
                generationConfig:
                  type: object
                  required:
                    - responseModalities
                  properties:
                    responseModalities:
                      type: array
                      description: 响应模态，设为 IMAGE 以返回编辑后的图片。
                      items:
                        type: string
                      example:
                        - IMAGE
      responses:
        '200':
          description: 成功编辑图片
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateContentResponse'
        '400':
          description: 请求参数有误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          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:
                        inline_data:
                          type: object
                          properties:
                            mime_type:
                              type: string
                              example: image/png
                            data:
                              type: string
                              example: iVBORw0KGgo...
                        text:
                          type: string
                  role:
                    type: string
                    example: model
              finishReason:
                type: string
                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

````