# Pricing and billing

PnP prices, what a request costs, how funds are reserved, budgets and the 402 error.

## PnP

Requests are paid in **PnP**, the currency of the Nodul platform: 1 PnP = 100 ₽. Usage of a Router space is charged to its **payer**, a Nodul space the owner chose in the space settings. Top up the payer's PnP balance in Nodul.

## Prices

Every model has a price per input token, per output token and sometimes per request, in PnP. The [catalog](/models) shows prices per 1 million tokens; `GET /api/v1/models` gives them per token in `pricing`:

| Field              | Price of                                       |
| ------------------ | ---------------------------------------------- |
| `prompt`           | one input token                                |
| `completion`       | one output token, including reasoning tokens   |
| `input_cache_read` | one input token read from the provider's cache |
| `request`          | one request, for models that charge one        |

Prices already include the router's markup. Prices of Global models follow the provider's dollar price; prices of Russia models follow the provider's ruble price.

## What a request costs

The response's `usage.cost` is the exact charge of that request in PnP, with every attempt it made. The same amount is in the cabinet logs and in `GET /api/v1/generation`. An attempt the provider rejected with an error costs nothing. Rarely a provider accepts a request and then sends a broken answer: such an attempt is billed by an estimate, and `GET /api/v1/generation` shows it as `billable`.

A cancelled request is billed for what was generated before you closed the connection.

## Reservation

Before calling a provider, the router reserves funds for the worst case of the request: the whole body as input tokens and `max_tokens` (4096 by default) as output, for the most expensive model of a `models` list. After the answer, the reservation is released and only the actual cost is charged.

A request is accepted only when the payer's **available balance** covers the reservation:

```text
available = PnP balance − charged but not yet withdrawn − reserved by running requests
```

So with a small balance:

- set `max_tokens` close to what you need;
- keep `models` lists short;
- avoid sending large files as base64.

## Budgets

| Budget       | Where                                                                           | When reached                                     |
| ------------ | ------------------------------------------------------------------------------- | ------------------------------------------------ |
| Key budget   | The key's settings; resets never, daily, weekly or monthly at 00:00 Moscow time | `402 the API key spending limit is reached`      |
| Space budget | The Router space settings                                                       | `402 the Router space spending limit is reached` |

`GET /api/v1/key` shows the key's spend in the current period.

## 402 Payment Required

| Message                                                       | What to do                                         |
| ------------------------------------------------------------- | -------------------------------------------------- |
| `Insufficient credits: top up the payer Nodul space with PnP` | Top up the payer's balance, or lower `max_tokens`. |
| `the API key spending limit is reached`                       | Raise the key budget or wait for its reset.        |
| `the Router space spending limit is reached`                  | Raise the space budget.                            |

A `402` costs nothing: the provider is not called.
