Keep Codex. Run the task to the end.
Point Codex at LunaRoute and it runs on open-weight models such as GLM 5.3, for a flat monthly price. Start with one session that writes no files at all — quit, and your Codex is exactly as it was. Make it permanent when you want it every time.
npx @lunaroute/cli login # once
npx @lunaroute/cli run codex # any sessionCan Codex use models other than OpenAI’s?
Yes. Codex takes its provider from configuration — command-line -c overrides, or a named profile — so LunaRoute can be attached for one session or permanently. LunaRoute speaks the Responses API that wire_api = "responses" selects, and answers with open-weight models such as GLM 5.3 and DeepSeek 4.1 Flash. OpenAI doesn’t support non-OpenAI models in Codex, so support for this setup comes from LunaRoute. See the Responses API.
Is this cheaper than a bigger ChatGPT plan?
No, and it isn’t meant to be. LunaRoute plans start at $99 a month — more than a basic ChatGPT plan and less than the top one — so this is not a way to spend less. It’s a way to keep the agent running.
ChatGPT plans meter how much Codex you get in a stretch of time. A LunaRoute plan doesn’t; it sets how many requests get priority scheduling at once. When those are busy your request waits in a queue, or runs at background priority — slower, and during a busy spell it can come back with a “try again shortly” error — but the month doesn’t run out on you. If your current plan already covers your week, keep it. This is for when it doesn’t.
What stays the same, and what changes
What stays the same
Codex itself. Your AGENTS.md, approval modes and sandbox, MCP servers and codex exec runs all work as they do now, and with the permanent setup your ~/.codex/config.toml is never touched — the LunaRoute profile is a separate file.
What changes
Two things. Requests go to open-weight models that LunaRoute runs on its own GPUs, and you pay for a number of priority concurrent requests per month instead of per token. One thing stops working: Codex’s own web search, which doesn’t run through LunaRoute.
Try it without writing anything
npx @lunaroute/cli run codex launches Codex with LunaRoute as the provider for that session only: the provider, the model catalog and the model are passed on the command line, the key goes into the child process environment, and no file is written. Quit, and your normal Codex is what you get next time.
It needs your stored login once (npx @lunaroute/cli login) and Codex already installed. --model starts on a specific model; everything after -- goes to Codex.
npx @lunaroute/cli login # once
npx @lunaroute/cli run codex # any sessionMake it permanent
One command writes one file — ~/.codex/lunaroute.config.toml, or under $CODEX_HOME if you set it — and Codex picks it up with --profile:
npx @lunaroute/cli setup codexcodex --profile lunarouteThe profile holds the provider, the model and Codex’s discovery settings:
model = "<id from the catalog>"
model_provider = "lunaroute"
[model_providers.lunaroute]
name = "LunaRoute"
base_url = "https://gw.lunaroute.com/v1"
model_catalog_url = "https://gw.lunaroute.com/v1/codex/models"
env_key = "LUNAROUTE_API_KEY"
wire_api = "responses"
[features]
api_key_model_discovery = trueThe key is not in that file. env_key makes Codex read it from the environment, so export LUNAROUTE_API_KEY=lr_… on Linux or macOS. On Windows the CLI prints the persistent user variable it supports — add it, then open a new window, because user-scope variables don’t reach shells already running.
model_catalog_url is what fills Codex’s /model picker with every LunaRoute model that can answer on the Responses API. Pick one with /model in a session, with --model <id> for one run, or by editing model in the profile. Model ids come from the live catalog — never a list copied from a page.
Full details, including how to verify without starting Codex, are in the Codex setup docs.
How do I undo it?
A run session never wrote anything, so quitting is the whole undo. The permanent setup is one file:
rm ~/.codex/lunaroute.config.tomlThen drop the LUNAROUTE_API_KEY export from your shell profile, and plain codex behaves exactly as it did before. There is no --remove for Codex, because there is nothing to restore: your config.toml was never modified. npx @lunaroute/cli logout removes the CLI’s own stored key too, if you want it gone.
How much does it cost to run Codex on LunaRoute?
You pay for a plan, not for tokens, and there is no monthly message cap. A retry loop that goes nowhere, a long context and a parallel branch don’t add to the bill, so a session’s cost doesn’t depend on how long the agent decides to run.
A cheap per-token API charges for every one of those, which is why the cost of an agent loop is hard to predict anywhere else. Web search is not part of this: Codex’s own search doesn’t run through LunaRoute (see the FAQ).
| Plan | Price per month | Priority concurrent requests |
|---|---|---|
| Pro | $99.00 | 2 |
| Max | $199.99 | 4 |
| Apex | $299.00 | 6 |
| Teams | $499.99 | 10, with per-member limits |
Your plan sets how many requests get priority scheduling. Extra requests run on overflow capacity automatically, at background priority, and may wait while it’s busy. A priority request waits up to 60 seconds for a free slot, and if none frees up it comes back with a 429 telling it when to try again.
Use both, one session at a time
Codex talks to one provider per session, and the permanent setup is a profile rather than a replacement, so the split is easy to control:
Keep your ChatGPT plan as the default and reach for LunaRoute when a task is long, repetitive or a branch you’d otherwise skip because of what it might cost.
your normal ChatGPT plan
codexthis session runs on LunaRoute
npx @lunaroute/cli run codexWork that fits LunaRoute well
- Agent runs that should reach the end of the task instead of stopping at a limit
- Several Codex sessions on their own branches at once
- codex exec jobs in scripts and CI, where a per-token bill is the thing you cannot predict
- Finding out how open-weight models do on your own repository before you commit
Where it’s not the right fit
- You rely on Codex’s own web search. It doesn’t run through LunaRoute (see the FAQ), and no setting turns it on.
- You need GPT models. LunaRoute runs open-weight models, and no configuration turns them into GPT. Try your repository on them first.
- You use Codex lightly. If your ChatGPT plan rarely runs out, the LunaRoute plan costs more than you are spending now.
How many priority requests does Codex use?
A concurrent request is one model call that is running right now. Requests waiting in a queue don’t count.
One Codex session makes one model call at a time, so it uses one concurrent request while it works and none while it waits for you. A second session on another branch is another one, and codex exec jobs are bursts rather than a permanent cost.
The Usage & Metrics page in your dashboard at app.lunaroute.com shows what percentage of the time your requests were queued and how long they waited. If both climb during your busy hours, add priority requests. Not sure where to start? See How much concurrency do I need?
Using other coding agents too? See Claude Code, Claude Desktop and the harness list.
Does LunaRoute keep my code?
No. Codex sends your instructions, your files and your command output with every request. On LunaRoute, prompts and responses are processed in memory and then discarded. We keep billing metadata (timestamps, model, token counts) and nothing else from the request, and we never use your data to train models. How zero data retention works
Codex questions, answered.
Run your next long task on LunaRoute
One session writes nothing, and one command makes it permanent.
npx @lunaroute/cli login # once
npx @lunaroute/cli run codex # any session