OmniRoute + Claude Code: setup, free-tier limits, and CCSub as a fallback provider
OmniRoute is an open-source local AI gateway that lets Claude Code use free tiers from many providers. How to install it, what ANTHROPIC_BASE_URL should be, the real limits of the free tiers, and how to add CCSub as an Anthropic Compatible provider that takes over when free quota runs out.
Copy-paste configuration
These are the three values the tool needs. Create the API key on the API Keys page of your CCSub dashboard.
- Provider type
Add Anthropic Compatible(on the Providers page of the OmniRoute dashboard)- Base URL
https://www.ccsub.net/v1(OmniRoute appends /messages itself)- Prefix
ccsub(models are then named ccsub/claude-sonnet-5)- API Key
sk-your-ccsub-key(added under Add Connection after the provider is created)
export ANTHROPIC_BASE_URL="http://localhost:20128"
export ANTHROPIC_AUTH_TOKEN="your-omniroute-key"
export ANTHROPIC_MODEL="ccsub/claude-sonnet-5"
claudeFor model, use an ID such as claude-sonnet-5 — the full list of model IDs is on the models page. No key yet? Create an account first.
Steps at a glance
- 1
Install and start OmniRoute
Requires Node.js. Run npm install -g omniroute, then start it with omniroute. The dashboard is at http://localhost:20128; omniroute setup runs a first-time wizard.
- 2
Create a CCSub API key
Sign up for CCSub, open the API Keys page in the dashboard, create a key and copy the sk- value.
- 3
Add an Anthropic Compatible provider in OmniRoute
In the dashboard go to Providers and click Add Anthropic Compatible: Name CCSub, Prefix ccsub, Base URL https://www.ccsub.net/v1, then save.
- 4
Add a connection to the provider
Open the new CCSub provider, click Add Connection, paste your CCSub key into API Key, save and run the connection test.
- 5
Point Claude Code at OmniRoute
Set ANTHROPIC_BASE_URL to http://localhost:20128 (no /v1), ANTHROPIC_AUTH_TOKEN to the key from the OmniRoute Endpoints page, and ANTHROPIC_MODEL to ccsub/claude-sonnet-5 or your combo name, then restart Claude Code.
- 6
Verify
Send a message in Claude Code. The OmniRoute dashboard shows which provider served it, and requests that went to CCSub also appear on the CCSub Usage page.
OmniRoute is an open-source local AI gateway (MIT licence, code on GitHub). It runs a service on your machine; Claude Code, Codex, Cursor and other tools send requests to it, and it routes them to providers by rules you set: use free tiers first, and move to the next provider when quota runs out or a request fails.
Most people searching for OmniRoute have seen a "use Claude Code for free" video. This guide covers three things: how to set it up, the real limits of the free tiers, and how to add CCSub as a paid fallback.
Install OmniRoute
Install Node.js first, then pick one method:
- npm (global)
npm install -g omniroutethen run omniroute to start it- Docker
docker run -d --name omniroute -p 127.0.0.1:20128:20128 -v omniroute-data:/app/data diegosouzapw/omniroute:latest- Dashboard
http://localhost:20128the API is at http://localhost:20128/v1
On first run, omniroute setup walks you through the basics and omniroute doctor runs a self-check. npm 11 and later may block install scripts; reinstall with the --allow-scripts list given in the OmniRoute README.
Point Claude Code at OmniRoute
Claude Code is configured through environment variables only; there is no base URL flag. Set three:
- ANTHROPIC_BASE_URL
http://localhost:20128no /v1; Claude Code appends /v1/messages itself- ANTHROPIC_AUTH_TOKEN
your OmniRoute keycopy it from the Endpoints page of the OmniRoute dashboard- ANTHROPIC_MODEL
provider-prefix/model, or a combo namefor example ccsub/claude-sonnet-5
If you would rather not set variables by hand, OmniRoute ships two commands:
omniroute launchstarts Claude Code with your current OmniRoute settings.omniroute setup-claudewrites per-model profiles to~/.claude/profiles/<name>/settings.json; start one withomniroute launch --profile <name>. Run it with--dry-runfirst to see which files it will write.
To pick OmniRoute models from the /model list, you need Claude Code v2.1.129 or later and CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1. The list only shows model IDs starting with claude or anthropic; set anything else with ANTHROPIC_MODEL.
Claude Code reads these variables once at startup. Quit and restart it after any change, or it keeps using the old address.
What "free" really means
OmniRoute itself costs nothing, but the free quota it routes to belongs to third parties:
- The numbers are estimates. The README's roughly 1.62 billion free tokens a month and 150+ free tiers are OmniRoute's own sum of other providers' free tiers, not quota it grants. Each provider sets its own quotas and rate limits and can change them at any time.
- A fresh install may have no usable route. The
automodel needs at least one eligible route. Right after install, before you connect any accounts, there may be none, and some keyless services reject third-party clients. - Some providers are off by default. Providers that OmniRoute flags as risky under their terms are excluded from automatic routing, even if you connect an account.
- Free models are not the model you are used to. Most free tiers serve other vendors' models. Whether Claude Code's tool calls and long contexts run reliably on them is something you need to test yourself.
In practice, small tasks often fit in free quota, while long tasks hit a limit or a rate cap halfway through. That is when you want a paid provider to take over, which is what the next section sets up.
Add CCSub as an OmniRoute provider
OmniRoute supports custom Anthropic Compatible and OpenAI Compatible providers, and CCSub works with both. Claude Code speaks the Anthropic format, so use the first:
- In the OmniRoute dashboard open Providers and click Add Anthropic Compatible.
- Fill in the form and save:
- Name
CCSubany label you like- Prefix
ccsubunique prefix used in model names- Base URL
https://www.ccsub.net/v1OmniRoute calls https://www.ccsub.net/v1/messages
- Open the new CCSub provider, click Add Connection, paste the key you created in the CCSub dashboard (it starts with
sk-) into API Key, save, and test the connection. - Models are now named
ccsub/model, for exampleccsub/claude-sonnet-5. All model IDs are on the models page.
To use GPT models through OmniRoute as well, add an Add OpenAI Compatible provider with the same Base URL https://www.ccsub.net/v1 and API type Chat Completions.
The two base URLs differ on purpose: Claude Code → OmniRoute has no /v1, OmniRoute → CCSub has /v1. In the first case Claude Code builds the path, in the second OmniRoute does, and they follow different rules.
Fall back to CCSub when free quota runs out
An OmniRoute combo is an ordered list of models. Use the priority strategy, put free models first and CCSub last:
omniroute combo create cc-fallback \
--strategy priority \
--targets <your-free-model>,ccsub/claude-sonnet-5
Then set Claude Code's ANTHROPIC_MODEL to the combo name, cc-fallback. When the providers ahead of CCSub run out of quota, get rate-limited or fail, requests land on CCSub and the task keeps going. You can also build the combo on the Combos page of the dashboard; use the target format your version's Combos page shows.
Check that it works
- The OmniRoute request log shows which provider served each request.
- Requests that went to CCSub also appear on the Usage page of the CCSub dashboard, with matching token counts and charges.
/statusinside Claude Code shows the address actually in use.
What it costs
OmniRoute is free; cost depends on which provider a request ends up at:
- Requests served from free tiers follow that provider's terms. They never reach CCSub and cost nothing on CCSub.
- Requests that reach CCSub are billed by CCSub's rules. Pay-as-you-go: ¥1 buys $1 of credit that never expires, charged per request by input / output tokens at the model's price (see the models page). Monthly plans: the day's quota is used first (it resets at midnight Beijing time) and then your balance.
- If OmniRoute token compression is on, fewer tokens reach CCSub and the charge drops with them.
- Requests that fail authentication (401) are not charged. Every request's tokens and charge are listed on the Usage page.
Who it is for
- People who want to use free quota first and only pay when it is not enough.
- People who use several model providers and want keys and routing rules in one place.
- If you just want Claude Code to work without running another local service, set two environment variables as in the Claude Code setup guide. To switch between services by hand, see the CC Switch guide.
Common errors and fixes
Claude Code ignores OmniRoute even though ANTHROPIC_BASE_URL is set
Cause:The URL ends in /v1, or Claude Code was not restarted. These variables are only read at startup.
Fix:Change the URL to http://localhost:20128 (no /v1), quit Claude Code and start it again; /status shows the address actually in use.
Auth error after launching a profile made by omniroute setup-claude
Cause:Profiles generated by setup-claude never store your OmniRoute key.
Fix:Start with omniroute launch --profile <name>, or export ANTHROPIC_AUTH_TOKEN=your-omniroute-key first.
The CCSub connection test returns 401 Invalid or disabled API key
Cause:The CCSub key under Add Connection is wrong, has a stray space, or has been disabled.
Fix:Check the key on the CCSub API Keys page, copy it again, then delete the old connection in OmniRoute and add a new one.
Requests routed to CCSub return 402
Cause:Both the daily plan quota and the pay-as-you-go balance on the CCSub account are used up.
Fix:Top up CCSub, or wait for the daily quota to reset at midnight Beijing time (UTC+8); any provider placed after CCSub in your combo takes over meanwhile.
For more error messages and what they mean, see the error troubleshooting index. Installation and network issues are covered in the troubleshooting docs (Chinese).
FAQ
Is OmniRoute free?
The software is MIT-licensed and free. The free tokens it advertises come from third-party free tiers; the README's figure of about 1.62 billion tokens a month is its own estimate across those tiers, not quota granted by OmniRoute. Each provider sets and changes its own limits and terms.
Should ANTHROPIC_BASE_URL include /v1?
Not when pointing Claude Code at OmniRoute: use http://localhost:20128 and Claude Code adds /v1/messages itself. When adding CCSub inside OmniRoute it is the other way round: the Base URL is https://www.ccsub.net/v1, because OmniRoute only appends /messages.
OmniRoute models don't show up in Claude Code's /model picker. Why?
You need Claude Code v2.1.129 or later with CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1. Even then the picker only lists model IDs that start with claude or anthropic; set any other model with ANTHROPIC_MODEL.
How is OmniRoute different from CC Switch?
CC Switch only rewrites each tool's config file; requests still go straight from the tool to the provider. OmniRoute is a gateway running on your machine that every request passes through, which is what lets it fail over when quota runs out, route by cost and compress tokens.
Can I skip the gateway and use CCSub directly?
Yes. Set ANTHROPIC_BASE_URL=https://www.ccsub.net and your CCSub key in Claude Code; see the Claude Code setup guide. OmniRoute makes sense if you want to mix free tiers with a paid provider.
Related setup guides
Need a CCSub API key?
Sign up, create a key in the dashboard, and paste the values above into your tool. Pay-as-you-go balance does not expire — you only pay for the tokens you use.