curl --request POST \
--url https://api.yingtu.ai/v1/images/tasks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2-vip",
"action": "generate",
"prompt": "深色石材上的银色腕表,不要文字"
}
'{
"task_id": "task_example",
"status": "queued",
"created_at": 1788307200
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "Insufficient balance for this request",
"type": "new_api_error",
"param": "",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "Request body exceeds the current limit",
"type": "new_api_error",
"param": "",
"code": "read_request_body_failed"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}统一图片任务
提交统一异步图片任务
通过统一 JSON 接口提交带幂等保护的 Nano Banana 或 GPT Image 生图与多图编辑任务,并查询各自原生结果。
POST
/
v1
/
images
/
tasks
curl --request POST \
--url https://api.yingtu.ai/v1/images/tasks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2-vip",
"action": "generate",
"prompt": "深色石材上的银色腕表,不要文字"
}
'{
"task_id": "task_example",
"status": "queued",
"created_at": 1788307200
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "Insufficient balance for this request",
"type": "new_api_error",
"param": "",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "Request body exceeds the current limit",
"type": "new_api_error",
"param": "",
"code": "read_request_body_failed"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}异步图片接入使用该接口。
action=generate 时不要传 input_images;action=edit 时提供 1~16 张 Base64 来源图。可能重试的提交应设置 Idempotency-Key。
Nano Banana 使用对应模型允许的 K 档位和 aspect_ratio。GPT Image 使用明确像素尺寸并转发 quality,实际效果取决于所选上游。两个逆向接口都固定 n=1。
HTTP 202 只表示任务已受理。先保存 task_id,再每隔 2~5 秒查询任务状态,直到 completed、failed 或 expired。成功结果保留 24 小时,并保持对应模型家族的原生响应结构。
在线测试会创建真实计费任务。表单生成的 cURL 可能直接显示已输入的密钥,请使用开发密钥,不要分享命令或带凭证的截图。
了解任务字段
正确填写 action、模型参数、来源图和终态处理。
实现安全轮询
设置截止时间、有限重试,并按模型家族解析结果。
授权
YingTu API Key。
请求头
建议为可重试提交设置唯一键,最长 255 字节。相同键与相同规范化请求返回原任务;请求内容变化时返回 HTTP 409。
Maximum string length:
255请求体
application/json
- 图片生成任务
- 图片编辑任务
选择图片生成,或使用 1 至 16 张来源图编辑;仍需遵循具体模型的 size、aspect_ratio 和 quality 规则。
可用选项:
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 Allowed value:
"generate"Minimum string length:
1示例:
"A quiet reading room at sunrise, editorial photography"
按模型填写:Nano Banana 使用该模型支持的 K 档位,要求省略时不要传;GPT Image 使用明确的像素尺寸。
可用选项:
1K, 2K, 4K, 1024x1024, 2048x2048, 3840x2160 仅 Nano Banana 使用。GPT Image 必须省略 aspect_ratio,并传入明确的像素尺寸。
可用选项:
1:1, 1:4, 1:8, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16, 16:9, 21:9 两个 GPT Image 接口都会转发该值;实际效果由所选上游决定。
可用选项:
low, medium, high, auto 示例:
"low"
省略 n 或传入 1。
可用选项:
1 最后修改于 2026年9月3日