Meters
Meters define how events are aggregated into billable usage. They separate what to measure from how to price, so the same meter can be reused across different pricing configurations and customers.What is a Meter?
A meter is a reusable configuration that specifies:- Which events to include — using event type filters and property filters
- How to aggregate them — COUNT, SUM, MAX, or MIN
- Which property to aggregate — for SUM, MAX, and MIN
Defining a Meter
There are two ways to define what a meter measures:Structured Filters (Recommended)
UseeventTypeFilter, propertyFilters, and aggregationKey to declaratively specify which events contribute to the meter and how they’re aggregated.
Custom SQL
For complex metrics that can’t be expressed with structured filters, provide a raw SQL query. Whensql is set, it overrides the structured fields.
Custom SQL queries must reference the
events table and return a single row
with a value column. Monk automatically injects organization, customer, and
time range filtering — your query only needs to express the metric logic.Meter Fields
| Field | Required | Description |
|---|---|---|
displayName | Yes | Human-readable name shown in the UI |
description | No | Optional description of what the meter tracks |
aggregationType | Yes | How to compute usage: COUNT, SUM, MAX, MIN |
eventTypeFilter | No | Which event types to include/exclude |
propertyFilters | No | Filters on event properties (ANDed together) |
aggregationKey | No* | Property key to aggregate on |
sql | No | Custom SQL query (overrides structured fields when set) |
status | — | active (accepts events) or inactive (rejects new events) |
code | Yes | Unique identifier within the org (deprecated — will be removed in a future version) |
SUM, MAX, and MIN aggregation types. Omit for COUNT.
Event Type Filter
Controls which event types contribute to this meter.include— only events with these types are counted (allowlist)exclude— events with these types are skipped (blocklist)
Property Filters
Narrow down events based on their properties. Each filter is ANDed together.| Field | Description |
|---|---|
name | Property key to match |
exists | If true, the property must be present |
include | Property value must be one of these (allowlist) |
exclude | Property value must NOT be one of these (blocklist) |
Aggregation Types
COUNT
Counts the total number of matching events. NoaggregationKey needed.
| Use Case | Example |
|---|---|
| API calls | Each request is one event |
| Messages sent | Each message is one event |
| Builds triggered | Each build is one event |
SUM
Sums a numeric property across all matching events.| Use Case | Aggregation Key |
|---|---|
| Token consumption | total_tokens |
| Data transfer | bytes_transferred |
| Compute hours | duration_hours |
MAX
Takes the maximum value of a property within the billing period.| Use Case | Example |
|---|---|
| Peak concurrent users | Max of periodic snapshots |
| High water mark | Max storage used during period |
MIN
Takes the minimum value of a property within the billing period.Planning Your Meters
Before creating meters, consider:- What actions are billable? — API calls, messages, compute time, storage
- How should usage be measured? — Per call (COUNT), per unit (SUM), peak usage (MAX)
- What granularity do customers need? — Broad (all API calls) vs. narrow (by endpoint or model)
Example: SaaS API Product
| Billable Action | Aggregation | Event Type Filter | Property Filters |
|---|---|---|---|
| API requests | COUNT | { include: ["api_call"] } | — |
| LLM token usage | SUM of total_tokens | { include: ["llm_usage"] } | [{ name: "total_tokens", exists: true }] |
| Peak active users | MAX of user_count | { include: ["active_users"] } | [{ name: "user_count", exists: true }] |
Linking Meters to Pricing
Meters don’t have prices — they measure usage. Prices are attached separately through pricing configurations on a plan. A single meter can have different pricing for different customers or plans. For example, a meter for API calls might cost$0.001/call on the Starter plan and $0.0005/call on the Enterprise plan.
See Pricing for details on pricing models.
Dimensional Pricing with Group Keys
For advanced use cases, you can configure group keys on a meter to enable dimensional pricing. Group keys specify which event properties Monk uses to break down usage for different rates.region=US, call_outcome=resolved→ $2.00/callregion=EU, call_outcome=escalated→ $7.50/call- Fallback → $4.00/call
Next Steps
How Usage-Based Billing Works
See how meters fit into the full billing flow
Create Your First Meter
Step-by-step guide
Dimensional Pricing
Different rates by event attributes
Meters API
API reference
Events
How events feed meters
Pricing
Attach prices to meters