> ## 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：结合网络搜索进行文生图

> 字节跳动 Seedream 5.0 图像生成 API，支持文生图和图生图工作流

## 概览

Seedream 5.0 是字节跳动的图像生成模型，用于文生图创建和参考引导的图像生成。它支持 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/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/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/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)
* [尝试 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.