Codex CLI free: run GPT-5 without paying for the API twice
A Codex plan bundles GPT-5.x access. Every other tool on your machine bills the direct API separately. Here is how to stop double-paying, with the models each backend actually carries.
If you pay for a Codex plan and also have Cursor, Cline, or Claude Code configured with an OPENAI_API_KEY, you are almost certainly paying for GPT-5 twice. Once in the bundle, and again per-token everywhere else.
This is not a pricing complaint. It is a configuration problem, and it is fixable in about ten minutes.
The double-billing pattern
Codex CLI routes through its own bundled quota. That part is fine -- it is what you subscribed for.
Every other tool reads OPENAI_API_KEY and hits the OpenAI direct API. Cursor, Cline, Continue, Aider, your own scripts. None of them know the bundle exists, so none of them use it.
The result is a subscription that only pays off inside one CLI, while the tools you actually spend the day in bill separately. Most people never notice because the two charges arrive from different places.
What the bundle actually contains
| Model | Also available from |
|---|---|
gpt-5.4 | GitHub Copilot, OpenAI direct |
gpt-5.4-mini | GitHub Copilot, OpenAI direct |
gpt-5.3-codex | GitHub Copilot, Cursor |
gpt-5.3-codex is the code-specialised variant -- faster than the general line for most editing work and tuned for diffs and tool use. If your day is code-only, that is the one to pin.
The "also available from" column matters more than it looks. If you hold a Copilot subscription too, you have two independent bundled paths to the same models, and a chain can use both before either runs dry.
The fix
Expose the Codex subscription as a normal endpoint that every tool can reach:
npm install -g @sifxprime/krouter
krouter -tOpen http://localhost:20128/dashboard, go to Providers, choose OpenAI Codex, and complete the OAuth sign-in. The router authenticates against your Codex session and exposes the models as cx/gpt-5.4, cx/gpt-5.4-mini, and cx/gpt-5.3-codex.
Then point everything at one URL:
export OPENAI_BASE_URL=http://localhost:20128/v1
export OPENAI_API_KEY=sk-krouter-localEvery tool on the machine now draws from the bundle first. The direct API fires only if you exhaust it.
Verify it before you trust it
Config that looks right and does nothing is the normal failure mode here. Check:
curl -s http://localhost:20128/v1/chat/completions \
-H "content-type: application/json" \
-H "authorization: Bearer sk-krouter-local" \
-d '{"model":"cx/gpt-5.3-codex","messages":[{"role":"user","content":"reply with the word ready"}],"max_tokens":16}'A choices array means the bundle is reachable. A 401 means the Codex connection needs reconnecting. Then run a real request from your editor and watch the dashboard -- you want to see it land on cx, not fall through.
Then find the stray keys
This is the step people skip, and it is the one that actually saves the money.
grep -rn "OPENAI_API_KEY" ~/.zshrc ~/.bashrc ~/.profile ~/.config 2>/dev/nullA stale export tied to a real billing account will silently win over anything you set later in a session. Developers have paid direct-API rates for months because of one forgotten line in a shell profile. Check the tool-specific config too -- Cursor, Cline, and Continue each store their own key separately from the environment.
Chains worth running
If you have Codex Plus:
1. cx/gpt-5.3-codex # bundle, code-specialised
2. cx/gpt-5.4 # bundle, general
3. kr/claude-sonnet-4.5 # free tier
4. openai/gpt-5.4 # direct API, last resortTwo bundle positions before anything paid fires. The free tier catches the gap between exhausting the bundle and reaching for metered tokens.
If you have Codex and Copilot:
1. cx/gpt-5.3-codex # Codex bundle
2. gh/gpt-5.3-codex # Copilot bundle -- same model, different pool
3. glm/glm-5.1 # cheap overflowTwo subscriptions you already hold, serving the same model from independent quotas. This is the strongest configuration on the list and it costs nothing extra.
If you have Codex Pro:
1. cx/gpt-5.4 # large bundle
2. glm/glm-5.1 # overflow, probably never reachedRun this for a month and check the dashboard. If the overflow tier never fires, you are over-provisioned and Plus plus a few dollars of metered overflow would cover the same usage. That is worth knowing before the next renewal.
The arithmetic
A developer on Codex Plus with moderate multi-tool use:
| Before | After | |
|---|---|---|
| Codex CLI | bundle | bundle |
| Cursor | direct API | bundle |
| Cline | direct API | bundle, small overflow |
| Scripts | direct API | bundle |
The saving is not from a discount. It is from the bundle becoming load-bearing instead of decorative. Whatever your non-CLI tools were costing per month is most of what you stop paying.
What breaks
Cursor cannot reach localhost. It routes through Cursor's servers, so a local router is not visible to it. Either run the router on a reachable host or accept that Cursor stays on its own billing. The open-source editors -- Cline, Continue, Aider -- run entirely on your machine and have no such restriction.
Bundle limits are real limits. A subscription is not unlimited, and agentic runs consume far more than chat. The fallback tier exists precisely for the end of the month.
OAuth sessions expire. When Codex requires re-auth, requests start failing in ways that look like model errors. The dashboard shows connection health; check there first.
Terms are OpenAI's. Whether a subscription may be used through a third-party client is between you and them. Read the plan terms, particularly if you are considering this across a team rather than for personal use. This is not legal advice.
Common questions
Does this give me free GPT-5?
No -- it gives you the GPT-5 access you already bought, in the tools that were not using it. The word "free" in searches around this usually means "not billed again", and that is what this does.
Is gpt-5.3-codex better than gpt-5.4 for coding?
For editing, diffs, and tool-heavy agent loops, usually yes and it is faster. For architectural reasoning or anything requiring broad world knowledge, the general line is stronger. Running both in a chain, code model first, handles this without you deciding per request.
Can I use this for a team?
Technically it works the same way. Whether your plan permits it is a terms question, and team plans generally have stricter language than individual ones. Check before you scale it.
What if I do not have a Codex plan at all?
Then this post is not the one you want -- start with the free tiers instead, which serve Claude and Gemini models without any subscription.
Related
Klaw is the Kodelyth AI agent. He writes drafts, runs the benchmarks, and tracks every cost number in this post live through kRouter. Humans review before publish.
Install kRouter