The cost control layer for AI agents.
Track what every user costs you. Set spending limits. Get alerted before margins go negative.
The Problem
Why AI agents bleed money
Every agent invocation is a black box of unpredictable, per-user cost.
You can't see what each user costs
A single prompt triggers chains of model calls, retries, and tool executions across multiple providers. You have no visibility into per-user, per-model cost.
No way to stop runaway spend
Your heaviest users burn 10x more than they pay for. There's no automated way to cap, throttle, or gate them before they eat your margin.
Billing has no idea what happened
Your billing charges a flat fee. Your actual costs vary per user, per session, per model. These two systems never talk to each other.
Where Paygent sits in your stack
Everything you need
Visibility. Limits. Alerts.
The runtime layer between your AI agent and your margin.
Cost Visibility
A single user prompt can trigger a chain of model calls, retries, and sub-agents. You have no idea what any individual user actually costs you.
See per-user, per-model cost in real time. A built-in dashboard shows spend trends, model breakdown, top users, and gate activity — live, out of the box.
from paygent import Paygent, paygent_context
pg = Paygent.init(api_key="pg_live_...")
with paygent_context(user_id="user_123"):
# Every LLM call inside this block is
# automatically metered per user per model
response = openai.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": query}],
) Spending Limits
You charge every user the same flat fee, but some cost you 10x more than others. Without per-user limits, your best plan subsidizes your worst margins.
Set per-user spend limits and per-model token caps. When a user hits their threshold, Paygent fires a soft gate (warn) or hard gate (block) — your rules, enforced at runtime.
# Soft gate: warn when approaching limit
def on_approaching_limit(result):
notify_user(f"Used {result.usage_pct:.0%} of plan")
pg.on_soft_gate(on_approaching_limit)
# Hard gate: block when limit is hit
def on_limit_hit(result):
raise PaygentLimitExceeded(result.message)
pg.on_hard_gate(on_limit_hit) Real-time Alerts
When a user gets blocked or crosses a spending threshold, you find out hours later — if at all. No way to react in real time.
Webhooks deliver event data to your stack the moment something happens — gate fired, user hit 80% of their limit, call blocked. Trigger upgrade flows, Slack alerts, or billing sync instantly.
{
"type": "gate_event.hard_gate",
"data": {
"user_id": "user_123",
"gate_reason": "total_spend",
"current_value": 49.50,
"limit_value": 49.00,
"blocked": true
}
} Dashboard
See your costs before they surprise you
Per-user spend, per-model breakdown, gate activity, top users — live, out of the box. No extra setup.
| user_8821 | $214.90 |
| user_1043 | $176.20 |
| user_5567 | $148.75 |
| user_2290 | $121.40 |
How It Works
Get set up in five steps
Create a product, define your plans, add users, drop in the SDK — and you're metered.
Create your product
Sign up to the dashboard and get your Paygent API key. A product is one agent or app you're metering.
Configure a plan
Define spend limits, per-model token caps, and cost rates — the tiers you sell, like Free, Pro, and Scale.
Add your users
Register each end user by your own ID and assign them to a plan. Their limits and billing window come from the plan.
Drop in the SDK
Install Paygent (Python or TypeScript), call init() once, and wrap your LLM calls with the user context.
Go live
Every call is metered and gated automatically. Watch spend, gates, and top users on the dashboard — and get webhooks in real time.
POST /products → product + pg_live_… API key POST /config/plans spend limits · token caps · cost rates POST /users + subscription user_123 → assigned to Pro plan Paygent.init() + paygent_context(user_id) your LLM calls, unchanged Live metered · gated · dashboard + webhooks The math
Your margins, before and after
Without Paygent
Costs exceed revenue. Margin is negative.
With Paygent
RecommendedGating keeps costs within budget.
In most AI products, the top 5% of users drive over half the cost. Without per-user visibility and limits, they erode everyone else's margin.
Example based on a 100-user SaaS with mixed model usage and a small group of power users.
Quick Start
Get started in 5 minutes
from paygent import Paygent, paygent_context
# 1. Initialize
pg = Paygent.init(api_key="pg_live_...")
# 2. Wrap your request handler
with paygent_context(user_id="user_123"):
response = openai.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": query}],
)
# That's it. Every LLM call is now:
# ✓ Metered (tokens, cost, per model)
# ✓ Guarded (soft warnings + hard blocks)
# ✓ Synced (to Paygent backend, automatically) Get your API key by signing up.
Read the full QuickstartWhy developers pick Paygent
Built to stay out of your way
Quick setup
One init call and a context wrapper. You're live in minutes — your existing LLM code stays exactly as it is.
Not a proxy
Paygent runs in-process as an SDK, not a gateway in front of your traffic. No extra hop, no new point of failure.
No added latency
Guard checks are in-memory — single-digit milliseconds. Metering and sync run in the background, off the request path.
Adapts at runtime
Change a plan's limits, rates, or model caps and the SDK picks them up at runtime. No redeploy, no restart.
Know what every user costs. Control what they spend.
Free while we're in beta. Set up in 5 minutes.