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 密钥,到可追踪、可核对的生成流程。
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;不会创建任务或扣积分。
先了解当前预览
APIstable 分两步建设:先完成网站、账户与执行架构,再接入真实模型供应商。当前模型目录与价格用于展示接口约定,不代表付费推理已经可用。 本页示例说明 API 预览契约。渠道未启用时,应返回供应商尚未配置的错误。复制代码不会执行请求或扣积分。 查看模型目录当前版本的实际行为
| 端点 | 当前行为 |
|---|---|
| GET /v1/models | 公开预览目录,无需密钥。 |
| POST /v1/quotes | 公开参数校验与示例报价,无需密钥,不冻结积分。 |
| GET /v1/balance | 需要 usage:read 权限的有效密钥和可用数据库。 |
| GET /v1/tasks 与 /v1/tasks/ | 使用 usage:read 读取账户存储任务,未知 ID 返回 404。 |
| POST /v1/tasks 与 /v1/chat/completions | 认证及适用校验后返回 HTTP 503 provider_not_configured,不真实生成或扣费。 |
1. 创建 API 密钥
登录后进入控制台 → API Keys。创建时立即保存完整密钥,它只显示一次。建议每个应用或环境使用独立密钥。export APISTABLE_BASE_URL="https://api.example.com"
export APISTABLE_API_KEY="YOUR_API_KEY"
export APISTABLE_IDEMPOTENCY_KEY="YOUR_UNIQUE_OPERATION_KEY"
将示例域名替换为实际部署地址。密钥只放在服务端环境变量中,不能写入浏览器代码、URL 或公开仓库。管理 API 密钥
2. 估价并提交
选择精确 Model ID 并校验输入。报价展示合格的低价/官方渠道、每个结果的价格与整次最高冻结积分。API 客户端可以不单独请求报价,但服务端仍会计算并校验价格。 图片和视频使用 output_count 创建 1–4 个结果项。fallback 默认关闭;开启后,每项在明确可回退失败时可独立尝试官方渠道。 创建任务 了解积分3. 保存任务 ID
媒体请求受理后返回 HTTP 202 和稳定的 task_id。保存 ID 并查询原任务,不要再次盲目提交。网络超时不能证明供应商未受理。- 合理间隔轮询并遵守 Retry-After。queued、running、falling_back、reconciliation_required 均不是终态。
- 逐项读取结果;即使其他项尚未结束,也可获取已成功项。在 expires_at 前下载文件。
- 通知失败不改变已完成生成,也不能导致再次扣费。
授权
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.
请求体
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