How to pay for an API with MPP on Tempo

Updated 2026-11-10

MPP (the Machine Payments Protocol) lets an agent pay for a single HTTP request with no account or API key: the server answers 402 with a payment challenge, the client pays on Tempo and retries. This guide shows the three client paths the MPP docs list, using a live Tanod route as the example (October 2026).

What the server sends

Call a paid route without paying and you get 402 Payment Required with an MPP challenge in the WWW-Authenticate header. On Tanod it looks like this (the request field is base64 JSON with the amount in token base units, the token address and chain 4217):

curl -i -X POST https://tanod.dev/v1/pdf (no payment)
HTTP/2 402
www-authenticate: Payment id="…", realm="tanod.dev", method="tempo", intent="charge", request="eyJhbW91bnQiOi…"

The same 402 also carries an x402 PAYMENT-REQUIRED header, so one route serves both protocols. Each Tanod operation in openapi.json declares both under x-payment-info.protocols, with the price in USD (most routes cost USD 0.001 to 0.02).

1. Tempo CLI

Tempo's wallet CLI pays the challenge and prints the response. You sign in once with a passkey in the browser.

terminal
curl -fsSL https://tempo.xyz/install | bash
tempo wallet login
tempo request -X POST --json '{"url": "https://www.rfc-editor.org/rfc/rfc9110.pdf", "max_pages": 50}' https://tanod.dev/v1/pdf

2. mppx in TypeScript

Mppx.create patches the global fetch, so an ordinary request pays a 402 and retries. Keep the key in a server-side environment variable.

npm install mppx viem
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`)
Mppx.create({ methods: [tempo({ account })] })

const res = await fetch('https://tanod.dev/v1/docs/to-markdown', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({ url: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf' }),
})
console.log(await res.json())

3. AgentCash

AgentCash keeps one balance for an agent and pays MPP or x402. Set up its wallet, see the document tools with their prices, then save the origin for your agent:

terminal
npx agentcash onboard
npx agentcash try https://docs.tanod.dev
npx agentcash add https://docs.tanod.dev

Then npx agentcash fetch <url> -m POST -b '…' calls a route and pays it.

Before you pay

Check the price in the challenge (or in x-payment-info) before signing. A failed Tanod lookup is not charged, and several routes have a small free daily allowance per IP over MCP. If your client only speaks x402, the same routes take USDC on Base, Polygon, Solana, BNB Chain or Arbitrum; see how agents find x402 APIs.

MPPScan probed Tanod's paid routes and indexed them as MPP-ready in October 2026; the client steps here follow the spec.

Try a route

Document to Markdown, PDF text, OCR, PDF tables and bank statements, FX and crypto market data: every paid Tanod route is listed with its price in the OpenAPI document and in llms-full.txt.

llms-full.txt →

How many developers install MPP next to x402, Lightning and ATXP (npm, 30 days): agent payment rails by developer adoption. Related guides: How to get your API listed in the directories agents search (includes MPP directories). Client commands follow mpp.dev's quickstart as of October 2026; check its docs for changes.
Listings and behaviour change, so check each tool's own docs.