对接阿里云图像生成服务,支持同步和异步任务两种模式,不支持流式 SSE。
支持的模型
同步模式
curl -X POST https://51kik.com/v1/image/v1/generations \
-H 'Authorization: Bearer sk-xxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"model": "wanx-v1",
"prompt": "ancient chinese ink painting of mountains and clouds",
"upstream_options": { "n": 1, "resolution": "1024*1024", "watermark": false, "prompt_extend": true }
}'
图生图
curl -X POST https://51kik.com/v1/image/v1/generations \
-H 'Authorization: Bearer sk-xxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"model": "qwen-image-edit",
"prompt": "convert to oil painting style",
"image": "https://example.com/source.jpg",
"upstream_options": { "n": 1, "aspect_ratio": "16:9", "result_type": "image" }
}'
异步任务
curl -X POST https://51kik.com/v1/image/v1/generations \
-H 'Authorization: Bearer sk-xxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"model": "wanx-v1",
"prompt": "a panoramic mountain landscape",
"task": true,
"upstream_options": { "resolution": "2048*1024", "n": 4 }
}'
响应只含 task_id,需轮询:
curl https://51kik.com/v1/image/v1/tasks/abc123-task-id \
-H 'Authorization: Bearer sk-xxxxxxxx'
流式限制
百炼不支持 SSE 流式,传 stream: true 返回 Bailian image generation does not support streaming 错误。
常用 upstream_options
| 参数 | 说明 |
|---|---|
n | 生成张数 |
resolution | 分辨率,如 1024*1024 |
aspect_ratio | 宽高比,如 16:9 |
watermark | 水印开关 |
prompt_extend | 是否自动扩写 prompt |
negative_prompt | 负向提示词 |
seed | 随机种子 |
result_type | 输出类型:image / url |
task: true+stream: true不要同时传,行为未定义。