Charge by the call, the token or the task.
Usage-based billing for AI products. Customers prepay credit by card, you record what they use and Tuppence draws it down. No card fee per use, and no invoice to chase at month end.
Lumen Labs sells reports from its API at 50p each. Its customer, Brightwell Studio, tops up £50.00 of credit by card. Each report delivered is recorded as usage and drawn from the credit: 43 reports, then 36, then 2 more take it below £10.00, which sends a low-balance event and triggers an automatic £50.00 top-up on the saved card. Then an agent calls the API: it is answered 402 Payment Required, retries with a Tuppence credit token, gets 200 OK, and 50p comes off the credit, leaving £59.00.
Price a unit
Create a meter, such as report at 50p. A meter’s price is fixed: a new price is a new meter.
Customers prepay
They top up credit by card on a hosted page, once or automatically when it runs low. Only that card payment carries a fee.
Record what they use
Send a meter event with your own ID for the work. Sent twice, it counts once. If credit runs out, the call returns a top-up link.
Record usage without double-charging.
Every usage event carries your own identifier, such as the task or request ID, so retries, replays and at-least-once queues can’t charge a customer twice.
- Quantity × the meter’s price, or an exact amount per event
- Batches of up to 100 events in one call
- Usage summaries per customer and per meter
402 insufficient_creditswith atopup_urlwhen the balance can’t cover it
// Once: 50p per report await tuppence.meters.create({ name: "report", unit_amount: 50 }); // Every time one is delivered await tuppence.meterEvents.create({ customer: "cus_01K…", meter: "report", identifier: "task_42", // sent twice, counted once });
# Once: 50p per report tuppence.meters.create(name="report", unit_amount=50) # Every time one is delivered tuppence.meter_events.create( customer="cus_01K…", meter="report", identifier="task_42", # sent twice, counted once )
Your customers top up. You never chase.
Customers buy credit by card at the normal card rate, and it’s drawn down as they use it. No card fee per use, and nothing to collect afterwards.
Top-ups
Top a customer up from your code, or send them to a hosted, branded top-up page that shows their balance.
Auto top-up
Set a threshold and an amount. When the balance drops below it, the saved card is charged and the credit refilled.
Low-balance events
credits.low_balance, credits.depleted and credits.auto_topup_failed reach your webhook so you can warn customers first.
Refund unused credit
Refund all or part of what’s left to the cards it came from.
Put a price on an API route in one line.
An unpaid request gets 402 Payment Required, with a link to pay or a way to spend prepaid credit. The caller, person or agent, pays, retries with the receipt and gets the response.
import { http402 } from "@tuppence/http402"; app.get( "/v1/report", http402({ tuppence, price: 50, currency: "gbp", credits: { meter: "report" }, // or pay by card }), (req, res) => res.json(buildReport()), );
from tuppence import AsyncTuppence from tuppence.http402 import Http402Middleware, PayWall app.add_middleware( Http402Middleware, routes={ "GET /v1/report": PayWall( AsyncTuppence(key), price=50, currency="gbp" ), }, )
$ curl -i https://your-api.example/v1/report HTTP/1.1 402 Payment Required Link: <https://pay.tuppence.ai/pay/pay_…>; rel="payment" { "price": 50, "currency": "gbp", "resource": "GET /v1/report", "accepts": [{ "type": "card_link", … }] } # Pay, then retry with the receipt: $ curl https://your-api.example/v1/report \ -H "Authorization: Tuppence-Receipt eyJ…"
Checked offline
Receipts are signed by Tuppence and checked against our published keys, with no call to us on the hot path.
Bound and single-use
A receipt names the route and amount it paid for, is valid for your account only and works once.
Agents spend credit, capped
Give a customer’s agent a short-lived credit token with a spending cap. Past the cap or expiry, it gets a 402 explaining why.
Paid MCP tools
paidTool() puts a price on a tool in any MCP server. Without a receipt it says where to pay. With one, it runs once.
Agents that can take payments and prove who they are.
An MCP server, tool packs for the major agent frameworks, a SKILL.md, and signed identities that show which agent did what.
MCP server
51 tools covering payment links, payments, refunds, subscriptions, customers, credit, cards, bookings and Connect. An agent sees only the tools its API key allows, and tools that move money need an idempotency key.
claude mcp add tuppence --env TUPPENCE_API_KEY=sk_test_… -- npx -y @tuppence/mcprecord_usageget_credit_balancecreate_credit_topupcreate_customercreate_payment_linkget_payment_linklist_payment_linksupdate_payment_linkexpire_payment_linkcreate_paymentcharge_saved_cardget_paymentlist_paymentscapture_paymentcancel_paymentcreate_refundget_balancecreate_plancreate_subscriptionget_subscriptioncancel_subscriptioncreate_agent_cardget_card_balancelist_topup_optionscreate_topuplist_topupsget_topuplist_card_transactionsfreeze_cardrequest_approvalget_approvallist_card_authorizationslist_servicescreate_servicefind_availabilitycreate_bookingget_bookinglist_bookingsreschedule_bookingcancel_bookingapprove_bookingdecline_bookingadd_to_waitlistcreate_connected_accountget_connected_accountlist_connected_accountscreate_onboarding_linkcreate_transferlist_application_feesget_connect_balancesearch_docsAgent frameworks
The same tools for the OpenAI Agents SDK, LangChain and the Claude Agent SDK, from one package: @tuppence/agent-tools.
import { tuppenceTools } from "@tuppence/agent-tools/openai-agents"; const { tools, close } = await tuppenceTools();
Agent identity
Give an agent its own key pair. It signs each request, and anyone can verify the signature against Tuppence’s public keys. Mandates record what a person allowed it to buy.
Identity docsCards for agents
Virtual Tuppence cards for your agents, with spending rules by merchant type and country, limits, and human approval above an amount you set. Their spend earns cashback.
How cashback worksPay the card rate once, when credit is bought.
A £20 top-up on a UK consumer card costs 16p (0.79%). The hundreds of uses it pays for cost nothing to record.
See all pricing- Prices below a penny per unit
- x402 and stablecoin payments
- Shared payment tokens from agentic checkout protocols
- Agent-to-agent payments
Spending credit through an agent’s token works in test mode. It opens for live payments once our compliance review is complete.
Payments that give more back.
Start in test mode in a minute. Go live once you’re verified.