# MPP - Agentic Payments

Let an agent pay per request from its own wallet over MPP: no account, no API key, the same models and prices.


An agent can pay for inference itself, request by request, with no account and no API key. It pays over [MPP](https://mpp.dev), the open machine payments standard co-authored by Tempo and Stripe, from a Tempo wallet. Same models, same gateway, same per-token prices as the [rate card](https://inference.boundless.network/docs/pricing). The overview is at [boundless.network/mpp](https://boundless.network/mpp).

> Real money: the MPP endpoint runs on Tempo mainnet (chain 4217) and takes USDC.e, MACH or OUSD, each priced 1:1 with USD.

## The MPP endpoint

```text
https://api.inference.boundless.network/mpp
```

| Route | Paid | What |
| --- | --- | --- |
| `POST /mpp/v1/chat/completions` | yes | OpenAI Chat Completions |
| `POST /mpp/v1/responses` | yes | OpenAI Responses |
| `GET /mpp/v1/models` | no | The models sold over MPP, with prices in USD per 1M tokens |
| `GET /mpp/setup` | no | The setup guide every 402 links to, written for an agent to follow |

## Supported client: Nanocode

Right now the supported client is [Nanocode](https://github.com/gakonst/nanocode), the coding agent, run with `--gateway tempo`: its model requests are paid over MPP from a Tempo wallet. A plain OpenAI client stops at the 402. It needs an MPP client to open the session and sign each request. `nanocode --help` documents the `--gateway` and `--tempo-*` flags.

Install the Tempo wallet, log in, and install Nanocode from source (needs a Rust toolchain; Nanocode's prebuilt release does not have `--gateway tempo` yet):

```bash
curl -fsSL https://tempo.xyz/install | bash
tempo wallet login
cargo install --git https://github.com/gakonst/nanocode nanocode-cli --bin nanocode --locked
```

Fund the wallet with a few dollars of USDC.e, OUSD or MACH on Tempo mainnet (`tempo wallet fund --mach`). A wallet paying with MACH must also hold a few cents of USDC.e: MACH's transfer policy lets it move only to approved addresses, so it can't pay Tempo gas, and the channel open and each top-up pay their network fee (a fraction of a cent) in USDC.e. Keep it small: a session locks only its deposit, and the unspent part comes back when the session closes. If cargo can't fetch a pinned revision, set `CARGO_NET_GIT_FETCH_WITH_CLI=true`.

Run it against the MPP endpoint:

```bash
nanocode --gateway tempo --gateway-base-url https://api.inference.boundless.network/mpp
```

`models` after the flags lists the endpoint's models, `exec` runs one prompt without the terminal interface, and `-m` picks a model:

```bash
nanocode --gateway tempo --gateway-base-url https://api.inference.boundless.network/mpp models
nanocode --gateway tempo --gateway-base-url https://api.inference.boundless.network/mpp exec -m deepseek/deepseek-v4.1-flash-1017 "Reply with exactly: ok"
```

With `--gateway tempo` and `--gateway-base-url` set:

- The models are the ones the endpoint lists at `/mpp/v1/models`; `-m` picks one, and the first listed is the default. The Claude models `nanocode models` also shows use your own Claude login, not the endpoint.
- The chain comes from the endpoint's payment challenge, so on Tempo mainnet it pays USDC.e by default. `--tempo-network mainnet` pins the chain.
- `--tempo-currency` picks the token: `usdc.e`, `mach` or `ousd`.
- The session deposit is 1 token by default. `--tempo-deposit` changes it, in base units with 6 decimals.
- Concurrent runs each pay from their own session. `--tempo-session <name>` pays from a named one instead.
- `NANOCODE_GATEWAY=tempo` in the environment stands in for `--gateway tempo`, and every `--tempo-*` flag has a `NANOCODE_TEMPO_*` variable: `NANOCODE_TEMPO_NETWORK`, `NANOCODE_TEMPO_CURRENCY`, `NANOCODE_TEMPO_DEPOSIT`, `NANOCODE_TEMPO_SESSION`, `NANOCODE_TEMPO_KEEP_SESSION`.

Inside a session, `/spend` shows what each model cost.

## How you are charged

1. An unpaid request gets `402 Payment Required` with a `WWW-Authenticate: Payment` challenge.
2. The client opens a payment channel with a small deposit (1 USDC.e suggested) and signs a voucher per request.
3. Each request first holds its worst case: every body byte counted as an input token, plus the output limit.
4. It is then charged the tokens the model actually used, at the listed prices. Cached input is charged at the cache rate.
5. A request the model fails to answer is refunded.
6. Closing the session refunds the unspent deposit to your wallet.

Wallets are screened against sanctions lists when they open a session.

## Closing a session

- Nanocode closes its session cooperatively on exit, and the unspent deposit comes back at once. `--tempo-keep-session` keeps the session open for the next run.
- With the Tempo wallet, `tempo wallet sessions close` sends an on-chain close request. If the session has unsettled spend, the endpoint answers with its own close within about 2 to 4 minutes, settling that spend and refunding the rest. With nothing unsettled, your wallet withdraws the deposit after the 900-second grace period.

## Not supported over MPP

These are refused before any payment:

- `n` or `best_of` above 1
- `previous_response_id`, `conversation`, and stored prompts or items
- Images or files by URL (send them inline as `data:` URLs)

For anything MPP doesn't cover, use an [API key](https://inference.boundless.network/docs/quickstart) and prepaid credits.
