Bearer Token Authentication
All API requests require an API Key in the header:
Authorization: Bearer YOUR_API_KEY
Getting an API Key
- Log in to Crazyrouter
- Go to the Token Management page
- Click “Create Token”
- Set the token name, quota limit, available models, etc.
- Copy the generated key starting with
sk-
The API Key is only displayed once at creation time. Please save it securely. If lost, you will need to create a new one.
Usage Examples
curl https://crazyrouter.com/v1/chat/completions \
-H "Authorization: Bearer sk-xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-4o", "messages": [{"role": "user", "content": "Hi"}]}'
Token Permission Controls
When creating a token, you can configure:
- Name: For easy identification of its purpose
- Quota Limit: Set the maximum available quota
- Expiration Time: Set a validity period
- Available Models: Restrict which models can be called
- IP Whitelist: Restrict the source IPs allowed to make calls