# gemini-3.1-flash-image-preview（同步按次收费-文生图）

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /ws/api/v3/google/nano-banana-2/text-to-image:
    post:
      summary: gemini-3.1-flash-image-preview（同步按次收费-文生图）
      deprecated: false
      description: |
        来自Google的Nano-Banana-2模型

        **价格：**
        **分辨率0.5K 0.045 PTC/次** 
        **分辨率1K 0.07 PTC/次** 
        **分辨率2K 0.105 PTC/次** 
        **分辨率4K 0.14 PTC/次**
      tags:
        - 图片生成/Google/Nano-Banana-2
      parameters:
        - name: Authorization
          in: header
          description: ''
          required: false
          example: Bearer {{YOUR_API_KEY}}
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                  description: 用于生成内容的正向提示词（必填）。
                aspect_ratio:
                  type: string
                  enum:
                    - '1:1'
                    - '3:2'
                    - '2:3'
                    - '3:4'
                    - '4:3'
                    - '4:5'
                    - '5:4'
                    - '9:16'
                    - '16:9'
                    - '21:9'
                  description: 生成媒体的宽高比（可选）。
                output_format:
                  type: string
                  description: 输出图像的格式（可选）。
                  enum:
                    - png
                    - jpeg
                  default: png
                  deprecated: true
                enable_sync_mode:
                  type: boolean
                  description: >-
                    启用同步模式（可选）。如果设置为 true，函数将在返回响应之前等待结果生成并上传。允许直接在响应中获取结果，仅通过
                    API 可用。
                  default: true
                enable_base64_output:
                  type: boolean
                  default: false
                  description: 启用 BASE64 输出（可选）。如果启用，输出将被编码为 BASE64 字符串，而非 URL，仅通过 API 可用。
                callback:
                  type: string
                  description: 回调接口地址（可选）。生成任务完成后系统会向此链接发送结果请求，返回状态码 200 表示接收成功。
                resolution:
                  type: string
                  description: 输出图像的分辨率
                  enum:
                    - 1k
                    - 2k
                    - 4k
                  x-apifox-enum:
                    - value: 1k
                      name: ''
                      description: ''
                    - value: 2k
                      name: ''
                      description: ''
                    - value: 4k
                      name: ''
                      description: ''
              required:
                - prompt
              x-apifox-orders:
                - prompt
                - aspect_ratio
                - output_format
                - enable_sync_mode
                - enable_base64_output
                - callback
                - resolution
            example:
              aspect_ratio: '3:4'
              enable_base64_output: false
              enable_sync_mode: true
              prompt: >-
                Create a vibrant and modern magazine cover for Women’s Health,
                themed for April 2025. The main backg...
              resolution: 2k
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                      model:
                        type: string
                      outputs:
                        type: array
                        items:
                          type: string
                      urls:
                        type: object
                        properties:
                          get:
                            type: string
                        required:
                          - get
                        x-apifox-orders:
                          - get
                      has_nsfw_contents:
                        type: array
                        items:
                          type: string
                      status:
                        type: string
                      created_at:
                        type: string
                      error:
                        type: string
                      executionTime:
                        type: integer
                      timings:
                        type: object
                        properties:
                          inference:
                            type: integer
                        required:
                          - inference
                        x-apifox-orders:
                          - inference
                    required:
                      - id
                      - model
                      - outputs
                      - urls
                      - has_nsfw_contents
                      - status
                      - created_at
                      - error
                      - executionTime
                      - timings
                    x-apifox-orders:
                      - id
                      - model
                      - outputs
                      - urls
                      - has_nsfw_contents
                      - status
                      - created_at
                      - error
                      - executionTime
                      - timings
                required:
                  - code
                  - message
                  - data
                x-apifox-orders:
                  - code
                  - message
                  - data
              example:
                code: 200
                message: success
                data:
                  id: 0380bfc901774222ac1adbc22262b804
                  model: google/nano-banana-pro/edit
                  outputs:
                    - >-
                      https://file.302.ai/gpt/imgs/20251225/6ed550c6be921bcc6ff90c9071.png
                  urls:
                    get: >-
                      https://api.302.ai/ws/api/v3/predictions/0380bfc901774222ac1adbc22262b804/result
                  has_nsfw_contents: null
                  status: completed
                  created_at: '2025-12-25T13:58:36.121Z'
                  error: ''
                  executionTime: 30155
                  timings:
                    inference: 30155
          headers: {}
          x-apifox-name: 成功
      security: []
      x-apifox-folder: 图片生成/Google/Nano-Banana-2
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/4012774/apis/api-420136730-run
components:
  schemas: {}
  securitySchemes:
    apiKeyAuth:
      type: apikey
      in: header
      name: Authorization
    BearerAuth:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
      description: 使用火山方舟 API Key 进行认证
servers:
  - url: https://api.302.ai
    description: 海外环境
  - url: https://api.302ai.com
    description: 国内环境2
security: []

```
