跳到正文
OpenRouter:Announcements·· 3 小时前AI 评分73

OpenRouter 用真实会话数据拆解 Claude Code 成本:Opus 5.5 短会话中位数 $0.31

AI 导读

OpenRouter 基于真实会话数据发布了 Claude Code 在不同模型和会话长度下的成本统计,显示 Opus 5.5 短会话(2至9轮)中位数为 $0.31,Sonnet 5.5 为 $0.16。文章指出大部分初始成本来自系统提示词和工具定义的提示词缓存写入,并给出了通过设置默认模型、路由后台任务至 Haiku 以及控制会话长度来降低开销的方法。

正文 · 原文

Claude Code is free to install. What you pay for is the model it calls. If you run Claude Code on an API key, a short session of 2 to 9 turns with Claude Opus 5.5 costs $0.31 at the median, and a long session of 10 to 49 turns costs $1.39. The same sessions with Claude Sonnet 5.5 cost $0.16 and $0.60.

Those medians come from real Claude Code sessions on OpenRouter in the 30 days to October 18, 2026. Claude Code was the top app in our daily app ranking on October 21, so there’s a lot of usage behind them. Below, we use that data to show what a session costs on each model, then how to run Claude Code on OpenRouter so you can pick the model for each session, see what it cost, and cap your spend.

Tl;dr

  • Claude Code is free. You pay for the model it calls, either through a Claude subscription or per token on an API key.
  • On an API key, a 2-to-9-turn session costs $0.31 at the median on Opus 5.5, $0.16 on Sonnet 5.5 and under a cent on Haiku 5.5.
  • Most of the cost is Claude Code’s own context, written to the prompt cache on the first request and read back on every turn after it.
  • Make Sonnet your default, send background jobs and sub-agents to Haiku, keep sessions short, and set a credit limit on the key.
  • Run Claude Code on OpenRouter with ori claude --model <model> to choose the model for each session. Your Activity page shows what each session really cost.

Does Claude Code cost money?

The CLI costs nothing. Every request it makes goes to a model, and you pay for those requests in one of two ways. A Claude subscription covers them up to a usage limit, and an API key charges per token. This post covers the API-key route, because that’s where you can see and control what each session costs. Through OpenRouter, the same key works with Claude models and with other models Claude Code can call.

The quickest way to run Claude Code on OpenRouter is Ori Harness. It starts the Claude Code already on your machine with OpenRouter settings in place, and signs you in through your browser, so there is no key to paste:

curl -fsSL https://openrouter.ai/labs/ori/install.sh | bash
ori claude --model anthropic/claude-sonnet-5.5

Only sessions you start with ori claude run on OpenRouter. Plain claude keeps using your subscription.

What does a Claude Code session cost?

We publish the median cost of Claude Code sessions by model and session length in our session-cost dataset. Here are the Claude models in our dataset and a few popular alternatives:

Model1 turn2–9 turns10–49 turns
Claude Fable 5.1$0.342$1.049$3.734
Claude Opus 5.5$0.136$0.305$1.390
Claude Sonnet 5.5$0.071$0.155$0.596
Claude Haiku 5.5$0.002$0.007$0.053
Kimi K3$0.040$0.117$0.825
GLM-5.3$0.010$0.044$0.363
DeepSeek V4.1 Flash$0.003$0.009$0.047
GPT-6 Luna$0.002$0.005$0.024

Median cost per Claude Code session by model and number of turns, for the 30 days to October 18, 2026.

The model you pick has the biggest effect on cost. A one-turn Fable 5.1 session costs more than a long Haiku 5.5 session. Once you’ve picked a model, session length matters most. A 10-to-49-turn Opus session costs about ten times as much as a one-turn session, and Sonnet 5.5 costs about half as much as Opus 5.5 or less at every length.

Why does a one-turn session cost 14 cents?

Most of the cost is Claude Code’s own context, not your prompt. We ran claude -p "Reply with exactly: ok" against Opus 5.5 through OpenRouter, in an empty folder on Claude Code 2.1.307. The reply was four tokens, but the session wrote 17,047 tokens to the prompt cache. Those tokens are Claude Code’s system prompt and tool definitions. At Opus 5.5’s cache-write price of $5 per million tokens, they cost $0.085. A real project adds its own instructions and the files Claude Code reads, which is why the dataset’s one-turn median is higher, at $0.136. The number of startup tokens also changes between Claude Code versions and settings.

Once that context is in the cache, later requests read it back at $0.20 per million tokens, which is 25 times cheaper than writing it. That’s why each turn after the first adds less than the first one did. Costs climb again as the context grows, because Claude Code writes every new file it reads to the cache once and then reads it back on every turn after that. Our prompt caching guide covers how writes and reads are billed.

What did our own sessions cost?

The dataset shows what other people’s sessions cost. To compare models on a task we controlled, we gave Claude Code a small invoicing library with three bugs and five failing tests. We ran it three times on each model through OpenRouter, and every run fixed all three bugs.

ModelMedian cost per sessionTurnsTokens read from cacheTokens written to cache
Opus 5.5$0.0985111,0009,800–10,300
Sonnet 5.5$0.0625125,000–154,00015,000–43,500
Haiku 5.5$0.00526–8126,000–199,00016,400–45,800

