> ## 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 API：結合網路搜尋進行文字生成圖片

> ByteDance Seedream 5.0 影像生成 API，支援文生圖與圖生圖工作流程

## 概覽

Seedream 5.0 是 ByteDance 的影像生成模型，用於文生圖與參考引導的影像生成。支援 2K 與 3K 輸出預設、可選的網路搜尋、可選擇的輸出格式，以及為偏好明確尺寸的使用者提供的靈活 `size` 輸入。

| 功能 | 值 |
| - | - |
| 模型 ID | `seedream-5-0` |
| 模式 | `text-to-image`, `image-to-image` |
| 提示詞長度 | 1 至 5000 個字元 |
| 參考圖片 | 1-14 `image-to-image` 的 URL |
| 每個任務的影像數量 | `max_images` 為必填項，範圍為 1-15；對於 `image-to-image`，`image_urls` 的數量加上 `max_images` 必須小於或等於 15。 |
| 解析度級距 | `2K`, `3K` |
| 縱橫比 | `1:1`, `2:3`, `3:2`, `4:3`, `3:4`, `9:16`, `16:9`, `21:9` |
| 尺寸輸入 | `2K`, `3K`, `2048x2048`, `2048X2048`, `2048*2048` |
| 輸出格式 | `jpeg`, `png` |
| 網頁搜尋 | `true`, `false` |
| 提示詞最佳化 | `standard` |

## 端點與身分驗證

API 基底網址：

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

| 方法 | 端點 | 用途 |
| - | - | - |
| `POST` | `/generateTask/seedream-5-0` | 送出生成任務 |
| `GET` | `/statusTask/seedream-5-0?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" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "mode": "text-to-image",
      "prompt": "a cozy cyberpunk cafe with neon lights, ultra detailed",
      "max_images": 1,
      "resolution": "2K",
      "aspect_ratio": "16:9",
      "output_format": "jpeg",
      "prompt_optimize_mode": "standard"
    }
  }'
```

成功回應：

```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?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",
    "max_images": 1,
    "resolution": "2K",
    "aspect_ratio": "1:1",
    "sequential_image_generation": "disabled",
    "output_format": "jpeg",
    "prompt_optimize_mode": "standard"
  }
}
```

### 圖生圖

```json theme={null}
{
  "input": {
    "mode": "image-to-image",
    "prompt": "make this scene look like sunrise with warm colors",
    "image_urls": [
      "https://example.com/ref1.jpg",
      "https://example.com/ref2.jpg"
    ],
    "max_images": 2,
    "resolution": "3K",
    "aspect_ratio": "3:4",
    "sequential_image_generation": "auto",
    "output_format": "png",
    "prompt_optimize_mode": "standard"
  }
}
```

### 顯式尺寸

```json theme={null}
{
  "input": {
    "mode": "text-to-image",
    "prompt": "a minimalist industrial poster",
    "max_images": 1,
    "size": "3072X3072",
    "output_format": "jpeg"
  }
}
```

## 參數

**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 的輸入參數。

**屬性**

**mode** `string` *required*

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

**prompt** `string` *required*

用文字描述想生成的影像。移除頭尾空白後，長度須為 1 至 5000 個字元。

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

參考影像 URL。`image-to-image` 所需。接受 1-14 公用影像 URL。對於 `image-to-image`，`image_urls` 計數 + `max_images` 必須小於或等於 15。

**max\_images** `integer` *required*

請求的影像計數。必須是 1 到 15 之間的整數。對於 `image-to-image`，`image_urls` 中的參考影像數量加上 `max_images` 不得超過 15。

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

輸出解析度預設。支援的值：`2K`、`3K`。當 `resolution + aspect_ratio` 與 `size` 同時存在時，`resolution + aspect_ratio` 優先。

**aspect\_ratio** `string`

輸出畫面的長寬比。可用值為 `1:1`、`2:3`、`3:2`、`4:3`、`3:4`、`9:16`、`16:9`、`21:9`。

**size** `string`

選填的顯式大小或預設標記。預設令牌不區分大小寫，支援 `2K` 和 `3K`。像素字串接受 `x`、`X` 或 `*` 分隔符，例如 `2048x2048`、`2048X2048` 或 `2048*2048`。自訂像素大小必須使用 16 像素粒度，保持寬高比在 `1/16` 和 `16` 之間，並將總像素保持在 `3,686,400` 和 `16,777,216` 之間（`2560x1440` 到 `4096x4096` 等效）。不支援的自訂值可能會調整為最接近的支援的輸出大小。

**sequential\_image\_generation** `string` (default: disabled)

順序生成模式。支援的值：`disabled`、`auto`。

**prompt\_optimize\_mode** `string` (default: standard)

提示優化模式。Seedream 5.0 目前支援 `standard`。

**web\_search** `boolean` (default: false)

設定為 `true` 時啟用網路搜尋。

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

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

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

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

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

當提供 `aspect_ratio` 時，Seedream 5.0 將 `resolution` 和 `aspect_ratio` 對應到這些輸出維度：

| 縱橫比 | `2K`尺寸 | `3K`尺寸 |
| - | - | - |
| `1:1` | `2048x2048` | `3072x3072` |
| `4:3` | `2304x1728` | `3456x2592` |
| `3:4` | `1728x2304` | `2592x3456` |
| `16:9` | `2848x1600` | `4096x2304` |
| `9:16` | `1600x2848` | `2304x4096` |
| `3:2` | `2496x1664` | `3744x2496` |
| `2:3` | `1664x2496` | `2496x3744` |
| `21:9` | `3136x1344` | `4704x2016` |

## 回應格式

### 送出任務時的回應

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

**code** `integer`

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

**message** `string`

狀態說明。

**data.taskId** `string`

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

## 輪詢和交付指導

Seedream 5.0 任務是異步的。

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

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

## 計費

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

Seedream 5.0 依產生的影像計費。目前的公開 APIXO 價格是該型號的單一統一費率。

| 單位 | APIXO 價格 |
| - | - |
| 每個生成的影像 | `$0.035 / image` |

計費行為：

```text theme={null}
precharge = requested max_images * unit price
final charge = successful images * unit price
```

如果成功輸出的影像數量少於要求的數量，APIXO 會自動將最終費用調整為成功輸出的實際數量。

## MCP 整合

[完整模型 Schema](https://apixo.ai/docs/models/schemas/image/seedream-5-0.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)
* [嘗試 Seedream 5.0 在 APIXO Playground](https://apixo.ai/models/seedream-5-0)
* [API定價](https://apixo.ai/pricing/api)


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