CLI · TOOLING
Claude Code for $0? Use OmniRoute
OmniRoute is a gateway you run locally. It puts one endpoint in front of a lot of model providers, many with free tiers — and Claude Code takes its base URL from config, so you point it at the gateway instead of at Anthropic. That is where the $0 comes from: not a discount, a different model answering.
The configuration below comes from OmniRoute’s
README and its
Claude Code configuration guide.
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, the oc/ model IDs and the checks
in step 5 are my additions, not from those documents. Where a write-up I found
disagrees, I say so and why it matters.
Docs last checked on 31 October 2026. OmniRoute moves quickly, so trust your dashboard over this page.
Prerequisites
node -v # 22.x, 24 LTS (recommended), 25.x or 26.x
claude --version # npm i -g @anthropic-ai/claude-code (2.1.219+ for the model picker)
1. Install and start
npm install -g omniroute
omniroute
| Surface | URL |
|---|---|
| Dashboard | http://localhost:20128 |
| API endpoint | http://localhost:20128/v1 |
Do not assume auto works straight away. OmniRoute’s README says it “needs an
eligible route”, that a fresh installation “can have no eligible keyless
targets”, and that a keyless provider may reject third-party clients. Check the
dashboard after installing. If no route is available, connect a provider from
the Free Tiers Guide,
which may mean signing up for a free account. OmniRoute itself costs nothing
either way.
2. Create your gateway key
The gateway authenticates its own endpoint, so you need a key before Claude Code can talk to it.
Dashboard → Endpoints → generate. Copy it; it looks like oma_live_….
3. Configure Claude Code
Add this to ~/.claude/settings.json. ANTHROPIC_MODEL sends every request to
auto, which picks from whatever you have connected:
{
"env": {
"ANTHROPIC_BASE_URL": "http://localhost:20128",
"ANTHROPIC_AUTH_TOKEN": "oma_live_xxx",
"ANTHROPIC_MODEL": "auto",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1"
}
}
The last line lets Claude Code’s /model picker list gateway models, on v2.1.219
or later. Only IDs starting with claude or anthropic appear there. Claude
Code reads env once, at startup — restart it.
If you would rather skip the manual edit, the guide says omniroute launch sets
these values for you.
Pinning specific models, optionally
To bind Claude Code’s Opus/Sonnet/Haiku tiers to particular models, remove
ANTHROPIC_MODEL and add these three. Use IDs from a provider you actually have — the free ones were prefixed
oc/ when I wrote this, and pasting a glm/ or kmc/ ID from a guide will fail with a 401
because those are paid providers you have not connected:
{
"env": {
"ANTHROPIC_DEFAULT_OPUS_MODEL": "oc/deepseek-v4-flash-free",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "oc/deepseek-v4-flash-free",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "oc/deepseek-v4-flash-free"
}
}
Model IDs move. Take the exact strings from your dashboard’s model list, not from here.
No /v1 on the base URL
Claude Code appends /v1/messages itself, so the base URL is the gateway
root. At least one popular write-up shows http://localhost:20128/v1; that
resolves to /v1/v1/messages. OmniRoute’s configuration guide says to omit the
suffix and that otherwise Claude Code “ignores the gateway”, so it can keep
working against Anthropic while you keep paying.
4. Verify the endpoint
curl http://localhost:20128/v1/models \
-H "Authorization: Bearer oma_live_xxx"
A JSON list means the endpoint and the key are both good. It is also where you read the real model IDs for the optional block above.
5. Prove it is actually routing
That only proves the gateway is up. It does not prove Claude Code is using it, and the failure mode above is silent. Two checks that cannot lie:
- Run
/statusin Claude Code. The API base URL should readlocalhost:20128, notapi.anthropic.com. - Stop the gateway —
Ctrl-Cin theomnirouteterminal — and send a prompt. Claude Code should fail to connect. Start it again; the prompt works.
If the second check answers normally with the gateway down, you are still on Anthropic’s API and still being billed.
If something breaks
| Symptom | Cause |
|---|---|
| Works, but still billed | /v1 left on the base URL, or Claude Code not restarted |
auto finds no route |
No eligible provider yet — connect one from the Free Tiers Guide |
400 Ambiguous model |
Use a prefixed ID, e.g. cc/claude-opus-4-8 |
401 on a specific model |
That provider is not connected — pick one from /v1/models |
401 from the gateway |
Key missing or not the one from Dashboard → Endpoints |
| Connection refused | omniroute is not running, or something took port 20128 |
Free is a price, not a policy
You are routing prompts — which for a coding tool means your source — through providers whose terms you have not read. Free tiers are often free because the traffic is worth something to somebody. Side projects and learning: fine. An employer’s codebase: check first.