AI agents are eating software. But the billing infrastructure built for SaaS subscriptions and per-seat pricing wasn't designed for autonomous systems that run thousands of times a day, consume variable compute per run, and succeed or fail in ways that matter to the customer. This guide covers what actually works.
Why AI agents break traditional billing
Traditional software has predictable resource consumption. A project management app costs roughly the same to serve per user per month. You charge a seat fee, cover your costs, take your margin. Done.
AI agents are different in three ways that matter for billing:
- Variable consumption. One agent run might use 500 tokens. The next uses 50,000. A fixed price per run either leaves money on the table or tanks conversion.
- Outcome-dependence. Customers don't buy agent runs — they buy agent results. An agent that books a meeting has a clear value. One that hallucinated and sent a wrong email has negative value. Billing the same for both is economically wrong.
- High frequency. Enterprise AI agents can fire 10,000+ times per day. Traditional billing systems weren't built for this event volume — they choke on metering, reporting, and invoice line items.
Token-based vs outcome-based pricing
Two models have emerged as viable. Here's how to think about them:
| Model | Best for | Risk |
|---|---|---|
| Token-based | Predictable workloads, developer tools, internal tooling | Customers don't understand tokens; friction at sale |
| Outcome-based | Customer-facing agents, workflow automation, revenue-generating actions | Requires reliable outcome detection; disputes on edge cases |
| Hybrid (base + token + outcome bonus) | Most production use cases | More complex to explain; worth it for conversion |
The hybrid model is what Rev uses internally and recommends to most builders. You charge a small base fee per API call (covers your fixed overhead), add a token component (covers compute), and add an outcome bonus only when the agent delivers a result the customer cares about. The base + token floor ensures you're never underwater on a run; the outcome bonus aligns incentives.
How metering actually works
Metering is the infrastructure layer that sits between your agent and your billing system. It captures four things per agent execution:
- Agent ID — which agent triggered the event
- Action — what the agent did (e.g.,
email.sent,calendar.booked) - Token count — input + output tokens consumed
- Outcome — success/failure/pending, with a result payload your pricing engine evaluates
Here's a minimal meter call using the Rev API:
curl -X POST https://rev.polsia.app/v1/meter \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "outreach-agent-v2",
"action": "email.sent",
"tokens_input": 1200,
"tokens_output": 340,
"outcome": "success",
"metadata": {
"recipient": "prospect@company.com",
"campaign": "q2-enterprise"
}
}'
Same call in Node.js:
const response = await fetch('https://rev.polsia.app/v1/meter', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
agent_id: 'outreach-agent-v2',
action: 'email.sent',
tokens_input: 1200,
tokens_output: 340,
outcome: 'success',
metadata: {
recipient: 'prospect@company.com',
campaign: 'q2-enterprise'
}
}),
});
const { price_charged, outcome_id } = await response.json();
console.log(`Charged: ${price_charged}`);
And in Python:
import requests
response = requests.post(
'https://rev.polsia.app/v1/meter',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'agent_id': 'outreach-agent-v2',
'action': 'email.sent',
'tokens_input': 1200,
'tokens_output': 340,
'outcome': 'success',
'metadata': {
'recipient': 'prospect@company.com',
'campaign': 'q2-enterprise'
}
}
)
data = response.json()
print(f"Charged: ${data['price_charged']}")
The API returns a price_charged value (computed from your pricing tier configuration) and an outcome_id you can use to resolve deferred outcomes — when your agent can't immediately confirm success, you register the call as "pending" and resolve it later via a webhook or manual API call.
Deferred outcomes: the pattern most builders miss
Not every agent action has an immediate, detectable outcome. An email gets sent — did the prospect reply? A meeting invite fires — did the contact accept? An order gets placed — did it ship successfully?
The naive approach is to assume success and charge upfront. This creates disputes and erodes trust. The correct approach is deferred outcome resolution:
// Step 1: Register the call as pending
const { outcome_id } = await revgrid.meter({
agent_id: 'email-agent',
action: 'email.sent',
tokens_input: 800,
tokens_output: 220,
outcome: 'pending',
expires_at: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000), // 7 days
});
// Step 2: When you detect a reply (via webhook, polling, etc)
await revgrid.resolveOutcome(outcome_id, {
outcome: 'success',
metadata: { reply_received: true, reply_at: new Date() }
});
// The outcome bonus is charged only now
Rev's pricing engine handles this natively — pending outcomes don't charge the outcome bonus until resolved, and expired outcomes fall back to a configurable default (usually just the base + token fee).
Build vs buy: what actually matters
Every team that builds their own metering regrets it by month 3. Here's the honest breakdown:
| Concern | Build yourself | Rev |
|---|---|---|
| Time to first meter call | 2–4 weeks (schema, API, reliability) | 30 minutes |
| Outcome bonus logic | Custom code per use case | Config-driven per pricing tier |
| Deferred outcomes | Build queue, expiry, resolution | Built in |
| Revenue analytics | Build dashboards | Real-time dashboard included |
| Stripe integration | Months of work | Done |
| What you're actually building | Billing infrastructure | Your AI agent |
The argument for building: full control, no vendor dependency, no revenue share. Valid if you're at scale with a dedicated platform team. At early stage, you're trading engineering time that should go into your core product for infrastructure that's been solved.
The Rev approach
Rev exposes metering, pricing configuration, and outcome resolution as a single API. You define your pricing tiers (base fee, token rate, outcome bonus conditions), call /v1/meter after every agent execution, and the engine handles the math, the storage, and the Stripe billing.
Three things worth knowing:
- Pricing simulator. Before you pick rates, run numbers through the interactive pricing simulator — it models your expected revenue under different call volumes, token usage, and success rates.
- Live demo. The live demo on the homepage shows real production API calls firing in real time, including the price computation on each call. Best way to see the system in action before committing.
- API key in 30 seconds. Sign up and your key is in your inbox before you close the tab. No sales call, no approval process.
Get your API key and make your first /v1/meter call in under 5 minutes. Get Your API Key →
What to read next
If you're building an AI agent that needs billing, the fastest path is:
- Read the API docs — 10 minutes to understand the full surface area
- Run the pricing simulator with your expected volume
- Get your API key and make a test meter call
- Wire your agent to call
/v1/meterafter every execution
The first three steps take under 30 minutes. The fourth is one line of code.