Claude Code vs Codex CLI cost on a pay-as-you-go API: setup and session math
AtmoRouter compares Claude Code and Codex CLI on a pay-as-you-go API gateway: Claude Code connects with two environment variables, Codex CLI needs a local bridge. Live prices put an illustrative 120-request session at about $3.72 on Sonnet 5.5 and $7.44 on GPT-6.2 Sol.
Why it matters
This AtmoRouter-written comparison looks at Claude Code and Codex CLI from the viewpoint of a developer paying per token instead of holding a subscription. Claude Code speaks the Anthropic Messages API and connects through two environment variables. Codex CLI only accepts the OpenAI Responses API, so it needs a local bridge that translates its calls into Chat Completions.
The bridge covers text, function tools and streaming, but hosted web search and reasoning summaries are off. The article models an illustrative session of 120 requests with 60,000 input tokens and 400 output tokens each, using public from-prices at the time of writing.
That session bills about $3.72 on the Claude Sonnet 5.5 route and about $7.44 on the GPT-6.2 Sol route. The model tier sets the price, not the agent, and an 85 percent prompt-cache hit rate drops the Sonnet session to about $0.97. Pick the model tier first, and treat the live model page as authoritative because rates change.