Codex CLI Pricing: Sign-In, API Costs, and Usage Limits
Codex CLI is free to install but runs on the OpenAI API, which charges per token. Here is how billing works, what affects your costs, and what to check before choosing a setup.
Updated 4 min read
Codex CLI is OpenAI's terminal-based coding assistant. The tool itself is free to install and open source, but running it costs money because it uses the OpenAI API, which charges by the token. How much you spend depends on which model you use, how large your codebase context is, and how much output you ask for. Understanding those factors before you start helps you avoid unexpected API bills.
Codex CLI connects directly to your project files, so the context it works with is your actual code. Tools like fenbs keep the project-level context — tasks, decisions, and where work stands — in a shared record that any connected AI can read, so if you move between Codex CLI and another tool the project knowledge travels with you.
How Codex CLI is billed
Codex CLI is not a subscription. You authenticate with your OpenAI API key and are billed for the API calls the tool makes on your behalf. OpenAI charges per token — tokens are roughly the pieces of text the model reads and writes. Each request Codex CLI makes counts toward your API usage.
OpenAI offers free credits to new API accounts, which gives you a starting budget to try Codex CLI without immediately incurring charges. Once those credits are used, usage is billed to the payment method on your OpenAI account. Check OpenAI's current API credits page for the current terms and credit amount, as these change.
What affects your API costs
Three things drive API cost: the model you select, the size of the context you send, and how much output you request.
- Model: different OpenAI models have different per-token prices. More capable models generally cost more per request. Codex CLI lets you choose which model to use, so the choice directly affects your bill.
- Input context: Codex CLI can send your full project directory or selected files as context. Larger codebases mean larger inputs and higher per-request costs. Scoping the context to the relevant files for each task reduces waste.
- Output length: longer generated code or explanations use more output tokens. Asking for more targeted changes rather than wholesale rewrites helps control cost.
- Request frequency: automated or looped tasks that make many API calls can run up costs quickly. Set usage limits on your OpenAI account to cap spending.
OpenAI's API pricing page lists the current per-token costs for each model. Use those numbers and your typical request size to estimate a monthly cost before committing. Many developers find cost predictable once they settle on a model and a working pattern.
Setting a usage limit
OpenAI lets you set a monthly spending limit on your API account. Set one before you start serious use of Codex CLI. Without a limit, a runaway automated task or an unexpectedly large context can generate a bill you did not plan for. Soft limits send a notification at a threshold; hard limits stop API calls once reached.
To set a limit, go to the Usage section of your OpenAI account. Set a conservative monthly cap when you are still learning your usage patterns, and review it after the first few weeks.
Keep your project context independent of the model you use
Codex CLI, Claude Code, Cursor, and GitHub Copilot can all connect to the same fenbs project over MCP. If you change models — to manage cost, to try a new release, or to use a different tool for a specific task — the project tasks, Decisions and rules, and Where we left off stay the same. The work is not locked to the model.
Create a free accountFree for one person · No credit card · Works with Claude, ChatGPT, Cursor and more
Codex CLI compared to other billing routes
Other coding tools use different billing models. GitHub Copilot is a monthly subscription that gives you a fixed set of features. Cursor offers both a subscription and an API-based option. ChatGPT or Claude subscriptions give conversational coding help without per-token billing but with different capabilities and integration depth.
Codex CLI's per-token model suits developers who want full control over their spending and are comfortable managing an API account. A subscription-based tool suits those who prefer a predictable monthly cost without thinking about tokens. See Codex app vs CLI vs IDE extension for a broader comparison of the Codex options.
For tips on reducing wasted context and getting better results from each request, Codex CLI best practices covers common patterns. Codex CLI commands explains the flags that control context scope and output mode.
What you get for free
New OpenAI API accounts receive free credits. That is enough to try Codex CLI across a range of tasks and get a sense of your usage before paying. The credits expire after a period — check the current OpenAI terms when you sign up.
Beyond the free credits, there is no ongoing free tier for the API in the way there is for ChatGPT's free conversation plan. Continued API use after the credits are exhausted requires payment. Budget accordingly before integrating Codex CLI into a regular workflow.
How to do this with fenbs
Connect Codex CLI sessions to a fenbs project so the cost and model choices the team makes are recorded and readable by every tool.
- Create a free account at fenbs. No credit card required.
- Add the coding project. Write the goal, the current tasks, and any decisions about which models or tools to use for which task types.
- Record model and cost decisions in Decisions and rules: which model the team uses for what, any per-session cost limits, who has access to the shared API key.
- Connect Codex CLI to fenbs at Integrations. Each CLI session reads the current task state and rules before starting work.
- After each session, save progress: what was completed, any tasks added, and where the next session should pick up.