Optionaldelete?: undefinedGet customer usage
Optionalcookie?: undefinedOptionalheader?: undefinedOptionalrequestBody?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedOptionalpost?: undefinedOptionalput?: undefinedOptionaltrace?: undefinedOptionaldelete?: undefinedList usage events
Retrieve a paginated list of usage events with optional filtering.
Use cursor-based pagination by passing the `nextCursor` from the previous response. You can filter events by customer, event type, or model.
**Pagination:**
- Use the `cursor` parameter from the previous response's `nextCursor` field
- The `hasMore` field indicates if there are more results
- Maximum limit is 100 events per request
Optionalcookie?: undefinedOptionalheader?: undefinedOptionalpath?: undefinedOptionalquery?: {Optionalcursor?: stringOptionalcustomerId?: stringOptionaleventType?: stringOptionallimit?: stringOptionalmodel?: stringOptionalrequestBody?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedIngest a usage event
Record a single usage event for metering and analytics.
This endpoint only records the event without checking quotas or rate limits. For quota enforcement and rate limiting, use `POST /v1/track` instead.
**When to use this endpoint:**
- Recording events for analytics only
- Post-event tracking after successful operations
- Bulk ingestion without enforcement
**When to use /v1/track instead:**
- Need quota enforcement before processing
- Need rate limit checking
- Want all-in-one tracking with enforcement
OptionalrequestBody?: {Optionalput?: undefinedOptionaltrace?: undefinedOptionaldelete?: undefinedOptionalget?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedIngest multiple usage events
Record multiple usage events in a single request for efficient bulk ingestion.
**Limits:**
- Maximum 1000 events per batch
- Events are processed asynchronously
- All events must be valid or the entire batch will be rejected
**Use cases:**
- Bulk import of historical data
- Batch processing of events
- High-throughput event ingestion
For quota enforcement and rate limiting, use `POST /v1/track` instead.
OptionalrequestBody?: {Optionalput?: undefinedOptionaltrace?: undefinedOptionaldelete?: undefinedGet current project
Returns the project associated with the API key used for authentication.
The project contains metadata about your organization's configuration, including:
- Project ID and organization ID
- Project name and slug
- Creation and update timestamps
This endpoint is useful for verifying your API key is valid and retrieving project details.
OptionalrequestBody?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedOptionalpost?: undefinedOptionalput?: undefinedOptionaltrace?: undefinedDelete a quota alert
OptionalrequestBody?: undefinedGet a quota alert
OptionalrequestBody?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedOptionalpost?: undefinedUpdate a quota alert
OptionalrequestBody?: { content: { "application/json": { threshold?: number } } }Optionaltrace?: undefinedOptionaldelete?: undefinedGet alert history
Optionalcookie?: undefinedOptionalheader?: undefinedOptionalquery?: { cursor?: string; limit?: string }Optionalcursor?: stringOptionallimit?: stringOptionalrequestBody?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedOptionalpost?: undefinedOptionalput?: undefinedOptionaltrace?: undefinedOptionaldelete?: undefinedList quotas
Optionalcookie?: undefinedOptionalheader?: undefinedOptionalpath?: undefinedOptionalquery?: { cursor?: string; limit?: string }Optionalcursor?: stringOptionallimit?: stringOptionalrequestBody?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedCreate a quota
OptionalrequestBody?: {Optionalput?: undefinedOptionaltrace?: undefinedDelete a quota
Optionalcookie?: undefinedOptionalheader?: undefinedOptionalquery?: undefinedOptionalrequestBody?: undefinedGet a quota
Optionalcookie?: undefinedOptionalheader?: undefinedOptionalquery?: undefinedOptionalrequestBody?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedOptionalpost?: undefinedUpdate a quota
Optionalcookie?: undefinedOptionalheader?: undefinedOptionalquery?: undefinedOptionalrequestBody?: {Optionaltrace?: undefinedOptionaldelete?: undefinedList quota alerts
Optionalcookie?: undefinedOptionalheader?: undefinedOptionalquery?: { cursor?: string; limit?: string }Optionalcursor?: stringOptionallimit?: stringOptionalrequestBody?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedCreate a quota alert
OptionalrequestBody?: { content: { "application/json": { threshold: number } } }Optionalput?: undefinedOptionaltrace?: undefinedOptionaldelete?: undefinedOptionalget?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedCheck quotas
Check usage against all matching quotas for the given dimensions without consuming quota.
This endpoint allows you to query quota status without actually recording usage. Useful for:
- Pre-flight checks before processing requests
- Displaying quota status to users
- Monitoring quota consumption
**Dimension Matching:**
Quotas are matched based on dimension filters. Pass dimensions like:
- `customer_id`: Filter by customer
- `event_type`: Filter by event type
- `model`: Filter by model
- `provider`: Filter by provider
- Any custom dimension from event properties
OptionalrequestBody?: { content: { "application/json": { [key: string]: unknown } } }Optionalput?: undefinedOptionaltrace?: undefinedOptionaldelete?: undefinedList rate limits
Optionalcookie?: undefinedOptionalheader?: undefinedOptionalpath?: undefinedOptionalquery?: { cursor?: string; limit?: string }Optionalcursor?: stringOptionallimit?: stringOptionalrequestBody?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedCreate a rate limit
OptionalrequestBody?: {Optionalput?: undefinedOptionaltrace?: undefinedDelete a rate limit
Optionalcookie?: undefinedOptionalheader?: undefinedOptionalquery?: undefinedOptionalrequestBody?: undefinedGet a rate limit
Optionalcookie?: undefinedOptionalheader?: undefinedOptionalquery?: undefinedOptionalrequestBody?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedOptionalpost?: undefinedUpdate a rate limit
Optionalcookie?: undefinedOptionalheader?: undefinedOptionalquery?: undefinedOptionalrequestBody?: {Optionaltrace?: undefinedOptionaldelete?: undefinedOptionalget?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedCheck rate limits
Check current rate limit status for the given dimensions without consuming a request.
This endpoint allows you to query rate limit status without actually counting against the limit. Useful for:
- Pre-flight checks before processing requests
- Displaying rate limit status to users
- Monitoring rate limit consumption
**Dimension Matching:**
Rate limits are matched based on dimension filters. Pass dimensions like:
- `customer_id`: Filter by customer
- `event_type`: Filter by event type
- `model`: Filter by model
- `provider`: Filter by provider
- Any custom dimension from event properties
OptionalrequestBody?: { content: { "application/json": { [key: string]: unknown } } }Optionalput?: undefinedOptionaltrace?: undefinedOptionaldelete?: undefinedOptionalget?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedTrack usage with enforcement
All-in-one endpoint for tracking usage with quota and rate limit enforcement.
**This is the recommended endpoint** for most use cases. It performs three operations in sequence:
1. **Rate Limit Check**: Validates against configured rate limits (fast, Redis-based)
2. **Quota Check**: Validates against configured quotas (database-based)
3. **Event Ingestion**: Records the event if all checks pass
**Response Codes:**
- `201 Created`: Event tracked successfully, all limits within bounds
- `429 Too Many Requests`: Rate limit or quota exceeded (check response body for details)
**Rate Limit Headers:**
The response includes standard rate limit headers:
- `X-RateLimit-Limit`: Maximum requests allowed
- `X-RateLimit-Remaining`: Requests remaining in current window
- `X-RateLimit-Reset`: Unix timestamp when window resets
- `Retry-After`: Seconds to wait before retrying (on 429 responses)
**Quota Headers (on quota exceeded):**
When a quota is exceeded, the response includes:
- `Retry-After`: Seconds to wait before retrying
- `X-Quota-Reset`: Unix timestamp when the quota period resets
- `X-Quota-Period`: Quota period (hour, day, week, month)
- `X-Quota-Metric`: Quota metric (total_tokens, total_events, total_cost_cents)
**Dimension Matching:**
Quotas and rate limits are matched based on dimensions extracted from:
- `customerId` → `customer_id`
- `eventType` → `event_type`
- `model` → `model`
- `provider` → `provider`
- `properties` → All string values are included as dimensions
OptionalrequestBody?: {Optionalput?: undefinedOptionaltrace?: undefinedOptionaldelete?: undefinedGet usage summary
Retrieve aggregated usage metrics for the project.
Returns totals for events, tokens, and costs within the specified date range. You can filter by customer, event type, or model to get specific subsets of data.
**Metrics Included:**
- Total events count
- Total tokens (input + output)
- Total input tokens
- Total output tokens
- Total cost in cents
Optionalcookie?: undefinedOptionalheader?: undefinedOptionalpath?: undefinedOptionalcustomerId?: stringOptionaleventType?: stringOptionalmodel?: stringOptionalrequestBody?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedOptionalpost?: undefinedOptionalput?: undefinedOptionaltrace?: undefinedOptionaldelete?: undefinedGet usage breakdown
Retrieve usage metrics grouped by a specific dimension.
This endpoint provides detailed breakdowns of usage data, allowing you to see how usage is distributed across different dimensions like models, customers, event types, or providers.
**Use Cases:**
- See which models consume the most tokens
- Identify top customers by usage
- Compare usage across different event types
- Analyze provider-specific consumption
Optionalcookie?: undefinedOptionalheader?: undefinedOptionalpath?: undefinedOptionalcustomerId?: stringOptionaleventType?: stringOptionalmodel?: stringOptionalrequestBody?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedOptionalpost?: undefinedOptionalput?: undefinedOptionaltrace?: undefinedOptionaldelete?: undefinedGet usage timeseries
Retrieve usage metrics bucketed by time interval.
Returns time-series data showing how usage changes over time. Useful for creating charts, identifying trends, and monitoring usage patterns.
**Intervals:**
- `hour`: Bucket data by hour
- `day`: Bucket data by day
- `week`: Bucket data by week
Each data point includes the timestamp and all usage metrics for that time period.
Optionalcookie?: undefinedOptionalheader?: undefinedOptionalpath?: undefinedOptionalcustomerId?: stringOptionaleventType?: stringOptionalmodel?: stringOptionalrequestBody?: undefinedOptionalhead?: undefinedOptionaloptions?: undefinedOptionalpatch?: undefinedOptionalpost?: undefinedOptionalput?: undefinedOptionaltrace?: undefined
This file was auto-generated by openapi-typescript. Do not make direct changes to the file.