LZLZL/AI toolchain/Local · Setup
FREEShallow · Start here A · Localsetup

Codex: install, config,
dividing the work

2026-08-21 · And a test that ranks nothing

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.

1Install

RouteCommand
npmnpm install -g @openai/codex
Homebrewbrew install --cask codex
BinaryGitHub 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.

2Sign-in: decide which path first

PathHowSuits
ChatGPT sign-inRun codex, choose "Sign in with ChatGPT" (Plus / Pro / Business / Edu / Enterprise)Already subscribed, do not want to think about quota
API keyExtra setup stepsAnyone 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.

3Config: ~/.codex/config.toml

The directory comes from CODEX_HOME, defaulting to ~/.codex. Two parts: pick a provider at the top level, define it in its own table.

model = "…" model_provider = "myproxy"
[model_providers.myproxy] name = "…" base_url = "https://…" env_key = "OPENAI_API_KEY"
KeyRequiredWhat it does
nameyesDisplay name, your choice
base_urlyesThe endpoint — the spine of this whole thread, see page 7
env_keyWhich environment variable holds the key
wire_apiWhich protocol: responses or chat-completions
query_paramsURL query params (some cloud endpoints require an api-version)
http_headers / env_http_headersCustom headers; the latter sourced from env
Three IDs are reserved

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.

4Division of labour, and why no ranking

"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 taskLean toward
Does it need long-lived, heavy contextWhichever one's context handling suits you — run each for a day and you will know
Does it need deep editor integrationSee page 4; the editor routes differ
Does it need a third-party endpointBoth can. The config shapes differ (JSON vs TOML), see page 8
Does the team share configWhichever 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.

Repo 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.
Install and sign-in 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.
Config 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.
Limits Releases land fast — the version checked here shipped the day before. Verify before copying.
Not in this page Which I use, how it is configured, what it connects to.

RelatedRead next

A · Local
Claude Code: install to first real edit
B · Access
What a relay API actually is
B · Access
Four clients, four places to put the endpoint
A · Local
Project memory that actually gets followed
An educational and engineering record — not a review or endorsement of any third-party product. Commands, config keys, prices and terms are per each vendor's official docs; this page states when it was checked and all of them can change without notice — verify before you copy anything. Self-hosting is your own responsibility: keys, accounts and data are on you.