本页目录
请求头
三种写法任选其一,对应三种协议的 SDK 默认行为:
text
Authorization: Bearer YOUR_APIONE_KEY OpenAI 协议及通用写法
x-api-key: YOUR_APIONE_KEY Anthropic 协议
x-goog-api-key: YOUR_APIONE_KEY Gemini 协议一次请求只带一个 Key。同时在多个请求头里带了不同的 Key 会直接返回 401。
校验 Key
bash
curl -s -o /dev/null -w "%{http_code}\n" \
https://api.apione.ai/v1/models \
-H "Authorization: Bearer $APIONE_API_KEY"返回 200 表示 Key 有效且未被禁用。
失败响应
| 状态 | message | 常见原因 |
|---|---|---|
401 | missing API token | 请求里没带 Key |
401 | invalid API token | Key 拼写错误或已删除 |
401 | API token is disabled | Key 被手动禁用 |
401 | API token has expired | Key 已过有效期 |
401 | conflicting API credentials… | 多个请求头里带了不同的 Key |
403 | API key is not allowed to use the requested model | 模型不在该 Key 的可用范围内(code 为 API_KEY_MODEL_DENIED) |
402 | — | 余额不足(code 为 insufficient_funds) |
Key 相关的 401 返回体形如:
json
{ "error": { "message": "invalid API token", "type": "proxy_error" } }注意
Key 只在服务端使用。任何把 Key 放进浏览器、移动端包体或公开仓库的做法都等同于公开你的余额。
联系我们
文档没写清楚,或者需要人工协助?按问题类型选一个渠道即可。