OmniRoute for Claude Code: Local AI Gateway Setup
OmniRoute is a free, MIT-licensed self-hosted AI gateway (diegosouzapw/OmniRoute) that puts one local endpoint in front of hundreds of providers (150+ marked with free-tier metadata) with quota-aware auto-fallback. For Claude Code, the supported path is omniroute launch, which injects ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN so the CLI talks to your gateway. Important: OmniRoute does not make paid Anthropic Claude free — “free” means routing to whichever upstream free tiers or credits you connect, under each provider’s own terms.
OmniRoute at a glance
| OmniRoute | |
|---|---|
| What it is | Self-hosted AI gateway: one endpoint, many providers, auto-fallback |
| Licence | MIT (official GitHub README) |
| Default local URL | localhost:20128 (Claude Code appends /v1/messages — do not put /v1 on ANTHROPIC_BASE_URL) |
| Works with | Claude Code, Codex, Cursor, OpenCode, Cline, Copilot (per README) |
| “Free” means | Upstream provider free tiers / credits you connect — not unlocked paid Claude |
Claude Code quick start (official docs)
From OmniRoute’s Claude Code configuration guide:
- Install and run OmniRoute; connect at least one provider that currently offers a model under its own free tier or credits (see the Free Tiers Guide in the repo).
- Create an OmniRoute API key from the dashboard Endpoints UI.
- Launch Claude Code through OmniRoute:
omniroute launch
# or generate per-model profiles first:
omniroute setup-claude
omniroute launch --profile <profile-name>
omniroute launch health-checks the server and sets:
| Variable | Purpose |
|---|---|
ANTHROPIC_BASE_URL |
Gateway root (no /v1 suffix) |
ANTHROPIC_AUTH_TOKEN |
OmniRoute access token (Authorization: Bearer …) |
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY |
Optional: list gateway models in /model |
Env vars are read once at Claude Code startup — restart after changes.
What “free Claude via OmniRoute” actually means
Community posts often imply OmniRoute gives free Claude. The project maintainers clarify the opposite:
- OmniRoute is a compatible gateway and router.
- Usage against your own Anthropic account, OAuth Claude subscription, or any paid key still consumes that account’s quota.
- Stacking multiple provider free tiers (with combo strategies like fill-first / round-robin) is the intended way to keep coding when one pool hits
429.
Always read each provider’s ToS, privacy policy, and quota before routing traffic.
Common pitfalls
- Claude Code ignores the gateway —
ANTHROPIC_BASE_URLmust not end with/v1; restartclaude. - Empty
/modelpicker — needs a recent Claude Code build +CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1; non-claude*/anthropic*ids may need discovery aliases orANTHROPIC_MODEL=<id>. - Ambiguous bare
claude-…ids — pin a prefixed model or enable OmniRoute’s “Prefer Claude Code for unprefixed Claude models” setting (see official docs).
What this page does not do
- No pirate Anthropic keys, cracked Claude subscriptions, or ToS-bypass tutorials.
- No ranking of “best free provider” — free catalogs change; use OmniRoute’s own Free Tiers Guide.
Frequently asked questions
Does OmniRoute make Claude Code free?
No. OmniRoute routes requests to providers you connect. Free only applies when the upstream model itself offers a free tier or credits under that provider’s terms.
How do I point Claude Code at OmniRoute?
Run omniroute launch (or set ANTHROPIC_BASE_URL to your gateway root without /v1 and ANTHROPIC_AUTH_TOKEN to your OmniRoute key). Official guide: omniroute.hagicode.com Claude Code configuration.
What is the default OmniRoute local URL?
localhost port 20128 — Claude Code appends /v1/messages itself.
Where is the official OmniRoute repo?
github.com/diegosouzapw/OmniRoute (MIT). Docs: omniroute.hagicode.com.