Login
Back to Blog
English

CrazyRouter API Quick Start Guide

This article explains how to quickly integrate the Crazyrouter API, make your first call within 5 minutes, and use models such as OpenAI, Claude, Gemini, etc.

C
Crazyrouter Team
January 22, 2026 / 1050 views
Share:
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#

  1. Visit the Crazyrouter official site
  2. Register an account and log in to the console
  3. Go to the “Token Management” page
  4. Click “Create Token”
  5. 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#

bash
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
  }'
python
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#

javascript
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#

python
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:

VendorModel examplesFeatures
OpenAIgpt-5.2, gpt-5, gpt-4o, o3-pro, o3-miniStrong overall capability, supports multimodality
Anthropicclaude-opus-4.5, claude-4, claude-sonnet-4Long context, strong coding ability
Googlegemini-3.0-pro, gemini-3-flash, gemini-2.5-proMultimodal with strong reasoning capability
xAIgrok-3, grok-3-mini, grok-3-visionReal-time information and deep search
DeepSeekdeepseek-r1, deepseek-v3High cost-performance, excellent Chinese support

View the full model list: Model Marketplace

4. Common parameter descriptions#

ParameterTypeDescription
modelstringModel name, e.g. gpt-5.2
messagesarrayList of conversation messages
temperaturenumberRandomness, 0–2, default 1
max_tokensintegerMaximum number of output tokens
streambooleanWhether to use streaming output
top_pnumberNucleus sampling parameter, 0–1

5. Error handling#

python
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#


Implementation Guides

Related Posts

16|Claude Code with Crazyrouter Series 16: Chapter 13: Reusing Documentation to Solve Similar ProblemsClaude Code

16|Claude Code with Crazyrouter Series 16: Chapter 13: Reusing Documentation to Solve Similar Problems

16|Claude Code with Crazyrouter Series 16: Chapter 13: Reusing Documentation to Solve Similar Problems. This article covers unified integration, configuration checks, and hands-on workflows for Claude Code and Crazyrouter, helping readers follow the site documentation to build reusable development workflows.

Jun 10
Sora API: The Complete Guide to Building with OpenAI Video GenerationTutorial

Sora API: The Complete Guide to Building with OpenAI Video Generation

OpenAI's current Sora API is asynchronous and tier-based, not a fire-and-forget video button. The official guide recommends polling every 10 to 20 seconds, and Sora access is not available on the F...

Mar 26
OpenRouter vs Crazyrouter (2026): Pricing, Models, and Which API Gateway Fits Developers BetterComparison

OpenRouter vs Crazyrouter (2026): Pricing, Models, and Which API Gateway Fits Developers Better

Practical comparison of OpenRouter and Crazyrouter for developers: pricing, model availability, OpenAI compatibility, coding tool support, video/image/music APIs, and regional access.

Apr 18
Kimi K2 API Pricing Guide: Moonshot AI Costs, Token Limits & Budget Optimization 2026Guide

Kimi K2 API Pricing Guide: Moonshot AI Costs, Token Limits & Budget Optimization 2026

"Complete Kimi K2 API pricing breakdown — input/output token costs, context window pricing, rate limits, and how to optimize spend on Moonshot AI's reasoning model with Crazyrouter routing."

Apr 13
AI API Pricing Comparison: How to Choose the Most Cost-Effective Model Stack in 2026Comparison

AI API Pricing Comparison: How to Choose the Most Cost-Effective Model Stack in 2026

At 1M tokens per month, GPT-4 costs $30 on the official API and $21 on Crazyrouter, which is a $108 yearly gap for one steady workload (pricing table, updated 2026-03-06). That number gets attentio...

Mar 18
How to Get a Claude API Key in 2026: Production Setup, Rotation, and Team AccessTutorial

How to Get a Claude API Key in 2026: Production Setup, Rotation, and Team Access

Learn how to get a Claude API key safely in 2026, including account setup, secrets rotation, team access, and production best practices.

Mar 25