curl --request POST \
--url https://api.ch88.cn/v1/open/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "一只橘猫坐在窗台上看夕阳,水彩画风格。",
"size": "16:9",
"resolution": "2k"
}
'{
"code": 200,
"data": {
"status": "submitted",
"task_id": "task_01K4Y7N5X6A7B8C9D0E1F2G3H4"
},
"request_id": "req_550e8400-e29b-41d4-a716-446655440000"
}
{
"error": {
"code": 400,
"type": "invalid_request_error",
"message": "请至少提供 1 张产品图"
},
"request_id": "req_xxx"
}
{
"error": {
"code": 401,
"type": "authentication_error",
"message": "缺少 Public API Key"
},
"request_id": "req_xxx"
}
{
"error": {
"code": 403,
"type": "permission_error",
"message": "成员或组织已停用"
},
"request_id": "req_xxx"
}
{
"error": {
"code": 409,
"type": "conflict_error",
"message": "成员未分配有效上游密钥"
},
"request_id": "req_xxx"
}
{
"error": {
"code": 413,
"type": "invalid_request_error",
"message": "请求体最大支持 32 MB",
"param": "body"
},
"request_id": "req_xxx"
}
{
"error": {
"code": 429,
"type": "rate_limit_error",
"message": "请求过于频繁,请稍后重试",
"retryable": true
},
"request_id": "req_xxx"
}
{
"error": {
"code": 502,
"type": "upstream_error",
"message": "上游服务暂时不可用,请稍后重试",
"retryable": true
},
"request_id": "req_xxx"
}
{
"error": {
"code": 503,
"type": "service_unavailable_error",
"message": "服务暂时不可用,请稍后重试",
"retryable": true
},
"request_id": "req_550e8400-e29b-41d4-a716-446655440000"
}
全部接口
提交原生图片生成任务
根据调用方提供的提示词、参考图片、比例和分辨率直接提交图片生成任务。当前生图模型为 image-2。
POST
https://api.ch88.cn
/
v1
/
open
/
images
/
generations
curl --request POST \
--url https://api.ch88.cn/v1/open/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "一只橘猫坐在窗台上看夕阳,水彩画风格。",
"size": "16:9",
"resolution": "2k"
}
'{
"code": 200,
"data": {
"status": "submitted",
"task_id": "task_01K4Y7N5X6A7B8C9D0E1F2G3H4"
},
"request_id": "req_550e8400-e29b-41d4-a716-446655440000"
}
{
"error": {
"code": 400,
"type": "invalid_request_error",
"message": "请至少提供 1 张产品图"
},
"request_id": "req_xxx"
}
{
"error": {
"code": 401,
"type": "authentication_error",
"message": "缺少 Public API Key"
},
"request_id": "req_xxx"
}
{
"error": {
"code": 403,
"type": "permission_error",
"message": "成员或组织已停用"
},
"request_id": "req_xxx"
}
{
"error": {
"code": 409,
"type": "conflict_error",
"message": "成员未分配有效上游密钥"
},
"request_id": "req_xxx"
}
{
"error": {
"code": 413,
"type": "invalid_request_error",
"message": "请求体最大支持 32 MB",
"param": "body"
},
"request_id": "req_xxx"
}
{
"error": {
"code": 429,
"type": "rate_limit_error",
"message": "请求过于频繁,请稍后重试",
"retryable": true
},
"request_id": "req_xxx"
}
{
"error": {
"code": 502,
"type": "upstream_error",
"message": "上游服务暂时不可用,请稍后重试",
"retryable": true
},
"request_id": "req_xxx"
}
{
"error": {
"code": 503,
"type": "service_unavailable_error",
"message": "服务暂时不可用,请稍后重试",
"retryable": true
},
"request_id": "req_550e8400-e29b-41d4-a716-446655440000"
}
{
"code": 200,
"data": {
"status": "submitted",
"task_id": "task_01K4Y7N5X6A7B8C9D0E1F2G3H4"
},
"request_id": "req_550e8400-e29b-41d4-a716-446655440000"
}
{
"error": {
"code": 400,
"type": "invalid_request_error",
"message": "请至少提供 1 张产品图"
},
"request_id": "req_xxx"
}
{
"error": {
"code": 401,
"type": "authentication_error",
"message": "缺少 Public API Key"
},
"request_id": "req_xxx"
}
{
"error": {
"code": 403,
"type": "permission_error",
"message": "成员或组织已停用"
},
"request_id": "req_xxx"
}
{
"error": {
"code": 409,
"type": "conflict_error",
"message": "成员未分配有效上游密钥"
},
"request_id": "req_xxx"
}
{
"error": {
"code": 413,
"type": "invalid_request_error",
"message": "请求体最大支持 32 MB",
"param": "body"
},
"request_id": "req_xxx"
}
{
"error": {
"code": 429,
"type": "rate_limit_error",
"message": "请求过于频繁,请稍后重试",
"retryable": true
},
"request_id": "req_xxx"
}
{
"error": {
"code": 502,
"type": "upstream_error",
"message": "上游服务暂时不可用,请稍后重试",
"retryable": true
},
"request_id": "req_xxx"
}
{
"error": {
"code": 503,
"type": "service_unavailable_error",
"message": "服务暂时不可用,请稍后重试",
"retryable": true
},
"request_id": "req_550e8400-e29b-41d4-a716-446655440000"
}
授权
成员级 Public API Key。请填写完整密钥,Mintlify Playground 会自动以 Authorization: Bearer <PUBLIC_API_KEY> 发送。完整明文只在管理后台创建成功时显示一次。
请求体
application/json
图片生成提示词。
Required string length:
1 - 32000参考图片,最多 15 张。每项可以是公网可访问的 HTTP(S) URL,也可以是 data:image/png;base64,... 格式的 Base64 Data URI,两种形式可以混合传入。
省略或传空数组时为文生图。Base64 图片单张解码后最大 20 MB,包含 JSON 在内的整个请求体最大 32 MB;多张或大图建议先调用图片上传接口再传 URL。
Maximum array length:
15HTTP(S) URL 或图片 Base64 Data URI。
图像生成的比例。支持以下比例,也可传入 auto 由服务端自动选择合适比例:
size | 类型 |
|---|---|
auto | 自动 |
1:1 | 正方 |
3:2 | 横图 |
2:3 | 竖图 |
4:3 | 横图 |
3:4 | 竖图 |
5:4 | 横图 |
4:5 | 竖图 |
16:9 | 横图 |
9:16 | 竖图 |
2:1 | 横图 |
1:2 | 竖图 |
3:1 | 横图 |
1:3 | 竖图 |
21:9 | 横图 |
9:21 | 竖图 |
也支持直接传入像素尺寸,例如 1881x836 / 887x1774。
注意:当 size 传入 auto 时,默认比例为 1:1。
输出分辨率档位。
可选值:1k / 2k / 4k
size × resolution 对应的实际像素:
size | 1k | 2k | 4k |
|---|---|---|---|
1:1 | 1024×1024 / 1254×1254 | 2048×2048 | 2880×2880 |
3:2 | 1536×1024 | 2048×1360 | 3520×2336 |
2:3 | 1024×1536 | 1360×2048 | 2336×3520 |
4:3 | 1024×768 | 2048×1536 | 3312×2480 |
3:4 | 768×1024 | 1536×2048 | 2480×3312 |
5:4 | 1280×1024 / 1448×1086 | 2560×2048 | 3216×2576 |
4:5 | 1024×1280 / 1122×1402 | 2048×2560 | 2576×3216 |
16:9 | 1536×864 / 1672×941 | 2048×1152 | 3840×2160 |
9:16 | 864×1536 / 941×1672 | 1152×2048 | 2160×3840 |
2:1 | 2048×1024 / 1774×887 | 2688×1344 | 3840×1920 |
1:2 | 1024×2048 / 887×1774 | 1344×2688 | 1920×3840 |
3:1 | 1881×836 / 1536×512 | 3072×1024 | 3840×1280 |
1:3 | 887×1774 / 512×1536 | 1024×3072 | 1280×3840 |
21:9 | 2016×864 / 1915×821 | 2688×1152 | 3840×1648 |
9:21 | 864×2016 / 821×1915 | 1152×2688 | 1648×3840 |
注意:4K 支持上述 15 个比例;也可以直接通过 size 传入表格中的像素尺寸。
可用选项:
1k, 2k, 4k 生成图片张数。
取值:1。省略时默认为 1。
注意:只能传入纯数字 1,不要加引号。当前不支持其他数字。
必填范围:
1 <= x <= 1响应
查询任务结果
任务提交成功后返回 data.task_id。请保存该任务编号,并通过 GET /v1/open/tasks/{task_id} 轮询任务状态,详见查询生图任务。

