Back to guides
Comparison·September 5, 2026·Updated October 3, 2026·8 min read

Codex vs. Claude Code — choose by billing and connection structure, not performance

Their capabilities have grown closer. What actually matters when deciding whether to switch is the billing model and which endpoint each can target.

There are many articles comparing Codex and Claude Code, and most compare features and subjective experience. This page compares only billing and connectivity. The reason is simple: those are what matter when someone who is already paying for one decides whether to switch. It does not rank performance—as explained below, you can assess that in 30 minutes using your own repository.

First, what they have in common

Both run in the terminal, read and write repository files, run tests, and even commit changes. Both have a dual billing structure: subscription usage limits or pay-as-you-go API key billing, and those two are not combined. Their capabilities have become more similar with each generation, and feature lists no longer settle which one is better.

Difference 1: How to change the endpoint (the most practically significant difference)

~/.zshrc
# Claude Code — Anthropic 形状の環境変数で向き先を変える
export ANTHROPIC_BASE_URL=https://api.kunavo.com
export ANTHROPIC_AUTH_TOKEN=sk-kn-...
# Claude Code の既定モデルと opus / sonnet エイリアスは Anthropic の最新モデルを指すので、
# Kunavo がまだ提供していなくても 404 にならないようモデルを固定する。
# sonnet エイリアスの指す Sonnet 5.5 は Kunavo では提供していないため、固定しないと /model sonnet、
# opusplan の実行フェーズ、sonnet 指定のサブエージェントが 404 になる。
# opus は Opus 5.5 に固定 (Claude Code v2.1.280 以降が必要。古ければ claude update)。
export ANTHROPIC_MODEL=claude-sonnet-5
export ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-5-5
export ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-5
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5
claude

# Codex CLI — OpenAI 形状。ただし受け付けるのは Responses API だけ
export OPENAI_BASE_URL=https://api.kunavo.com/v1
export OPENAI_API_KEY=sk-kn-...
codex

Claude Code changes its destination with two lines: ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN. Codex CLI looks similar, but there is one restriction: as a custom provider, it accepts only POST /v1/responses(Responses API), and will not work with endpoints that implement only chat completions.

When choosing a destination to switch to or use alongside your current tool, check this one point before the price list. Setup instructions are in Codex CLI API key setup and Claude Code API key setup.

Difference 2: Token prices

Rates are loaded from the catalog. Per 1M tokens:

ModelInput / output
Claude Sonnet 5(Claude Code default)$1.40 / $7.00
GPT-5.6 Sol(Codex default)$2.00 / $12.00

However, unit price tells only half the story of your bill. The actual amount is determined by how much context you send in each step, which varies with your tool design and the size of your repository. Run the same task once with each, and compare the usage in the responses — in 30 minutes, you will have an answer better suited to your use case than any comparison article.

The actual pay-as-you-go costs and break-even points for each are calculated separately in Codex pricing and Claude Code pricing.

Difference 3: What to do when you hit a usage limit

Both subscription allowances use rolling windows. For options when you hit a Codex limit, OpenAI's help page lists adding credits, applying a reset, upgrading, or waiting for the reset. Because the limits are counted separately, switching to the other tool when one is unavailable is also a practical workaround. You can also use one key for both—they speak different protocols, Anthropic format and Responses format, to the same endpoint.

Claude's usage window and your options when you hit a limit are described in Claude Pro limits.

No performance ranking

Public benchmarks vary depending on task selection, and the numbers have a short shelf life compared with the rate of model updates. Any ranking written here may already be out of date by the time you read it.

Use a reliable procedure instead. Choose one fairly challenging task from your repository (such as adding a feature without breaking existing tests). Give both tools the same instructions and record only ① whether it worked, ② tokens used, and ③ the number of times you had to rework it. This will give you a ranking for your own use case. See Claude Code vs Codex for a detailed comparison in English.

Frequently asked questions

What is the biggest difference between Codex and Claude Code?

Both are terminal-based agents that work with repositories, and their capabilities have become similar. In practice, the biggest differences are billing and connectivity. Claude Code can change its destination with ANTHROPIC_BASE_URL, while Codex CLI accepts only the Responses API as a custom provider. Both have a dual structure of subscription usage limits and pay-as-you-go billing, but their limits are counted separately and are not combined.

Which one is cheaper?

There is no fixed answer; it depends on how you use them. By token price, through Kunavo, Claude Sonnet 5 costs $1.40 / $7.00 per 1M tokens, while GPT-5.6 Sol costs $2.00 / $12.00. However, the amount of context sent per step determines the actual bill more than the unit price does, so the only reliable approach is to run the same task once with each and compare measured usage.

Can I use both together?

Yes, and many people do. A practical approach is to switch to the other one when you hit a usage limit; their limits are counted separately, so they do not affect each other. You can also use one API key for both—Claude Code speaks Anthropic format and Codex speaks Responses format, but both use the same endpoint.

Can I point Codex CLI to another provider's endpoint?

Yes, if the endpoint provides the Responses API (POST /v1/responses). The practical catch is that Codex CLI will not work with a gateway that implements only chat completions. Claude Code has no such restriction and works with an Anthropic-compatible /v1/messages endpoint. When considering a switch, check protocol support before looking at the price list.

Which one performs better?

This page does not rank them. Public benchmarks vary depending on task selection, and the numbers have a short shelf life compared with the rate of model updates. The most reliable way to judge them is to give both the same task in your own repository and check whether they complete it and how many tokens they use. It takes a few dozen minutes and gives you a more useful answer for your needs than any benchmark.

How much configuration changes when switching?

Each tool needs only two environment variables, so either one takes a few minutes to set up. Project rules files are not compatible, so instructions in Claude Code's CLAUDE.md need to be rewritten in the format used by the destination tool. In other words, most of the migration work is rewriting that rules file, not configuring the CLI itself.