Install
# Install: pip install revgrid
import os, revgrid
client = revgrid.RevGrid(api_key=os.environ["REV_API_KEY"])
# After your agent processes a request:
resp = client.meter(
    agent_id="agent-001",
    action="completion",
    tokens=2000,
    outcome="success",
    metadata={"customer_id": "customer-123", "campaign": "q2-outreach"},
)
print(f"Charged {resp.price.total_cents}¢  (event_id={resp.event_id})")
{
  "event_id": "evt_8c1a2f3e",
  "price": {
    "total_cents": 42,
    "breakdown": {
      "base_fee_cents": 10,
      "token_cost_cents": 20,
      "outcome_bonus_cents": 12
    }
  },
  "event": {
    "customer_id": "customer-123",
    "agent_id":    "agent-001",
    "action":      "completion",
    "tokens":     2000,
    "outcome":     "success"
  }
}

You're logging tasks. Now wire up pricing.

Configure per-action pricing, set up webhooks, and explore the full API surface for outcome-based billing.

← Back to Developer Hub