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

# Seedream 5.0 Pro API：生成分層影像

> 位元組跳動 Seedream 5.0 Pro 影像生成 API，用於文生圖、圖生圖和圖層分解工作流程

## 概覽

Seedream 5.0 Pro 是位元組跳動影像生成模型，用於高品質文生圖創建、參考引導影像生成以及單一來源影像的層分解。它支援 `1K` 和 `2K` 生成層、用於生成和編輯的靈活寬高比、選填的顯式像素大小以及 `jpeg` 或 `png` 輸出。

| 功能 | 值 |
| - | - |
| 模型 ID | `seedream-5-0-pro` |
| 模式 | `text-to-image`, `image-to-image`, `layer-decomposition` |
| 提示詞長度 | 1-5000 字元；`layer-decomposition` 可選 |
| 參考圖片 | `image-to-image` 所需；必要且必須提供 1 個公開可存取的影像 URL 用於 `layer-decomposition` |
| 每個任務的影像數量 | 1 份用於產生或編輯的輸出影像；基礎影像加上 `layer-decomposition` 的圖層 |
| 解析度級距 | `1K`、`2K` 用於產生與編輯 |
| 縱橫比 | `1:1`、`2:3`、`3:2`、`4:3`、`3:4`、`9:16`、`16:9`、`21:9` 用於產生/編輯 |
| 尺寸輸入 | 產生/編輯：`1K`、`2K`、`1024x1024`、`2048X2048`、`2048*2048`；分層分解：`auto`、`1K`、`1.5K`、`2K` |
| 輸出格式 | `jpeg`, `png` |

## 端點與身分驗證

API 基底網址：

```text theme={null}
https://api.apixo.ai/api/v1
```

| 方法 | 端點 | 用途 |
| - | - | - |
| `POST` | `/generateTask/seedream-5-0-pro` | 送出生成任務 |
| `GET` | `/statusTask/seedream-5-0-pro?taskId={taskId}` | 查詢任務狀態並取得結果 |

每個請求都必須附上 APIXO API 金鑰：

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

送出任務時，還需設定以下請求標頭：

```http theme={null}
Content-Type: application/json
```

## 非同步請求範例

以下範例提交一個最簡單的文字生成圖片任務，回應中會傳回 `taskId`。

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/seedream-5-0-pro" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "mode": "text-to-image",
      "prompt": "a cinematic product photo of wireless earbuds on black glass, crisp highlights",
      "resolution": "1K",
      "aspect_ratio": "1:1",
      "output_format": "jpeg"
    }
  }'
```

成功回應：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
```

請保留 `taskId`，後續輪詢結果時會用到。

## 輪詢結果

```bash theme={null}
curl -X GET "https://api.apixo.ai/api/v1/statusTask/seedream-5-0-pro?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

成功回應：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/xxx.jpeg\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965644132,
    "costTime": 33203
  }
}
```

## 請求體

### 文生圖

```json theme={null}
{
  "input": {
    "mode": "text-to-image",
    "prompt": "a clean product photo of wireless earbuds on soft stone",
    "resolution": "1K",
    "aspect_ratio": "1:1",
    "output_format": "jpeg"
  }
}
```

### 圖生圖

```json theme={null}
{
  "input": {
    "mode": "image-to-image",
    "prompt": "keep the product shape, change the scene to a premium studio setup",
    "image_urls": [
      "https://example.com/reference-product.jpg"
    ],
    "resolution": "2K",
    "aspect_ratio": "4:3",
    "output_format": "png"
  }
}
```

### 顯式尺寸

```json theme={null}
{
  "input": {
    "mode": "text-to-image",
    "prompt": "a minimalist industrial poster with strong geometric composition",
    "size": "2048x2048",
    "output_format": "jpeg"
  }
}
```

### 分層分解

```json theme={null}
{
  "input": {
    "mode": "layer-decomposition",
    "prompt": "decompose the product inside <bbox>10 20 600 900</bbox>",
    "image_urls": [
      "https://example.com/source-product.png"
    ],
    "size": "auto",
    "output_format": "png"
  }
}
```

為了 `layer-decomposition`，模型傳回基礎影像加上提取的圖層影像。若要引導區域分解，請包含文字標籤，例如 `<bbox>x1 y1 x2 y2</bbox>` 裡面 `prompt`。不要單獨發送 `bbox` 請求欄位。

## 參數

**request\_type** `string` (default: async)

取得結果的方式。選擇 `async` 時，透過 `statusTask` 輪詢結果；選擇 `callback` 時，透過 Webhook 接收結果。

**callback\_url** `string`

