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

# Gemini 圖片(Nano Banana)

> Gemini 圖片生成。

Nano Banana系列支援OpenAI Dall-E 格式（詳見連結 [圖片生成OpenAI DALL-E 格式](#tag/%E5%9B%BE%E7%89%87%E7%94%9F%E6%88%90OpenAI%20DALL-E%E6%A0%BC%E5%BC%8F)）。

Gemini 圖片生成相容介面。`contents[].parts` 中放文字或圖片輸入，`generationConfig.responseModalities` 通常傳 `IMAGE`，圖片尺寸透過 `generationConfig.imageConfig.imageSize` 控制。



## OpenAPI

````yaml api-reference/zh-tw/openapi.json POST /v1beta/models/{model}:generateContent
openapi: 3.0.0
info:
  title: 出海營 API 參考文件
  version: 1.0.0
  description: Public AI Gateway API Reference
servers:
  - url: https://api.aiid.edu.kg
security:
  - BearerAuth: []
tags:
  - name: OpenAI格式（Chat）
  - name: OpenAI格式（Responses）
  - name: 圖片生成 Gemini 格式
  - name: 圖片生成OpenAI DALL-E 格式
  - name: 獲取模型列表
  - name: 影片生成HappyHorse與 Wan
  - name: 影片生成Kling格式
  - name: 影片生成 Omni 與 Veo 格式
  - name: 影片生成 Seedance 格式
  - name: 影片生成Sora相容格式
  - name: 影片生成 Vidu 格式
  - name: 音樂生成任務格式
paths:
  /v1beta/models/{model}:generateContent:
    post:
      tags:
        - 圖片生成 Gemini 格式
      summary: Gemini 圖片(Nano Banana)
      description: >-
        Gemini 圖片生成。


        Nano Banana系列支援OpenAI Dall-E 格式（詳見連結 [圖片生成OpenAI DALL-E
        格式](#tag/%E5%9B%BE%E7%89%87%E7%94%9F%E6%88%90OpenAI%20DALL-E%E6%A0%BC%E5%BC%8F)）。


        Gemini 圖片生成相容介面。`contents[].parts`
        中放文字或圖片輸入，`generationConfig.responseModalities` 通常傳 `IMAGE`，圖片尺寸透過
        `generationConfig.imageConfig.imageSize` 控制。
      operationId: geminiRelayV1Beta
      parameters:
        - name: model
          in: path
          description: 模型名稱
          required: true
          example: gemini-3-pro-image-preview
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                contents:
                  type: array
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                        description: 訊息角色，常見值為 `user` 或 `model`。
                      parts:
                        type: array
                        items:
                          type: object
                          properties:
                            text:
                              type: string
                              description: 文字輸入內容。
                            inlineData:
                              type: object
                              description: 內嵌二進位內容物件，適用於 base64 圖片等輸入。
                              properties:
                                mimeType:
                                  type: string
                                  description: 內嵌內容 MIME 類型，例如 `image/png`。
                                data:
                                  type: string
                                  description: Base64 編碼後的二進位資料內容。
                        description: 訊息片段陣列；文字、圖片等輸入都放在這裡。
                  description: 必填。Gemini 輸入內容陣列，通常至少包含一則 user 訊息。
                generationConfig:
                  type: object
                  properties:
                    responseModalities:
                      type: array
                      items:
                        type: string
                      description: 回應模式清單；圖片生成通常傳 `IMAGE`。
                    imageConfig:
                      type: object
                      properties:
                        aspectRatio:
                          type: string
                          description: 寬高比，例如 `16:9`、`1:1`、`9:16`。
                        imageSize:
                          type: string
                          description: 輸出解析度等級，例如 `1K`、`2K`、`4K`。
                      description: 圖片生成配置物件。
                  required:
                    - responseModalities
                  description: 生成設定物件。
              required:
                - contents
                - generationConfig
            example:
              contents:
                - role: user
                  parts:
                    - text: draw a cat
              generationConfig:
                responseModalities:
                  - TEXT
                  - IMAGE
                imageConfig:
                  aspectRatio: '16:9'
                  imageSize: 4K
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeminiResponse'
          headers: {}
      deprecated: false
      security:
        - BearerAuth: []
components:
  schemas:
    GeminiResponse:
      type: object
      properties:
        candidates:
          type: array
          items:
            type: object
            properties:
              content:
                type: object
                properties:
                  role:
                    type: string
                  parts:
                    type: array
                    items:
                      type: object
                      properties: {}
              finishReason:
                type: string
              safetyRatings:
                type: array
                items:
                  type: object
                  properties: {}
        usageMetadata:
          type: object
          properties:
            promptTokenCount:
              type: integer
            candidatesTokenCount:
              type: integer
            totalTokenCount:
              type: integer
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |-
        使用 Bearer Token 認證。
        格式: `Authorization: Bearer sk-xxxxxx`

````