Skip to main content

Tracking Usage

To monitor customer usage and enforce limits or billing, record each usage event with Metrifox. Send Usage Events Use the RecordUsage method to log consumable feature usage, such as AI image generations or API calls. You always record usage in feature units (e.g. number of API calls) — never in credits.
Credits are never recorded or deducted directly. A feature is credit-based when it is priced as prepaid with a credit cost (e.g. 1 API call = 0.02 credits). When you record usage for that feature, Metrifox adds to the consumed count and automatically deducts the equivalent credits from the wallet funding it (4 API calls → 0.08 credits deducted).
Before recording usage, it’s best to verify that the customer is entitled to use the feature. This helps prevent:
  • Exceeding usage limits
  • Unauthorized access
  • Unintended overage charge
Each time a customer uses a feature:
  1. Call theRecordUsage
  2. Include relevant metadata (e.g. feature Key, quantity, timestamp)
  3. Metrifox updates the customer’s usage balance accordingly
This ensures accurate enforcement of quotas, overage billing, and usage-based pricing.

SDK available in

Javascript | Ruby | cURL | Python | PHP | Go | Java
{
  "message": "Usage recorded",
  "event_name": "candidate.sourced",
  "customer_key": "cust-6d11ca90",
  "amount": 2
}

Adjusting Usage Counts for Persistent Features

For persistent-use features — features that represent a standing count rather than one-off consumption, such as seats or licenses — you can decrement the recorded usage count by sending a negative value with RecordUsage. This only applies to persistent features. It does not apply to consumable/event-style usage, and it does not add credits to a customer. Use Case: Reclaiming Seats If a customer is using 8 seats and removes one, send a quantity of -1. Metrifox updates their usage count from used: 8 to used: 7, which frees up their available allowance for that feature (available = allowance − used).
This adjusts the usage count of a persistent feature only. To add credits to a customer, use a credit topup — recording negative usage does not add credits.