# Pricing

URL: https://docs.router.ezat.io/pricing

> Live prices per million tokens for every model, what each price column means, long-context tiers, and how to work out a request's cost from its usage.

## When to use this page

You want to know what a model costs, which tokens are billed at which price, or how to estimate a request's cost from the `usage` in its response. How the balance is charged is on [How billing works](https://docs.router.ezat.io/billing.md).

## Prices

| Model id | Input | Output | Cache write (5 min) | Cache write (1 h) | Cache read |
| --- | --- | --- | --- | --- | --- |
| `anthropic/claude-fable-5-1` | $9 (~~$10~~) | $45 (~~$50~~) | $11.25 (~~$12.5~~) | $18 (~~$20~~) | $0.225 (~~$0.25~~) |
| `anthropic/claude-fable-5` | $9.5 (~~$10~~) | $47.5 (~~$50~~) | $11.875 (~~$12.5~~) | $19 (~~$20~~) | $0.95 (~~$1~~) |
| `anthropic/claude-opus-5-5` | $3.6 (~~$4~~) | $18 (~~$20~~) | $4.5 (~~$5~~) | $7.2 (~~$8~~) | $0.18 (~~$0.2~~) |
| `anthropic/claude-opus-5` | $4.75 (~~$5~~) | $23.75 (~~$25~~) | $5.9375 (~~$6.25~~) | $9.5 (~~$10~~) | $0.475 (~~$0.5~~) |
| `anthropic/claude-sonnet-5-5` | $1.8 (~~$2~~) | $9 (~~$10~~) | $2.25 (~~$2.5~~) | $3.6 (~~$4~~) | $0.09 (~~$0.1~~) |
| `anthropic/claude-sonnet-5` | $1.9 (~~$2~~) | $9.5 (~~$10~~) | $2.375 (~~$2.5~~) | $3.8 (~~$4~~) | $0.19 (~~$0.2~~) |
| `anthropic/claude-haiku-5-5` | $0.09 (~~$0.1~~) | $0.45 (~~$0.5~~) | $0.1125 (~~$0.125~~) | $0.18 (~~$0.2~~) | $0.009 (~~$0.01~~) |
| `anthropic/claude-opus-4-8` | $4.75 (~~$5~~) | $23.75 (~~$25~~) | $5.9375 (~~$6.25~~) | $9.5 (~~$10~~) | $0.475 (~~$0.5~~) |
| `anthropic/claude-opus-4-7` | $4.75 (~~$5~~) | $23.75 (~~$25~~) | $5.9375 (~~$6.25~~) | $9.5 (~~$10~~) | $0.475 (~~$0.5~~) |
| `anthropic/claude-opus-4-6` | $4.75 (~~$5~~) | $23.75 (~~$25~~) | $5.9375 (~~$6.25~~) | $9.5 (~~$10~~) | $0.475 (~~$0.5~~) |
| `anthropic/claude-sonnet-4-6` | $2.85 (~~$3~~) | $14.25 (~~$15~~) | $3.5625 (~~$3.75~~) | $5.7 (~~$6~~) | $0.285 (~~$0.3~~) |

Live from the catalog. Struck-through prices are Anthropic's official list prices. Prices are in USD per million tokens and exclude tax.

**Long context**

| Model id | Input | Output | Cache write (5 min) | Cache write (1 h) | Cache read |
| --- | --- | --- | --- | --- | --- |
| `anthropic/claude-haiku-5-5` > 100,000 | $0.45 (~~$0.5~~) | $2.25 (~~$2.5~~) | $0.5625 (~~$0.625~~) | $0.9 (~~$1~~) | $0.045 (~~$0.05~~) |

Prices are in USD per million tokens. Each price is below Anthropic's official list price for the same model; the struck-through number next to it is that official price. The table is live from the catalog (`GET https://api.router.ezat.io/api/models`), so it always shows the current prices.

A request is charged at the prices in force when it starts, for the tokens it used. Listing models and counting tokens are free.

## What each column means

| Column | What it prices | Anthropic format `usage` | OpenAI format `usage` |
| --- | --- | --- | --- |
| Input | Input tokens that were not written to or read from the prompt cache | `input_tokens` | `prompt_tokens` minus `cached_tokens` and `cache_write_tokens` |
| Output | Every token the model generates, thinking included | `output_tokens` | `completion_tokens` |
| Cache write (5 min) | Input tokens written to the cache with the default 5-minute lifetime | `cache_creation.ephemeral_5m_input_tokens` | `prompt_tokens_details.cache_write_tokens` |
| Cache write (1 h) | Input tokens written to the cache with `"ttl": "1h"` | `cache_creation.ephemeral_1h_input_tokens` | Included in `cache_write_tokens` |
| Cache read | Input tokens read back from the cache | `cache_read_input_tokens` | `prompt_tokens_details.cached_tokens` |

