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

# Nano Banana 2.1

> 文生图与参考图编辑。



## OpenAPI

````yaml zh/openapi/images/nano-banana-2-1.yaml POST /v1/images/generate
openapi: 3.1.0
info:
  title: Nano Banana 2.1
  version: '1.0'
  description: 文生图与参考图编辑。
servers:
  - url: https://openapi.imini.ai/imini/router
security:
  - ApiKeyAuth: []
paths:
  /v1/images/generate:
    post:
      summary: Nano Banana 2.1
      description: >
        提交后[查询任务状态](/zh/api-reference/images/task-query)。参见[模型价格](/zh/guide/pricing)。
      operationId: generateNanoBanana21
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - prompt
              properties:
                model:
                  type: string
                  const: nano-banana-2.1
                prompt:
                  type: string
                  minLength: 1
                  maxLength: 20000
                  description: 生成或编辑提示词。
                images:
                  type: array
                  maxItems: 14
                  description: 参考图；省略或传空数组为文生图。
                  items:
                    type: object
                    required:
                      - url
                    properties:
                      url:
                        type: string
                        description: 公网图片 URL 或 Base64 Data URI（解码后最多 20 MiB）。
                      reference_type:
                        type: string
                        enum:
                          - asset
                        default: asset
                        description: 参考图用途。
                resolution:
                  type: string
                  enum:
                    - 1K
                    - 2K
                    - 4K
                  default: 1K
                  description: 输出清晰度。
                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'
                    - '1:4'
                    - '1:8'
                    - '4:1'
                    - '8:1'
                  default: '1:1'
                  description: 支持自动比例时，可省略以适配参考图。
                num:
                  type: integer
                  minimum: 1
                  maximum: 4
                  default: 1
                  description: 输出数量。
            examples:
              text:
                summary: 文生图
                value:
                  model: nano-banana-2.1
                  prompt: 晨光中的海边城市，水彩插画。
                  resolution: 1K
                  aspect_ratio: '1:1'
              edit:
                summary: 参考图编辑
                value:
                  model: nano-banana-2.1
                  prompt: 保留构图，将背景改成浅蓝色。
                  images:
                    - url: https://example.com/reference.png
                      reference_type: asset
                  resolution: 1K
                  aspect_ratio: '1:1'
      responses:
        '200':
          description: 任务已受理。
          content:
            application/json:
              schema:
                type: object
                required:
                  - task_id
                  - model
                  - created_at
                  - request_id
                properties:
                  task_id:
                    type: string
                    description: 任务 ID，用于轮询。
                  model:
                    type: string
                    description: 回显请求中的模型 ID。
                  created_at:
                    type: string
                    format: date-time
                    description: 任务创建时间（UTC）。
                  request_id:
                    type: string
                    description: 请求 ID。
              example:
                task_id: task_2041350318103396352
                model: nano-banana-2.1
                created_at: '2026-11-16T07:00:00.000Z'
                request_id: task_2041350318103396352
        '400':
          description: 模型或请求参数无效。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                error:
                  code: INVALID_PARAMETER
                  message: Parameter value is out of range or has incorrect type
                  status: 400
                  request_id: req_example
        '402':
          description: 积分不足。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                error:
                  code: INSUFFICIENT_CREDITS
                  message: >-
                    Insufficient credits. Upgrade your plan or purchase
                    additional credits.
                  status: 402
                  request_id: req_example
        '413':
          description: 请求体或 Base64 素材超出大小限制。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                error:
                  code: PAYLOAD_TOO_LARGE
                  message: Request payload exceeds the supported size
                  status: 413
                  request_id: req_example
components:
  schemas:
    ApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - status
          properties:
            code:
              type: string
            message:
              type: string
            status:
              type: integer
            request_id:
              type: string
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: '`Bearer YOUR_API_KEY`。在 [API Keys](https://imini.ai/zh/api-keys) 管理密钥。'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.