Codex vs Claude Code: pricing, permission models, config files and when to use which
OpenAI's Codex and Anthropic's Claude Code compared on what changes slowly: pricing, permission and sandbox design, AGENTS.md versus CLAUDE.md, cloud execution and CI.
Contents
Codex (OpenAI) and Claude Code (Anthropic) are both coding agents you can drive from the terminal and from VS Code. "Which is smarter" flips with every model release, so this article compares the parts that stay put: pricing structure, permission model, configuration files and surrounding features.
KEY POINT
What you will learn
- How pricing and subscriptions differ
- The permission models: OS sandbox versus per-tool rules
- Configuration files, extensions, cloud execution, CI, and rules of thumb for choosing
At a glance
| Aspect | Codex | Claude Code |
|---|---|---|
| Vendor | OpenAI | Anthropic |
| Subscription | ChatGPT paid plans, or API key | Claude paid plans, or API key |
| CLI | codex | claude |
| VS Code extension | Yes (local and cloud tasks) | Yes |
| Context file | AGENTS.md (shared standard) | CLAUDE.md (product-specific) |
| Config file | ~/.codex/config.toml (TOML) | settings.json (JSON, three scopes) |
| Permission model | Approval policy + OS-level sandbox | Per-tool allow / deny / ask + permission modes |
| Extension points | MCP, AGENTS.md | MCP, hooks, skills, subagents |
| Cloud execution | Codex cloud (GitHub integration, PRs) | Claude Code on the web, GitHub Actions |
| Non-interactive | codex exec | claude -p |
| CI | GitHub Action, codex exec | claude-code-action, claude -p |
Pricing
Both offer usage included in a subscription, or pay-as-you-go through an API key. If you already subscribe to one of the chat products, starting there is cheapest.
- Codex: ChatGPT Plus / Pro / Team / Enterprise allowances, or the OpenAI API
- Claude Code: Claude Pro / Max / Team / Enterprise allowances, or the Anthropic API
Allowance sizes and reset windows differ by plan.
Permission models
This is the biggest design difference.
Codex layers an approval policy (do we ask) on top of an OS-level sandbox (what is physically possible). The sandbox uses Seatbelt on macOS and Landlock on Linux to block writes outside the workspace and network access. You can reduce prompts and still limit the blast radius. Details: Codex CLI approval modes versus sandbox modes.
Claude Code uses per-tool rules such as allowing Bash(npm run test:*) and denying Read(./.env). There is no OS isolation, but the rules give fine control over what runs unattended. Details: Claude Code permissions in settings.json.
用語解説
Which is safer? Codex's sandbox physically stops unexpected actions. Claude Code's rules precisely shape expected actions. Codex's style suits CI and autonomous runs; Claude Code's suits flexible daily work.
Configuration and customization
| Item | Codex | Claude Code |
|---|---|---|
| Rules | AGENTS.md (hierarchical) | CLAUDE.md (user / project / local + subdirectories) |
| Config format | One TOML file with profiles | JSON in three scopes; deny always wins |
| Deterministic automation | None (relies on AGENTS.md instructions) | Hooks (for example, always lint after edits) |
| Reusable prompts | Written into AGENTS.md | Skills / slash commands |
| Role separation | - | Subagents |
Claude Code has the thicker customization layer (hooks, skills, subagents), which suits teams that want their workflow built into the tool. Codex keeps everything in config.toml and AGENTS.md, which is simpler.
Cloud execution and CI
- Codex cloud runs tasks against a GitHub repository in OpenAI's containers and returns pull requests; it is convenient for parallel, independent tasks.
- Claude Code integrates with GitHub through
claude-code-action(mention@claudein issues and PRs) and offers Claude Code on the web.
Rules of thumb
| Situation | Leans toward |
|---|---|
| Already paying for ChatGPT | Codex |
| Already paying for Claude | Claude Code |
| Want team workflow (lint, review checklist) built into the tool | Claude Code (hooks, skills) |
| Want OS-level limits on what autonomous runs can break | Codex (sandbox) |
| Want many independent tasks running in parallel in the cloud | Codex cloud |
| Want fixes triggered from GitHub issue comments | Either, with different setups |
If you use both, run the same task through each for a while and compare the diffs and rework; that tells you more than benchmark headlines.
Summary
- Both bill either through a subscription allowance or an API key; start with what you already pay for
- Codex enforces limits with an OS sandbox; Claude Code with per-tool rules
- Claude Code's hooks, skills and subagents make it easier to embed a team process; Codex is simpler to configure
- Codex cloud for parallel cloud tasks; both can be driven from GitHub comments
FAQ
- Which is better, Codex or Claude Code?
- There is no stable answer; model strengths swap with each release. This article compares the design and operational differences that do not change every month.
- Can I use both on the same project?
- Yes. Keep an AGENTS.md and a CLAUDE.md, and share the common content from one file to avoid maintaining two copies.
- If I can only subscribe to one, ChatGPT Plus or Claude Pro?
- Start with whichever you already pay for. If neither, decide by the editor you use most and how you want CI integration to work.
Primary sources
This article was drafted by AI from official documentation and reviewed by the site operator before publishing. Found a mistake? Let us know via the contact page.