图像生成
curl --request POST \
--url https://api.maxapi.ai/kling/v1/images/generations \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "string"
}
'import requests
url = "https://api.maxapi.ai/kling/v1/images/generations"
payload = { "prompt": "string" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({prompt: 'string'})
};
fetch('https://api.maxapi.ai/kling/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.maxapi.ai/kling/v1/images/generations"
payload := strings.NewReader("{\n \"prompt\": \"string\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.maxapi.ai/kling/v1/images/generations")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"string\"\n}")
.asString();{
"code": 0,
"message": "string",
"request_id": "string",
"data": {
"task_id": "string",
"task_status": "string",
"created_at": 0,
"updated_at": 0
}
}POST
https://api.maxapi.ai
/
kling
/
v1
/
images
/
generations
图像生成
curl --request POST \
--url https://api.maxapi.ai/kling/v1/images/generations \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "string"
}
'import requests
url = "https://api.maxapi.ai/kling/v1/images/generations"
payload = { "prompt": "string" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({prompt: 'string'})
};
fetch('https://api.maxapi.ai/kling/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.maxapi.ai/kling/v1/images/generations"
payload := strings.NewReader("{\n \"prompt\": \"string\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.maxapi.ai/kling/v1/images/generations")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"string\"\n}")
.asString();{
"code": 0,
"message": "string",
"request_id": "string",
"data": {
"task_id": "string",
"task_status": "string",
"created_at": 0,
"updated_at": 0
}
}请求头
在 Header 添加参数 Authorization,其值为在 Bearer 之后拼接 Token 示例Authorization: Bearer YOUR_API_KEY
请求体
application/json
正向文本提示,必须,不能超过500个字符
Maximum string length:
5000负向文本提示,可选,不能超过200个字符
Maximum string length:
2000参考图片,可选,支持Base64编码或图片URL,支持.jpg / .jpeg / .png格式,大小不能超过10MB
生成过程中对用户上传图片的参考强度,可选,取值范围:[0,1]
必填范围:
0 <= x <= 1生成图片数量,可选,取值范围:[1,9]
必填范围:
1 <= x <= 9生成图片的纵横比,可选,枚举值:16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3
可用选项:
16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3 本次任务结果回调通知地址,可选
响应
200 - application/json
请求成功
错误码;具体定义错误码
错误信息
请求ID,系统生成,用于跟踪请求、排查问题
Hide child attributes
Hide child attributes