> ## 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.5 API：生成影像與拆分圖層

> 4K 影像產生與編輯、透明 PNG 輸出以及具有富文本辨識功能的圖層分解

檢查 [APIXO 型號目錄](https://apixo.ai/models) 以了解目前可用性

## 端點

| 方法 | 端點 | 說明 |
| - | - | - |
| POST | `/api/v1/generateTask/seedream-5-5` | 建立生成任務 |
| GET | `/api/v1/statusTask/seedream-5-5?taskId=...` | 查詢任務狀態 |

## 驗證

將 APIXO API 金鑰放在 `Authorization: Bearer YOUR_API_KEY` 請求頭中。向 `https://api.apixo.ai` 傳送 JSON 請求，並設定 `Content-Type: application/json`。

## 請求主體

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "text-to-image",
    "prompt": "A ceramic cup on a transparent background",
    "resolution": "4k",
    "aspect_ratio": "16:9",
    "background": "transparent"
  }
}
```

## 參數

| 參數 | 型別 | 規則 |
| - | - | - |
| `request_type` | string | `async` 用於輪詢或 `callback` 用於 webhook 傳遞。 |
| `callback_url` | string | 當`request_type`為`callback`時需要。使用公開 HTTPS URL。請參閱 [Webhooks](https://apixo.ai/docs/zh-hant/api-reference/webhooks.md)。 |
| `input.mode` | string | `text-to-image`、`image-to-image` 或 `layer-decomposition`。預設為 `text-to-image`。 |
| `input.prompt` | string | 產生和編輯時必需。層分解為可選。 |
| `input.image_urls` | 細繩\[] | 圖生圖（1–10 個 URL）和層分解（必須為一個 URL）時必需。請參閱[參考影像要求](#reference-images)。文生圖將忽略此欄位。 |
| `input.resolution` | string | 產生和編輯支援 `1k`、`1.5k`、`2k` 或 `4k`。層分解支援 `1k`、`1.5k` 或 `2k`。層分解中若需自動調整尺寸，可省略此欄位。大寫 `K` 亦可使用。 |
| `input.aspect_ratio` | string | `auto`、`1:1`、`4:3`、`3:4`、`16:9`、`9:16`、`3:2`、`2:3`、`21:9`、`1:2`、`2:1`、`1:3`、`3:1`、`4:5`、`5:4` 或 `9:21`。請參閱 [4K 目標尺寸](#4k-target-dimensions)。層分解將忽略此欄位，並使用自動縱橫比。 |
| `input.size` | string | 用於產生或編輯的自訂寬度和高度，例如 `3840x2160`、`3840X2160` 或 `3840*2160`。兩個維度都必須是正整數。此欄位優先於 `resolution` 和 `aspect_ratio`。如果省略，請提供這兩個欄位。總像素必須為 921,600–8,294,400（含），寬高比必須為 1:16–16:1。分解會忽略該欄位。 |
| `input.background` | string | `auto`（預設）、`transparent` 或 `opaque`。透明輸出需要 PNG。分解會忽略該欄位。 |
| `input.output_format` | string | `png`（預設）或 `jpeg`。在分解中，這控制基本影像格式。其他層是 PNG。 |
| `input.watermark` | boolean | 預設 `false`。 |
| `input.nsfw_checker` | boolean | 設為 `true` 可在支援的生成路由上啟用上游內容審核。API 預設值為 `false`。 |
| `input.prompt_optimize_mode` | string | 選填。支援的值為 `standard`，也是預設值。 |
| `input.max_images` | integer | 對於 `layer-decomposition`，最大總輸出包括基礎影像 2–100。預設 30。文生圖和圖生圖忽略此欄位並傳回一張影像。 |
| `input.text_recognition` | boolean | 僅分解。包括可用的富文本識別。預設 `false`。 |

## 參考圖片

對 HTTP 請求和 MCP `input.image_urls` 使用可公開存取的影像 URL。以下模型限制適用於每個參考文件。參考影像比與輸出 `aspect_ratio` 無關。

| 模式 | 數量 | 格式 | 每個檔案的大小 | 方面 | 寬度/高度 | 每個檔案的總像素 |
| - | - | - | - | - | - | - |
| `image-to-image` | 1–10 | JPEG, PNG, WebP, BMP, TIFF, GIF, HEIC, HEIF | 最多 30 MB | 寬度和高度至少為 15 px | 1:16–16:1 | 最多 36,000,000 |
| `layer-decomposition` | 正是 1 | JPEG, PNG | 最多 30 MB | 同時使用長寬比和像素面積限制 | 1:16–16:1 | 262,144–36,000,000 |

APIXO Studio 檔案選擇器將本機上傳限制為每個影像 10 MiB（10,485,760 位元組），並接受 JPEG、PNG 和 WebP。分解時選擇 JPEG 或 PNG 以滿足模型要求。

## 4K 目標尺寸

當 `resolution` 為 `4k` 且省略 `size` 時，套用這些預設。以下尺寸為按寬度×高度順序排列的目標尺寸。讀取傳回影像的尺寸，以進行取決於精確像素的計費或佈局。

| `aspect_ratio` | 目標像素 |
| - | - |
| `auto`, `1:1` | 2880 × 2880 |
| `4:3` | 3200 × 2400 |
| `3:4` | 2400 × 3200 |
| `16:9` | 3840 × 2160 |
| `9:16` | 2160 × 3840 |
| `3:2` | 3456 × 2304 |
| `2:3` | 2304 × 3456 |
| `21:9` | 4200 × 1800 |
| `9:21` | 1800 × 4200 |
| `1:2` | 2032 × 4064 |
| `2:1` | 4064 × 2032 |
| `1:3` | 1648 × 4944 |
| `3:1` | 4944 × 1648 |
| `4:5` | 2560 × 3200 |
| `5:4` | 3200 × 2560 |

## 4K 圖生圖範例

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-image",
    "prompt": "Keep the ceramic cup and change the background to light blue",
    "image_urls": ["https://example.com/cup.png"],
    "resolution": "4k",
    "aspect_ratio": "16:9"
  }
}
```

