Quickstart
Get one usage event in under five minutes. All you need is an API key from the dashboard and one of the SDKs below.
Step 1: Get your API key
Sign in to the Paygentic dashboard and open Settings to copy your key. Production keys start with pyg_live_; test-mode keys start with pyg_test_. Work in test mode while you follow this guide.
Step 2: Install the SDK
Pick the library for your language:
pip install paygentic
npm install @paygentic/sdk
go get github.com/paygentic/paygentic-go
curl https://api.getpaygentic.org/v1/events \
-H "Authorization: Bearer pyg_test_xxxx" \
-H "Content-Type: application/json" \
-d '{"events": [...]}'
Step 3: Initialize the client
import paygentic
client = paygentic.Client(api_key="pyg_test_xxxxxxxxxxxxxxxxxxxxxx")
In production, pull the key from an environment variable instead of placing it in source:
import os
import paygentic
client = paygentic.Client(api_key=os.environ["PAYGENTIC_API_KEY"])
Step 4: Send your first event
An event stands for one billable action. Three fields are the minimum: an idempotency key, a customer ID, and an event type. The idempotency key is what stops a repeated request from being counted twice.
response = client.events.ingest(
events=[
{
"idempotency_key": "agent-run-abc123-step-1",
"customer_id": "cust_9f3k2m",
"event_type": "model_call",
"timestamp": "2026-10-15T14:22:00Z",
"properties": {
"model": "claude-3-5-sonnet",
"input_tokens": 1240,
"output_tokens": 320
}
}
]
)
print(response.ingested) # 1
Step 5: Verify in the dashboard
Open the dashboard and go to Events. Your event appears a few seconds later with its customer, type, and properties. Test-mode events carry a test badge and leave invoice totals untouched.
Step 6: Send a batch
Agent workloads tend to arrive in volume, so reach for batch ingestion. One request can hold up to 500 events. With the buffered client, the SDK handles batching as you go:
# Buffered client flushes automatically when the buffer fills or on flush()
buffered = client.events.buffer(max_batch_size=500)
for step in agent_run_steps:
buffered.add(
idempotency_key=step.id,
customer_id=step.customer_id,
event_type=step.event_type,
timestamp=step.completed_at,
properties=step.billing_properties()
)
buffered.flush()
Next steps
With events flowing, add a meter to aggregate them:
- Create a meter that totals
model_callevents by token count. - Register customers so billing plans can be attached and invoices generated.
- Explore the full API reference for every endpoint and parameter.
- Set up multi-agent tracing so spend follows orchestrator and sub-agent call graphs to the right account.