UnitPay
Blog

The AI Billing Data Model You Actually Need

A pragmatic schema for AI billing: events, price versions, costs, invoices, and outcomes—so eng doesn't rebuild it twice.

Published on
August 23, 2025
Written by
Vijay Gorfad Vijay Gorfad
The AI Billing Data Model You Actually Need

The minimal tables

  • Customers, Accounts, Subscriptions
  • Agents & Signals (events you meter)
  • UsageEvents (immutable, versioned)
  • Costs (vendor, rate, allocation)
  • PriceVersions (effective_at, rules)
  • Invoices & LineItems (ties to usage + outcomes)

Event example (JSON)

{
  "customer_id": "acme",
  "agent_id": "outbound_v2",
  "signal": "meeting_held",
  "quantity": 1,
  "metadata": {"duration_min": 27, "attendee_role": "VP Sales"},
  "occurred_at": "2025-08-28T09:15:00Z",
  "price_version": "v1.3"
}

Cost example (allocation)

  • LLM tokens → workflow step → customer.
  • RAG queries/minutes → feature → customer.
  • Storage/egress → monthly proration → customer.

Rev-rec pointers

  • Usage lines: recognize on consumption.
  • Outcome lines: recognize on completion/acceptance.
  • Commitments: recognize over term; overages as consumed.

Why this model future-proofs you

You can switch value metrics, add outcomes, or re-price without data migrations—just add a new PriceVersion and keep the event log immutable.

Want the full schema (SQL) as a downloadable? Ping us—we’ll share the UnitPay starter pack.

Related Posts

Continue reading

More articles from the UnitPay team.

The revenue engine for AI agents

Stop building billing.
Start selling AI.

UnitPay handles usage tracking, pricing, invoicing, and payments for AI agents, all in one platform. Live in 10 minutes.