Claude Code vs Codex vs Cursor vs OpenCode (October 2026): Price, Models, Open Source and Which to Use
On this page
Short answer: pick Claude Code if you want Claude models and the deepest agent features, from a $20 Claude Pro plan that now defaults to Opus 5.5. Pick Codex if you already pay for ChatGPT, want an open-source CLI, or want cloud tasks and automatic code review. Pick Cursor if you want a full editor with Tab completion, but note that Claude and GPT now cost extra on top of its $30 Premium plan. Pick OpenCode if you want free, open-source software that works with almost any model provider.
All four read your code, edit files and run commands as an agent. The real differences are who you pay, which models you get, and where you work. Plans, prices and features below come from each vendor's documentation and pricing pages, checked on October 17, 2026, against these versions: Claude Code 2.1.302, Codex CLI 0.163.0, Cursor 3.9.16 and OpenCode 2.0.31.
At a glance
| Claude Code | Codex | Cursor | OpenCode | |
|---|---|---|---|---|
| Made by | Anthropic | OpenAI | Cursor (X Subscription) | Open-source project |
| Type | Agent | Agent | Editor + agent | Agent |
| Starts at | $20/mo | Free, $8 or $20/mo | Free, $8/mo | Free software |
| Main models | Claude | GPT | Grok, Composer; Claude and GPT from $30/mo | Any provider |
| Own key or gateway | Yes, Anthropic format | Yes, Responses API | Yes, from $30/mo | Yes, 75+ providers |
| Open source | No | Apache-2.0 | No | MIT |
| Config file | settings.json |
config.toml |
Settings screen | opencode.jsonc |
| Instructions file | CLAUDE.md or AGENTS.md |
AGENTS.md |
Rules or AGENTS.md |
AGENTS.md |
Details and caveats for each row are in the sections below.
What each tool is
Claude Code is Anthropic's coding agent. It started as a terminal program and now also runs in a desktop app (macOS, Windows, and Linux in beta), VS Code, JetBrains IDEs, the browser and your phone (cloud sessions), Slack, Chrome and GitHub Actions. It only runs Claude models.
Codex is OpenAI's coding agent. The CLI is open source. It also comes as an editor extension, a desktop app, a web version that runs tasks in the cloud and an iOS app, plus automatic code review and a Slack integration on paid plans. It runs OpenAI's GPT models by default.
Cursor is a code editor built on VS Code, with an AI agent, chat and Tab autocomplete built in, plus a CLI and Cloud Agents. Since 2026 it's sold as part of The X Subscription together with Grok and X, and its included models are Cursor's own (Grok 4.7, Grok 4.6, Grok 4.5 and Composer 2.5).
OpenCode is an open-source coding agent that isn't tied to any model company. It runs in the terminal, as a desktop app, and as an extension for VS Code, Cursor, Windsurf and VSCodium. You connect whatever models you like. Version 2 was released in October 2026; the npm package is now @opencode/cli.
Price: what you actually pay
Subscriptions
| Claude Code | Codex | Cursor | OpenCode | |
|---|---|---|---|---|
| Free | — | $0: GPT-6 Luna in the desktop app, subject to rollout | $0: Agent and Chat, limited | Software is free |
| ~$8–10 | — | Go $8: GPT-6 Luna in the desktop app | Plus $8: Cursor models only | Go $10: open models such as Kimi K3, GLM-5.3, DeepSeek V4.1 Flash, plus GPT-6 Luna, Claude Haiku 5.5 and others |
| ~$20–40 | Pro $20 | Plus $20: GPT-6.1 Sol and Luna, everywhere | Premium $30: 4x Plus usage, plus third-party models | Go Plus $40: higher limits |
| $100+ | Max $100 / $200 | Pro $100 / $200 / $500 | Super $100, Ultra $200 | — |
| Pay per token | Claude API | OpenAI API key | Third-party models at API list price | Your key, or OpenCode Zen |
A few things that the comparisons ranking on Google today get wrong or leave out:
- Claude Pro is no longer "mid-tier models only". Claude Code's model documentation says the default model has been Opus 5.5 on Pro, Max, Team, Enterprise and the API since version 2.1.280. What differs between plans is how much you can use, not which model you start on. Fable 5.1, Anthropic's top model, has to be selected explicitly, and Claude Code asks before it bills usage credits for it.
- Codex's $20 plan includes the flagship. ChatGPT Plus gets GPT-6.1 Sol, which OpenAI recommends for Codex, in the CLI, editors, web and iOS.
- Cursor's cheap plan doesn't include Claude or GPT. Plus at $8 is limited to Cursor's own models. Claude, GPT and Gemini start at Premium ($30) and are paid at the provider's API list price from prepaid credit, on top of the subscription. Usage on Cursor's own models comes from a pool that refreshes weekly.
- OpenCode's cost is just the models. With your own key you pay that provider's rates; Go is a flat $10 or $40 a month for a curated list of mostly open models.
For token-level costs, see our Claude API pricing, OpenAI API pricing, DeepSeek API pricing and Claude Code pricing pages.
Models you can use
| Out of the box | Other models | |
|---|---|---|
| Claude Code | Fable 5.1, Opus 5.5 (default), Sonnet 5.5, Haiku 5.5 | Claude models served by any Anthropic-format gateway. Anthropic says it doesn't support routing Claude Code to non-Claude models |
| Codex | GPT-6.1 Sol and GPT-6 Luna on ChatGPT plans; any OpenAI model with an API key | Any provider that implements the OpenAI Responses API, such as DeepSeek's official API; local models through Ollama or LM Studio with --oss |
| Cursor | Grok 4.7, 4.6, 4.5 and Composer 2.5 | Claude, GPT and Gemini on Premium and above, including your own keys. Tab completion always uses Cursor's own models |
| OpenCode | Limited-time free models, Zen and Go if you subscribe | 75+ providers through the AI SDK and Models.dev, and any OpenAI- or Anthropic-compatible API |
If you want to switch between Claude, GPT, Gemini, DeepSeek and others in the same tool, OpenCode is the most flexible, followed by Cursor on Premium. Claude Code and Codex are each built around their own company's models.
Bring your own key or a custom API
All four can send requests to an API endpoint you choose, but the requirements differ:
| How | What the endpoint must support | Guide | |
|---|---|---|---|
| Claude Code | ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN in ~/.claude/settings.json |
Anthropic Messages (/v1/messages); base URL without /v1 |
Claude Code setup |
| Codex | A [model_providers.<id>] table in ~/.codex/config.toml |
OpenAI Responses (/v1/responses) with full streaming; base URL with /v1. Chat Completions alone won't work |
Codex CLI and config.toml |
| Cursor | Settings → Models → API Keys, plus Override OpenAI Base URL | OpenAI Chat Completions; requests still pass through Cursor's servers; Premium plan or higher | Cursor API key setup |
| OpenCode | /connect, or a provider in opencode.jsonc |
OpenAI-compatible or Anthropic-compatible | OpenCode providers |
The /v1 difference trips up a lot of people who use both Claude Code and Codex: Claude Code appends /v1/messages to the base URL itself, while Codex appends only /responses. We captured both clients' requests with a local test server when writing our setup guides.
Where you can run them
| Terminal | Desktop app | VS Code | JetBrains | Browser or cloud | Mobile | |
|---|---|---|---|---|---|---|
| Claude Code | ✓ | ✓ (Linux in beta) | ✓ | ✓ | ✓ cloud sessions | ✓ via cloud sessions |
| Codex | ✓ | ✓ | ✓ extension | — | ✓ Codex web | ✓ iOS |
| Cursor | ✓ CLI | It is the editor | It replaces VS Code | — | ✓ Cloud Agents (Premium+) | — |
| OpenCode | ✓ | ✓ | ✓ extension (also Cursor, Windsurf, VSCodium) | Terminal inside any IDE | — | — |
A dash means the vendor's documentation doesn't list it, not that it's impossible. OpenCode, for example, runs in any IDE's built-in terminal.
Project instructions: one AGENTS.md for all four
Each tool reads a markdown file with your project's conventions, such as how to run tests, code style and what not to touch. As of October 2026 all four read AGENTS.md:
- Codex and OpenCode use
AGENTS.mdas their native format. Running/initin OpenCode creates one. - Cursor accepts
AGENTS.mdalongside its own project rules. - Claude Code 2.1.277 and later reads
AGENTS.mdwhen your project has noCLAUDE.mdorCLAUDE.local.md. If you also keep aCLAUDE.md, Claude Code reads only that, so importAGENTS.mdfrom it to share one file.
If your team uses more than one of these tools, keep the shared instructions in AGENTS.md and commit it.
Which one should you use?
- You want the strongest Claude models and plan to live in the terminal: Claude Code. It supports subagents, hooks, skills, plugins and MCP for customizing the agent, and the Pro plan now starts on Opus 5.5.
- You already pay for ChatGPT: Codex costs you nothing extra and includes GPT-6.1 Sol.
- You want to start for free or at $8: Codex's Free and Go plans (GPT-6 Luna in the desktop app), Cursor's Plus plan (Cursor's own models), or OpenCode with its free models.
- You prefer an editor to a terminal and want autocomplete: Cursor. Budget for Premium ($30) plus API usage if you want Claude or GPT in it.
- You want to read or modify the agent's source code: Codex (Apache-2.0) or OpenCode (MIT).
- You want to mix models from different companies or avoid lock-in: OpenCode, with your own keys or a gateway.
- Your company already runs an LLM gateway: all four can use it. Check which API format it speaks (Anthropic Messages for Claude Code, OpenAI Responses for Codex).
Many developers use two of them, for example Claude Code or Codex in the terminal plus Cursor as the editor. They don't conflict, and a shared AGENTS.md keeps their behavior consistent.
Using all four with one API key
If you'd rather not keep three subscriptions, a multi-model gateway can serve Claude, GPT, Gemini, DeepSeek and others behind one key and one bill. api.foo, the service that publishes these docs, is one example. These are the settings for each tool:
| Tool | Base URL | Models |
|---|---|---|
| Claude Code | https://api.foo |
Claude models, using the same names Claude Code requests by default |
| Codex | https://api.foo/v1 |
GPT models such as gpt-6.1-sol |
| OpenCode | https://api.foo/v1 (OpenAI- or Anthropic-compatible provider) |
Any model on api.foo |
| Cursor | https://api.foo/v1 in Override OpenAI Base URL |
OpenAI-format models; needs Cursor Premium or higher |
Model names and prices are on the api.foo pricing page. A gateway is billed per token, so compare it with a flat subscription against your real usage.
Related
- How to install Claude Code
- Claude Code pricing: plans vs API
- How to install Codex CLI and set up config.toml
- Cursor API key setup
- Cline setup guide
- What is an OpenAI-compatible API?
Sources
Checked October 17, 2026: Claude Code documentation (model configuration, memory and AGENTS.md, LLM gateways, platforms); Claude Code license; Codex documentation (pricing, models, custom model providers); openai/codex on GitHub (Apache-2.0); Cursor's Models & Pricing; OpenCode documentation (intro, providers, Go, Zen, IDE) and anomalyco/opencode on GitHub (MIT).
FAQ
Is Claude Code the same as Codex?
No. Claude Code is Anthropic's coding agent and runs Claude models. Codex is OpenAI's coding agent and runs OpenAI's GPT models. Both work in the terminal, in editors and in a desktop app, and both can read and edit your code and run commands, but they come from different companies, use different models and are billed through different subscriptions.
Which is cheaper, Claude Code or Codex?
Both start at $20 a month with a full flagship model. Claude Pro includes Claude Code, which has defaulted to Opus 5.5 on every plan since version 2.1.280. ChatGPT Plus includes Codex with GPT-6.1 Sol. Codex also has a Free plan and an $8 Go plan with GPT-6 Luna in the desktop app, rolling out gradually. Claude Code has no free tier.
Which of these AI coding tools is open source?
Codex CLI is open source under Apache-2.0 and OpenCode under MIT. Claude Code is not open source. Its repository states all rights reserved, with use subject to Anthropic's commercial terms. Cursor is a closed-source editor.
Can Claude Code use GPT or other non-Claude models?
Not officially. Claude Code can send requests to any gateway that speaks the Anthropic Messages format through ANTHROPIC_BASE_URL, but Anthropic's documentation says it doesn't support routing Claude Code to non-Claude models. Use OpenCode or Cursor if you want to switch freely between model families.
Does Cursor include Claude and GPT models?
Not in the base plan. Since Cursor became part of The X Subscription, Free and Plus ($8 a month) use only Cursor's own models such as Grok 4.7 and Composer 2.5. Claude, GPT and Gemini need Premium ($30 a month) or higher, and they're charged at the provider's API list price from prepaid credit.
Is OpenCode free?
The software is free and open source. You pay for the models. You can bring an API key from any of 75+ supported providers, use the pay-as-you-go OpenCode Zen, subscribe to OpenCode Go at $10 or $40 a month, or use the limited-time free models it offers.
Can I use one project instructions file for all four tools?
Yes. All four read AGENTS.md. Codex, OpenCode and Cursor read it directly. Claude Code 2.1.277 and later reads AGENTS.md when your project has no CLAUDE.md, or you can import it from a CLAUDE.md.
Found a mistake? Email [email protected].