Change one line. Get 26 models.

ModelRouter is OpenAI-compatible. Point any SDK at your ModelRouter URL.

Integration
# Before (direct OpenAI) from openai import OpenAI client = OpenAI(api_key="sk-...") # After (through ModelRouter) from openai import OpenAI client = OpenAI( base_url="https://gratefully-stunning-skylark.edgecompute.app/v1", api_key="YOUR_MODELROUTER_KEY" )
// Before import OpenAI from 'openai'; const client = new OpenAI({ apiKey: 'sk-...' }); // After import OpenAI from 'openai'; const client = new OpenAI({ baseURL: 'https://gratefully-stunning-skylark.edgecompute.app/v1', apiKey: 'YOUR_MODELROUTER_KEY' });
# Before curl https://api.openai.com/v1/chat/completions \ -H "Authorization: Bearer sk-..." # After curl https://gratefully-stunning-skylark.edgecompute.app/v1/chat/completions \ -H "Authorization: Bearer YOUR_MODELROUTER_KEY"
Behind the Scenes

What happens when you send a request

Every request passes through six stages at the Fastly edge, all in under 50ms of overhead.

1
Authenticate
Bearer token validated against Fastly Secret Store. Invalid keys rejected instantly.
2
Injection Scan
30+ regex patterns check for prompt injection, jailbreak attempts, and system prompt extraction.
3
Rules Engine
Custom DLP rules run: block PII, SSNs, source code, or any pattern you define.
4
Cache Check
SHA-256 hash of the prompt checked against KV Store. Cache hits return in <5ms.
5
Classify
Request classified into a tier: fast, balanced, quality, reasoning, code, vision, or embedding.
6
Route
Best available model selected based on tier, cost, latency, and provider health.
Response Headers

Headers you get back

Every response includes metadata headers so you can see exactly what ModelRouter did.

X-ModelRouter-Provider Which provider handled the request (e.g., openai, groq, anthropic)
X-ModelRouter-Model Exact model used (e.g., gpt-4o-mini, llama-3.3-70b-versatile)
X-ModelRouter-Tier Routing tier applied: fast, balanced, quality, reasoning, code, vision, embedding
X-ModelRouter-Cached true if response came from edge cache (KV Store), saving you LLM costs
X-ModelRouter-Latency Total round-trip time in milliseconds, including edge processing
X-ModelRouter-Injection clean or the specific pattern that was detected and blocked

All headers are opt-in visible. They never expose API keys or internal routing logic to end users. Use them for observability, debugging, and audit compliance.

Get Started

Ready to route?

Create an account and start sending requests in under two minutes.