Other blogsGuides

Codex CLI: what it is, how to set it up and how to track its usage

OpenAI's terminal coding agent is free to install and runs on your ChatGPT plan or an API key. Here is the setup, the cost and a way to keep a usage history.

Codex CLI is OpenAI's coding agent for the terminal: you start it inside a repository, describe a task, and it reads files, edits code and runs your local tools with the permissions you allow. The tool is free and open source, and the model time behind it comes from a ChatGPT plan, from Plus upward, or from an OpenAI API key billed per token.

This guide covers setup, a first session, how usage is counted and how to keep a record of it. Facts come from OpenAI's Codex CLI docs and the openai/codex repository, checked on November 3, 2026.

What Codex CLI does

The CLI works on code that is already on your machine. Inside a project folder it can explain the codebase, plan a change, edit files, run tests and show you the diff as it goes. You choose the model, the reasoning effort and how much it may do before asking. For scripts and CI there is codex exec, which runs a task without the interactive screen.

It is one of several Codex surfaces. The same account also works in the ChatGPT desktop app, the IDE extension and Codex Cloud, and they all draw on one plan allowance.

Set it up in three steps

  1. Install it. On macOS or Linux, OpenAI's installer is curl -fsSL https://chatgpt.com/codex/install.sh | sh. Windows gets a PowerShell installer, and npm (npm install -g @openai/codex) or Homebrew (brew install --cask codex) work as well.
  2. Sign in. Run codex in a project folder and pick Sign in with ChatGPT, or pipe an API key to codex login --with-api-key.
  3. Give it a small task. Ask it to explain the project first. OpenAI's docs suggest a Git commit before and after each task so you can roll back.

Run /init once per repository. It creates an AGENTS.md file for standing instructions such as test commands.

What it costs

Way in Price as of November 2026 Notes
ChatGPT Plus $20 a month CLI included, shared plan limits
ChatGPT Pro $100, $200 or $500 a month Bigger allowance, no five-hour limit for now
ChatGPT Business $20 per user a month yearly, $25 monthly Admin controls, two users minimum
API key Standard API rates Billed per token, suited to CI

Prices come from OpenAI's Codex pricing page. Free and Go are listed with desktop app access, subject to rollout, so check before you count on the CLI there.

How usage is counted

On a ChatGPT plan, Codex does not charge per prompt. Each message uses part of an allowance, and how big that part is depends on the model, the size of the task and how much context it carries. OpenAI publishes rough message ranges per five hours, says they are estimates rather than fixed limits, and notes that weekly limits may also apply. Long sessions, a large AGENTS.md and many MCP servers all make each message heavier.

Inside the CLI you have two checks. /status shows the session's model, permissions, token usage and remaining context. /usage opens your account's token activity by day or week. The web usage dashboard shows current limits and reset times.

Keep a record with UsageAtlas

Those checks tell you where you stand right now. They do not keep a long history, put an estimated cost next to it, or warn you before a window runs out. That is what UsageAtlas is for: a free, open-source desktop tracker for macOS, Windows and Linux.

It uses the Codex CLI you are already signed in to on the same machine and shows:

  • the session and weekly windows with their reset times
  • credits, where Codex reports them
  • tokens, requests and models from local sessions, with an estimated cost
  • daily history, plus one alert per reset cycle at a threshold you choose

No account is needed for local tracking, and it does not read prompts or responses. Claude Code, Cursor and OpenCode can sit in the same view. The dollar figures are estimates; OpenAI's billing remains the record of what you paid.

When you need something else

If your company runs Codex on ChatGPT Enterprise, the admin analytics dashboard and Compliance API are the place for team-wide numbers. UsageAtlas covers your own computer, and for a quick check before the next prompt, /status is all you need.

Browse guides by topic