Amux AI

Create task

最近更新:2026年11月25日

通过统一任务接口 /v1/tasks 提交 bytedance/seedream-5.5 异步图像任务,支持文生图、多图融合编辑、原生透明背景、百层图层拆分与富文本 OCR。

通过统一异步任务入口 /v1/tasks 提交 bytedance/seedream-5.5 图像任务,立即返回任务 id,随后可通过查询任务获取结果。对于耗时较长的百层图层拆分与富文本 OCR 场景,优先推荐使用本异步入口。

POSThttps://gateway.amux.ai/v1/tasks

鉴权

header
Authorizationstring必填

Bearer <你的 Amux AI 密钥> Amux AI API 密钥。

请求

application/json
modelstring必填

平台模型 ID,可追加 :provider 后缀指定服务供应商。

promptstring

文本提示词。图层拆分模式下可选,其余场景必填。

imagestring | array<string>

参考图(单张字符串或最多 10 张的字符串数组)。图层拆分模式要求恰好传入 1 张。

sizestring

输出尺寸。常规生成支持 1K、1.5K、2K 或 宽x高;图层拆分支持 1K、1.5K、2K 或 auto,不支持像素值。

output_format"png" | "jpeg"默认 "png"

输出编码格式,默认 png。拆分图层固定为 png。

background"auto" | "transparent" | "opaque"默认 "auto"

背景透明度模式(auto / transparent / opaque)。transparent 原生支持文生图与图生图,不可与 jpeg 或 layer_decomposition: true 同用。

watermarkboolean默认 false

右下角「AI 生成」水印。平台默认关闭(false),传入 true 开启。

layer_decompositionboolean默认 false

启用图层拆分(最多 1 底图 + 99 图层)。要求传入恰好 1 张参考图,prompt 可省略。

layer_decomposition_optionsobject

图层拆分子配置(仅 layer_decomposition: true 时生效)。使用 multipart/form-data 提交时亦可改用扁平字段 layer_max_images 与 layer_text_recognition。

›layer_decomposition_optionsobject
max_imagesinteger默认 30

最大输出图像总数(含底图),范围 2–100,默认 30。

text_recognitionboolean默认 false

是否开启规整文字图层的富文本 OCR 识别,默认 false。

optimize_prompt_optionsobject

提示词优化配置,省略时默认 standard。使用 multipart/form-data 提交时请改用扁平文本字段 optimize_prompt_mode。

›optimize_prompt_optionsobject
mode"standard" | "fast"默认 "standard"

standard 构图质量更高、耗时略长;fast 响应更快、优化幅度较小。两档模式单价相同。

webhook_urlstring

任务进入终态后的 Webhook 回调地址,推送 {event, sent_at, task} 信封并附带 Amux-Signature 签名头及退避重试。仅支持公网 HTTPS 地址,提交时校验。

响应

202response

任务已创建,请使用 id 轮询结果或等待 Webhook 回调。携带 Prefer: wait 在等待期内到达终态或命中幂等键重放时返回 200。

400response

请求参数不合法。参数超出模型取值范围时,错误信息将说明有效范围。

402response

工作区可用余额不足以覆盖本次请求的预授权金额。

参数说明

业务参数与火山方舟原生同步端点完全一致,size、image、background、output_format(默认 png)、watermark(默认关闭)、layer_decomposition、layer_decomposition_options 与 optimize_prompt_options 均原样生效。

本端点不区分图像生成与图像编辑:不传 image 为文生图,传入 1–10 张 image 为图生图或多图融合编辑(均支持 background: "transparent" 原生透明通道);传入恰好 1 张 image 并设置 layer_decomposition: true 为图层拆分(此时 prompt 可省略,不可同时传 background)。

若使用 multipart/form-data 上传本地文件,参考图通过 image 文件字段传入,布尔参数传字符串 "true",图层拆分子选项可传 JSON 字符串 layer_decomposition_options 或扁平字段 layer_max_images / layer_text_recognition,提示词优化模式传扁平字段 optimize_prompt_mode。

结果获取方式

获取方式调用方法
轮询查询GET /v1/tasks/{id},建议间隔 5–10 秒
Webhook 回调提交任务时传入 webhook_url
同步等待提交任务时携带请求头 Prefer: wait=60

关于任务生命周期、Webhook 签名验签及幂等键机制,请参见创建任务。

计费说明

计费规则与同步端点一致:按输入参考图张数及每张输出图像的实际像素面积分档计费;图层拆分模式下底图与每个拆分图层分别按张计费。查询任务时 cost 字段即为本次实际扣费金额。

请求受理时按预计上限冻结额度(图层拆分按 layer_decomposition_options.max_images 或默认 30 张预授权,可用余额不足返回 402),完成后按实际用量结算并释放差额;失败或过期任务不产生费用。

cURL
curl https://gateway.amux.ai/v1/tasks \
  -H "Authorization: Bearer $AMUX_API_KEY" \
  -d '{
    "model": "bytedance/seedream-5.5",
    "image": "https://example.com/poster.png",
    "layer_decomposition": true,
    "layer_decomposition_options": {
      "max_images": 30,
      "text_recognition": true
    },
    "webhook_url": "https://hooks.example.com/amux"
  }'
{
  "id": "task_01M5CWPZEAJ6FRGPDM1G7G1V29",
  "status": "queued",
  "model": "bytedance/seedream-5.5",
  "created_at": "2026-11-25T09:00:00Z",
  "output": {
    "images": [
      {
        "index": 0,
        "url": "https://cdn.amux.ai/gen/20261125/task_01M5CWPZEAJ6FRGPDM1G7G1V29-0.png",
        "layer": {
          "zIndex": 0,
          "role": "background",
          "bboxAbsolute": [
            0
          ],
          "bboxNormalized": [
            0
          ],
          "name": "<string>",
          "description": "<string>",
          "textRecognition": {
            "text": "<string>",
            "lines": [
              {
                "bboxAbsolute": [
                  0
                ],
                "bboxNormalized": [
                  0
                ],
                "runs": [
                  {
                    "text": "<string>",
                    "style": {
                      "similarFontFamily": "<string>",
                      "foregroundColor": "<string>",
                      "bold": false,
                      "italic": false,
                      "underline": false,
                      "strikethrough": false,
                      "shadow": false,
                      "translucent": false
                    }
                  }
                ]
              }
            ]
          }
        }
      }
    ],
    "videos": [
      {}
    ]
  },
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0,
    "total_tokens": 0
  },
  "cost": "0.035",
  "notes": [
    "dropped seed: this model has no seed parameter"
  ],
  "error": {
    "message": "<string>",
    "code": "<string>"
  }
}