How Paygentic Works
Usage metering for AI agents, not humans.
Capture every agent action, attribute cost to the right customer, and generate invoices without building billing plumbing yourself.
The billing pipeline
Four layers, each with a single job. No billing logic in your application code.
Three stages, no gaps
Every event moves through ingestion, metering, and billing output. Each stage is independently durable.
Event Ingestion
Your SDK call hits the ingest endpoint. Paygentic assigns an idempotency key, validates the schema, and acknowledges receipt in under 50ms.
import paygentic
paygentic.event(
"agent.action",
quantity=1,
customer_id="cust_42",
metadata={"model": "gpt-4o"}
)
Metering Engine
Events accumulate in real time against your configured meters. Billing rules apply automatically: tiered rates, volume discounts, and overage caps all resolved server-side.
# billing_rule.json
{
"meter": "agent.action",
"tiers": [
{"up_to": 100000, "unit_price": 0.000},
{"up_to": 5000000, "unit_price": 0.001},
{"up_to": null, "unit_price": 0.0008}
]
}
Billing Output
At your configured interval, Paygentic closes the period, calculates the invoice total, and fires a webhook to Stripe, Paddle, or your downstream billing provider.
# Outbound webhook payload
{
"event": "invoice.ready",
"customer_id": "cust_42",
"period": "2026-09",
"amount_cents": 4980,
"events_total": 4980000
}
SDK Integration
Instrument in an afternoon
Install the SDK, set your API key, and fire your first event. That is all the instrumentation Paygentic needs to start metering.
- Python, Node.js, Go, and Ruby SDKs
- REST API for any language or framework
- Idempotency keys on every event by default
# Install
pip install paygentic
# Authenticate
export PAYGENTIC_API_KEY="pk_live_..."
# Fire an event
import paygentic
paygentic.event(
"agent.action",
quantity=1,
customer_id="cust_aiapp_42",
metadata={
"model": "gpt-4o",
"tokens": 2847
}
)
Multi-Agent Tracing
Attribution across agent chains
When an orchestrator spawns sub-agents, Paygentic traces the full call chain and attributes every event back to the originating customer workflow. No guesswork, no allocation models.
- Nested trace IDs propagated automatically
- Per-agent cost breakdown per customer
- Works with LangChain, CrewAI, and AutoGen
# Orchestrator fires parent event
paygentic.event(
"workflow.start",
customer_id="cust_42",
trace_id="tr_8f2a1b"
)
# Sub-agent references same trace
paygentic.event(
"agent.action",
customer_id="cust_42",
trace_id="tr_8f2a1b",
metadata={"agent": "summarizer"}
)
Start metering in an afternoon.
Install the SDK, fire your first event, and see your usage data live. No billing plumbing required.