Metered Billing & Usage Reporting
Fype supports usage-based pricing models, allowing you to charge customers based on their actual consumption during a billing cycle.Usage Reporting Flow
To implement metered billing, your application reports usage events to Fype as they occur. Fype tracks and aggregates these events to calculate the total amount due when the billing cycle closes.Reporting Consumption Events
Whenever a customer consumes a metered feature (e.g., processes LLM tokens, transfers files, or makes API requests), report the usage event to Fype.- Endpoint:
POST /v1/usage/events - Request Parameters:
subscription_id: The subscription UUID to attribute usage to.event_type: The metric name (e.g.,api_tokens,file_storage).quantity: Float value representing the consumed units.unit: Description of units (e.g.tokens,gigabytes).metadata: Optional key-value object containing details (e.g.{"model": "gpt-4o"}).
API Request
Python SDK Request
Retrieving Usage Summaries
To audit consumption or show real-time limits in your client application, retrieve the aggregated usage summary for a subscription:- Endpoint:
GET /v1/usage/summary?subscription_id={subscription_uuid}