提交 Kling-O1-Image-Edit 生成任务
curl --request POST \
--url https://api.poyo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-o1-image-edit",
"callback_url": "https://your-domain.com/callback",
"input": {
"prompt": "Transform the product shot into a premium studio campaign image",
"image_urls": [
"https://example.com/reference1.png"
],
"elements": [
{
"frontal_image_url": "https://example.com/subject-front.png",
"reference_image_urls": [
"https://example.com/subject-side.png"
]
}
],
"resolution": "2K",
"size": "16:9",
"output_format": "png",
"n": 2
}
}
'import requests
url = "https://api.poyo.ai/api/generate/submit"
payload = {
"model": "kling-o1-image-edit",
"callback_url": "https://your-domain.com/callback",
"input": {
"prompt": "Transform the product shot into a premium studio campaign image",
"image_urls": ["https://example.com/reference1.png"],
"elements": [
{
"frontal_image_url": "https://example.com/subject-front.png",
"reference_image_urls": ["https://example.com/subject-side.png"]
}
],
"resolution": "2K",
"size": "16:9",
"output_format": "png",
"n": 2
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'kling-o1-image-edit',
callback_url: 'https://your-domain.com/callback',
input: {
prompt: 'Transform the product shot into a premium studio campaign image',
image_urls: ['https://example.com/reference1.png'],
elements: [
{
frontal_image_url: 'https://example.com/subject-front.png',
reference_image_urls: ['https://example.com/subject-side.png']
}
],
resolution: '2K',
size: '16:9',
output_format: 'png',
n: 2
}
})
};
fetch('https://api.poyo.ai/api/generate/submit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.poyo.ai/api/generate/submit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'kling-o1-image-edit',
'callback_url' => 'https://your-domain.com/callback',
'input' => [
'prompt' => 'Transform the product shot into a premium studio campaign image',
'image_urls' => [
'https://example.com/reference1.png'
],
'elements' => [
[
'frontal_image_url' => 'https://example.com/subject-front.png',
'reference_image_urls' => [
'https://example.com/subject-side.png'
]
]
],
'resolution' => '2K',
'size' => '16:9',
'output_format' => 'png',
'n' => 2
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.poyo.ai/api/generate/submit"
payload := strings.NewReader("{\n \"model\": \"kling-o1-image-edit\",\n \"callback_url\": \"https://your-domain.com/callback\",\n \"input\": {\n \"prompt\": \"Transform the product shot into a premium studio campaign image\",\n \"image_urls\": [\n \"https://example.com/reference1.png\"\n ],\n \"elements\": [\n {\n \"frontal_image_url\": \"https://example.com/subject-front.png\",\n \"reference_image_urls\": [\n \"https://example.com/subject-side.png\"\n ]\n }\n ],\n \"resolution\": \"2K\",\n \"size\": \"16:9\",\n \"output_format\": \"png\",\n \"n\": 2\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.poyo.ai/api/generate/submit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"kling-o1-image-edit\",\n \"callback_url\": \"https://your-domain.com/callback\",\n \"input\": {\n \"prompt\": \"Transform the product shot into a premium studio campaign image\",\n \"image_urls\": [\n \"https://example.com/reference1.png\"\n ],\n \"elements\": [\n {\n \"frontal_image_url\": \"https://example.com/subject-front.png\",\n \"reference_image_urls\": [\n \"https://example.com/subject-side.png\"\n ]\n }\n ],\n \"resolution\": \"2K\",\n \"size\": \"16:9\",\n \"output_format\": \"png\",\n \"n\": 2\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.poyo.ai/api/generate/submit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"kling-o1-image-edit\",\n \"callback_url\": \"https://your-domain.com/callback\",\n \"input\": {\n \"prompt\": \"Transform the product shot into a premium studio campaign image\",\n \"image_urls\": [\n \"https://example.com/reference1.png\"\n ],\n \"elements\": [\n {\n \"frontal_image_url\": \"https://example.com/subject-front.png\",\n \"reference_image_urls\": [\n \"https://example.com/subject-side.png\"\n ]\n }\n ],\n \"resolution\": \"2K\",\n \"size\": \"16:9\",\n \"output_format\": \"png\",\n \"n\": 2\n }\n}"
response = http.request(request)
puts response.read_body{
"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-o1
Kling O1 API 使用 1 到 10 张参考图以及可选的角色或物体元素编辑图像。输出为 1K 或 2K,可选预设宽高比或 auto。
POST
/
api
/
generate
/
submit
提交 Kling-O1-Image-Edit 生成任务
curl --request POST \
--url https://api.poyo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-o1-image-edit",
"callback_url": "https://your-domain.com/callback",
"input": {
"prompt": "Transform the product shot into a premium studio campaign image",
"image_urls": [
"https://example.com/reference1.png"
],
"elements": [
{
"frontal_image_url": "https://example.com/subject-front.png",
"reference_image_urls": [
"https://example.com/subject-side.png"
]
}
],
"resolution": "2K",
"size": "16:9",
"output_format": "png",
"n": 2
}
}
'import requests
url = "https://api.poyo.ai/api/generate/submit"
payload = {
"model": "kling-o1-image-edit",
"callback_url": "https://your-domain.com/callback",
"input": {
"prompt": "Transform the product shot into a premium studio campaign image",
"image_urls": ["https://example.com/reference1.png"],
"elements": [
{
"frontal_image_url": "https://example.com/subject-front.png",
"reference_image_urls": ["https://example.com/subject-side.png"]
}
],
"resolution": "2K",
"size": "16:9",
"output_format": "png",
"n": 2
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'kling-o1-image-edit',
callback_url: 'https://your-domain.com/callback',
input: {
prompt: 'Transform the product shot into a premium studio campaign image',
image_urls: ['https://example.com/reference1.png'],
elements: [
{
frontal_image_url: 'https://example.com/subject-front.png',
reference_image_urls: ['https://example.com/subject-side.png']
}
],
resolution: '2K',
size: '16:9',
output_format: 'png',
n: 2
}
})
};
fetch('https://api.poyo.ai/api/generate/submit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.poyo.ai/api/generate/submit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'kling-o1-image-edit',
'callback_url' => 'https://your-domain.com/callback',
'input' => [
'prompt' => 'Transform the product shot into a premium studio campaign image',
'image_urls' => [
'https://example.com/reference1.png'
],
'elements' => [
[
'frontal_image_url' => 'https://example.com/subject-front.png',
'reference_image_urls' => [
'https://example.com/subject-side.png'
]
]
],
'resolution' => '2K',
'size' => '16:9',
'output_format' => 'png',
'n' => 2
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.poyo.ai/api/generate/submit"
payload := strings.NewReader("{\n \"model\": \"kling-o1-image-edit\",\n \"callback_url\": \"https://your-domain.com/callback\",\n \"input\": {\n \"prompt\": \"Transform the product shot into a premium studio campaign image\",\n \"image_urls\": [\n \"https://example.com/reference1.png\"\n ],\n \"elements\": [\n {\n \"frontal_image_url\": \"https://example.com/subject-front.png\",\n \"reference_image_urls\": [\n \"https://example.com/subject-side.png\"\n ]\n }\n ],\n \"resolution\": \"2K\",\n \"size\": \"16:9\",\n \"output_format\": \"png\",\n \"n\": 2\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.poyo.ai/api/generate/submit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"kling-o1-image-edit\",\n \"callback_url\": \"https://your-domain.com/callback\",\n \"input\": {\n \"prompt\": \"Transform the product shot into a premium studio campaign image\",\n \"image_urls\": [\n \"https://example.com/reference1.png\"\n ],\n \"elements\": [\n {\n \"frontal_image_url\": \"https://example.com/subject-front.png\",\n \"reference_image_urls\": [\n \"https://example.com/subject-side.png\"\n ]\n }\n ],\n \"resolution\": \"2K\",\n \"size\": \"16:9\",\n \"output_format\": \"png\",\n \"n\": 2\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.poyo.ai/api/generate/submit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"kling-o1-image-edit\",\n \"callback_url\": \"https://your-domain.com/callback\",\n \"input\": {\n \"prompt\": \"Transform the product shot into a premium studio campaign image\",\n \"image_urls\": [\n \"https://example.com/reference1.png\"\n ],\n \"elements\": [\n {\n \"frontal_image_url\": \"https://example.com/subject-front.png\",\n \"reference_image_urls\": [\n \"https://example.com/subject-side.png\"\n ]\n }\n ],\n \"resolution\": \"2K\",\n \"size\": \"16:9\",\n \"output_format\": \"png\",\n \"n\": 2\n }\n}"
response = http.request(request)
puts response.read_body{
"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-o1-image-edit - 基于参考图的图像编辑,可选元素引导
必填参数
prompt- 必填的编辑提示词image_urls- 必填的参考图 URL,1-10张
可选参数
elements- 可选的元素描述数组,用于控制角色/物体。在提示词中以@Element1、@Element2等方式引用。推荐结构:frontal_image_url填主要的人脸/物体图像,可选的reference_image_urls填其他参考视角resolution-1K或2Ksize-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-o1-image-edit",
"callback_url": "https://your-domain.com/callback",
"input": {
"prompt": "Transform the product shot into a premium studio campaign image",
"image_urls": ["https://example.com/reference1.png"],
"elements": [
{
"frontal_image_url": "https://example.com/subject-front.png",
"reference_image_urls": ["https://example.com/subject-side.png"]
}
],
"resolution": "2K",
"size": "16:9",
"output_format": "png",
"n": 2
}
}'
授权
所有 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