Query task result
curl --request GET \
--url https://apistable.com/api/v1/tasks/{task_id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://apistable.com/api/v1/tasks/{task_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://apistable.com/api/v1/tasks/{task_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"code": 200,
"msg": "success",
"data": {
"task_id": "task_example",
"model": "prism-image-2",
"status": "succeeded",
"message": "",
"created_at": "2026-11-01T08:30:00Z",
"completed_at": "2026-11-01T08:31:20Z",
"duration": 80000,
"charged_credits": 80,
"input": "{\"prompt\":\"A red fox\",\"output_count\":3,\"fallback\":true}",
"result": {
"urls": [
"https://cdn.example.com/a.png",
"https://cdn.example.com/b.png"
]
}
}
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}接口参考
查询任务
读取任务最终结果和总扣费。
GET
/
api
/
v1
/
tasks
/
{task_id}
Query task result
curl --request GET \
--url https://apistable.com/api/v1/tasks/{task_id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://apistable.com/api/v1/tasks/{task_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://apistable.com/api/v1/tasks/{task_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"code": 200,
"msg": "success",
"data": {
"task_id": "task_example",
"model": "prism-image-2",
"status": "succeeded",
"message": "",
"created_at": "2026-11-01T08:30:00Z",
"completed_at": "2026-11-01T08:31:20Z",
"duration": 80000,
"charged_credits": 80,
"input": "{\"prompt\":\"A red fox\",\"output_count\":3,\"fallback\":true}",
"result": {
"urls": [
"https://cdn.example.com/a.png",
"https://cdn.example.com/b.png"
]
}
}
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}{
"code": 123,
"msg": "<string>",
"data": null
}能力按服务端配置逐项启用。未启用操作返回 503 且不创建任务;音乐积分扣除当前未启用。
任务响应
status 为 processing、succeeded 或 failed。排队、fallback 和核对统一为 processing;全部执行结束后,只要至少一个成功就是 succeeded,零个成功才为 failed,不单设部分成功状态。 duration 是从创建到结束的整数毫秒。任务未结束时 completed_at、duration、charged_credits 为 null;失败扣 0,成功只显示最终实扣总额。 失败任务的 message 透传供应商错误;所有渠道失败时取最后一次供应商错误。成功/处理中为空字符串;查询本身成功时外层 msg 仍为 success。{
"code": 200,
"msg": "success",
"data": {
"task_id": "task_example",
"model": "prism-image-2",
"status": "succeeded",
"message": "",
"created_at": "2026-11-01T08:30:00Z",
"completed_at": "2026-11-01T08:31:20Z",
"duration": 80000,
"charged_credits": 80,
"input": "{\"prompt\":\"A red fox in a snowy forest\",\"output_count\":3,\"fallback\":true}",
"result": {
"urls": [
"https://cdn.example.com/a.png",
"https://cdn.example.com/b.png"
]
}
}
}