Authentication
All API requests are authenticated via Bearer Token. Include your API Key in the request header:
http
Authorization: Bearer sk-xxxxxxxxxxxxxxxxExample
bash
curl $URL/v1/models \
-H "Authorization: Bearer $YOUR_API_KEY"Details
| Item | Description |
|---|---|
| Key prefix | Starts with sk- |
| Scope | One Key can access all authorized models under the account |
| Quota | Keys can have independent quota limits and expiration times (configured in the console) |
| Security best practice | Call from the server side; do not expose in browser/client code. Use different Keys for different businesses to facilitate auditing and damage control |
FAQ
Q: Got 401 Unauthorized?
- Check that the Key is copied completely (including the
sk-prefix) - Check header format:
Authorization: Bearer <key>, with one space betweenBearerand the Key - The Key may have been deleted or expired; confirm in the console
Q: Got 403 insufficient quota?
Account balance or the Key's available quota has been exhausted. Please contact the admin to recharge or adjust the quota. Support: 控制台内联系管理员
