OpenAI Codex Pricing: What the CLI Actually Costs in 2026
OpenAI Codex CLI is a free, open-source tool — but it sends every prompt to the OpenAI API, which charges per token. One image compression task burned 7,675 tokens: between 3 and 11 cents. The default model, codex-mini-latest, costs $1.50 per million input tokens and $6.00 per million output tokens. Pointing Codex at RunAPI instead cuts those rates by 50%, with no other changes to your workflow.
How much does OpenAI Codex cost?
The Codex CLI itself is free to download and run. The cost comes from API calls: every prompt, file read, and code generation goes to the OpenAI API. The default model is codex-mini-latest, priced at $1.50/1M input tokens and $6.00/1M output tokens through OpenAI directly. A moderate coding session — roughly 8M input and 2M output tokens per month — runs about $24 with OpenAI. The same usage through RunAPI costs $12. RunAPI is OpenAI-compatible, so you change two environment variables and nothing else. Tip: run /compact during long sessions to free up context and stop burning tokens on conversation history.
The CLI itself has no subscription fee. You pay only for the API tokens consumed during each coding session.
codex-mini-latest input costs $1.50/1M tokens, output costs $6.00/1M tokens through the OpenAI API.
RunAPI delivers the same model at 50% off. Set two env vars and Codex routes through RunAPI automatically.
Pay only for what you use. No monthly seat fee. No minimum spend. Bills stop the moment you stop coding.
What gets counted as a token?
Every message Codex sends to the API includes your prompt, the full context of files it has read, any tool results, and conversation history. That combined input is tokenized (roughly 750 words per 1,000 tokens). The model's response — edited code, explanations, next steps — counts as output tokens. Both directions are billed separately. Codex caches nothing between sessions, so a fresh session re-reads the same files and bills that context again. One real example from a developer testing image compression — a single 5 MB file task burned 7,675 tokens, or roughly 3 to 11 cents. Not very cheap for one file, but most coding sessions stay well under a dollar each.
codex-mini-latest pricing: OpenAI vs RunAPI
Prices in USD per million tokens. RunAPI rates are 50% of OpenAI list prices.
What does a typical month cost?
Based on codex-mini-latest at $1.50/$6.00 (OpenAI) and $0.75/$3.00 (RunAPI) per 1M tokens.
How to use Codex CLI with RunAPI
Install Codex CLI
Create a RunAPI account
Set your environment variables
Run Codex
Verify the model
Common questions about Codex pricing
Explore More
OpenAI API Pricing
Full OpenAI model lineup — GPT-5.4, o3, and more at 50% off.
Claude Code Pricing
What Claude Code costs with API billing vs Max subscription.
Claude Code vs Cursor
Feature and cost comparison of the two leading AI coding tools.
RunAPI CLI
Run any model from your terminal with a single command.
Set two environment variables and every Codex session runs through RunAPI at 50% off OpenAI rates. No subscription, no minimum spend — you pay only for tokens used.