> ## 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.

# 編輯圖像（OpenAI Dall-E 相容）

> OpenAI Dall-E 格式圖片編輯介面。

- `POST /v1/images/edits`：編輯圖片

標準鑑權標頭：
- `Content-Type: application/json`

- `model: string`：必填，對外模型名稱
- `prompt: string`：推薦，圖片生成描述
- `n: number`：可選，生成張數
- `size: string`：可選，尺寸或解析度表達
- `quality: string`：可選，品質等級
- `response_format: string`：可選，回傳格式

常用相容擴展參數：
- `image`
- `image_url`
- `image_urls`
- `image_list`
- `subject_image_list`
- `scene_image`
- `style_image`
- `negative_prompt`
- `aspect_ratio`
- `resolution`
- `callback_url`
- `external_task_id`

Kling 專用擴充參數：
- `model_name`
- `element_list`
- `result_type`
- `series_amount`
- `human_image`
- `cloth_image`
- `up_expansion_ratio`
- `down_expansion_ratio`
- `left_expansion_ratio`
- `right_expansion_ratio`

### 3.1 Nano Banana 系列

對外模型：
- `nano-banana`
- `nano-banana-pro`
- `nano-banana-pro-2k`
- `nano-banana-pro-4k`
- `nano-banana-2`
- `nano-banana-2-2k`
- `nano-banana-2-4k`

能力說明：
- `nano-banana`：基礎文字生圖，也相容圖片編輯
- `nano-banana-pro*`：更高品質版本
- `nano-banana-2*`：更新版本系列
- `*-2k` / `*-4k`：高解析度型號

常用參數：
- 文生圖：`model + prompt`
- 圖片編輯：`model + prompt + image`，也相容 `image_urls`
- 常用擴展：`n` `size` `quality` `response_format`

範例：

```json
{
  "model": "nano-banana",
  "prompt": "a cute cat running in cloud",
  "n": 1,
  "size": "1024x1792"
}
```

```json
{
  "model": "nano-banana-pro",
  "prompt": "把主体改成赛博朋克夜景",
  "image": "https://example.com/input.png",
  "n": 1
}
```

### 3.2 Seedream 系列

對外模型：
- `doubao-seedream-3-0-t2i-250415`
- `doubao-seedream-4-0-250828`
- `doubao-seedream-4-5-251128`
- `doubao-seedream-5-0-260128`

能力說明：
- 統一按文生圖呼叫
- 建議優先傳入標準參數：`prompt + model + size/aspect_ratio`

常用參數：
- `model + prompt`
- 可選：`size` `aspect_ratio` `n`

### 3.3 Kling 常規圖片主模型

對外主模型：
- `kling-image`

必填：
- `model`
- `model_name`

支援的 `model_name`：
- `kling-v1`
- `kling-v1-5`
- `kling-v2`
- `kling-v2-new`
- `kling-v2-1`
- `kling-v3`

能力說明：
- 文生圖：`model + model_name + prompt`
- 圖生圖：在文生圖基礎上增加 `image`
- 多圖生圖：傳 `subject_image_list`，或傳多張 `image_urls/images`
- 擴圖：傳 `image` 和擴圖比例參數

常用參數：
- `image`
- `subject_image_list`
- `scene_image`
- `style_image`
- `aspect_ratio`
- `resolution`
- `up_expansion_ratio`
- `down_expansion_ratio`
- `left_expansion_ratio`
- `right_expansion_ratio`

範例：

```json
{
  "model": "kling-image",
  "model_name": "kling-v3",
  "prompt": "海边日落，电影感人像",
  "aspect_ratio": "16:9",
  "n": 1
}
```

### 3.4 Kling Omni 圖片主模型

對外主模型：
- `kling-omni-image`

必填：
- `model`
- `model_name`

支援的 `model_name`：
- `kling-image-o1`
- `kling-v3-omni`

常用參數：
- `image_list`
- `element_list`
- `resolution`
- `aspect_ratio`
- `result_type`
- `series_amount`

範例：

```json
{
  "model": "kling-omni-image",
  "model_name": "kling-v3-omni",
  "prompt": "生成一张海边跳舞的图片",
  "element_list": [
    {
      "element_id": 835266081714884677
    }
  ]
}
```

### 3.5 Kling 虛擬試衣模型

對外模型：
- `kolors-virtual-try-on-v1`
- `kolors-virtual-try-on-v1-5`

最小輸入參數：
- `model + human_image + cloth_image`

說明：
- 這兩個模型本身就是完整主模型，不需要再傳 `model_name`

範例：

```json
{
  "model": "kolors-virtual-try-on-v1",
  "human_image": "https://example.com/human.jpg",
  "cloth_image": "https://example.com/cloth.jpg"
}
```



