Developer Quickstart
Log your first task in 60 seconds
Three lines. Python or Node. Live in the Rev console.
Install
# Install: pip install revgrid import os, revgrid client = revgrid.RevGrid(api_key=os.environ["REV_API_KEY"])
Log a task
# 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})")
Expected output
{
"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"
}
}