Why start here? Events are the raw record of what customers do. Send them early and you’ll have real usage data, whether you charge for it or not. See Usage.
2026-10.
Send your first event
Send an event whenever a customer does something you want to measure, whether you’ll bill for it, limit it or just track it. Identify the customer with your own user ID asexternal_customer_id (see External IDs):
track() adds the event to the SDK’s queue and returns. The SDK sends queued events in batches in the background. flush() waits until they’re delivered, and in Python leaving the async with block does the same. In Python, track() is only on the async client, PolarAsync. See Send events for running the queue in a server or serverless function.
You don’t need to create the customer first. Polar accepts the event now, and links it to the customer once one exists with external_id set to user_123. You’ll do that in step 3.
For LLM calls, streams and S3 uploads, an ingestion strategy can send these events for you.
Create a meter
A meter selects events with a filter and aggregates them into usage. Create one that sumstotal_tokens across ai_usage events:
- Dashboard
- CLI
- Prompt
- Pricing as Code Beta
- Open Catalog → Meters
- Click Create Meter
- Set Name to “AI tokens”
- Under Filters, add a condition: Name equals
ai_usage - Set Aggregation to Sum over the property
total_tokens - Click Create Meter
metadata. prefix.
Polar backfills a new meter from events you’ve already sent, so your first event counts.
Save the meter’s ID as POLAR_METER_ID in your application’s environment. You’ll use it in step 2 and to check balances in step 4. In the dashboard, open the AI tokens meter and click Copy meter ID. The CLI example exports it already.
Verify it works
Read the meter’s usage foruser_123. It includes the 77 tokens from your event.
- Dashboard
- CLI
- Prompt
- Open Catalog → Meters
- Select AI tokens
- Open the Customers tab to see usage per customer, or Events to see the event you sent
Learn more
Next: Set up your catalog
Turn this meter into a price, and include credits in a plan.

