创建异步图片任务
/v1/async/images/tasks创建持久化的异步图片生成任务。接口立即返回 HTTP 202;使用查询异步图片任务轮询结果。
同步接口 POST /v1/images/generations 保持不变。完整流程见异步图片生成。
身份验证
Authorization Bearer
在 Authorization header 中使用 API key 作为 Bearer token。
Headers
Idempotency-Keystring推荐的重试 key,按已认证所有者隔离,最长 200 个字符。
Request Body
modelstringrequired对外图片模型名。
promptstring图片提示词,具体要求由所选模型决定。
executionenum<string>执行偏好。
ninteger图片数量。
sizestring请求的图片尺寸,例如 1024x1024。
qualitystring模型支持时指定图片质量。
output_formatstring模型支持时指定输出格式。
streamboolean必须为 false 或省略。
partial_imagesinteger不支持,请省略。
还可以传入同步图片接口接受的其他模型专属字段。
Response
idstring以 img_task_ 开头的任务 ID。
objectstringimage_generation.task
modelstring对外模型名。
statusstring初始状态,通常为 queued。
executionenum<string>调度前为请求偏好,选路后为实际执行模式。
versioninteger单调递增的任务版本。
resultobject幂等重放返回已完成任务时的图片响应。
errorobject幂等重放返回 failed 或 needs_attention 任务时的错误详情。
error.messagestringHuman-readable error message.
error.codestringMachine-readable error code.
error.typestringError category when returned.
error.stagestringProcessing stage where the error occurred.
error.upstream_http_statusintegerProvider HTTP status when the error came from upstream.
error.upstream_messagestringProvider error message when available.
created_atstringISO-8601 创建时间。
updated_atstringISO-8601 最近更新时间。
completed_atstring任务进入终态时的 ISO-8601 完成时间。