tokenlab-api-integrationlisted
Install: claude install-skill hedging8563/tokenlab-skills
# TokenLab API Integration
## Current public roots
- API root: `https://api.tokenlab.sh`
- OpenAI-compatible base URL: `https://api.tokenlab.sh/v1`
- Anthropic SDK base URL: `https://api.tokenlab.sh`(不要自行追加 `/v1`)
- Docs: `https://docs.tokenlab.sh`
- Model catalog: `GET https://api.tokenlab.sh/v1/models`
- Model detail: `GET https://api.tokenlab.sh/v1/models/{id}`
- OpenAPI: `https://docs.tokenlab.sh/openapi.json`
- Auth: `Authorization: Bearer $TOKENLAB_API_KEY`,或由原生 SDK 按其协议发送 key
## Required workflow
1. 明确任务类型、同步/异步需求、输入输���媒体和调用方支持的协议。
2. 对所有非 chat 请求,先调用 `/v1/models?category=<category>`;不要把示例模型名当作实时可用性。
3. 对准备使用的模型再调用 `/v1/models/{id}`,读取 `tokenlab.accepted_request_formats`、`tokenlab.capabilities`、token 上限、价格与公开 request contract。
4. 根据公开 detail contract 选择 endpoint;禁止按模型名 substring、供应商印象或物理渠道字段推断。
5. 只发送所选 endpoint 声明的 request shape。不要把 Responses、Messages、Gemini 和 Chat payload 相互拍平或混用字段。
6. 请求失败时保留原始语义;只根据结构化 error 或用户明确选择重试。不得为了得到 HTTP 200 删除历史、工具调用、思考签名或媒体输入。
7. 异步创建后读取 `delivery.mode` / `id` / `task_id` / `poll_url`,以 `status` 判终态;不要用缺失的 progress 推断成功。
8. 代码必须从环境变量读 key,传播超时与取消信号,并在结束时关闭流/reader。
可先运行本 Skill 的只读发现脚本:
```bash
python skills/tokenlab-api-integration/scripts/search_api.py --category video --limit 20
python skills/tokenlab-api-integration/scripts/search_api.py --detail claude-sonnet-4-6
```
## Protocol selection
模型列表适合筛选;最终 endpoint eligibility 以模型详情中的 `tokenlab.accepted_request_formats` 为准。
| Contract value | Endpoint | Base URL / client | Select