Macropay is your Merchant of Record. Once usage is metered, we calculate
the charge, collect payment, and remit the correct sales tax or VAT in every
jurisdiction — so usage-based pricing never turns into a global tax project.
Choose a strategy
LLM
Wrap an
@ai-sdk/* model (or a PydanticAI agent) to auto-report input,
output, and cached tokens per call — the foundation for AI metered billing.Stream
Wrap a Readable or Writable stream to meter bytes consumed as data flows.
S3
Meter object storage — track uploads, downloads, and stored volume on S3.
Delta time
Bill on elapsed wall-clock time between a start and a stop — compute minutes,
sandbox sessions, render jobs.
How a strategy fits together
1
Wrap the thing you want to meter
Hand the strategy your existing client, stream, or timer. It returns an
instrumented version that behaves identically to the original.
2
Run your code as usual
As your wrapped object does its work, the strategy measures the dimension you
care about — tokens, bytes, seconds — and tags each event with the customer.
3
Events stream to your meter
The helper batches and sends events off the hot path. A
meter aggregates them, and a metered
price turns the total into a charge.
Why use a strategy instead of raw events
You can always call the ingestion API yourself. Strategies exist so you don’t have to wire up the boilerplate that surrounds every metered workload:Built for AI and agent workloads
The LLM strategy captures token usage from a single model call — the building block for billing on usage. From there you can layer on Macropay’s AI primitives to bill on what actually matters:- Activity and outcomes — go beyond tokens with the Signals API, ingesting agent-attributed activity and outcome signals.
- Margin visibility — compare billed revenue against AI cost (COGS) per agent to see your agentic margin, not just top-line usage.