What is the difference between Codex and Aider?
Codex is OpenAI's coding agent for the terminal and Aider is an independent AI pair programmer for the terminal; both are open source and edit code in your local repo, but Codex runs OpenAI models inside a sandbox with approvals, while Aider works with almost any model and records every change as a git commit. In short, Codex leans on a sandbox for safety and Aider leans on git.
Both are Apache 2.0 licensed on GitHub and run in any terminal. Everything below comes from each project's official docs and repository as of 26 October 2026. For deeper single-tool guides, see the Codex CLI guide and the Aider guide.
How does Codex work?
The openai/codex repository describes Codex as a "Lightweight coding agent that runs in your terminal." You install it, run codex in a project and sign in:
# macOS and Linux
curl -fsSL https://chatgpt.com/codex/install.sh | sh
# or with npm or Homebrew
npm install -g @openai/codex
brew install --cask codex
cd your-project
codex
You sign in with a ChatGPT account or an OpenAI API key. OpenAI's pricing page lists Codex plans from ChatGPT Free and Go (GPT-6 Luna in the desktop app, subject to rollout) up to Plus, Pro, Business, Edu and Enterprise, and the README recommends Plus, Pro, Business, Edu or Enterprise for the CLI. An API key bills at standard API rates instead.
Codex runs OpenAI models. The models page currently recommends gpt-6.1-sol for complex coding and gpt-6-luna for focused, repeatable tasks, and --oss switches to a local model through LM Studio or Ollama. Codex works agentically: it reads files, edits them and runs commands on its own inside a sandbox, then stops to ask when it needs to go further.
How does Aider work?
The Aider site calls it "AI pair programming in your terminal," and the source is at github.com/Aider-AI/aider. It installs as a Python tool:
python -m pip install aider-install
aider-install
cd your-project
aider --model sonnet --api-key anthropic=<key>
# or
aider --model o3-mini --api-key openai=<key>
Aider has no account or plan of its own. You bring a key for a provider, and its models page lists OpenAI, Anthropic, Gemini, GROQ, LM Studio, xAI, Azure, Cohere, DeepSeek, Ollama, OpenAI compatible APIs, OpenRouter, GitHub Copilot, Vertex AI and Amazon Bedrock.
Aider is built around three ideas. It sends the model a repo map, which "helps it work well in larger projects." You choose which files are in the chat with /add and /drop. And its git page says: "Whenever aider edits a file, it commits those changes with a descriptive commit message."
How do Codex and Aider compare side by side?
| Codex | Aider | |
|---|---|---|
| Maker | OpenAI | Open source project (Aider-AI) |
| License | Apache 2.0 | Apache 2.0 |
| Command | codex |
aider |
| Install | Script, npm, Homebrew, binaries | aider-install via pip, install scripts, uv, pipx, Docker images |
| Sign-in and billing | ChatGPT plan or OpenAI API key | Your own API key for any supported provider |
| Models | OpenAI models; local via --oss (LM Studio, Ollama) |
Many providers, plus local models through Ollama or OpenAI compatible APIs |
| Working style | Agent that plans, edits and runs commands in a loop | Pair programmer; you add files, it edits them |
| Safety model | OS sandbox, approvals, network off by default | Offers to run suggested shell commands; git commit per change; optional Docker |
| Undo | Your own Git workflow; .git is read-only to Codex |
/undo reverts the last aider commit |
| Chat modes | /plan and normal mode |
code, ask, architect, help |
| Project instructions | AGENTS.md, read automatically |
A conventions file you load with --read |
| Agent Skills | .agents/skills/, ~/.agents/skills/ |
Not documented |
| MCP | STDIO and Streamable HTTP servers in config.toml |
Not documented |
| Scripting | codex exec, with --json |
aider --message, with --yes-always |
| Sessions | codex resume, codex fork |
Chat log in .aider.chat.history.md; --restore-chat-history |
| Cloud tasks | codex cloud |
Not part of Aider |
How do they keep your code safe?
This is the clearest design difference.
Codex has a sandbox built in. The approvals and security docs say a version-controlled folder starts in the Auto preset, which edits and runs commands inside the project and asks before editing outside it or using the network. In the docs' words, "By default, the agent runs with network access turned off." Codex also keeps .git read-only, so commits need your approval. The Codex approvals and sandbox guide covers every mode.
Aider relies on git and confirmations. Every edit becomes its own commit, /diff shows changes since your last message, and /undo "will undo and discard the last change." Before editing files you have not committed, aider commits your work separately first so it is not mixed with the AI's changes. Its release notes say aider "offers to run shell commands" it suggests, such as tests or installs, and the options reference documents --no-suggest-shell-commands to turn suggestions off. For isolation, aider publishes Docker images, and its Docker page notes: "When you use the in-chat /run command, it will be running shell commands inside the docker container."
If you want OS-level isolation without setting anything up, Codex gives you more out of the box. If you want a reviewable commit for every change, Aider does that by default.
How do instructions, skills and MCP compare?
Instructions. Codex reads AGENTS.md automatically, from a global file in ~/.codex and from the repo root down to your current folder. Run /init to generate one. Aider has no automatic rules file. Its conventions page says "It's best to load the conventions file with /read CONVENTIONS.md or aider --read CONVENTIONS.md," and a read: key in .aider.conf.yml loads it every time. That means one shared file can serve both:
# .aider.conf.yml
read: AGENTS.md
Skills. Codex follows the Agent Skills format: it scans .agents/skills from your folder up to the repo root, plus ~/.agents/skills, and you call a skill with $name or /skills. Aider's docs do not describe skills. See Codex skills.
MCP. Codex supports STDIO and Streamable HTTP servers, added with codex mcp add and stored in config.toml. Aider's docs and recent release notes do not describe MCP support. Aider does have /web to pull a page into the chat as Markdown. See Codex MCP.
How do models and cost compare?
Codex gives you two ways to pay. With a ChatGPT plan, usage counts against the plan, so cost is predictable. With an API key, you pay per token at OpenAI's rates. Either way you get OpenAI's models, switched with /model or -m. The Codex pricing guide has plan details.
Aider costs whatever your provider charges. You can mix models: --weak-model handles commit messages and chat summaries, and architect mode pairs a main model that proposes a change with an --editor-model that writes the edits. That flexibility lets you trade cost against quality per task, or run fully local with Ollama.
How do you run them in scripts?
Both have a one-shot mode:
# Codex: read-only by default in exec mode
codex exec "summarize the changes on this branch"
codex exec --sandbox workspace-write "fix the failing lint errors"
# Aider: one message, then exit
aider --message "add descriptive docstrings to all the functions" app.py
The Codex non-interactive docs add --json for a JSON Lines event stream and codex exec resume --last for multi-stage pipelines; the codex exec guide covers CI. Aider's scripting page shows --message in a shell loop over files, and --yes-always answers every confirmation. It warns that its Python API "is not officially supported or documented, and could change in future releases without providing backwards compatibility."
Which should you pick?
Start with how you want to pay and how much autonomy you want.
Codex tends to fit when:
- You already pay for ChatGPT, or want OpenAI models with simple sign-in.
- You want a sandbox with network off by default and approvals for anything outside the project.
- You want the agent to plan, edit, run tests and iterate with less steering.
- You use MCP servers, Agent Skills,
AGENTS.mdor cloud tasks.
Aider tends to fit when:
- You want to choose your provider per task, including Anthropic, Gemini, DeepSeek, OpenRouter or a local model.
- You like a git commit for every change and
/undoas the safety net. - You prefer to control exactly which files the model sees.
- You want architect mode to pair a reasoning model with a cheaper editing model.
You can also keep both. A shared AGENTS.md, loaded by Aider with --read, keeps your conventions consistent whichever one you open.
Keep your prompts portable
Prompts and conventions outlast any single agent. Kipt keeps prompts and Agent Skills as Markdown in a private GitHub repo you own, and installs every skill into Claude Code or Codex with one npx skills add command. If you have a prompt you paste into both tools, the free SKILL.md generator turns it into a skill folder.