# Credits and pricing

> What a page costs, by route. What is free, and when you are charged.

**TL;DR**: you pay in credits, only for a page we deliver. The route that
fetched the page sets its price. Blocks we detect are free, and so are our
errors. `X-Credits-Charged` on every answer says what the request cost.

## What a page costs

Leave `engine` and `proxy_tier` out, and we try the cheapest route first.

| Route | Credits a page | Included data | Each started 128 KiB above | Most a page costs |
| -- | -- | -- | -- | -- |
| HTTP, datacenter | 1 | 64 KiB | +1 | 129 |
| HTTP, residential | 8 | 64 KiB | +8 | 520 |
| Browser, datacenter | 15 | 1 MiB | +1 | 87 |
| Browser, residential | 32 | 64 KiB | +8 | 544 |

Lowest credits per page, before page size. Each site has its own price: a site we have not priced yet costs at least 8 on residential and Browser. Run check_site (free) to see the price for your site.

- **Included data** means everything we download to build the page, not
  only the HTML you get back. Above it, each started 128 KiB adds the
  amount in the next column.
  When we open the site's home page first to look like a visitor (our
  routing choice, never yours), those bytes are ours up to a fixed
  allowance per route. The same goes for a first try that was blocked or
  stalled when our retry then got the page. Above the allowance, those bytes
  count like page bytes. All bytes count toward the byte cap.
- **Most a page costs** is the largest page we fetch on that route, on most
  sites, before extras.
- **Extras**: JSON output (`response_types=json`) and a premium country add
  +1 each. A screenshot adds +1 (`viewport`) or +2 (`full`), only when its
  link is delivered. Page actions (`actions`) add +3 per page, however many
  actions run. Markdown, text, links, metadata, page data, compact HTML
  and network capture (`network=true`) add nothing.
- **A copy** served for `max_age` costs the cache price from the price list, never more than the
  fetch it copies. See [Reuse a recent copy](/guides/cache).
- **Schema extraction** (`schema`) adds a base and a rate per started 1,000
  weighted tokens (input + 5 × output), only when the answer matches the
  schema. The answer's `credits` says what it added; a failed extraction is
  free, and the page is still charged.
- **Documents**: when the `url` answers with a PDF, DOCX, PPTX or XLSX
  file, it adds the document price per PDF page, per PPTX slide, per started
  3,000 characters of DOCX text, or per started 1,000 non-empty XLSX cells.
  `X-Document-Units` says what we counted. We count after the file arrives;
  if your balance cannot cover it, nothing is sent and nothing is charged. A
  scanned or locked file is a free 422 `document_unreadable`.
- [Engines and proxy tiers](/guides/engines) explains the routes.

## Where the credits went

Three headers split `X-Credits-Charged` in parts. They always add up to it.

| header | what it paid for |
| -- | -- |
| `X-Credits-Route` | Reaching the page: the engine and proxy tier, a premium country, and data above the included amount. |
| `X-Credits-Output` | What we made of the page: JSON output, a schema extraction, and a document's pages. |
| `X-Credits-Other` | The rest: page actions, and on a monitor's page the monitor check. |

The screenshot is not in them, as it is not in `X-Credits-Charged`. When we
lower the charge, for example because the browser found no more text than
the HTTP page, the cut comes off the route first, then other, then output.

## What is free

- A block we detect: a 422 `blocked` with `X-Billing: blocked`.
- Every error of ours, 4xx and 5xx. Errors carry no `X-Credits-Charged`.
- A target that answers 5xx.
- A page action that cannot run: a 422 `action_failed`. Above the
  [failure cap](/reference/errors#actions-and-the-failure-cap), it is charged.

A free answer carries no page content: only the status, our headers and, for
a block, our JSON error.
- `GET /v1/tier`, `GET /v1/stats/domain`, and the MCP tool `check_site`.
- Submitting a batch. Each URL is charged on its own, when we fetch it.

## Cap what one page may cost

- `max_credits` is the most one page may cost. We skip any route above it,
  and `X-Ladder-Truncated: true` says routes were skipped. If no route is
  left, the answer is a free 400 `max_credits_too_low` before any attempt.
- A page whose bytes would cost more than `max_credits` is cut at the bytes
  it pays for: a 200 with `X-Truncated: max_credits`, charged at most
  `max_credits`.

## Check a site first

Before you spend credits on a new site, ask what it costs and how well it
works. All three are free. The first shows the success of each route over
the last days, the second shows today's price, and the MCP tool shows both:

```sh tab="/v1/stats/domain"
curl -s -H "Authorization: Bearer $MEG_API_KEY" \
  "https://get.megalania.io/v1/stats/domain?host=lab.megalania.io&days=7"
```

```sh tab="/v1/tier"
curl -s -H "Authorization: Bearer $MEG_API_KEY" \
  "https://get.megalania.io/v1/tier?host=lab.megalania.io"
```

```json tab="MCP check_site"
{"name": "check_site", "arguments": {"host": "www.example.com"}}
```

- `/v1/stats/domain` answers each route's `success_rate` and `block_share`
  for the whole platform. A route counts only the days with at least 3
  customers and at least 20 requests behind it.
- `/v1/tier` answers `price`, the quote for a typical page on the host, and
  `quotes`, what each route we can use today costs. A request pays the route
  that delivers the page. Before response types and premium geo, the quotes
  equal the base prices on the Plan page.
- `check_site` returns both, as `success` and `price`, and says when there
  is no data yet.

[Fetch, extract and lists](/guides/fetch#ask-about-a-host-before-you-spend-credits)
explains every field.
