
CrazyRouter API Quick Start Guide
Welcome to Crazyrouter! This guide will help you integrate the API within 5 minutes and start using world-class AI models.
Why choose Crazyrouter?#
- Unified interface: Access 300+ AI models with a single API Key
- OpenAI compatible: No code changes needed, just replace the base_url
- Lower cost: More affordable than official pricing, pay-as-you-go with no subscription
- High availability: Intelligent routing with automatic failover
1. Get your API Key#
- Visit the Crazyrouter official site
- Register an account and log in to the console
- Go to the “Token Management” page
- Click “Create Token”
- Copy the generated API Key (starting with
sk-)
Tip: Keep your API Key safe and do not expose it in public.
2. Make your first request#
Using curl#
curl https://crazyrouter.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-api-key" \
-H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" \
-d '{
"model": "gpt-5.2",
"messages": [{"role": "user", "content": "Hello, how are you?"}],
"temperature": 0.7
}'
Using Python (recommended)#
from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://crazyrouter.com/v1"
,
default_headers={
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
}
)
response = client.chat.completions.create(
model="gpt-5.2",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello, how are you?"}
],
temperature=0.7,
max_tokens=1000
)
print(response.choices[0].message.content)
Using Node.js#
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'sk-your-api-key',
baseURL: 'https://crazyrouter.com/v1'
});
async function main() {
const response = await client.chat.completions.create({
model: 'gpt-5.2',
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Hello,Please introduce yourself' }
],
temperature: 0.7
});
console.log(response.choices[0].message.content);
}
main();
Streaming output#
from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://crazyrouter.com/v1"
,
default_headers={
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
}
)
stream = client.chat.completions.create(
model="gpt-5.2",
messages=[{"role": "user", "content": "Write a poem about spring"}],
stream=True
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
3. Supported models#
Crazyrouter supports 300+ AI models. Here are some popular ones:
| Vendor | Model examples | Features |
|---|---|---|
| OpenAI | gpt-5.2, gpt-5, gpt-4o, o3-pro, o3-mini | Strong overall capability, supports multimodality |
| Anthropic | claude-opus-4.5, claude-4, claude-sonnet-4 | Long context, strong coding ability |
| gemini-3.0-pro, gemini-3-flash, gemini-2.5-pro | Multimodal with strong reasoning capability | |
| xAI | grok-3, grok-3-mini, grok-3-vision | Real-time information and deep search |
| DeepSeek | deepseek-r1, deepseek-v3 | High cost-performance, excellent Chinese support |
View the full model list: Model Marketplace
4. Common parameter descriptions#
| Parameter | Type | Description |
|---|---|---|
model | string | Model name, e.g. gpt-5.2 |
messages | array | List of conversation messages |
temperature | number | Randomness, 0–2, default 1 |
max_tokens | integer | Maximum number of output tokens |
stream | boolean | Whether to use streaming output |
top_p | number | Nucleus sampling parameter, 0–1 |
5. Error handling#
from openai import OpenAI, APIError, RateLimitError
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://crazyrouter.com/v1"
,
default_headers={
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
}
)
try:
response = client.chat.completions.create(
model="gpt-5.2",
messages=[{"role": "user", "content": "Hello!"}]
)
except RateLimitError:
print("Too many requests. Please try again later.")
except APIError as e:
print(f"API error: {e}")
6. Next steps#
- Check Model Pricing to learn about the prices of different models
- Visit the console to manage your account
- Read the API documentation to learn more features
- Join the Discord community for help


