> ## 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：高分辨率图像生成

> 字节跳动 Seedream 4.5 图像生成 API，用于高分辨率、多图像和参考引导工作流程

## 概览

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