Create a media task
curl --request POST \
--url https://apistable.ai/api/v1/tasks/create_task \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "prism-image-2",
"input": {
"prompt": "A red fox",
"output_count": 3,
"fallback": true
},
"callback_url": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'prism-image-2',
input: {prompt: 'A red fox', output_count: 3, fallback: true},
callback_url: '<string>'
})
};
fetch('https://apistable.ai/api/v1/tasks/create_task', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://apistable.ai/api/v1/tasks/create_task"
payload = {
"model": "prism-image-2",
"input": {
"prompt": "A red fox",
"output_count": 3,
"fallback": True
},
"callback_url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"code": 200,
"msg": "success",
"data": {
"task_id": "<string>"
}
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}通用接口与指南
创建任务
提交图片、视频或音乐生成。
POST
/
api
/
v1
/
tasks
/
create_task
Create a media task
curl --request POST \
--url https://apistable.ai/api/v1/tasks/create_task \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "prism-image-2",
"input": {
"prompt": "A red fox",
"output_count": 3,
"fallback": true
},
"callback_url": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'prism-image-2',
input: {prompt: 'A red fox', output_count: 3, fallback: true},
callback_url: '<string>'
})
};
fetch('https://apistable.ai/api/v1/tasks/create_task', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://apistable.ai/api/v1/tasks/create_task"
payload = {
"model": "prism-image-2",
"input": {
"prompt": "A red fox",
"output_count": 3,
"fallback": True
},
"callback_url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"code": 200,
"msg": "success",
"data": {
"task_id": "<string>"
}
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}能力按服务端配置逐项启用。未启用操作返回 503 且不创建任务;音乐积分扣除当前未启用。
请求
发送 model 和 input 对象;按模型 Schema 将可选 output_count、fallback 放在 input 内。callback_url 是可选的顶层公网 HTTPS 地址。不使用 max_credits、报价步骤或提交幂等键。 每次成功受理都创建新任务。网络超时后重发可能产生另一单和另一笔费用;已配置启用的 Suno 操作创建持久化任务;未启用操作返回 50301 且不创建任务。{
"model": "prism-image-2",
"input": {
"prompt": "A red fox in a snowy forest",
"output_count": 3,
"fallback": true
}
}
受理响应
已启用模型成功受理后返回 HTTP 200,data 中包含 task_id;受理不代表生成成功。未启用操作返回 HTTP 503、code 50301,且不创建任务。{
"code": 200,
"msg": "success",
"data": {
"task_id": "task_example"
}
}
授权
Every valid key can submit and query its own account. Revoked keys are rejected.
请求体
application/json
示例:
"prism-image-2"
Validate against the selected model input_schema. output_count/fallback are optional model-specific input fields; never top-level.
示例:
{
"prompt": "A red fox",
"output_count": 3,
"fallback": true
}
Optional public HTTPS endpoint for signed completion callbacks; no redirects or private IPs.