> ## 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/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` | 包含 `resultUrls` 的 JSON 字符串，按结果顺序排列 |
| `layerDecomposition` | Base图像后接图层。条目标识文件及其作用，可能包含大小、格式、堆叠顺序、位置、名称、描述和背景。 |
| `layerDecomposition[].bounding_box` | 基础图像中绝对像素与归一化坐标（范围0至1000），顺序为左、上、右、下。OCR线框使用相同的坐标系统。 |
| `layerDecomposition[].text_recognition` | 当启用文本识别且图层包含已识别的常规文本时包含。包含全文及带有样式文本段落的行级框（若可用）。 |
| `failCode`, `failMsg` | 错误代码和错误消息。 |

## 错误代码

请求可能因缺少输入、图像尺寸超出范围或格式与背景选项不兼容而验证失败。失败任务将包含`failCode`和`failMsg`。

## 计费

以下价格为标准美元费率。请查看[实时API定价目录](https://apixo.ai/api/pricing/catalog?modelName=seedream-5-5)获取当前定价。

折扣前，初始费用为：`1k` 和 `1.5k` 每输出 `$0.020`，`2k` 每输出 `$0.035`，`4k` 每输出 `$0.079`。显式尺寸根据请求的像素数进行估算。分解操作初始按最多 `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/guides/mcp-model-contracts.md#result-formats)。


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