- `cache_creation_input_tokens` is the total of both cache writes. When a response doesn't split it, all of it is billed as 5-minute writes.
- On the OpenAI-compatible API, `prompt_tokens` counts all input, cached or not. Prompt caching is automatic there, with 5-minute writes, so `cache_write_tokens` are 5-minute writes unless you set a 1-hour breakpoint yourself. See [Prompt caching](https://docs.router.ezat.io/guides/prompt-caching.md).
- A model without prompt caching (see the Features column on [Models](https://docs.router.ezat.io/models.md)) bills all input at the input price.

### Thinking tokens

Thinking tokens are output tokens and bill at the output price. On `/v1/messages` they are part of `output_tokens`. On the OpenAI-compatible API they are part of `completion_tokens`, and `completion_tokens_details.reasoning_tokens` says how many there were; the thinking text itself isn't returned.

## Long-context tiers

Some models have a long-context tier, listed under **Long context** below the main table. The tier applies when a request's input is above the threshold shown (in `GET /api/models`, when it reaches the tier's `minInputTokens`, which is the threshold plus one). Input here means every input token: `input_tokens` plus cache writes plus cache reads.

When a request is above the threshold, the whole request is billed at the tier's prices, output and cache tokens included, not only the tokens past the threshold. A request at or below the threshold is billed entirely at the normal prices.

## Work out the cost of a request

Multiply each token count by its price and divide by one million:

```text
cost = ( input_tokens          × Input
       + 5-minute cache writes × Cache write (5 min)
       + 1-hour cache writes   × Cache write (1 h)
       + cache_read_input_tokens × Cache read
       + output_tokens         × Output ) / 1,000,000
```

Use the long-context prices instead when the request is above its model's threshold. Amounts are kept to 12 decimal places, so a small request costs a fraction of a cent.

This script makes a request, reads the prices from the public catalog and prints what the request cost:

```python title="cost.py" test
import json
import os
import urllib.request

import anthropic

client = anthropic.Anthropic(base_url="https://api.router.ezat.io", api_key=os.environ["EZAT_API_KEY"])
message = client.messages.create(
    model="anthropic/claude-sonnet-5-5",
    max_tokens=64,
    messages=[{"role": "user", "content": "Say hello in five words."}],
)

# Prices in USD per million tokens, from the public catalog (no key needed).
with urllib.request.urlopen("https://api.router.ezat.io/api/models") as response:
    catalog = json.load(response)["data"]
name = message.model.lower()  # the response echoes the id or alias you sent
pricing = next(m["pricing"] for m in catalog if name == m["id"] or name in m["aliases"])

usage = message.usage
written = usage.cache_creation_input_tokens or 0
written_1h = (usage.cache_creation.ephemeral_1h_input_tokens if usage.cache_creation else 0) or 0
tokens = {
    "input": usage.input_tokens,
    "cacheWrite5m": written - written_1h,
    "cacheWrite1h": written_1h,
    "cacheRead": usage.cache_read_input_tokens or 0,
    "output": usage.output_tokens,
}

# Above a long-context threshold, the whole request uses that tier's prices.
prompt = tokens["input"] + written + tokens["cacheRead"]
prices = {field: pricing[field] for field in tokens}
for tier in sorted(pricing["longContext"], key=lambda tier: tier["minInputTokens"]):
    if prompt >= tier["minInputTokens"]:
        prices.update(tier["prices"])

cost = sum(count * float(prices[field]) for field, count in tokens.items()) / 1_000_000
print(tokens)
print(f"about {cost:.8f} USD")
```

The script estimates with the catalog's prices. What a request was actually charged is on the dashboard's **Usage** page (https://router.ezat.io/usage), in the **Cost** column of **Recent requests**.

## What isn't charged

- Requests refused before they reach a model: a missing or invalid key, an unknown model, a limit, or a zero balance.
- Requests that fail: the provider returns an error, no capacity is available, or the response stops with an error.
- `POST /v1/messages/count_tokens`, and the model lists.

[How billing works](https://docs.router.ezat.io/billing.md) covers interrupted streams, which are charged for what was generated.

## For AI agents

1. Prices are in USD per million tokens. Read them from `GET https://api.router.ezat.io/api/models` (`pricing`, with `longContext` tiers) or `https://docs.router.ezat.io/pricing.md`. Never hard-code them.
2. Cost = Σ tokens × price / 1,000,000, over `input_tokens`, both kinds of cache write, `cache_read_input_tokens` and `output_tokens`.
3. Thinking tokens are output tokens.
4. If `input_tokens` + cache writes + cache reads is at least a tier's `minInputTokens`, every component uses that tier's price.
5. On the OpenAI-compatible API, uncached input is `prompt_tokens` − `cached_tokens` − `cache_write_tokens`.