> ## Documentation Index
> Fetch the complete documentation index at: https://docs.macropay.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Payment Infrastructure for AI SaaS

> Meter tokens, bill by usage or outcome, and watch your margin per customer — Merchant of Record billing built for AI products and agents.

The unit you sell is a token, a tool call, or a job completed — not a seat. Yet most billing stacks still assume a flat monthly subscription and a single price. Macropay is the **Merchant of Record** for teams whose costs and revenue both move with usage: we run the metering, price the consumption, file the tax, and show you the margin on every customer.

## Why generic billing breaks for AI

A spreadsheet of flat plans falls apart the moment one account burns 200x more inference than another. Four problems show up on day one:

<AccordionGroup>
  <Accordion title="Usage swings by orders of magnitude" icon="chart-scatter">
    The same customer might send 800 tokens at 9am and 400,000 at noon. Your meter has to capture every event at that granularity — no dropped requests, no double counts — because each one is money in or money out.
  </Accordion>

  <Accordion title="Every model has a different cost" icon="microchip-ai">
    A reasoning model for hard prompts, a small model for classification, an embeddings model for retrieval — each carries its own per-token rate. Billing that treats them as one bucket either overcharges customers or quietly erodes your margin.
  </Accordion>

  <Accordion title="You can't see what a customer costs you" icon="chart-line">
    Knowing what someone *pays* tells you half the story. Without the upstream model spend sitting next to the invoice, you can't spot the power user who's underwater or the prompt that doubled your COGS.
  </Accordion>

  <Accordion title="Subscriptions and metering have to coexist" icon="coins">
    Most AI plans bundle credits into a tier, then bill overage on top. That means real subscription logic *and* real usage aggregation in one system — not two tools stitched together with a nightly cron.
  </Accordion>
</AccordionGroup>

## Pick how you charge

With Macropay everything you sell is a **product** — one-time or recurring, same API. The pricing model is a setting on that product, so you can change how you charge without re-plumbing your integration:

| Model                        | Good for                                                       |
| ---------------------------- | -------------------------------------------------------------- |
| **Usage-based (metered)**    | Pure consumption — per token, per request, per generated asset |
| **Seat-based**               | Team tools where price scales with members                     |
| **Credits**                  | Prepaid balances or monthly grants drawn down by usage         |
| **Fixed + metered**          | A base tier with included credits, then overage                |
| **Pay-what-you-want / free** | Open-source tiers, design partners, freemium funnels           |

## Three ways to instrument it

### Capture token cost automatically

Wrap your LLM calls with the `@macropayments/ingestion` SDK. It reads token counts and model metadata off each response and ships a usage event — no metering pipeline to build and maintain.

```typescript theme={null}
import { Ingestion } from "@macropayments/ingestion";
import { LLMStrategy } from "@macropayments/ingestion/strategies/LLM";
import { openai } from "@ai-sdk/openai";

// Bill summarization runs at $3 per million tokens.
const ingestion = Ingestion({
  accessToken: process.env.MACROPAY_ACCESS_TOKEN,
})
  .strategy(new LLMStrategy(openai("gpt-4o")))
  .cost((ctx) => ({
    amount: (ctx.metadata.totalTokens / 1_000_000) * 3.0,
    currency: "usd",
  }))
  .ingest("ai-usage");
```

Works with the Vercel AI SDK (TypeScript) and PydanticAI (Python), across OpenAI, Anthropic, Google, and any provider those frameworks support.

### Route through the AI proxy

Already calling an OpenAI-compatible API? Point it at Macropay's `/ai/v1` endpoint and every completion is metered and cost-attributed as it streams through — zero changes to your request shape.

```bash theme={null}
curl https://api.macropay.ai/ai/v1/chat/completions \
  -H "Authorization: Bearer $MACROPAY_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [{ "role": "user", "content": "Draft a release note." }]
  }'
```

### Bill agents by outcome, not just tokens

For agentic products, raw token counts are a weak proxy for value. The **Signals API** lets you bill on what the agent actually *did* — a ticket resolved, a lead qualified, a deployment shipped — and attribute it to the customer.

