curl --request POST \
--url https://api.poyo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-o3-image",
"callback_url": "https://your-domain.com/callback",
"input": {
"prompt": "A cinematic futuristic alley with rain and neon reflections",
"resolution": "4K",
"size": "16:9",
"output_format": "png",
"n": 2
}
}
'{
"code": 200,
"data": {
"task_id": "task-unified-1757165031-uyujaw3d",
"status": "not_started",
"created_time": "2025-11-12T10:30:00"
}
}{
"code": 400,
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"code": 401,
"error": {
"message": "Unauthorized - Invalid API key",
"type": "authentication_error"
}
}Kling
Kling-o3
Kling O3 API 根据提示词生成图像,或编辑 1 到 10 张参考图。分辨率为 1K、2K 或 4K,可选的元素可锁定角色或物体。
POST
/
api
/
generate
/
submit
curl --request POST \
--url https://api.poyo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-o3-image",
"callback_url": "https://your-domain.com/callback",
"input": {
"prompt": "A cinematic futuristic alley with rain and neon reflections",
"resolution": "4K",
"size": "16:9",
"output_format": "png",
"n": 2
}
}
'{
"code": 200,
"data": {
"task_id": "task-unified-1757165031-uyujaw3d",
"status": "not_started",
"created_time": "2025-11-12T10:30:00"
}
}{
"code": 400,
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"code": 401,
"error": {
"message": "Unauthorized - Invalid API key",
"type": "authentication_error"
}
}- 提交后会返回
task_id。如果提供了callback_url,当任务状态变为finished或failed时,系统会向callback_url发送 POST 请求。 - 无论是否提供
callback_url,都可以通过统一的查询任务状态接口获取结果。
模型
- kling-o3-image - 仅凭提示词生成图像
- kling-o3-image-edit - 基于参考图的图像编辑
必填参数
prompt- 必填的生成或编辑提示词
可选参数
image_urls- 可选的参考图 URL,1-10张,用于图像编辑模式elements- 可选的元素描述数组,用于控制角色/物体。在提示词中以@Element1、@Element2等方式引用。推荐结构:frontal_image_url填主要的人脸/物体图像,可选的reference_image_urls填其他参考视角resolution-1K、2K、4Ksize-kling-o3-image:16:9、9:16、1:1、4:3、3:4、3:2、2:3、21:9;kling-o3-image-edit:auto、16:9、9:16、1:1、4:3、3:4、3:2、2:3、21:9output_format-jpeg、png、webpn- 输出图像数量,1-9
示例
使用统一提交接口:POST /api/generate/submit
仅提示词示例:
curl --request POST \
--url https://api.poyo.ai/api/generate/submit \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model": "kling-o3-image",
"callback_url": "https://your-domain.com/callback",
"input": {
"prompt": "A cinematic futuristic alley with rain and neon reflections",
"resolution": "4K",
"size": "16:9",
"output_format": "png",
"n": 2
}
}'
curl --request POST \
--url https://api.poyo.ai/api/generate/submit \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model": "kling-o3-image-edit",
"callback_url": "https://your-domain.com/callback",
"input": {
"prompt": "Turn the reference scene into a luxury night interior with dramatic window light",
"image_urls": ["https://example.com/reference1.png"],
"resolution": "4K",
"size": "auto",
"output_format": "png",
"n": 1
}
}'
注意事项
Elements 说明
elements用于上游的人脸/物体控制- 推荐的元素字段:
frontal_image_url:主要角色/物体视角的公开图像 URLreference_image_urls:可选的其他公开图像 URL 数组
elements为可选项,仅在需要更强的主体一致性时使用
授权
所有 API 接口都需要 Bearer Token 认证。
创建 API Key:登录 PoYo,进入 仪表盘 → API 密钥(poyo.ai/zh/dashboard/api-key),点击创建 Key。
在请求头中添加:
Authorization: Bearer YOUR_API_KEY
请求体
application/json
响应
任务提交成功
Show child attributes
Show child attributes