Authentication
All requests require an Claudexia API key.
API key format
sk_cdx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxSupported auth headers
Anthropic-style requests
Use x-api-key:
bash
curl https://api.claudexia.tech/v1/messages \
-H "x-api-key: sk_cdx_YOUR_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"max_tokens": 256,
"messages": [{"role": "user", "content": "Hi"}]
}'OpenAI-style requests
Use Authorization: Bearer:
bash
curl https://api.claudexia.tech/v1/chat/completions \
-H "Authorization: Bearer sk_cdx_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"messages": [{"role": "user", "content": "Hi"}]
}'Both methods work on the main API. The gateway checks x-api-key first and then falls back to Authorization: Bearer.
Per-key controls
Open Dashboard > API Keys to choose Premium, Cheap, or Cheap + Premium fallback. New keys default to Premium. The channel is stored on the key; changing a catalog tab does not change an existing key.
| Setting | What it does |
|---|---|
| Name | Identifies the key in your dashboard |
| Premium | channel=premium, fallback_premium=false. This is the default. |
| Cheap | channel=cheap, fallback_premium=false. Uses the Cheap channel only. |
| Cheap + Premium fallback | channel=cheap, fallback_premium=true. Allows the provider to use Premium under its channel policy; Premium rates may apply. |
| Expiry | expires_at sets a future expiry date; omit it when creating a key without an expiry |
| Usage | Shows recent requests, tokens, and customer cost. Per-key budget, IP, IDE, and model restrictions are not configurable through this key API. |
| Streaming | Requests stream when the client sends "stream": true; send "stream": false for non-streaming |
Security tips
- Keep separate keys for personal use, apps, and automation
- Delete keys you no longer use
- Choose Cheap without fallback when you do not want to allow Premium routing
- Set an expiry for temporary integrations
- Monitor per-key usage from the dashboard