← Blog

Claude API Cost Calculator: Price Out Every Request

2026-11-14 · 5 min read · SubToAPI Team

If you're trying to figure out what a single Claude API call actually costs, the answer always comes down to the same formula: (input tokens × input price) + (output tokens × output price), with the price depending on which model you call. There's no flat "per request" fee — cost scales with how much text goes in and how much text comes out, so a short classification call and a long document-summarization call on the same model can differ in price by 100x or more.

This article walks through the exact math, gives you a reusable calculator you can drop into your own code, and covers the details that trip people up: caching, streaming, system prompts, and tool use all count toward your token totals even though they're easy to forget.

The core pricing formula

Claude models are billed per million tokens, split into input and output rates. As of this writing, approximate rates look like this (always check Anthropic's pricing page for current numbers, since rates change):

| Model tier | Input (per 1M tokens) | Output (per 1M tokens) | |---|---|---| | Fast/small model | ~$0.80 | ~$4 | | Mid-tier model | ~$3 | ~$15 | | Top-tier model | ~$15 | ~$75 |

Output tokens are consistently 4–5x more expensive than input tokens across tiers. This matters a lot for cost calculation: a request that returns a long essay costs far more than one that returns a short JSON object, even if the input prompt is identical.

A worked example

Say you send a 2,000-token prompt (roughly 1,500 words) to a mid-tier model and get back a 500-token response:

input_cost  = 2000 / 1_000_000 * 3   = $0.006
output_cost = 500  / 1_000_000 * 15  = $0.0075
total       = $0.0135 per request

That's about 1.35 cents for that single call. Run it 10,000 times a month and you're at roughly $135/month for that one feature — which is why estimating per-request cost before shipping matters more than it seems at first glance.

Building your own calculator

You don't need a third-party tool for this — a small function covering the math is enough, as long as you keep your rate table current.

const RATES = {
  "fast-model":  { input: 0.80, output: 4.00 },
  "mid-model":   { input: 3.00, output: 15.00 },
  "top-model":   { input: 15.00, output: 75.00 },
};

function estimateCost(model, inputTokens, outputTokens) {
  const rate = RATES[model];
  if (!rate) throw new Error(`Unknown model: ${model}`);
  const inputCost = (inputTokens / 1_000_000) * rate.input;
  const outputCost = (outputTokens / 1_000_000) * rate.output;
  return {
    inputCost,
    outputCost,
    total: inputCost + outputCost,
  };
}

console.log(estimateCost("mid-model", 2000, 500));
// { inputCost: 0.006, outputCost: 0.0075, total: 0.0135 }

To estimate tokens before you've made the call, a rough rule of thumb is 1 token ≈ 4 characters of English text (closer to 0.75 words). For precise pre-call estimates, tokenize your actual prompt with a tokenizer library rather than guessing.

What actually counts toward token usage

A lot of "my calculator doesn't match my bill" confusion comes from undercounting what's included in a request:

This last point surprises people: streaming is a UX improvement, not a cost-saving technique. If you're building streaming responses, see /docs/streaming for implementation details, but don't expect it to change your bill.

Caching and batching can cut real costs

If your calculator shows a higher number than what you actually want to pay, two levers actually move the number:

  1. Prompt caching — if you repeatedly send the same large system prompt or document context, cached input tokens are billed at a steep discount (often 90% off) compared to fresh input tokens.
  2. Batch processing — non-real-time workloads (bulk classification, offline summarization) are often eligible for batch discounts of around 50% off standard rates, in exchange for asynchronous processing.

Both require you to restructure how you call the API, so they're worth planning for before you've built a system that assumes synchronous, uncached calls.

Tracking actual cost per request in production

A calculator is useful for estimation, but once you're live, you want real per-request cost, not an estimate — and you want it per API key, per team, or per customer if you're billing usage onward.

Every Claude API response includes usage metadata (input and output token counts for that specific call), so the cleanest approach is to multiply those real numbers by your rate table immediately after each response, rather than trying to reconstruct cost from logs later.

This is one of the gaps SubToAPI (https://subtoapi.app) is built to close. It turns your Claude access into a standard HTTPS API with per-key usage tracking, so every request's token counts and derived cost show up in a dashboard automatically — no need to hand-roll the accounting logic above across every service that calls Claude. If you're issuing separate API keys per customer or per internal team, that visibility is what lets you see which feature or which client is actually driving spend. Check /docs/messages for the request/response shape and /pricing for plan details (Solo, Team, and Scale tiers with a free trial at signup).

Quick mental benchmarks

To sanity-check any number your calculator spits out:

Questions

Does Claude charge a flat fee per API call? No. There's no per-request fee — cost is entirely based on input and output token counts multiplied by the model's per-million-token rate.

Why is my output more expensive than my input for the same request? Output tokens are priced 4–5x higher than input tokens across Claude's model tiers, so even a short completion to a long prompt can carry a meaningful chunk of the total cost.

Does streaming change how much a request costs? No. Streaming affects how the response is delivered to your client, not the billing — you pay the same per-token rate whether the response streams or arrives all at once.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →