Codex is OpenAI's terminal agent, same shape as Claude Code. Install and config here, plus the more practical question: you have both installed — which gets what?
In this pageinstall, sign-in, config structure, a division test. No ranking and no head-to-head — reason in §4. Nothing about my own setup either.
| Route | Command |
|---|---|
| npm | npm install -g @openai/codex |
| Homebrew | brew install --cask codex |
| Binary | GitHub Releases; Mac ships separate Apple Silicon and Intel builds — do not grab the wrong one |
It is written in Rust, so it is a self-contained binary — no Python or Node runtime trailing behind it.
| Path | How | Suits |
|---|---|---|
| ChatGPT sign-in | Run codex, choose "Sign in with ChatGPT" (Plus / Pro / Business / Edu / Enterprise) | Already subscribed, do not want to think about quota |
| API key | Extra setup steps | Anyone pointing at a self-hosted or third-party endpoint — this is the door to page 8 |
Subscription sign-in is the documented recommendation. But the two paths are separate billing and quota systems — signing in with a subscription does not mean you can casually repoint the endpoint. That runs through the config below.
~/.codex/config.tomlThe directory comes from CODEX_HOME, defaulting to ~/.codex.
Two parts: pick a provider at the top level, define it in its own table.
| Key | Required | What it does |
|---|---|---|
name | yes | Display name, your choice |
base_url | yes | The endpoint — the spine of this whole thread, see page 7 |
env_key | Which environment variable holds the key | |
wire_api | Which protocol: responses or chat-completions | |
query_params | URL query params (some cloud endpoints require an api-version) | |
http_headers / env_http_headers | Custom headers; the latter sourced from env |
openai, ollama and lmstudio are built-in provider IDs.
A custom provider cannot reuse them. Name yours something else — because the failure mode
is that your table is silently ignored, not that you get an error.
wire_api set wrong looks like "model not supported"
responses and chat-completions are two request shapes.
Choosing wrong rarely produces a clean error — you get odd field errors, empty replies,
or tool calls that quietly stop working. Before pointing at any non-official endpoint,
find out which protocol it speaks. That matters more than any other setting.
"Which one is better" has an answer that changes with every release and every task type — it starts going stale the day you write it down. What lasts is a test:
| About this task | Lean toward |
|---|---|
| Does it need long-lived, heavy context | Whichever one's context handling suits you — run each for a day and you will know |
| Does it need deep editor integration | See page 4; the editor routes differ |
| Does it need a third-party endpoint | Both can. The config shapes differ (JSON vs TOML), see page 8 |
| Does the team share config | Whichever config file fits your repo better |
This site does not run tool comparisons. The reason is at the end of the spine page: a comparison written by someone who uses one of the options is an interested opinion — mine included. So I give the test and let you do the ranking.
openai/codex, Rust, 110,216 stars / 16,857 forks, created 2025-04-13,
latest release rust-v0.149.0 (2026-08-20). GitHub API, checked 2026-08-21.npm install -g @openai/codex, brew install --cask codex,
or a GitHub Releases binary; sign-in either via ChatGPT subscription (the documented recommendation) or an API key.CODEX_HOME defaults to ~/.codex; main file config.toml;
top-level model / model_provider; provider table [model_providers.ID] with
name, base_url, env_key, wire_api, query_params,
http_headers, env_http_headers; reserved IDs openai, ollama,
lmstudio. Official docs, checked 2026-08-21.