## 分層分解

選擇 `1k`、`1.5k` 或 `2k`，或忽略 `resolution` 以自動調整大小。分解使用自動寬高比並忽略 `aspect_ratio` 和 `size`。它會傳回一個基礎影像以及最多 99 個透明 PNG 圖層。`max_images` 包含基礎影像，預設為 30。

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "layer-decomposition",
    "image_urls": ["https://example.com/poster.png"],
    "resolution": "2k",
    "max_images": 10,
    "text_recognition": true
  }
}
```

## 回覆

任務創建傳回`data.taskId`。輪詢狀態端點或使用 Webhook 取得結果。

### 4K 文字轉影像成功

對於上面的文生圖請求，此範例顯示了 3840 × 2160 影像的成功狀態回應。

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_4k_text_example",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://example.com/cup-4k.png\"]}",
    "createTime": 1795742400000,
    "completeTime": 1795742442000,
    "costTime": 42000
  }
}
```

### 4K 圖生圖成功

此範例顯示使用一個參考影像進行 3840 × 2160 編輯。解碼 `resultJson` 字串以獲得輸出 URL。對於兩個 4K 範例，從影像檔案中取得實際尺寸並使用 [計費規則](#billing) 計算費用。

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_4k_edit_example",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://example.com/cup-blue-4k.png\"]}",
    "createTime": 1795742460000,
    "completeTime": 1795742508000,
    "costTime": 48000
  }
}
```

### 層分解成功

成功的輪詢回應和 Webhook 傳回相同的 `data.layerDecomposition` 結構，包括任何富文本 OCR。

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_123",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://example.com/base.png\",\"https://example.com/title.png\"]}",
    "layerDecomposition": [
      {"role": "base", "url": "https://example.com/base.png", "size": "2048x2048", "output_format": "png", "z_index": 0, "background": "opaque"},
      {
        "role": "layer",
        "url": "https://example.com/title.png",
        "size": "800x160",
        "output_format": "png",
        "z_index": 1,
        "background": "transparent",
        "bounding_box": {"absolute": [120, 80, 920, 240], "normalized": [59, 39, 449, 117]},
        "text_recognition": {
          "text": "Summer Sale",
          "lines": [
            {
              "bounding_box": {"absolute": [120, 80, 920, 240], "normalized": [59, 39, 449, 117]},
              "runs": [{"text": "Summer Sale", "style": {"bold": true}}]
            }
          ]
        }
      }
    ]
  }
}
```

