HTTP 错误码
| 状态码 | 错误码 | 含义 | 建议 |
|---|---|---|---|
| 400 | bad_request | 参数错误 | 看 message,修请求体 |
| 400 | model_not_allowed | model 不存在/未启用 | 到 模型广场 看可用列表 |
| 401 | unauthorized | API key 无效 / 已吊销 | 到 API Keys 检查 |
| 402 | insufficient_credits | 钱包余额不足 | 到 钱包 充值 |
| 403 | plan_forbidden | 当前 plan 不允许此 model | 升级 plan 或换 model |
| 429 | rate_limited | 超过 RPM / TPM / daily | 看响应头 X-RateLimit-Reset,退避重试 |
| 500 | internal | LOLAI 内部错 | 用 request_id 联系我们 |
| 503 | upstream_unavailable | 所有 upstream 都失败 | 重试或换 model |
错误响应体
错误响应
{
"error": {
"type": "rate_limited",
"message": "RPM exceeded: 60/min",
"code": "rate_limited",
"request_id": "req_abc123"
}
}每次调用都会带 x-request-id 响应头,有问题贴这个 id 给我们, 我们能在调用日志里精确定位上下文。
限速
每个 API key 可独立配置 RPM / TPM / daily 调用数 三档限速, 在 API Keys 页面创建时设置。默认值跟当前 plan 走。
响应头会带当前余量:
响应头
X-RateLimit-Limit-Rpm: 60
X-RateLimit-Remaining-Rpm: 42
X-RateLimit-Reset: 1715961290计费模型
预付钱包 + 实时按量扣费。每次调用根据上游返回的 tokens / images / seconds × 该 model 的刊例价(USD),实时扣 钱包余额。
- 计价单位:USD($),按实际用量实时结算
- 失败请求不扣费(成本计 $0)
- 流式中途断开按已生成 tokens 扣费
- 缓存命中(prompt caching)按
cache_read折扣价计