> ## 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 4.5 API：高解析度影像生成

> ByteDance Seedream 4.5 影像生成 API，支援高解析度、多圖像及參考引導工作流程

## 概覽

Seedream 4.5 是 ByteDance 提供的影像模型，支援文字生成圖像與參考引導圖像生成。支援 2K 與 4K 輸出預設、每任務最多生成 15 張圖像、可選的順序生成，以及提供呼叫者偏好顯式尺寸的靈活 `size` 輸入設定。

| 功能 | 值 |
| - | - |
| 模型 ID | `seedream-4-5` |
| 模式 | `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`, `4K` |
| 縱橫比 | `1:1`, `2:3`, `3:2`, `4:3`, `3:4`, `9:16`, `16:9`, `21:9` |
| 尺寸輸入 | `2K`, `4K`, `2048x2048`, `2048X2048`, `2048*2048` |
| 順序生成 | `disabled`, `auto` |
| 提示詞最佳化 | `standard` |

## 端點與身分驗證

API 基底網址：

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

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

任務處理中的回應範例：

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

成功回應：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/img1.png\",\"https://file.apixo.ai/img2.png\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965652317,
    "costTime": 41388
  }
}
```

## 請求體

### 文生圖

```json theme={null}
{
  "input": {
    "mode": "text-to-image",
    "prompt": "a fox in watercolor style",
    "max_images": 1,
    "resolution": "2K",
    "aspect_ratio": "1:1",
    "sequential_image_generation": "disabled",
    "prompt_optimize_mode": "standard"
  }
}
```

### 圖生圖

```json theme={null}
{
  "input": {
    "mode": "image-to-image",
    "prompt": "turn this scene into a warm sunrise illustration",
    "image_urls": [
      "https://example.com/reference-1.png",
      "https://example.com/reference-2.jpg"
    ],
    "max_images": 3,
    "resolution": "4K",
    "aspect_ratio": "3:4",
    "sequential_image_generation": "auto",
    "prompt_optimize_mode": "standard"
  }
}
```

### 顯式尺寸

```json theme={null}
{
  "input": {
    "mode": "text-to-image",
    "prompt": "an editorial still life scene",
    "max_images": 1,
    "size": "2048*2048"
  }
}
```

## 參數

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

**屬性**

**mode** `string` *required*

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

**prompt** `string` *required*

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

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

請求的影像數量。支援範圍：1-15。此欄位是必需的；後端不套用預設值。對於 `image-to-image`，`image_urls` 加上 `max_images` 中的參考影像數量不得超過 15。

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

參考影像 URL，`image-to-image` 時為必填。支援 1-14 個 URL，必須為公開可存取且可直接訪問的影像檔案。對於 `image-to-image`，`image_urls` 的數量加上 `max_images` 必須小於或等於 15。

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

輸出解析度預設。支援的值：`2K`、`4K`。當 `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` 和 `4K`。像素字串接受 `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`。當應產生多個影像作為相關序列時，請使用 `auto`。

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

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

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

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

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

當提供 `aspect_ratio` 時，APIXO 會將 `resolution` 與 `aspect_ratio` 映射至這些輸出維度。

| 縱橫比 | `2K`尺寸 | `4K` 尺寸 |
| - | - | - |
| `1:1` | `2048x2048` | `4096x4096` |
| `2:3` | `1664x2496` | `3328x4992` |
| `3:2` | `2496x1664` | `4992x3328` |
| `3:4` | `1728x2304` | `3520x4704` |
| `4:3` | `2304x1728` | `4704x3520` |
| `9:16` | `1600x2848` | `3040x5504` |
| `16:9` | `2848x1600` | `5504x3040` |
| `21:9` | `3136x1344` | `6240x2656` |

## 回應格式

### 送出任務時的回應

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

**code** `integer`

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

**message** `string`

狀態說明。

**data.taskId** `string`

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

### 狀態回應

**data.state** `string`

任務狀態。常用值為 `processing`、`success` 和 `failed`。

**data.resultJson** `string`

成功時會出現。解析這個JSON字串並讀取 `resultUrls`。

**data.failCode** `string`

失敗時會出現。穩定的機器可讀故障碼。

**data.failMsg** `string`

失敗時會出現。人類可讀的故障訊息。

## 輪詢和交付指導

Seedream 4.5 任務是異步的。

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

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

## 計費

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

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

| 單位 | APIXO 價格 |
| - | - |
| 每個生成的影像 | `$0.040 / 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-4-5.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 4.5](https://apixo.ai/models/seedream-4-5)
* [API定價](https://apixo.ai/pricing/api)


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