## 狀態回應欄位

| 欄位 | 說明 |
| - | - |
| `taskId` | 任務標識符 |
| `state` | 當任務未完成時為`processing`，然後為`success`或`failed`。 |
| `resultJson` | JSON 字串，依結果順序包含 `resultUrls`。 |
| `layerDecomposition` | Base image 後接圖層。條目說明檔案及其角色，可能包含大小、格式、堆疊順序、位置、名稱、描述與背景。 |
| `layerDecomposition[].bounding_box` | 基礎影像中以像素為單位的絕對座標與歸一化座標（0 到 1000），順序為左、上、右、下。OCR 線框使用相同的座標系統。 |
| `layerDecomposition[].text_recognition` | 啟用文字辨識且圖層包含已識別的常規文字時會出現。包含全文以及帶有樣式文字運行的行級框（若可用）。 |
| `failCode`, `failMsg` | 錯誤代碼與訊息。 |

## 錯誤代碼

請求可能因缺少輸入、影像尺寸超出範圍或格式與背景選項不相容而驗證失敗。失敗的任務將包含 `failCode` 與 `failMsg`。

## 計費

以下價格為標準 USD 費率。請參考[即時 API 定價目錄](https://apixo.ai/api/pricing/catalog?modelName=seedream-5-5)以取得最新優惠。

折扣前，初始費用為 `$0.020` 每個輸出（對應 `1k` 和 `1.5k`），`$0.035`（對應 `2k`），以及 `$0.079`（對應 `4k`）。顯式尺寸依據請求的像素數進行估算。分解功能最初以選定速率計費，最多達 `max_images` 個輸出，或當未指定解析度時，每輸出 `$0.035`。

最終計費依據回傳圖像的實際寬×高計算，包含基礎圖與分解後的各層。請求的解析度決定了初始估計值。每張回傳圖像的實際像素數將決定其最終價格等級。若多付費用，將予以退款，且總費用不超過初始費用。文字辨識與提示優化無需額外收費。

| 每個輸出的實際像素數 | 每個輸出的標準價格 |
| - | -: |
| 最高至 2,601,123（含） | `$0.020` |
| 2,601,124–4,624,220 | `$0.035` |
| 4,624,221 至 8,294,400（生成與編輯） | `$0.079` |

標準輸入價格為每張影像 `$0.008`，包括第一張影像。先套用適用的折扣，再將請求總額以 `$0.001` 為單位無條件進位。任務使用接受時所應用的費率。

### 4K 計費範例

每個範例傳回一個 3840 × 2160 影像（8,294,400 像素）。最後一列說明瞭應用於整個請求的 30% 帳戶折扣。

| 模式 | 標準收費 | 按範例折扣收費 |
| - | - | - |
| 文生圖 | `$0.079` | `$0.0553`無條件進位為`$0.056` |
| 透過一個參考進行圖生圖的轉換 | `$0.079 + $0.008 = $0.087` | `$0.0609`無條件進位為`$0.061` |

## MCP 整合

這 [模型圖式](https://apixo.ai/docs/models/schemas/image/seedream-5-5.json) 宣稱 `mcp.attachments` 用於 `input.image_urls`，以及 `mcp.result` 用於影像 URL 與結構化層。詳見 [MCP 結果格式](https://apixo.ai/docs/zh-hant/guides/mcp-model-contracts.md#result-formats)。


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