> ## 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` 必需；`layer-decomposition` 需提供且必须为 1 个可公开访问的图像 URL |
| 每个任务的图像数量 | 生成或编辑输出 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` 模式下，模型返回基础图像及提取的图层图像。为指定需分解的区域，可在 `prompt` 中包含文本标签，例如 `<bbox>x1 y1 x2 y2</bbox>`。无需单独发送 `bbox` 请求字段。

## 参数

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

结果获取方式。选择 `async` 时，通过 `statusTask` 轮询结果；选择 `callback` 时，通过 Webhook 接收结果。

**callback\_url** `string`

当 `request_type` 为 `callback` 时必填。请提供公网可访问的 HTTPS 地址，用于接收任务的最终结果。详见 [Webhook](https://apixo.ai/docs/zh/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)

Output纵横比用于`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/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` |
| Output像素数 > 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/models/image)
* [生成 API 概览](https://apixo.ai/docs/zh/models.md)
* [提交生成任务](https://apixo.ai/docs/zh/api-reference/generate-task.md)
* [查询任务状态](https://apixo.ai/docs/zh/api-reference/status-task.md)
* [Webhook](https://apixo.ai/docs/zh/api-reference/webhooks.md)
* [错误码](https://apixo.ai/docs/zh/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.