拿 API Key
登录 Console → API Keys 创建一把密钥。pk_live 用于前端,sk_live 用于服务器端。
发一个请求
把 prompt 与通道 slug 发到中枢入口,中枢依模态与健康度自动分派。
收结果 / 扣点
返回结果与本次消耗的 Prisms。通道挂了会自动容错改派,扣点透明。
最小请求 · curl
最小可跑的图像生成请求。把 YOUR_API_KEY 换成你的密钥即可。
curl -X POST https://api.refractnest.dev/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "forge-pro",
"prompt": "a cozy pixel-art control tower at sunrise",
"n": 1
}'
响应 (200)
{
"task_id": "t_9af31c",
"model": "forge-pro",
"status": "done",
"cost_prisms": 8,
"data": [{ "url": "https://cdn.refractnest.dev/o/9af31c.png" }]
}
端点一览
| 方法 | 端点 | 用途 |
|---|---|---|
| POST | /v1/images/generations | 图像生成(带 model slug) |
| GET | /v1/tasks/{task_id} | 查询任务状态与结果 |
| GET | /v1/models | 列出可用通道与点数 |
| GET | /v1/account/balance | 查询 Prisms 余额(免费桶 + 购买桶) |
可用通道 slug
把 model 换成下面任一 slug,即可切换背后的 AI 通道。完整清单与健康度见 Models 页。
| slug | 模态 | 每次 | 状态 |
|---|---|---|---|
| forge-v8 | IMAGE | 10 Prisms | 正常 |
| forge-v7 | IMAGE | 8 Prisms | 正常 |
| forge-v6 | IMAGE | 6 Prisms | 正常 |
| prism-type | IMAGE | 6 Prisms | 降级 |
| lumen-pro | TEXT | 2 Prisms | 降级 |
| lumen-lite | TEXT | 1 Prisms | 降级 |
| prism-art | IMAGE | 5 Prisms | 降级 |
| lumen-flash | TEXT | 1 Prisms | 降级 |
| lumen-max | TEXT | 3 Prisms | 降级 |
| prism-hd | IMAGE | 5 Prisms | 降级 |