These costs come in under the dataset’s 2-to-9-turn medians for two reasons. Our task was small, and we ran each model’s three sessions back to back, so they shared a warm cache. That’s also why the Opus runs wrote fewer tokens to the cache than our one-turn test did. For a fresh session on a real project, the dataset medians above are the better guide. The models still land in the same order. Sonnet cost about two thirds of what Opus did, and Haiku cost about a twelfth of what Sonnet did.

If you check numbers like these yourself, don’t rely on Claude Code’s own total_cost_usd. It uses Anthropic’s built-in price table, and when it doesn’t recognize an OpenRouter model name, it guesses. In our runs, it reported $0.16 to $0.31 for Haiku sessions that cost about half a cent, and it overstated Opus sessions by about 50%. Your Activity page shows what you actually paid. For a running total inside Claude Code, you can add our cost-tracking statusline, which reads each session’s spend from OpenRouter.

How much does Claude Code cost per month?

Multiply the number of sessions you run by the median for your typical session length. Here are three examples, using the dataset medians and 22 workdays a month:

UsageOpus 5.5Sonnet 5.5
Light: 5 short sessions (2–9 turns) a workday$34$17
Regular: 20 short sessions a workday$134$68
Heavy: 10 long sessions (10–49 turns) a workday$306$131

These are estimates. Your own sessions will cost more or less depending on the size of your codebase and how much of it Claude Code reads.

How do you lower Claude Code’s cost?

You control the two things that drive the bill, which model each session runs on and how long the session goes on.

Make Sonnet your default

If you use Opus for everything, switching your default to Sonnet roughly halves the bill. In our test, Sonnet fixed the same bugs. Keep Opus for the sessions that need it.

Send background work and sub-agents to Haiku

Claude Code uses a fast model for small background jobs, and it can hand parts of a task to sub-agents. Haiku 5.5 passed our bug-fix test at a fraction of Sonnet’s cost, so it’s a good fit for both. These settings make Sonnet 5.5 your default and route background jobs and sub-agents to Haiku 5.5:

export ANTHROPIC_BASE_URL="https://openrouter.ai/api"
export ANTHROPIC_AUTH_TOKEN="$OPENROUTER_API_KEY"
export ANTHROPIC_API_KEY=""
export ANTHROPIC_MODEL="anthropic/claude-sonnet-5.5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="anthropic/claude-haiku-5.5"
export CLAUDE_CODE_SUBAGENT_MODEL="anthropic/claude-haiku-5.5"

The first three lines connect Claude Code to OpenRouter; the last three set the models. Our Claude Code integration guide and setup tutorial cover the rest of the setup.

Keep sessions short

A 10-to-49-turn session costs about four to five times as much as a 2-to-9-turn one. When you move on to an unrelated task, start a fresh session or run /compact instead of carrying the old context with you.

Try a cheaper model for routine work

Through OpenRouter, Claude Code can call models from other labs, and the dataset shows people doing it. GLM-5.3 and Kimi K3 sessions cost less than Opus sessions at every length, and our guide to the lowest-cost LLM inference on OpenRouter covers how to find cheaper options. To try one, pass it to Ori Harness:

ori claude --model z-ai/glm-5.3

Claude Code is built for Anthropic models, though, so test any other model on your own tasks before you switch. Ori Eval does this for you: your coding agent finds test material in your project, runs the models you want to compare on it, and recommends one with the scores and costs behind it.

Set a spending cap

You can set a credit limit on an API key, so a runaway session stops at a number you chose. In an organization, a guardrail with a budget limit caps each member or key per day, week or month, and OpenRouter applies it to sessions started with Ori Harness too. On Enterprise plans, workspace budgets cap a whole team’s spend per day, week, month or lifetime.

Frequently asked questions

How much does Claude Code cost per token?

Claude Code costs whatever the model it calls charges per token. Claude Opus 5.5 costs $4 per million input tokens, $20 per million output tokens, $5 per million tokens written to the prompt cache and $0.20 per million tokens read from it. Claude Sonnet 5.5 costs half those rates. Claude Haiku 5.5 costs $0.10 per million input tokens and $0.50 per million output tokens, with cache reads at $0.01 per million. Most of a Claude Code session’s tokens are cache reads.

Is Claude Code cheaper with Sonnet or Opus?

Sonnet is cheaper. In our session-cost data, Claude Code sessions on Claude Sonnet 5.5 cost about half as much as sessions on Claude Opus 5.5 at every session length. In our own bug-fixing test, Sonnet fixed the same bugs as Opus.

Can I use Claude Code with other models?

Yes. When you point Claude Code at OpenRouter, it can call models from other labs. Our session-cost data includes Claude Code sessions on GLM, Kimi, DeepSeek, Qwen and GPT models. Claude Code is built for Anthropic models, so test another model on your own tasks before you switch to it.

Why is my first Claude Code request so expensive?

The first request writes Claude Code’s system prompt, tool definitions and project context to the prompt cache. In our test with Claude Opus 5.5 in an empty folder, that was about 17,000 tokens, which cost about $0.085, and a real project adds more. Later requests read the same context from the cache at a much lower price, 25 times lower on Opus 5.5.

Next steps

来源:OpenRouter:Announcements · openrouter.ai