Generation submission placeholder / 生成提交预览
curl --request POST \
--url https://apistable.com/v1/tasks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "prism-image-2",
"input": {
"prompt": "<string>",
"duration_seconds": 123,
"resolution": "<string>",
"seed": 1,
"generate_audio": true,
"instrumental": true,
"lyrics": "<string>"
},
"output_count": 1,
"fallback": false,
"max_credits": 1
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'prism-image-2',
input: {
prompt: '<string>',
duration_seconds: 123,
resolution: '<string>',
seed: 1,
generate_audio: true,
instrumental: true,
lyrics: '<string>'
},
output_count: 1,
fallback: false,
max_credits: 1
})
};
fetch('https://apistable.com/v1/tasks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://apistable.com/v1/tasks"
payload = {
"model": "prism-image-2",
"input": {
"prompt": "<string>",
"duration_seconds": 123,
"resolution": "<string>",
"seed": 1,
"generate_audio": True,
"instrumental": True,
"lyrics": "<string>"
},
"output_count": 1,
"fallback": False,
"max_credits": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "provider_not_configured",
"message": "Live model providers are not connected in this build. No credits were reserved or charged."
}
}接口参考
创建生成任务
提交异步图片、视频或音乐生成。
POST
/
v1
/
tasks
Generation submission placeholder / 生成提交预览
curl --request POST \
--url https://apistable.com/v1/tasks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "prism-image-2",
"input": {
"prompt": "<string>",
"duration_seconds": 123,
"resolution": "<string>",
"seed": 1,
"generate_audio": true,
"instrumental": true,
"lyrics": "<string>"
},
"output_count": 1,
"fallback": false,
"max_credits": 1
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'prism-image-2',
input: {
prompt: '<string>',
duration_seconds: 123,
resolution: '<string>',
seed: 1,
generate_audio: true,
instrumental: true,
lyrics: '<string>'
},
output_count: 1,
fallback: false,
max_credits: 1
})
};
fetch('https://apistable.com/v1/tasks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://apistable.com/v1/tasks"
payload = {
"model": "prism-image-2",
"input": {
"prompt": "<string>",
"duration_seconds": 123,
"resolution": "<string>",
"seed": 1,
"generate_audio": True,
"instrumental": True,
"lyrics": "<string>"
},
"output_count": 1,
"fallback": False,
"max_credits": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "provider_not_configured",
"message": "Live model providers are not connected in this build. No credits were reserved or charged."
}
}当前为 API 预览。生成接口尚未接入供应商,成功认证后仍可能返回 503;不会创建任务或扣积分。
请求参数
| 参数 | 类型 | 规则 |
|---|---|---|
| model | 字符串 · 必填 | 精确模型/操作 ID。 |
| input | 对象 · 必填 | 按当前模型规范校验。 |
| output_count | 整数 · 默认 1 | 仅图片/视频,目标结果项 1–4。 |
| fallback | 布尔值 · 默认 false | 授权符合条件的官方回退。 |
| max_credits | 非负整数 · 可选 | 可接受的整次最高冻结。 |
真实接入后的受理契约
真实执行启用后,受理成功会原子记录父操作、结果项、冻结积分和持久调度记录。HTTP 202 表示已受理,不表示模型已经完成。 output_count=4 返回一个包含四个稳定结果项的 task_id。Worker 在账户和供应商限制内调度,不保证四项同时开始。当前建设阶段尚未连接真实供应商。接口不能伪造生成成功或已完成的付费结果。
计划中的幂等受理
真实任务受理启用后,提交 Idempotency-Key 并与输入一起保存。当前 POST /v1/tasks 在创建操作前拒绝真实执行,尚不会因该请求头产生存储操作。同键同输入引用原操作;改变数量、fallback 或费用上限应返回冲突。主动重新生成需新幂等键和新付费操作。 错误与恢复授权
API key beginning as_. Keep on the server. Scope permissions are checked separately.
请求头
Reserved for live acceptance. No task is currently created or deduplicated by this header.
请求体
application/json
Minimum string length:
1示例:
"prism-image-2"
Current preview input. Supported fields vary by modality and exact catalog model. No live provider mapping is implied.
Show child attributes
Show child attributes
Target result count. Images/videos accept 1–4; music and LLM must remain 1. Not a concurrency guarantee. / 目标结果数,非同时并发保证。
必填范围:
1 <= x <= 4Authorizes a higher-priced compatible official fallback after an eligible confirmed failure. Live execution is disabled in this build.
Whole-request reservation cap. Reject the entire request when max_reserved_credits exceeds it.
必填范围:
x >= 0响应
Invalid or unsupported input
Show child attributes
Show child attributes