當 `request_type` 為 `callback` 時必填。請提供可從網際網路存取的 HTTPS 網址，以接收任務的最終結果。詳見 [Webhook](https://apixo.ai/docs/zh-hant/api-reference/webhooks.md)。

**input** `object` *required*

Seedream 5.0 Pro 的輸入參數。

**屬性**

**mode** `string` *required*

生成模式。可用值為 `text-to-image`、`image-to-image`、`layer-decomposition`。

**prompt** `string`

用提示詞描述想生成的圖片。`text-to-image` 與 `image-to-image` 必填，`layer-decomposition` 選填。去除頭尾空白後，長度須為 1–5000 個字元。使用 `layer-decomposition` 時，可在提示詞中加入 `<bbox>x1 y1 x2 y2</bbox>`，指定來源圖片中要分解的區域。請求沒有獨立的 `bbox` 欄位。

**image\_urls** `string[]`

參考影像 URL。需用於 `image-to-image`。支援 1-10 個公開可存取的影像 URL，適用於 `image-to-image`。必須用於 `layer-decomposition`，且必須精確包含 1 個公開影像 URL。每個 URL 必須在任務提交期間可由 APIXO 通達。每張影像的像素數不得超過 36,000,000（寬度乘以高度）。層分解所需的最小像素數為 262,144。

**resolution** `string` (default: 1K)

`text-to-image` 與 `image-to-image` 的輸出解析度層。支援的值為：`1K`、`2K`。`layer-decomposition` 不支援。當提供 `resolution` 或 `aspect_ratio` 時，Seedream 5.0 Pro 會使用 `resolution + aspect_ratio` 預設路徑；若任一值缺失，則預設為 `1K` 與 `1:1`。

**aspect\_ratio** `string` (default: 1:1)

`text-to-image` 與 `image-to-image` 的輸出縱橫比。支援的值：`1:1`、`2:3`、`3:2`、`4:3`、`3:4`、`9:16`、`16:9`、`21:9`。`layer-decomposition` 不支援。當同時提供 `resolution + aspect_ratio` 與 `size` 時，`resolution + aspect_ratio` 優先。

**size** `string`

選填的顯式大小或預設標記。對於 `text-to-image` 與 `image-to-image`，預設標記支援 `1K` 與 `2K`；像素字串可使用 `x`、`X` 或 `*` 作為分隔符，例如 `1024x1024`、`2048X2048` 或 `2048*2048`。自訂像素大小必須以 16 像素為粒度，寬高比維持在 `1/16` 至 `16` 之間，總像素數介於 `921,600` 至 `4,194,304` 之間（相當於 `1280x720` 至 `2048x2048`）。對於 `layer-decomposition`，請選擇 `auto`、`1K`、`1.5K` 或 `2K` 之一；預設為 `auto`。

**output\_format** `string` (default: jpeg)

輸出圖片的格式。可用值為 `jpeg`、`png`。

**nsfw\_checker** `boolean` (default: false)

為這次請求啟用內容安全過濾。預設值為 `false`。若有填寫，必須使用布林值。

對於`layer-decomposition`，請勿傳送`resolution`、`aspect_ratio`、`max_images`、`num_images`或`n`。分解輸出的數量由模型控制。

### 尺寸預設來自 `resolution + aspect_ratio`

當提供 `resolution` 或 `aspect_ratio` 時，Seedream 5.0 Pro 將有效 `resolution + aspect_ratio` 對映射到這些輸出維度：

| 縱橫比 | `1K`尺寸 | `2K`尺寸 |
| - | - | - |
| `1:1` | `1024x1024` | `2048x2048` |
| `4:3` | `1152x864` | `2304x1728` |
| `3:4` | `864x1152` | `1728x2304` |
| `16:9` | `1312x736` | `2848x1600` |
| `9:16` | `736x1312` | `1600x2848` |
| `3:2` | `1248x832` | `2496x1664` |
| `2:3` | `832x1248` | `1664x2496` |
| `21:9` | `1568x672` | `3024x1296` |

## 回應格式

### 送出任務時的回應

任務受理後，`POST /generateTask/seedream-5-0-pro` 會傳回任務 ID：

**code** `integer`

API 狀態碼。`200` 表示任務已受理。

### 層分解結果

為了 `mode=layer-decomposition`, `data.resultJson` 保持相容性 JSON 僅包含的字串 `resultUrls` 大批。讀 `data.layerDecomposition` 有關文件級分解詳細資訊：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/base.png\",\"https://file.apixo.ai/layer-1.png\"]}",
    "layerDecomposition": [
      {
        "role": "base",
        "url": "https://file.apixo.ai/base.png"
      },
      {
        "role": "layer",
        "url": "https://file.apixo.ai/layer-1.png",
        "size": "512x512",
        "output_format": "png",
        "z_index": 1,
        "bounding_box": {
          "absolute": [10, 20, 600, 900],
          "normalized": [5, 10, 293, 439]
        },
        "name": "foreground object",
        "description": "Extract the foreground object, no other elements included."
      }
    ],
    "createTime": 1783569600000,
    "completeTime": 1783569638000,
    "costTime": 38000
  }
}
```

**message** `string`

狀態說明。

**data.taskId** `string`

用於稍後輪詢或 webhook 匹配的任務標識符。

## 耗時與輪詢

Seedream 5.0 Pro 任務是異步的。

| 輸出層 | 一般生成時間 | 建議首次查詢時間 | 輪詢間隔 |
| - | - | - | - |
| `1K` | 20s-35s | 任務建立 20 秒後 | 3s |
| `2K` | 25s-50s | 任務建立 20 秒後 | 3s |

對於生產系統，建議使用 `callback_url` 代替緊密的輪詢循環。

## 計費

新提交的非 LLM 請求按 **1 點 = `$0.001`** 計費。先依用量和加購項目計算總額，再套用帳戶折扣，最後將請求總額無條件進位至整數點數。若已約定固定單價，則保留該單價的精度，不再使用標準價或另行打折；最終點數仍須進位。詳見[積分換算與進位](https://apixo.ai/docs/zh-hant/pricing.md#credit-conversion-and-rounding)。

Seedream 5.0 Pro 使用輸出影像計費。 `text-to-image` 和 `image-to-image` 傳回一個輸出影像。 `layer-decomposition` 被引用並收費為 4 預期輸出影像，因為它會傳回基礎影像加圖層影像。

| 單位 | APIXO 價格 |
| - | - |
| 輸出像素數 ≤ 2,610,000 | `$0.045 / output image` |
| 輸出像素數 > 2,610,000 | `$0.09 / output image` |
| 第一個之後的附加輸入參考影像 | `$0.003 / image` |

計費行為：

```text theme={null}
output_charge = 1 * selected output pixel tier price
reference_charge = max(0, reference_image_count - 1) * 0.003
final charge = output_charge + reference_charge
```

對於 `layer-decomposition`，請求必須恰好包含一張輸入影像，因此輸入參考附加元件為 `$0`。預設 `size=auto` 報價使用 `2K` 層

```text theme={null}
layer_decomposition_default_charge = 4 * 0.09 = 0.36
```

顯式 `size=1K` 或 `size=1.5K` 使用 `$0.045` 輸出影像圖層。顯式 `size=2K` 使用 `$0.09` 輸出影像圖層。

生成失敗時會退還相應費用。

## 實用筆記

* 此公共生成和編輯合約中故意省略了影像計數欄位；Seedream 5.0 Pro 正好傳回一張為 `text-to-image` 和 `image-to-image` 生成的影像。
* 此端點不支援 `3K` 和 `4K`。
* `2K + 21:9` 映射到 `3024x1296`，這會保留 `21:9` 比率，同時保持在 `4,194,304` 像素限制內。
* 如果`resolution`或`aspect_ratio`與`size`一起提供，則有效的`resolution + aspect_ratio`預設決定輸出尺寸。
* 如果您僅提供 `size`，APIXO 將使用該明確的像素大小或預設標記。
* 為了 `layer-decomposition`，區域控制是基於文字的：在 `prompt` 中寫入 `<bbox>x1 y1 x2 y2</bbox>`；不得新增頂級或輸入級 `bbox` 欄位。

## MCP 整合

[完整模型 Schema](https://apixo.ai/docs/models/schemas/image/seedream-5-0-pro.json) 中的 `mcp.result` 指定結果的解析方式，`mcp.attachments` 列出可繫結檔案的欄位。這些中繼資料供用戶端整合使用，無須當作生成參數提交。附件欄位為 `image_urls`。請保留使用者指定的檔案順序。模型參數由 API 驗證。

## 相關連結

* [影像模型](https://apixo.ai/docs/zh-hant/models/image)
* [生成 API 總覽](https://apixo.ai/docs/zh-hant/models.md)
* [送出生成任務](https://apixo.ai/docs/zh-hant/api-reference/generate-task.md)
* [查詢任務狀態](https://apixo.ai/docs/zh-hant/api-reference/status-task.md)
* [Webhook](https://apixo.ai/docs/zh-hant/api-reference/webhooks.md)
* [錯誤碼](https://apixo.ai/docs/zh-hant/api-reference/errors.md)
* [在 APIXO Playground 嘗試 Seedream 5.0 Pro](https://apixo.ai/models/seedream-5-0-pro)
* [API定價](https://apixo.ai/pricing/api)


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