Documentation Index
Fetch the complete documentation index at: https://docs.tokenlab.sh/llms.txt
Use this file to discover all available pages before exploring further.
API key
所有 TokenLab API 请求都需要 API key。 对于兼容 OpenAI 的端点,请按如下方式发送:/v1/messages 请求,你也可以使用:
获取你的 API key
- 登录你的 TokenLab Dashboard
- 打开 API Keys
- 创建一个新 key
- 为其指定一个便于识别的名称
- 立即复制它,因为它只会显示一次
使用 API key
API key 特性
使用限制
你可以为每个 API key 设置使用限制:| 设置 | 描述 |
|---|---|
| No Limit | key 可无限制地使用你的账户余额 |
| Fixed Limit | key 在达到指定金额后将停止工作 |
key 前缀
所有 TokenLab API key 都以sk- 开头。
Anthropic 兼容性
对于/v1/messages 端点,Anthropic 风格的请求头可按预期工作:
对于兼容 OpenAI 的端点,例如
/v1/responses、/v1/chat/completions、/v1/models 以及大多数其他 TokenLab 路由,请使用 Authorization: Bearer ...。错误响应
| 状态码 | 类型 | 代码 | 描述 |
|---|---|---|---|
| 401 | invalid_api_key | invalid_api_key | 缺少或无效的 API key |
| 401 | expired_api_key | expired_api_key | API key 已被撤销 |
| 402 | insufficient_balance | insufficient_balance | 账户余额不足 |
| 402 | quota_exceeded | quota_exceeded | 已达到 API key 使用限制 |