## OpenAPI

````yaml api-reference/zh-tw/openapi.json POST /v1/images/edits
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:
  /v1/images/edits:
    post:
      tags:
        - 圖片生成OpenAI DALL-E 格式
      summary: 編輯圖像（OpenAI Dall-E 相容）
      description: |-
        OpenAI Dall-E 格式圖片編輯介面。

        - `POST /v1/images/edits`：編輯圖片

        標準鑑權標頭：
        - `Content-Type: application/json`

        - `model: string`：必填，對外模型名稱
        - `prompt: string`：推薦，圖片生成描述
        - `n: number`：可選，生成張數
        - `size: string`：可選，尺寸或解析度表達
        - `quality: string`：可選，品質等級
        - `response_format: string`：可選，回傳格式

        常用相容擴展參數：
        - `image`
        - `image_url`
        - `image_urls`
        - `image_list`
        - `subject_image_list`
        - `scene_image`
        - `style_image`
        - `negative_prompt`
        - `aspect_ratio`
        - `resolution`
        - `callback_url`
        - `external_task_id`

        Kling 專用擴充參數：
        - `model_name`
        - `element_list`
        - `result_type`
        - `series_amount`
        - `human_image`
        - `cloth_image`
        - `up_expansion_ratio`
        - `down_expansion_ratio`
        - `left_expansion_ratio`
        - `right_expansion_ratio`

        ### 3.1 Nano Banana 系列

        對外模型：
        - `nano-banana`
        - `nano-banana-pro`
        - `nano-banana-pro-2k`
        - `nano-banana-pro-4k`
        - `nano-banana-2`
        - `nano-banana-2-2k`
        - `nano-banana-2-4k`

        能力說明：
        - `nano-banana`：基礎文字生圖，也相容圖片編輯
        - `nano-banana-pro*`：更高品質版本
        - `nano-banana-2*`：更新版本系列
        - `*-2k` / `*-4k`：高解析度型號

        常用參數：
        - 文生圖：`model + prompt`
        - 圖片編輯：`model + prompt + image`，也相容 `image_urls`
        - 常用擴展：`n` `size` `quality` `response_format`

        範例：

        ```json
        {
          "model": "nano-banana",
          "prompt": "a cute cat running in cloud",
          "n": 1,
          "size": "1024x1792"
        }
        ```

        ```json
        {
          "model": "nano-banana-pro",
          "prompt": "把主体改成赛博朋克夜景",
          "image": "https://example.com/input.png",
          "n": 1
        }
        ```

        ### 3.2 Seedream 系列

        對外模型：
        - `doubao-seedream-3-0-t2i-250415`
        - `doubao-seedream-4-0-250828`
        - `doubao-seedream-4-5-251128`
        - `doubao-seedream-5-0-260128`

        能力說明：
        - 統一按文生圖呼叫
        - 建議優先傳入標準參數：`prompt + model + size/aspect_ratio`

        常用參數：
        - `model + prompt`
        - 可選：`size` `aspect_ratio` `n`

        ### 3.3 Kling 常規圖片主模型

        對外主模型：
        - `kling-image`

        必填：
        - `model`
        - `model_name`

        支援的 `model_name`：
        - `kling-v1`
        - `kling-v1-5`
        - `kling-v2`
        - `kling-v2-new`
        - `kling-v2-1`
        - `kling-v3`

        能力說明：
        - 文生圖：`model + model_name + prompt`
        - 圖生圖：在文生圖基礎上增加 `image`
        - 多圖生圖：傳 `subject_image_list`，或傳多張 `image_urls/images`
        - 擴圖：傳 `image` 和擴圖比例參數

        常用參數：
        - `image`
        - `subject_image_list`
        - `scene_image`
        - `style_image`
        - `aspect_ratio`
        - `resolution`
        - `up_expansion_ratio`
        - `down_expansion_ratio`
        - `left_expansion_ratio`
        - `right_expansion_ratio`

        範例：

        ```json
        {
          "model": "kling-image",
          "model_name": "kling-v3",
          "prompt": "海边日落，电影感人像",
          "aspect_ratio": "16:9",
          "n": 1
        }
        ```

        ### 3.4 Kling Omni 圖片主模型

        對外主模型：
        - `kling-omni-image`

        必填：
        - `model`
        - `model_name`

        支援的 `model_name`：
        - `kling-image-o1`
        - `kling-v3-omni`

        常用參數：
        - `image_list`
        - `element_list`
        - `resolution`
        - `aspect_ratio`
        - `result_type`
        - `series_amount`

        範例：

        ```json
        {
          "model": "kling-omni-image",
          "model_name": "kling-v3-omni",
          "prompt": "生成一张海边跳舞的图片",
          "element_list": [
            {
              "element_id": 835266081714884677
            }
          ]
        }
        ```

        ### 3.5 Kling 虛擬試衣模型

        對外模型：
        - `kolors-virtual-try-on-v1`
        - `kolors-virtual-try-on-v1-5`

        最小輸入參數：
        - `model + human_image + cloth_image`

        說明：
        - 這兩個模型本身就是完整主模型，不需要再傳 `model_name`

        範例：

        ```json
        {
          "model": "kolors-virtual-try-on-v1",
          "human_image": "https://example.com/human.jpg",
          "cloth_image": "https://example.com/cloth.jpg"
        }
        ```
      operationId: createImageEdit
      parameters: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                model:
                  type: string
                  example: dall-e-2
                  description: 對外圖片模型名稱。
                  enum:
                    - nano-banana
                    - doubao-seedream-3-0-t2i-250415
                    - kling-image
                    - kling-omni-image
                    - kolors-virtual-try-on-v1
                    - kolors-virtual-try-on-v1-5
                image:
                  type: string
                  format: binary
                  description: 單張圖片輸入，常用於圖生圖與擴圖。
                mask:
                  type: string
                  format: binary
                  description: 選填遮罩圖
                prompt:
                  type: string
                  description: 圖片生成描述。虛擬試衣模型可不傳。
                'n':
                  type: integer
                  description: 生成張數。
                  default: 1
                size:
                  type: string
                  enum:
                    - 256x256
                    - 512x512
                    - 1024x1024
                  description: 尺寸或解析度表達。
                response_format:
                  type: string
                  description: 回傳格式。
                  enum:
                    - url
                    - b64_json
                user:
                  type: string
              required:
                - model
                - image
                - prompt
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                  example: dall-e-2
                  description: 對外圖片模型名稱。
                  enum:
                    - nano-banana
                    - doubao-seedream-3-0-t2i-250415
                    - kling-image
                    - kling-omni-image
                    - kolors-virtual-try-on-v1
                    - kolors-virtual-try-on-v1-5
                image:
                  type: string
                  format: binary
                  description: 單張圖片輸入，常用於圖生圖與擴圖。
                mask:
                  type: string
                  format: binary
                  description: 選填遮罩圖
                prompt:
                  type: string
                  description: 圖片生成描述。虛擬試衣模型可不傳。
                'n':
                  type: integer
                  description: 生成張數。
                  default: 1
                size:
                  type: string
                  enum:
                    - 256x256
                    - 512x512
                    - 1024x1024
                  description: 尺寸或解析度表達。
                response_format:
                  type: string
                  description: 回傳格式。
                  enum:
                    - url
                    - b64_json
                user:
                  type: string
              required:
                - model
                - image
                - prompt
            examples:
              nano_banana_text2img:
                summary: Nano Banana 文生圖
                value:
                  model: nano-banana
                  prompt: a cute cat running in cloud
                  'n': 1
                  size: 1024x1792
              seedream_text2img:
                summary: Seedream 文生圖
                value:
                  model: doubao-seedream-3-0-t2i-250415
                  prompt: 一张电影感海边日落人像
                  size: 1536x1024
                  'n': 1
              kling_text2img:
                summary: Kling 文生圖
                value:
                  model: kling-image
                  model_name: kling-v3
                  prompt: 海边日落，电影感人像
                  aspect_ratio: '16:9'
                  'n': 1
              kling_img2img:
                summary: Kling 圖生圖
                value:
                  model: kling-image
                  model_name: kling-v2-1
                  prompt: 改成赛博朋克夜景风格
                  image: https://example.com/input.png
                  'n': 1
              kling_omni_image:
                summary: Kling Omni 圖片
                value:
                  model: kling-omni-image
                  model_name: kling-v3-omni
                  prompt: 生成一张海边跳舞的图片
                  element_list:
                    - element_id: 835266081714884700
              kling_virtual_try_on:
                summary: Kling 虛擬試衣
                value:
                  model: kolors-virtual-try-on-v1
                  human_image: https://example.com/human.jpg
                  cloth_image: https://example.com/cloth.jpg
      responses:
        '200':
          description: 成功產生圖片
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageResponse'
          headers: {}
      deprecated: false
      security:
        - BearerAuth: []
components:
  schemas:
    ImageResponse:
      type: object
      properties:
        created:
          type: integer
        data:
          type: array
          items:
            type: object
            properties:
              url:
                type: string
              b64_json:
                type: string
              revised_prompt:
                type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |-
        使用 Bearer Token 認證。
        格式: `Authorization: Bearer sk-xxxxxx`

````