Meters
Meters specify how to aggregate events for billing and analytics purposes. Meters can be configured with multiple aggregation methods and groupings. Multiple meters can be created for the same event type, enabling flexible metering scenarios.
Query meter
Query a meter for usage.
Path Parameters
ULID (Universally Unique Lexicographically Sortable Identifier).
Match pattern:^[0-7][0-9A-HJKMNP-TV-Z]{25}$
Example:01G65Z755AFWAKHE12NY0CQ9FH
Body
application/json
Body
MeterQueryRequest
A meter query request.
The start of the period the usage is queried from.
Example:2023-01-01T01:01:01.001Z
The end of the period the usage is queried to.
Example:2023-01-01T01:01:01.001Z
The size of the time buckets to group the usage into.
If not specified, the usage is aggregated over the entire period.
Allowed values:PT1MPT1HP1DP1M
The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones).
The time zone is used to determine the start and end of the time buckets.
If not specified, the UTC timezone will be used.
Default:UTC
The dimensions to group the results by.
<= 100 items
Example:["model","type"]
Filters to apply to the query.
Show Child Parameters
Response
application/json
Response
The request has succeeded.
MeterQueryResult
Meter query result.
The start of the period the usage is queried from.
Example:2023-01-01T01:01:01.001Z
The end of the period the usage is queried to.
Example:2023-01-01T01:01:01.001Z
A row in the result of a meter query.
Example:{"value":"12.3456","from":"2023-01-01T00:00:00Z","to":"2023-01-02T00:00:00Z","dimensions":{"customer_id":"01G65Z755AFWAKHE12NY0CQ9FH","model":"gpt-4-turbo","type":"input"}}
Show Child Parameters
Authentication
Path Parameters
Body
BillingCostBasis
objectDescribes currency basis supported by billing system.
ULID (Universally Unique Lexicographically Sortable Identifier).
Match pattern:^[0-7][0-9A-HJKMNP-TV-Z]{25}$
Example:01G65Z755AFWAKHE12NY0CQ9FH
The fiat currency code for the cost basis.
Match pattern:^[A-Z]{3}$
>= 3 characters<= 3 characters
Example:USD
The cost rate for the currency.
Match pattern:^\-?[0-9]+(\.[0-9]+)?$
An ISO-8601 timestamp representation of the date from which the cost basis is effective.
If not provided, it will be effective immediately and will set to now by the system.
Example:2023-01-01T01:01:01.001Z
An ISO-8601 timestamp representation of entity creation date.
Example:2023-01-01T01:01:01.001Z
BillingCurrency
objectFiat or custom currency.
One OfULID (Universally Unique Lexicographically Sortable Identifier).
Match pattern:^[0-7][0-9A-HJKMNP-TV-Z]{25}$
Example:01G65Z755AFWAKHE12NY0CQ9FH
The type of the currency.
Allowed values:fiat
The name of the currency. It should be a human-readable string that represents the name of the currency, such as “US Dollar” or “Euro”.
>= 1 characters<= 256 characters
Description of the currency.
>= 1 characters<= 256 characters
The symbol of the currency. It should be a string that represents the symbol of the currency, such as “$” for US Dollar or “€” for Euro.
>= 1 characters
Three-letter ISO4217 currency code.
Custom three-letter currency codes are also supported for convenience.
Match pattern:^[A-Z]{3}$
>= 3 characters<= 3 characters
Example:USD
BillingCurrencyCodeCustom
stringCustom currency code.
It should be a unique code but not conflicting with any existing fiat currency codes.
>= 3 characters<= 24 characters