OpenAI's Codex agent is free on every ChatGPT plan as of May 14, 2026 — including the $0 tier — but its rate limit walls mid-build when you push it hard. The fix that actually works in 2026 is to run Codex through a multi-provider AI gateway with auto-fallback: one local endpoint that routes each request across 237+ upstream providers, hops to the next free tier the moment one caps out, and compresses tokens 15–95% before the request leaves your machine. Adopt this and Codex keeps building all day instead of dying at the 5-hour rolling window.
Last verified: 2026-07-30 · Codex free access confirmed on all ChatGPT tiers · OmniRoute at 237+ providers (90+ with a free tier, 11 free-forever) · Pricing/limits change often — last checked 2026-07-30.
TL;DR — five bullets that answer the whole article
- Codex is free, but metered. OpenAI included it across Free, Go, Plus, Pro, Business, Edu, and Enterprise plans; free users get roughly 15–80 local tasks per rolling 5-hour window. (OpenAI Codex help page, freeainews.com).
- Codex CLI is open source and MIT/Apache-2.0 licensed, released April 16, 2025, now 95.6% Rust. You can point it at any OpenAI-compatible endpoint. (github.com/openai/codex)
- A multi-provider gateway is the missing link. Self-hosted routers like OmniRoute or 9router sit between Codex and the upstream LLM, exposing one
localhostendpoint, picking the cheapest/free provider first, and hopping to the next when one hits a rate limit. (OmniRoute on GitHub, 9router on GitHub) - Auto-fallback is what makes "free" viable for serious builds. OmniRoute aggregates 1.53 billion free tokens per month across 90+ free-tier providers; when one caps out, the next free provider picks up in milliseconds. (pyshine.com OmniRoute deep dive)
- Caution before you ship it. Multi-provider routing mixes model quality, vendor reliability, and data routing — confirm your gateway's TLS/stealth stack and credential encryption before pointing it at production code. (OmniRoute security model)
Is OpenAI Codex actually free in 2026?
Yes, on every ChatGPT plan. OpenAI quietly rolled Codex out to the Free tier on May 14, 2026, alongside the Codex Mobile launch on iOS and Android. The company's Codex help page explicitly lists "Free" first, with no waitlist, no credit card, and no asterisk attached. (freeainews.com, eesel.ai).
What "free" buys in practice:
| Plan | Price | Codex cap | Notable limits |
|---|---|---|---|
| Free | $0 | ~15–80 local tasks / 5h | No cloud tasks, no GitHub code review |
| Go | $8/mo | Higher limits | API key billing optional |
| Plus | $20/mo | Expanded | Cloud tasks, Slack, GitHub PR review added |
| Pro 5x | $100/mo | 5× Plus | 10× rate limits |
| Pro 20x | $200/mo | 20× Plus | Maximum capacity |
Source: OpenAI Codex pricing page, eesel.ai, agentdeals.dev.
The asterisk is capacity. The free tier is brilliant for learning, debugging, and one-off scripts; it caps out the moment you start multi-hour agentic builds — exactly the workflow Codex CLIset was built for. That's where the gateway comes in.
What is the Codex CLI, and why does that matter?
The Codex CLI is the piece worth knowing here. It's the terminal-native command-line agent OpenAI released on April 16, 2025, Apache-2.0 licensed, now rewritten in Rust (95.6% of the codebase by April 2026). Install it with npm i -g @openai/codex or brew install --cask codex, and the same agent will read files, edit code, run shell commands in a sandbox, and complete multi-step coding tasks against any OpenAI-compatible endpoint. (augmentcode.com v0.116.0 analysis, developers.openai.com/codex/cli, Wikipedia OpenAI Codex (AI agent))
The key fact for this guide: the CLI doesn't care who's behind the endpoint. It talks to OpenAI's API by default, but only because OpenAI's API is what it points at by default. Change the base_url and it will talk to anything OpenAI-compatible. That's the wedge a multi-provider gateway exploits.
If you've already gone down the rabbit hole of how to run the Codex CLI for free with a local workflow, this article is the next chapter — moving from "free with limits" to "free all day."
How does a multi-provider gateway keep Codex running free?
A multi-provider gateway is a local-first router that exposes one OpenAI-compatible endpoint on your machine (typically http://localhost:20128/v1) and routes each request upstream across dozens or hundreds of LLM providers behind the scenes. For Codex CLI users, this means:
- You install the gateway, point Codex's
model/base_urlatlocalhost:20128, and forget it. - The gateway picks the cheapest or free provider first, sends your prompt upstream, and returns the response.
- If a provider returns 429 (rate-limited) or 5xx, the gateway silently hops to the next provider in its configured chain — without breaking the agent's turn.
- When the agent finishes its task, the gateway logs which provider served it, the tokens used, and the cost saved, so you can see exactly what free capacity you used.
This is precisely the workflow we already covered conceptually in our free OpenAI Codex paths guide — gateway routing is the structure that makes the "route to free providers every time" actually repeatable.
The two open-source gateways most worth knowing in 2026:
| Gateway | GitHub stars | Providers | Free-tier providers | Routing strategies | License |
|---|---|---|---|---|---|
| OmniRoute | ~12,500 (and growing ~4,500/wk) | 237+ | 90+ free tiers, 11 free-forever | 17 (incl. auto-combo, cost-optimized, fusion) | MIT |
| 9router | 13,400 | 45+ (3 tiers) | Kiro AI, OpenCode Free, Vertex AI credits | 3-tier fallback (subscription → cheap → free) | MIT |
Sources: OmniRoute repo, pyshine.com OmniRoute deep dive, 9router repo, themenonlab.blog 9router guide.
OmniRoute: the most comprehensive open-source AI gateway
OmniRoute (MIT-licensed, self-hosted on your machine — no third-party router sees your prompts) is the most feature-rich option right now. Its documented scope as of July 2026:
- 237+ upstream providers behind a single OpenAI-compatible endpoint. (OmniRoute repo)
- 90+ providers with a documented free tier, 11 free-forever providers, aggregating to roughly 1.53 billion free tokens per month total — a metric the dashboard shows live at
/dashboard/free-tiers. pyshine.com - 17 routing strategies including the auto-combo engine that scores providers live across latency, cost, quota, and error rate, then routes through subscriptions first → API keys → free tiers as a default chain. Sub-millisecond provider switching on failure.
- RTK + Caveman stacked compression that cuts token usage by 15–95% before the request ever leaves your machine — at an ~89% average, a 10,000-token prompt gets served by a 1,080-token request to the provider. That means even when you do burn paid tokens, you burn less.
- Built-in MCP server with 95 tools and an A2A (agent-to-agent) protocol, so you can also surface the gateway to other agents programmatically. pyshine.com
- Per-request cost ceiling via the
X-OmniRoute-Budgetheader — if no provider can satisfy a request within your budget, it routes to a free provider instead.
This is the right pattern for a workflow where you want Codex "planning, writing, and running commands for hours" without burning your monthly credits or getting stopped at the wall.
For readers who already run an agent OS at home (see our Hermes Agent + Obsidian free agent OS guide), OmniRoute slots in as the model-routing layer underneath Codex.
9router: the simpler three-tier alternative
If OmniRoute's surface area is too much, 9router is the lighter option. It's also MIT-licensed, runs locally on Node, and exposes a similarly simple OpenAI-compatible endpoint on localhost:20128. The key difference: it ships a three-tier fallback chain instead of 17 routing strategies:
- Subscription tier — your paid API keys (Anthropic, OpenAI, etc.). Used first when within budget.
- Cheap tier — lower-cost providers like DeepSeek, Groq, Together AI. Falls back here when subscription quotas run out.
- Free tier — providers like Kiro AI, OpenCode Free, and Vertex AI (which throws in $300 of free credits per new account).
Each tier supports multi-account round-robin, so if one API key hits a rate limit, the next in the pool picks up. For solo builders who measure the value of their agent stack in "did the build finish?" rather than "which routing strategy won?", 9router is the quicker install. (9router repo, themenonlab.blog))
Step-by-step: how to wire Codex to OmniRoute in 2026
Heads up: this is the path that takes ~10 minutes if you're comfortable in a terminal. The trade-off is that you're introducing a new component between Codex and the upstream model — which means now would be a smart moment to revisit our six-step AI agents productivity workflow, since gateways slot most cleanly into step 2 of that system.
1. Install Codex CLI (open source, Apache-2.0). Pick one install path:
npm i -g @openai/codex # Node.js
brew install --cask codex # macOS
curl -fsSL https://chatgpt.com/codex/install.sh | sh
Source: OpenAI Codex CLI docs, github.com/openai/codex.
2. Install OmniRoute (MIT-licensed, self-hosted):
npm install -g omniroute
omniroute # serve gateway + dashboard on port 20128
omniroute setup # first-run wizard
omniroute doctor # diagnose providers/ports/health
Verify at http://localhost:20128 — the dashboard should list ~237 providers (OmniRoute repo, CLI section).
3. Connect a free-tier provider. In the dashboard's Providers page, add one or more free-tier providers (Kiro, OpenCode Free, Pollinations, LongCat are common in the auto-combo's "$0 Free Stack" combo). You don't have to enter paid API keys at all to get a working free path. pyshine.com
4. Configure the auto-combo (or write your own combo). Open the Combos page, switch your default to auto, and let OmniRoute score providers across latency, cost, quota, and error rate. The auto-combo tries subscriptions first, then API keys, then free tiers — falling over to the next on failure.
5. Point Codex at the gateway. Set your Codex environment so its base_url is the local gateway rather than OpenAI:
OPENAI_BASE_URL=http://localhost:20128/v1
OPENAI_API_KEY=your_omniroute_token
(The gateway issues its own scoped tokens via omniroute tokens create --name codex --scope read.)
6. Run a normal Codex session. Launch codex and ask it to plan, edit files, run tests, open a PR. The agent is unchanged — only the backend differs. Monitor the gateway's dashboard to confirm which providers served the requests and how much you (would have) paid per session. OmniRoute repo, CLI section
Can you really run Codex "all day" for free?
In the optimistic sense — yes. The bottleneck Codex hits in normal free-tier use is the 5-hour rolling window limit on a single ChatGPT plan. A multi-provider gateway sidesteps this by adding N other providers' free tiers as fallbacks, exhausting each one in sequence before returning to OpenAI's quota. With 11 free-forever providers and 90+ free-tier providers aggregated, OmniRoute's documented free-tier budget is roughly 1.53 billion tokens/month — for a developer whose daily Codex session burns 50–100k tokens, that's effectively unlimited. pyshine.com
But two caveats matter — and they keep this from being a "free forever, no asterisk" story:
- Model quality varies. Your
autocombo's free tier includes models from smaller labs that may not match GPT-5.3-Codex on multi-file refactors. Keep your primary subscription in the chain (or a paid API key) so quality-sensitive requests ride the paid tier; let free tiers soak up the easy edits. - Reliability is your problem. Free providers cap, rate-limit, and disappear. The fallback protects against the cap, but not against a provider going dark long-term. The auto-combo tries subscriptions first because that's where stability is — only use the "free only" path if you understand that uptime is approximate.
For serious autonomous loops (long-horizon agent runs), don't rely on a pure-free stack in production. Check our long-horizon agent evaluation guide for the patterns that hold up.
What this means for you
- If you just want to learn Codex: free ChatGPT tier is enough. Sign in at chatgpt.com, open the Codex web app or install the CLI / VS Code extension, and stop there.
- If you're a solo developer hitting the wall: install OmniRoute or 9router, configure 2–3 free-tier providers, point Codex's
base_urlatlocalhost, and only fall back to paid tokens when quality/cost actually demands it. The setup is one afternoon; the payoff is being able to run goal-mode loops for hours without opening your wallet. - If you're a team: don't put production traffic on the pure-free stack. Run Codex on a paid tier, then add a gateway for plan-cost spike protection — the model-quality floor and reliability floor in a small business workflow both matter more than free tokens. For the patterns that hold up under load, see our production-scale agent evaluation guide.
FAQ
Q: Is OpenAI Codex free in 2026? A: Yes. Codex is included across every ChatGPT plan — Free, Go, Plus, Pro 5x, Pro 20x, Business, Edu, and Enterprise — per OpenAI's help page. Free users get roughly 15–80 local coding tasks per rolling 5-hour window. Cloud features (GitHub code review, Slack, persistent cloud tasks) start at Plus ($20/mo). No credit card needed to start.
Q: Is the Codex CLI itself free?
A: Yes. The Codex CLI is open-source software released on April 16, 2025 (github.com/openai/codex), Apache-2.0 licensed, now 95.6% Rust. npm i -g @openai/codex installs it. Model usage still costs either your ChatGPT plan credits or per-token API billing — the CLI is the interface; the API is the billing layer.
Q: What is a multi-provider AI gateway?
A: A local-first router that exposes one OpenAI-compatible endpoint (e.g. http://localhost:20128/v1) and routes each request upstream across dozens or hundreds of LLM providers behind the scenes. Examples include OmniRoute (237+ providers, MIT) and 9router (45+ providers, MIT). It handles fallback when one provider caps, format translation between providers, token compression, and usage logging. OmniRoute repo, 9router repo
Q: Will auto-fallback really let me run Codex all day on free tiers? A: In the optimistic case — yes, but with caveats. OmniRoute aggregates roughly 1.53 billion free tokens/month across 90+ free-tier providers (11 free-forever), so aggregated supply exceeds any one developer's daily usage. The caveat is that free-tier model quality varies; keep a paid API key in your chain for quality-sensitive work, and treat pure-free routing as a stretch run, not a production stack. pyshine.com
Q: Does routing Codex through a gateway violate OpenAI's terms of service? A: The OpenAI API Terms of Use prohibit reselling, sharing, or using OpenAI API endpoints to build a competing proxy offering — not personal routing for your own usage. A self-hosted gateway that splits your own usage across your own API keys and other providers' free tiers is consistent with the public ToS language as of July 30, 2026. Verify against the current ToS before you ship anything in a team setting; ToS shifts are volatile facts and we re-check monthly. OpenAI API Terms of Use
Q: What's the difference between OmniRoute and OpenRouter? A: OpenRouter is a cloud-based gateway with approximately 300 providers; it charges a per-token markup on top of provider pricing. OmniRoute is self-hosted and free — you pay only the providers directly, with no intermediary markup. OmniRoute also adds token compression (15–95%), an MCP server with 95 tools, A2A protocol, and 17 routing strategies versus OpenRouter's 1–3. pyshine.com OmniRoute vs OpenRouter section
Q: Can I use this approach with Claude Code or Cursor too? A: Yes. Both gateways expose an OpenAI-compatible endpoint but also handle Claude API-format requests. The 9router guide documents setup for Claude Code, Cursor, Codex, and Cline. themenonlab.blog For more on Claude Code specifically, see our Claude Opus 5 enterprise cost strategy guide.

Discussion
0 comments