接口说明
查询只读取已存在任务,不会重复提交或再次收费。queued、running、succeeded、failed 都通过同一任务对象表达;结果 URL 的有效期以 result_expires_at 为准。
认证:Bearer API Key
请求
路径参数
| 名称 | 类型 | 说明 |
|---|---|---|
task_id必填 | string | 创建任务响应返回的不可变任务 ID。 |
响应
JSON 接口使用统一响应信封。HTTP 状态表达请求结果,业务错误不会伪装成 HTTP 200。
| HTTP | 含义 |
|---|---|
200 | 请求成功 |
401 | 缺少或无效的 API Key |
403 | API Key 已禁用或无权访问 |
404 | 资源不存在,或签名无效 |
410 | 任务结果或签名资源已过期 |
422 | 请求结构校验失败 |
500 | 服务内部错误 |
完整成功响应示例(可选字段可能因状态不同而变化)
{
"code": 0,
"message": "success",
"data": {
"task_id": "task_01JEXAMPLE",
"status": "succeeded",
"terminal_reason": null,
"model": "gpt-image-2",
"operation": "generation",
"size": "1024x1024",
"size_tier": null,
"quality": "standard",
"response_format": "url",
"input_count": 0,
"has_mask": false,
"response_mode": "async",
"auto_async_on_timeout": null,
"requested_count": 1,
"result": {
"requested_count": 1,
"completed_count": 1,
"partial": false,
"partial_reason": null,
"partial_reason_message": null,
"images": [
{
"asset_id": "asset_01JEXAMPLE",
"mime_type": "image/png",
"width": 1024,
"height": 1024,
"byte_size": 824311,
"expires_at": "2026-08-10T03:00:30Z",
"url": "/api/v1/assets/asset_01JEXAMPLE/content?expires=...&representation=url&signature=...",
"b64_json": null
}
]
},
"result_expires_at": "2026-08-10T03:00:30Z",
"result_expired": false,
"poll_url": "/api/v1/tasks/task_01JEXAMPLE",
"retry_after_seconds": null,
"channel": {
"channel_row_id": "gpt-image-2-generations-economy-a",
"platform_name": "Channel 001",
"request_price": {
"resolved_size": "1024x1024",
"resolved_quality": "standard",
"currency": "USD",
"unit": "request",
"request_price": "0.023000",
"effective_at": "2026-08-10T00:00:00Z"
},
"refund_policy": {
"code": "rpf_rrr",
"zero_delivery": "refund_all",
"policy_violation": "refund_all",
"unrecoverable": "refund_all",
"description": {
"zh-CN": "三类终态均全额退款。",
"en-US": "All three terminal classes receive a full refund."
}
},
"size_semantics": "approximate_tier",
"billing_basis": "per_request"
},
"routing": {
"strategy": "stable_first",
"total_attempts": 1,
"switch_count": 0,
"attempts": [
{
"attempt_number": 1,
"channel_row_id": "gpt-image-2-generations-economy-a",
"channel_name": "Channel 001",
"action": "initial",
"outcome": "accepted",
"reason_code": "accepted_stop",
"reason": "accepted",
"occurred_at": "2026-08-10T00:00:01Z"
}
]
},
"error": null,
"billing": {
"status": "charged",
"currency": "USD",
"reserved_amount": "0.023000",
"charged_amount": "0.023000",
"refunded_amount": "0.000000",
"released_amount": "0.000000",
"balance_after_settlement": "12.477000"
},
"created_at": "2026-08-10T00:00:00Z",
"updated_at": "2026-08-10T00:00:30Z",
"completed_at": "2026-08-10T00:00:30Z"
},
"request_id": "8f25b42f-2ed1-4ad7-99de-61d7f779bc7b",
"timestamp": "2026-08-10T00:00:00Z"
}重要边界
- 在线调试不会自动轮询;每次查询必须由你显式点击。
- 失败任务的 terminal_reason、error 与 billing 来自同一最终快照。