Creating a feature
Follow the steps below to create a feature in Flexprice:
-
In the main navigation menu, select Features from Product Catalog.
-
At the top-right of the Feature dashboard, select Add Feature to create a new feature.
-
Fill in the feature details:
- Feature Name: Enter a unique and descriptive name for the feature (e.g., “Premium API Access”).
- Feature Type: Select the type of feature:
- Metered: Tracks quantifiable usage (e.g., number of API calls)
- Boolean: Indicates a simple on/off state (e.g., access to a premium dashboard)
- Static: Represents fixed attributes or entitlements (e.g., priority support)
Creating a Boolean Feature
- Select Boolean as Type which indicates a simple on/off state (e.g., access to a premium dashboard).
Creating a Static Feature
- Select Static as feature type which represents fixed attributes or entitlements (e.g., priority support)
Creating a Metered Feature
-
Select Metered as Type which tracks quantifiable usage (e.g., number of API calls).
-
Optionally edit the singular and plural unit names, for example: “token” and “tokens”.
Define Event Details
Event Name
For example, suppose you want to track how many tokens users consume while calling your AI model:
- Event Name:
tokens_total
- This is the unique identifier you’ll use to send events that match the metric
- Must be unique across your Flexprice account to avoid confusion with other metrics
Filters (Optional)
It is important to note that filters cannot be edited later, so decide up front if you’ll need them for billing or reporting.
Filters let you narrow down which events get counted or summed in this metric. You do not have to add filters if you want to aggregate all events of a given type. However, filters become crucial if you need more granular control, such as billing for only certain AI models or distinguishing usage by environment.
Example: If your system supports multiple AI models (gpt 3
, llama3.2
, gpt 4
), and you only want to track usage from GPT models for specialized billing, you can add a filter:
- Key:
model
- Values:
gpt 3
,gpt 4
This means Flexprice will only aggregate token usage events where model
is either gpt 3
or gpt 4
.
Define Aggregation
The aggregation settings tell Flexprice how to measure your events.
Function
Choose one of these aggregation functions:
- SUM: Adds a numeric property (like tokens, price, etc.) across all matching events
- COUNT: Counts the total number of matching events, regardless of any numeric value in the event data
- COUNT UNIQUE: Counts only the unique values of a specified event property
Field
- The property that Flexprice sums or evaluates. For
SUM
andCOUNT UNIQUE
, this property should be numeric (e.g.,tokens
) - If you choose
COUNT
, you typically don’t specify a numeric property (because you’re just counting occurrences)
Usage Reset
- Cumulative: The meter never resets. Usage keeps accumulating across billing cycles, providing a running total. This is useful for features like storage.
- Periodic: Usage resets at each billing period (e.g., monthly). This is ideal for most subscription-based models where usage resets for every billing period
Example Configuration:
- Aggregation =
SUM
- Aggregation Value =
tokens
- Aggregation Type =
Periodic
(if you invoice monthly and want usage to reset each month)