```bash theme={null}
curl https://api.macropay.ai/v1/signals \
  -H "Authorization: Bearer $MACROPAY_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "signals": [{
      "kind": "outcome",
      "event_name": "ticket_resolved",
      "external_customer_id": "support-bot-user-42",
      "external_id": "ticket_8Qp2",
      "data": { "agent": "support-bot", "minutes_saved": 14 }
    }]
  }'
```

Outcome signals roll up into **value receipts** that certify ROI to your customer — time saved, revenue generated, cost avoided — and into your **agentic margin**: billed revenue versus the AI cost of producing it, per agent.

## See your margin, not just your revenue

Metering is only half the picture; the other half is what each call cost *you*. [Cost Insights](/features/cost-insights/introduction) pairs upstream model spend with customer revenue so you can act on it:

* Gross margin per customer and per agent
* Cost traces for individual LLM spend
* Per-model breakdowns to guide model selection
* Profitability alerts before a customer goes underwater

## What Merchant of Record covers

You meter usage; we handle the rest of the money. As the legal seller of record, Macropay:

<CardGroup cols={2}>
  <Card title="Files and remits tax worldwide" icon="receipt">
    EU VAT, UK VAT, US sales tax and more — calculated, collected, and filed for you. You never touch a return, and your tax liability stays with us.
  </Card>

  <Card title="Fights chargebacks" icon="shield-halved">
    We're the merchant on the customer's statement, so disputes route to us. We work to prevent them and manage the ones that land.
  </Card>

  <Card title="Carries PCI scope" icon="lock">
    Cards are tokenized in our PCI DSS Level 1 compliant vault. Sensitive data never reaches your servers.
  </Card>

  <Card title="Issues compliant invoices" icon="file-invoice">
    Every receipt carries the correct tax treatment for the buyer's jurisdiction, globally.
  </Card>
</CardGroup>

## Patterns that ship on Macropay

<CardGroup cols={2}>
  <Card title="Writing & content tools" icon="pen-nib">
    A monthly tier with included words, overage past the allowance, and per-model cost tracking to tune which model handles which prompt.
  </Card>

  <Card title="Inference & API platforms" icon="cloud">
    Pure per-token or per-request pricing, volume tiers for big accounts, and a self-serve usage view in the customer portal.
  </Card>

  <Card title="AI features inside SaaS" icon="wand-magic-sparkles">
    A fixed subscription plus metered AI add-ons, or a credit allowance that AI actions draw down each cycle.
  </Card>

  <Card title="Agents & assistants" icon="robot">
    Outcome-based billing through the Signals API, value receipts that prove ROI, and per-agent margin so you know which agents pay for themselves.
  </Card>
</CardGroup>

## Pricing

<CardGroup cols={2}>
  <Card title="4.5% + 50¢" icon="percent">
    **Per successful transaction**

    Covers tax filing, remittance, dispute handling, and all billing infrastructure. +0.5% on subscriptions; +1.5% on international cards.
  </Card>

  <Card title="$0 to start" icon="dollar-sign">
    **No setup fees, no monthly minimum**

    Free ACH and SEPA payouts. You pay when your customers pay you.
  </Card>
</CardGroup>

## Ship metered billing today

<Steps>
  <Step title="Create your account">
    [Sign up at macropay.ai](https://macropay.ai/signup) — no credit card needed.
  </Step>

  <Step title="Define a meter">
    In the dashboard, add a meter that filters your usage events and aggregates the quantity you bill on — token sum, request count, or an outcome signal.
  </Step>

  <Step title="Attach pricing to a product">
    Create a product and pick its model: a subscription with included credits and an overage rate, or pure per-unit usage pricing.
  </Step>

  <Step title="Send your first event">
    Drop in the ingestion SDK, route through `/ai/v1`, or post to the Signals API. Each event meters and bills automatically.
  </Step>

  <Step title="Hand off the money">
    Macropay runs invoicing, tax, disputes, and the customer portal. You stay on the product.
  </Step>
</Steps>

<CardGroup cols={2}>
  <Card title="Start building" icon="rocket" href="https://macropay.ai/signup">
    Spin up an account and bill your first metered request.
  </Card>

  <Card title="Read the guide" icon="book" href="/blog/ai-inference-billing-guide">
    A deeper walk through billing for LLM inference and protecting your margin.
  </Card>
</CardGroup>
