直接看数字

← 回到全部文章

Codex vs Claude Code: A Small-Repo Cost Receipt

01 / One Small Repo, Two Receipts, No Claimed Winner

What does it cost to give Codex and Claude Code the same small coding job? An honest answer needs usage logs and the rates actually charged. No execution logs accompany this article, so the receipts below are explicitly hypothetical accounting examples, not measured runs, current model prices, or evidence that either tool performs better.

The proposed comparison uses a small TypeScript repository: one CSV parser, one command-line entry point, and a test suite. The assignment is identical: reject malformed rows, add regression tests, and preserve existing command-line behavior. Start both tools from the same commit in separate working directories.

02 / Separate API Spending From Subscription Allowances

Choose the billing path before comparing dollars. Codex supports API-key authentication with usage-based billing, distinct from access through a ChatGPT plan. This comparison concerns token-billed API usage, not the value of an existing subscription. ([developers.openai.com](https://developers.openai.com/codex/auth))

Record the tool version, selected model, reasoning settings, permissions, prompt, and charged rates. Keep the task boundaries identical, but do not assume identical prompts produce identical token counts. Treat model choice as part of the tested configuration, not an invisible constant.

03 / The Illustrative Rate Card Behind Every Line

For arithmetic only, assume these rates per million tokens: $2.00 for uncached input, $0.20 for cache reads, $2.50 for separately billed cache writes, and $10.00 for output. These are invented worksheet inputs, clearly labeled as such—not advertised CheapRelay rates or vendor quotations. Replace them before budgeting.

Each line equals tokens divided by 1,000,000, multiplied by its applicable rate. Keep categories mutually exclusive. OpenAI usage reporting can identify cached tokens within input usage; do not bill that portion again as uncached input. ([help.openai.com](https://help.openai.com/en/articles/10478918-reviewing-api-usage-and-costs?utm_source=openai))

04 / Codex Receipt: An Illustrative $0.1640

  • ■ Uncached input: 30,000 tokens × $2.00 per million = $0.0600.
  • ■ Cache reads: 120,000 tokens × $0.20 per million = $0.0240.
  • ■ Separately billed cache writes: none assumed in this example.
  • ■ Output: 8,000 tokens × $10.00 per million = $0.0800.
  • ■ Total illustrative API charge: $0.1640, or 16.40 cents.

05 / Claude Code Receipt: An Illustrative $0.1900

  • ■ Uncached input: 24,000 tokens × $2.00 per million = $0.0480.
  • ■ Cache writes: 20,000 tokens × $2.50 per million = $0.0500.
  • ■ Cache reads: 160,000 tokens × $0.20 per million = $0.0320.
  • ■ Output: 6,000 tokens × $10.00 per million = $0.0600.
  • ■ Total illustrative API charge: $0.1900, or 19.00 cents.

The difference is 2.60 cents under these assumptions. That demonstrates the calculation, not a tool ranking. Claude Code documentation explains that its session dollar figure is calculated locally from token counts and pricing settings; reconcile estimates against the billing provider’s records. ([code.claude.com](https://code.claude.com/docs/en/costs))

06 / A Single Retry Changes the Receipt

Add one hypothetical Codex repair turn containing 10,000 cached-input tokens and 2,000 output tokens. At the assumed rates, that adds $0.0020 plus $0.0200, bringing its receipt to $0.1860. The gap shrinks to 0.40 cents. Neither retry frequency nor success rate has been measured here.

Cache behavior also belongs in the record. OpenAI documents caching around matching prompt prefixes, while Anthropic notes that changing session configuration can disrupt cache reuse. Run cold-start and follow-up comparisons separately rather than mixing them into one unexplained average. ([developers.openai.com](https://developers.openai.com/api/docs/guides/prompt-caching?trk=article-ssr-frontend-pulse_x-social-details_comments-action_comment-text&utm_source=openai))

07 / Use CheapRelay’s Bill as the Final Receipt

CheapRelay describes its service as pay-as-you-go access compatible with Codex and Claude Code, with one key, real-token billing including cache reads and writes, and no monthly subscription. Use its charged rates and transaction records rather than substituting a tool’s default price estimate. Sign up for CheapRelay when you are ready to collect your own receipts.

Finally, price accepted work. Require passing tests, inspect the diff, and record review time separately. Five minutes of review at an assumed $60 hourly labor cost equals $5.00—far more than this example’s API difference. The useful winner is the configuration that delivers an acceptable patch at the lowest verified total cost.

注册 价格自己试,注册就送试用额度。

顺手再看

日期货架语言标题
2026-10-25省钱用编码 AgentENCoding Assistant Habits That Double Your Bill
A receipt-style breakdown shows how oversized prompts and verbose answers turn a $0.60 coding session into $1.20, before retries.
2026-10-25省钱用编码 AgentENThree AI CLIs, One Desktop, a $30 Budget
A receipt-style plan for running Claude Code, Codex and Gemini CLI together, with a $30 usage budget and no invented token prices.
2026-10-25省钱用编码 AgentENCoding Agents in CI: A $0.50 Pipeline Budget
Build a receipt for every coding-agent run, reserve spend before requests, and stop retries before they turn a small fix into a large bill.
2026-10-25省钱用编码 AgentENClaude Code on Windows: A PowerShell Cost Receipt
Configure Claude Code with PowerShell environment variables, then audit a four-line token receipt without confusing example rates with real prices.
2026-10-25省钱用编码 AgentENGemini CLI vs Claude Code: The Shell Chore Receipt
A concrete token-cost comparison for shell chores, with itemized receipts, retry math, cache caveats, and practical spending controls.
2026-10-25省钱用编码 AgentENCheap First, Escalate Later: A Coding Cost Receipt
A worked token receipt shows how cheaper-first pair programming can cut API spending, with clear rules for escalating without wasting developer time.