文档OriHub
创建图片生成任务
本站媒体协议:提交任务拿 task_id,轮询出图。
本站媒体协议下所有媒体生成共用一个端点,图片也一样:提交拿 task_id,再轮询到成品。
要同步出图走图像生成,两条路别混。
请求
curl https://api.lk888.ai/v1/media/generate \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "tt-image-2.5",
"prompt": "一只戴眼镜的橘猫坐在窗台上看书",
"params": {
"version": "sunburst",
"aspect_ratio": "16:9",
"resolution": "2K",
"quality": "high"
}
}'
响应
{ "code": 200, "data": { "task_id": 12345 }, "msg": "Task created successfully" }
参数各家不一样
先查再用:GET /v1/skills/models/{name}。参数名不统一,照抄别的模型一定错。
| 模型 | 比例 | 分辨率 | 其他 |
|---|---|---|---|
tt-image-2.5 / tt-image-2.5-token |
aspect_ratio auto / 1:1 / 16:9 / … / custom |
resolution auto / 1K / 2K / 4K |
version flare / sunburst;quality auto / low / medium / high / xhigh / max;background opaque / transparent / auto;size 自定义像素 |
tt-image-2 / tt-image-2-token |
size 必填,直接写像素(1024x1024、2048x2048…) |
同左 | quality auto / high / medium / low |
banana-2.1 / banana-2.1-token |
aspectRatio 必填 |
imageSize 必填,1K / 2K / 4K |
thinkingLevel minimal / high |
banana-2 / banana-2-token |
aspectRatio 必填 |
imageSize 必填,0.5K / 1K / 2K / 4K |
thinkingLevel minimal / high |
banana-pro / banana-pro-token |
aspectRatio 必填 |
imageSize 必填,1K / 2K / 4K |
— |
doubao-seedream-5-0-pro-260628 / doubao-seedream-5-0-260128 / doubao-seedream-4-5-251128 |
aspect_ratio auto / 1:1 / … / 21:9 |
size 1K / 2K |
— |
gk-image-2.0 |
aspect_ratio 必填,1:1 / 16:9 / 9:16 / 4:3 / 3:4 |
resolution 必填,1k / 2k |
— |
mj_imagine |
aspectRatio 必填 |
— | botType 必填,MID_JOURNEY / NIJI_JOURNEY;quality 0.25 / 0.5 / 1 / 2;stylize 0–1000;chaos 0–100;style raw |
vidu-image-2 |
aspect_ratio 必填,16:9 / … / 7:3 |
resolution 必填,1K / 2K / 3K |
quality 必填 low / medium / high;style general |
wan2.7-image |
size 必填,auto / 1:1 / … / 3:2 |
— | quality 必填 standard / pro |
wan2.6-image |
size 必填 |
— | prompt_extend true / false |
qwen-image |
size 必填 |
— | prompt_extend true / false |
kling-v3 / kling-v3-omni |
aspect_ratio 必填 |
resolution 必填,1k / 2k |
— |
images 是每个模型都有的参考图参数,能传几张各不相同(1 张到 14 张都有)。
参考图怎么给
- 公网直链 URL —— 推荐,可跨任务复用
- 内联 base64 ——
data:image/<格式>;base64,...,只支持图片和音频;单文件解码后 ≤10MB、单请求内联总量 ≤30MB、整个请求体 ≤50MB
复数名参数一律传数组 —— images / videos / clips / files / attachments / reference_urls 都一样,只有一张也要写成 ["https://..."],直接传字符串有些模型会判成参数格式错误。
轮询
GET /v1/skills/task-status?task_id=12345,间隔 5 秒,is_final = true 停。成品在 result_url,result_type 是 image,cost 是结算金额。详见查询任务。
特别注意
tt-image-2.5的size只接受像素写法或auto—— 清晰度档位传resolution,比例传aspect_ratio。误填的 1K / 2K / 4K 会按resolution处理,但必须同时传具体的aspect_ratio,否则返回 400- 透明底会自动转 PNG 输出,并只派给支持透明底的渠道
notify_url是顶层字段,跟model/prompt/params平级- 提交前查余额:
GET /v1/skills/balance - 失败看
error_code,能不能重试见错误码查询