# Retrieve task

通过统一任务接口查询 bytedance/seedream-5.5 任务状态、输出图像、图层元数据、富文本 OCR 结果与实际扣费。

根据任务 ID 查询 `bytedance/seedream-5.5` 任务状态与输出结果。无论任务是否完成均返回 HTTP `200`，请通过 `status` 字段判断当前状态。

`GET https://gateway.amux.ai/v1/tasks/{id}`

**鉴权**

`Authorization: Bearer <API key>`

**响应**

| 状态码 | 说明 |
|---|---|
| `200` | 返回任务当前状态；`status` 为 `succeeded` 时包含 `output`。 |
| `404` | 任务不存在，或不属于当前工作区。 |

**请求示例**

```bash
curl https://gateway.amux.ai/v1/tasks/{id} \
  -H "Authorization: Bearer $AMUX_API_KEY"
```

**响应示例**

```json
{
  "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>"
  }
}
```

## 轮询建议

文生图与图生图通常在 15–60 秒内完成，图层拆分与富文本 OCR 通常耗时 60–150 秒。建议在提交任务 10 秒后开始轮询，间隔 5–10 秒；亦可在提交时携带请求头 `Prefer: wait=60` 直接等待结果。

## 输出结果、图层与富文本 OCR 结构

生成的图像位于 `output.images`；`output.videos` 字段恒为空数组，不可用于判断任务模态。

启用图层拆分时，`output.images` 第一项为底图，其后每项对应一个独立透明 PNG 图层，并各自附带驼峰命名的 `layer` 元数据对象（数据语义对应火山方舟原生格式的 `z_index`、`bounding_box` 与 `text_recognition`，其中 `bboxNormalized` 为 0–1000 的整数）：

```json
{
  "output": {
    "images": [
      { "index": 0, "url": "https://…/task_x-0.png", "layer": { "zIndex": 0, "role": "background" } },
      {
        "index": 1,
        "url": "https://…/task_x-1.png",
        "layer": {
          "zIndex": 1,
          "role": "layer",
          "bboxAbsolute": [0, 0, 836, 336],
          "bboxNormalized": [0, 0, 1000, 268],
          "name": "主标题文字",
          "description": "白色大号促销标题文字",
          "textRecognition": {
            "text": "SUMMER",
            "lines": [
              {
                "bboxAbsolute": [0, 0, 836, 336],
                "bboxNormalized": [0, 0, 1000, 268],
                "runs": [
                  {
                    "text": "SUMMER",
                    "style": {
                      "similarFontFamily": "TikTok Sans",
                      "foregroundColor": "#FFFFFF",
                      "bold": true,
                      "italic": false,
                      "shadow": true
                    }
                  }
                ]
              }
            ]
          }
        }
      }
    ],
    "videos": []
  }
}
```

图像文件访问地址 `url` 具有时效性，如需长期保存请及时下载。

## 用量与费用

本模型按图像张数计费，`usage` 中的三个 Token 字段恒为 `0`。本次任务的实际结算金额记录在 `cost` 字段中（图层拆分模式下包含底图、全部拆分图层与输入参考图费用）。

## 错误处理

错误响应结构与 OpenAI 格式一致，错误类型 `type` 与重试策略请参见[错误与重试](/api-reference/errors)。
