跳转到主要内容
GET
查询异步图片任务
任务处于 queued 或 in_progress 时继续轮询。本接口返回 Cache-Control: no-store;任务不存在与任务属于其他账号都会得到 HTTP 404。 看到 completed 后,根据 model 选择解析方式:
  • Nano Banana:遍历 result.candidates[].content.parts[],查找 inlineData, 再按网关根据真实字节修正后的 mimeType 解码 data;
  • GPT Image:按原生 ImagesResponse 读取 result.data[].b64_json,响应不会增加 YingTu 自定义的 mime_type。
成功任务包含 result_expires_at,图片结果从完成起保留 24 小时。清理完成后,任务 状态变为 expired,同时返回 error.code=result_expired,不再携带旧 Base64。 任务失败时,用 error.code 分类,向用户展示经过处理的 error.message;只有 error.retryable=true 且仍在业务截止时间内时,才创建新的任务。

使用轮询代码

加入截止时间、Retry-After、有上限退避与分模型解析。

核对异步提交

设置幂等键,并理解多图输入和结果过期。

提交图片任务

使用正确的生成或编辑请求分支。

处理任务失败

根据结构化错误决定是否重试。

授权

Authorization
string
header
必填

YingTu API Key。

路径参数

task_id
string
必填

POST /v1/images/tasks 返回的任务 ID。

响应

当前任务状态

task_id
string
必填
model
enum<string>
必填
可用选项:
gemini-2.5-flash-image,
gemini-3.1-flash-lite-image,
gemini-3.1-flash-image,
gemini-3-pro-image,
gpt-image-2-web,
gpt-image-2-vip
action
enum<string>
必填

图片任务请求的操作类型。

可用选项:
generate,
edit
status
enum<string>
必填
可用选项:
queued,
in_progress,
completed,
failed,
expired
progress
string
必填
示例:

"100%"

created_at
integer<int64>
必填
started_at
integer<int64>
completed_at
integer<int64>
result_expires_at
integer<int64>

成功结果的过期时间,通常为完成后 24 小时,以 Unix 秒级时间戳表示。

result
object

按模型家族保留原生结果:Nano Banana 使用 GenerateContentResponse,GPT Image 使用 ImagesResponse。

error
object
最后修改于 2026年9月3日