Authentication
KushRouter authenticates requests using your API key. Provide the key via the appropriate header depending on the provider family.
Headers
- OpenAI-compatible routes:
Authorization: Bearer <API_KEY>
- Anthropic-compatible routes:
x-api-key: <API_KEY>
orAuthorization: Bearer <API_KEY>
- Unified route:
Authorization: Bearer <API_KEY>
cURL examples
OpenAI-compatible streaming:
curl -N -X POST "https://api.kushrouter.com/api/openai/v1/chat/completions" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role":"user","content":"Hello"}],
"stream": true
}'
Anthropic-compatible streaming:
curl -N -X POST "https://api.kushrouter.com/api/anthropic/v1/messages" \
-H "x-api-key: $API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-3-5-sonnet-20241022",
"messages": [{"role":"user","content":[{"type":"text","text":"Hello"}]}],
"max_tokens": 256,
"stream": true
}'
Unified endpoint:
curl -N -X POST "https://api.kushrouter.com/api/v1/messages" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role":"user","content":"Hello"}],
"stream": true
}'
Notes
- Ensure
stream
is a boolean (true
/false
), not a string. Otherwise the server returns 400. - On validation errors, the response includes a descriptive error message.