Rightshold™ Sign up

Answers · agent payments

Our agent pays for LLM inference and other metered APIs with MPP (the Machine Payments Protocol) sessions through the mppx client, reserving stablecoin once and paying per request or per streamed token. Which settings actually cap what it can spend, which ones only look like a cap, and how do we set a total budget?

Last updated

TL;DR: Use three layers, because each mppx setting caps something different. maxDeposit caps the funds reserved in one session channel, not total spend: an agent that opens channels with ten APIs can reserve ten times that amount. maxAmount caps the price per unit (one request or one token) and needs currencies and decimals set; expectedRecipients rejects offers from any seller address you didn't list. The total budget lives below the SDK: the MPP docs say to cap spend across channels, processes and restarts with a Tempo access key, a delegated signing key with a token spending limit per period (their example is 10 OUSD a day), recipient scopes and an expiry. Two gaps matter for streaming: the session manager used for per-token streams doesn't enforce currencies, expectedRecipients or maxAmount, so stream only from APIs you trust; and by default Mppx.create installs a payment-aware global fetch, so every fetch-based tool and MCP transport in the agent can pay when a server answers with a 402 challenge. Close sessions when the job is done, because the reserve stays locked until the channel closes.

What should I check, step by step?

1. Give each agent runtime its own Tempo access key with a daily (or shorter) token spending limit, recipient scopes and an expiry of days, not months. That is the only limit in the MPP docs that holds across channels, processes and restarts.

  1. Set maxDeposit to what one job should be able to spend with one API, remembering that it is per channel. The client reserves the smaller of the seller's suggested deposit and your maxDeposit.
  2. Set maxAmount (price per request or token) together with currencies and decimals, and list the seller addresses you expect in expectedRecipients, so a changed price or a different payee is rejected before anything is signed.
  3. Pin origin and use one channel store per API origin, so one API's session can't be reused against another.
  4. For per-token streaming with tempo.session.manager, stream only from APIs you trust and rely on maxDeposit plus the access-key limit, because the manager ignores currencies, expectedRecipients and maxAmount.
  5. Decide which code is allowed to pay. Mppx.create patches the global fetch by default, so any tool, plugin or MCP transport using fetch can answer a 402 challenge with the agent's money; keep paid calls behind a wrapper that checks the task's budget first.
  6. Close each session with the same manager instance when the job is done (not between requests) and check the receipt's spent value, so unspent reserve comes back and the next job starts from a known balance.
  7. Use the SDK's payment hooks to log every challenge, amount, currency and receipt reference with the task that caused it, without logging keys.
  8. Test the whole setup on the Moderato testnet with npx mppx before funding a mainnet account.

What do maxDeposit and maxAmount cap in an mppx MPP session?

MPP, co-authored by Stripe and Tempo, is an open protocol in which a server answers a request with HTTP 402 and a payment challenge, the client authorizes payment and retries, and the server returns the resource with a receipt. A session is the pay-as-you-go form: the first paid request opens a payment channel and reserves funds on-chain, later requests or streamed tokens are paid with signed off-chain vouchers, and closing settles what was spent and returns the rest.

How do you set a total daily budget for an AI agent paying with MPP?

The MPP guide on managing agent spend points to Tempo access keys: delegated signing keys authorized by a wallet, with token spending limits per period, limits on which contracts or functions can be called, recipient restrictions and an expiry. Its example key can spend up to 10 OUSD per 86,400-second period, can only transfer OUSD to one recipient and expires after seven days. Separate keys for separate apps, tools or deployments each get their own budget, scopes and revocation path, and pinning a key to a runtime keeps two deployments from sharing one budget by accident.

Does the mppx session manager enforce price and recipient limits when streaming?

For streamed responses the guide uses tempo.session.manager with .sse(), which signs new vouchers and tops up the channel within maxDeposit without interrupting the stream. The same guide says the manager doesn't enforce currencies, expectedRecipients or maxAmount, so a streaming API can raise its per-token price and the client keeps paying until the reserve or the access-key limit runs out.

How do I ask Rightshold about this (free, no key)?

Add the MCP server https://www.rightshold.com/mcp to Claude, Cursor, ChatGPT, Grok or VS Code, then ask: “Before my research agent opens an MPP session with api.example.com, check the session's $1.00 maximum reserve against its spending policy for this task and record the decision with the session reference, so the total across every API it pays stays inside today's budget.”

One-click setup

{
  "tool": "authorize_spend",
  "arguments": {
    "credential_id": "YOUR_AGENT_CREDENTIAL_ID",
    "amount_minor": 100,
    "currency": "USD",
    "merchant_domain": "api.example.com",
    "category": "api-usage",
    "reference": "mpp-session-api.example.com-task-42"
  }
}

Rightshold records spending decisions your agent asks it for. It never holds or moves money, isn't a wallet or payment processor and isn't affiliated with Stripe, Tempo or the MPP project. The mppx behavior described here comes from the mpp.dev guides and Stripe's MPP docs as checked on November 10, 2026 (mppx 0.18.0 was the latest npm release); settings and defaults may change. Not financial advice.

What are the sources?

Related

Not legal advice. JSON · Markdown · All answers

Get a free API key in one call

No card and no email needed. 100 free credits; the license and policy checks stay free without a key.

curl -s -X POST https://www.rightshold.com/v1/accounts/signup -H "Content-Type: application/json" -d '{"accept_terms":true}'
export RIGHTSHOLD_API_KEY=rs_...   # the api_key from the reply (shown once)
curl -s https://www.rightshold.com/v1/licenses/check -H "Authorization: Bearer $RIGHTSHOLD_API_KEY" \
  -H "Content-Type: application/json" -d '{"license":"MIT","intended_use":{"commercial_use":true}}'