Metered AI payments

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.

Card rate on top-ups only Recording usage is free Node and Python

Lumen Labs sells reports from its API at 50¢ 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 50¢ comes off the credit, leaving $59.00.

Prepaid credit topped up, drawn down by usage, refilled automatically, and spent by an agent over HTTP 402.
1

Price a unit

Create a meter, such as report at 50¢. A meter’s price is fixed: a new price is a new meter.

2

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.

3

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.

Meters and usage

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_credits with a topup_url when the balance can’t cover it
// Once: 50¢ 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
});
Prepaid credit

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.

HTTP 402

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: "usd",
    credits: { meter: "report" }, // or pay by card
  }),
  (req, res) => res.json(buildReport()),
);
An unpaid request
$ 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.

For agents

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/mcp
MCP docs
Credit and usage 4record_usageget_credit_balancecreate_credit_topupcreate_customer
Payments and links 13create_payment_linkget_payment_linklist_payment_linksupdate_payment_linkexpire_payment_linkcreate_paymentcharge_saved_cardget_paymentlist_paymentscapture_paymentcancel_paymentcreate_refundget_balance
Subscriptions 4create_plancreate_subscriptionget_subscriptioncancel_subscription
Cards for agents 11create_agent_cardget_card_balancelist_topup_optionscreate_topuplist_topupsget_topuplist_card_transactionsfreeze_cardrequest_approvalget_approvallist_card_authorizations
Bookings 11list_servicescreate_servicefind_availabilitycreate_bookingget_bookinglist_bookingsreschedule_bookingcancel_bookingapprove_bookingdecline_bookingadd_to_waitlist
Connect 7create_connected_accountget_connected_accountlist_connected_accountscreate_onboarding_linkcreate_transferlist_application_feesget_connect_balance
Docs 1search_docs

Agent 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();
Framework docs

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 docs

Cards 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 works
Pricing

Pay the card rate once, when credit is bought.

A $20 top-up on a US card costs 70¢ (2.49% + 20¢). The hundreds of uses it pays for cost nothing to record.

See all pricing
Top-upUS card$20.00 Card fee2.49% + 20¢, once70¢ Each use recordedmeter events, batches, summaries$0.00 Each use drawn from creditno card, no fee per call$0.00
Not yet. Not available yet:
  • Prices below a cent 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.