> getting started
Codex is OpenAI's coding agent for the terminal: it reads your repo, edits files, and runs commands, driven by the GPT-5.6 models. This section covers getting the codex binary installed, signing in with ChatGPT or an API key, and launching your first session. The core idea is that one command, codex, opens an interactive session in whatever directory you run it from, and it reads AGENTS.md for project context automatically.
// getting started
6 commands$ npm install -g @openai/codex$ codex login$ printenv OPENAI_API_KEY | codex login --with-api-key$ codex login status$ codex$ codex update// faq
Is the Codex CLI free?
It needs a paid OpenAI account. Signing in with ChatGPT includes Codex on Plus, Pro, Business, Edu, and Enterprise plans, with usage counting against your plan limits. Alternatively you authenticate with an OpenAI API key and pay usage-based through the API. There is no free tier for meaningful use.
How do I install the Codex CLI?
Three official ways: npm (npm install -g @openai/codex), Homebrew on macOS (brew install --cask codex), or the install script (curl -fsSL https://chatgpt.com/codex/install.sh | sh). Requirements are macOS 12+, Ubuntu 20.04+/Debian 10+, or Windows 11 via WSL2. Upgrade with npm install -g @openai/codex@latest or codex update.
What is the difference between signing in with ChatGPT and an API key?
ChatGPT sign-in (codex login) uses your subscription and its included limits; API-key sign-in (printenv OPENAI_API_KEY | codex login --with-api-key) bills usage-based through the OpenAI API. Credentials for either land in ~/.codex/auth.json. Run codex login status to see which is active.
Does Codex run on Windows?
Yes, but through WSL2 on Windows 11; native Windows support is experimental. Under WSL, keep your project on the Linux filesystem so the sandbox behaves correctly. The config directory on Windows is %USERPROFILE%\.codex.