Anthropic API pricing 2026: التكلفة حاسبة
- Anthropic API pricing is per-رمز, billed separately for input (what you send) and output (what Claude returns). السعرs vary by model — Haiku is ~19x cheaper per input رمز than Opus.
- For most production workloads, Sonnet 4.5 is the right default: it التكلفةs $3.00/M input رمزs and $15.00/M output رمزs, versus $15/$75 for Opus 4. Use Opus only when the quality difference is measurable and the التكلفة increase is in the budget.
- The three patterns that cause unexpected bills: long context windows on expensive models, high output-to-input ratios, and sub-وكيل loops that multiply per-call التكلفة by task count.
Current pricing — verified April 2026
These are the published rates from anthropic.com/api as of April 2026. الكل prices are per million رمزs. Anthropic adjusts pricing periodically; verify against the current pricing page before committing to a budget.
| Model | Input / M رمزs | Output / M رمزs | Context window |
|---|---|---|---|
| Claude Haiku 3.5 | $0.80 | $4.00 | 200K |
| Claude Sonnet 4.5 | $3.00 | $15.00 | 200K |
| Claude Opus 4 | $15.00 | $75.00 | 200K |
The ratio between input and output التكلفة is approximately 1:5 across all models — output رمزs are five times more expensive than input رمزs. This asymmetry matters for workloads that generate long responses, like code generation or document drafting.
There is also a prompt caching tier for all models. Cached input رمزs (content that appears at the same position in repeated requests) التكلفة significantly less: $0.08/M for Haiku cache reads, $0.30/M for Sonnet cache reads, $1.50/M for Opus cache reads. Prompt caching is a meaningful lever for applications that send the same system prompt or context repeatedly.
التكلفة حاسبة — five common workloads
The table above is the raw rate. What follows is what those rates actually mean for real workloads. الكل calculations use Sonnet 4.5 unless otherwise noted.
Workload 1: Single Claude Code task (scoped)
A typical scoped task: read 3 files (avg 200 lines each), conversation with 4 back-and-forth turns, output 150 lines of code.
Workload 2: Long Claude Code session (2 hours)
An extended session working across a codebase: 20+ file reads, multiple tasks, accumulated conversation history. No /compact.
Workload 3: PR review automation (per PR)
Automated PR review: system prompt, diff of ~400 lines, output a structured review with inline comments.
Workload 4: Sub-وكيل parallel task (5 وكيلs)
Five parallel وكلاء فرعيون, each with workload equivalent to Workload 1. Context is not shared — each وكيل carries its own copy.
Workload 5: Same as Workload 2, but on Opus 4
The two-hour extended session, switching from Sonnet 4.5 to Opus 4 without changing the workload.
Septim Drills — $29 · التكلفة calibration exercises
Twelve structured exercises including a التكلفة-projection drill: you estimate workload التكلفة before running it, then compare against the Anthropic console. The delta closes fast. Includes the sub-وكيل budget worksheet and the prompt-caching الإعداد دليل.
Get Septim Drills — $29 →The three patterns that cause unexpected bills
1. Opus 4 on tasks that Sonnet handles equivalently
The most common mistake: a developer sets their default model to Opus 4 because it is the most capable model, then runs it on workloads where Sonnet 4.5 produces identical results. Code formatting, التوثيق generation, test writing, and most مراجعة الكود tasks do not benefit from Opus 4's additional capability. At $15/$75 per million رمزs versus $3/$15, this التكلفةs five times as much for the same output.
The correct default: start with Sonnet 4.5 and measure whether Opus 4 produces meaningfully better results on your specific workload before paying for it.
2. Long context windows with expensive models
A single request to Opus 4 that fills the 200K context window التكلفةs $3.00 in input رمزs alone. If you are running dozens of these requests daily — document analysis, codebase review, large refactors — the التكلفة compounds quickly. The context management دليل covers the techniques for keeping context lean.
Prompt caching helps significantly here for repeated contexts: a 100K-رمز system prompt cached and reused التكلفةs $1.50/M on Opus versus $15/M uncached. If your application sends the same large context on every request, caching is likely your highest-leverage التكلفة lever.
3. Sub-وكيل loops without a budget ceiling
Claude Code can spawn وكلاء فرعيون. An وكيلic سير العمل that spawns 10 وكيلs to work in parallel on a large codebase multiplies your single-session التكلفة by 10. Without an explicit task budget defined in your CLAUDE.md, this is not a configuration error — it is Claude doing what you asked. The fix is explicit task scoping: define what each وكيل should read, what it should produce, and how many turns it is allowed.
If you have already had a Tokenocalypse-style spike, Septim Rescue ($299) covers emergency remote intervention to diagnose the source and implement ceiling controls on your workloads.
Token estimation without running the call
Rough estimation rules that hold to within 20% for English-language content:
- 1,000 words of English prose ≈ 1,300–1,500 رمزs
- 100 lines of TypeScript ≈ 800–1,000 رمزs
- 100 lines of Python ≈ 700–900 رمزs
- A 200-line diff ≈ 1,600–2,000 رمزs
- The Anthropic رمزizer is available at console.anthropic.com/رمزizer for exact counts
For production applications, use the usage field in every API response to track actual رمز consumption. Log it from day one — reconstructing التكلفة history from aggregated logs is much harder than collecting it in real time.
Claude Code vs. direct API: which التكلفةs more
Claude Code (the CLI tool) uses the same underlying API but adds overhead: the system prompt, tool descriptions, and the conversation management layer all consume رمزs you do not pay for when making direct API calls. In practice, a Claude Code session التكلفةs roughly 15–25% more per وحدة of useful output than an equivalent direct API call optimized for the same task.
That overhead is the price of the وكيلic loop — the ability to iterate, read files, run commands, and course-correct. For structured, predictable API calls (classification, extraction, generation of a known format), the direct API is cheaper. For مفتوح-ended development tasks, Claude Code's overhead is worth it.
Septim Drills — $29 · 12 التكلفة-aware exercises
Structured exercises covering model selection, context compression, prompt caching الإعداد, and sub-وكيل budgeting. Each exercise includes a التكلفة target and a verification step. ادفع مرة واحدة, مستودع GitHub invite on purchase.
اشترِ Septim Drills — $29 → التكلفة already out of control? Septim Rescue ($299) →