ARouter supports per-user usage tracking by passing a user field in your API requests. This lets you attribute API costs to individual users in your application and monitor usage patterns at the user level.
Passing a User ID
Include the user field in any chat completions request:
The user value can be any string that identifies the end user in your system — a database ID, a hashed email, or a session ID. ARouter does not validate or interpret this value.
Privacy Considerations
Do not pass personally identifiable information (PII) as the user value. Use opaque identifiers such as hashed IDs or database primary keys.
Recommended approaches:
Viewing Usage by User
User-level usage data is available in the Activity Export. Each record includes the user field you passed, allowing you to:
- Calculate per-user token consumption and cost
- Identify high-usage users for capacity planning
- Detect anomalous usage patterns or abuse
- Build usage-based billing for your end users
Activity Export API
Query usage records filtered by user:
Use Cases
Per-User Cost Allocation
Track how much each of your customers costs to serve:
Abuse Detection
Monitor for unusual usage patterns by user:
Multi-Tenant Applications
In multi-tenant SaaS applications, pass an organization or tenant ID:
Notes
- The
user field is optional. Requests without it are still tracked under your API key’s aggregate usage.
- User IDs are stored as opaque strings. ARouter does not validate, parse, or interpret the format.
- User tracking data is included in Activity Export records.
- See Organization Management for team-level usage controls.