The right Codex alternative depends on why you’re leaving. If it’s other models, OpenCode is the closest swap: open source like Codex CLI, but with 75+ providers and local models. If it’s results, Claude Code is the one agent that scores above Codex on the public benchmark. If it’s usage limits, you may not need to switch at all. And if you like Codex, its native Windows sandbox and its ChatGPT plan, stay.
One thing to get right first: Codex CLI is already open source, under Apache-2.0. An “open-source Codex alternative” isn’t more open than Codex; it’s open source and free to use any model.
Why do people look for a Codex alternative?
- Usage limits. Codex on a ChatGPT plan shares one allowance with the rest of ChatGPT. Plus and Business have limits per rolling five-hour window, weekly limits can apply on top, and once they run out you buy credits or wait. See Codex pricing.
- It’s built around OpenAI’s models. Codex can use local models through Ollama or LM Studio, and other providers only if they speak OpenAI’s Responses API: that’s the only protocol its config accepts. You can’t point it at any provider that offers a standard chat endpoint.
- Windows friction. Codex runs natively in PowerShell with its own sandbox, which is more than most agents offer. But the recommended sandbox needs recent Windows 11 builds, the fallback needs administrator setup, and users report repeated elevation prompts. Dev servers started in the background stop when the command that started them exits.
- Approval prompts. In the default mode Codex asks before commands that leave the sandbox, and on a real task that adds up.
Can you fix it without switching?
Often.
For limits, use an API key instead of your ChatGPT plan. Usage is then billed per token at API rates and doesn’t touch your ChatGPT allowance. See Codex: API key vs subscription for when that’s cheaper.
For other models, run a local model:
codex --oss --local-provider ollama
Or add a provider that supports the Responses API to ~/.codex/config.toml:
model_provider = "myprovider"
[model_providers.myprovider]
name = "My provider"
base_url = "https://api.example.com/v1"
env_key = "MY_PROVIDER_API_KEY"
wire_api = "responses"
This only works in the user-level ~/.codex/config.toml. A project’s .codex/config.toml can’t set model_provider or model_providers, so a provider block in the repo is ignored.
For prompts, keep the sandbox and hand routine approvals to Codex’s reviewer:
codex --approve-for-me
That uses the workspace-write sandbox with an automatic reviewer. Don’t reach for --yolo instead: it removes the sandbox too. See YOLO mode.
On Windows, see Codex on Windows for the sandbox options, or run Codex in WSL if you need Linux tooling anyway.
The main Codex alternatives
| Tool | Open source | Models | Pick it if |
|---|---|---|---|
| OpenCode | Yes, MIT | 75+ providers; ChatGPT and Copilot sign-in; Ollama, LM Studio, llama.cpp | You want a terminal agent like Codex CLI with any model |
| Claude Code | No | Claude only | You want the top benchmark results and pay for Claude |
| Cline | Yes, Apache-2.0 | Many providers; can sign in with your ChatGPT plan | You want the agent in VS Code or JetBrains |
| Kilo Code | Yes, MIT; owned by Anaconda | 500+ models via Kilo Gateway, your keys, local | You want an IDE agent with a free-models option |
| GitHub Copilot | No | Many vendors through GitHub | You want a free tier, or your team is on GitHub |
| Contenox | Yes, Apache-2.0 | ChatGPT and Claude (through Claude Code) plans, Copilot unofficially; API keys; local | You want a Windows desktop app with readable permission rules |
You can keep paying for ChatGPT and still switch tools: OpenCode, Cline and Contenox all sign in with a ChatGPT plan.
Codex vs Claude Code
| Codex | Claude Code | |
|---|---|---|
| License | CLI: Apache-2.0 | Proprietary; public repo, all rights reserved |
| Models | OpenAI; local; Responses API providers | Claude only |
| Free plan | ChatGPT Free includes Codex | No; needs a paid Claude plan or Console account |
| Windows | Native, with a Windows sandbox | Native; sandbox only in WSL 2 |
| Terminal-Bench 4.0, best row | 58.18% (GPT-6 Astra, GPT-6.1 Sol) | 64.85% (Opus 5.5) |
| Surfaces | CLI, IDE extension, ChatGPT desktop app, cloud | Terminal, VS Code, JetBrains, desktop, web |
On the Terminal-Bench 4.0 leaderboard, Claude Code holds the top two rows. Codex’s best rows sit just above Claude Code with Fable 5.1 and a few points below Opus 5.5 and Sonnet 5.5. Each score has a margin of about 3 points, so treat them as close. Pick by which plan you already pay for and by platform: Codex does more natively on Windows.
Codex vs OpenCode
| Codex CLI | OpenCode | |
|---|---|---|
| License | Apache-2.0 | MIT |
| Models | OpenAI; local; Responses API providers | 75+ providers, local, OpenCode’s own model plans |
| Sign in with a plan | ChatGPT | ChatGPT Plus/Pro, GitHub Copilot |
| Windows | Native, with a Windows sandbox | Native install; docs recommend WSL |
| Interfaces | CLI, IDE extension, ChatGPT desktop app, cloud | Terminal, desktop app (beta), IDE extension |
| Read-only mode | --sandbox read-only | The plan agent (Tab to switch) |
OpenCode wins on model choice; Codex wins on Windows and on its sandbox. Both can sign in with ChatGPT, so you can try OpenCode on the same plan before you decide.
The Claude-plan gotcha: OpenCode can’t use a Claude Pro or Max subscription. Anthropic doesn’t allow it, and OpenCode removed those plugins in version 1.3.0. Use an Anthropic API key there.
Who should stay with Codex
- You pay for ChatGPT and its limits are fine for your work.
- You work on native Windows and want a sandbox without WSL.
- You use Codex’s cloud tasks or the ChatGPT desktop app alongside the CLI.
- You want an open-source agent and OpenAI’s models are the ones you use.
Contenox
Contenox is a free, open-source desktop app, built Windows-first. Sign in with your ChatGPT plan by device code, or add Claude, Copilot, API keys or a local model, and switch between them per session. The difference from Codex: what the agent may do without asking is a list of rules you can read in Permissions, not a reviewer model’s call. Builds, tests and read-only git run freely; edits and risky commands ask. On Windows, a sandbox limits writes to the project folder. Download it here.
Related guides
- Best AI coding agents: the full ranking with criteria
- Open source AI coding agents: license and status for each
- Codex API key vs subscription: the limits fix
- Codex on Windows: sandbox setup and its traps
- Claude Code alternative: the same question from the other side