API Reference
Log In
API Reference

Get cost by model over time

Returns one cost value in USD per model for each time bucket in the window. Every model used in the window appears in every bucket, with 0 where it had no calls. group chooses how calls are combined: TOTAL sums their cost; MEAN, MEDIAN, MAXIMUM and MINIMUM give the cost of a single call. The default is TOTAL. For one value per model over the whole window, use GET /v2/api/sources/metrics/ai/cost-metric-by-model.

Bucket size by period: HOUR 5 minutes, EIGHT_HOURS 30 minutes, TWENTY_FOUR_HOURS 2 hours, SEVEN_DAYS 12 hours, THIRTY_DAYS 1 day, NINETY_DAYS 1 week, SIX_MONTHS and TWELVE_MONTHS 1 calendar month. Buckets are cut in UTC. Monthly buckets start at midnight UTC on the first of each month; shorter buckets start at the beginning of the window, which is the time of the request minus the period. With a custom startDate and endDate the range is split into 10 equal buckets, the first starting at startDate and the last ending at endDate. Bucket lengths are whole seconds and the last bucket also takes the remainder; a range shorter than 10 seconds is one bucket. Buckets are listed newest first.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Query Params
string
required

ID of the team that owns this data.

string

Start of a custom date range in ISO 8601 format (e.g., 2025-09-01T00:00:00Z). Must be provided together with endDate. When both are provided, the period parameter is ignored and this custom range is used instead.

string

End of a custom date range in ISO 8601 format (e.g., 2025-09-30T23:59:59Z). Must be provided together with startDate. When both are provided, the period parameter is ignored and this custom range is used instead.

string
enum

Aggregation group for the metric. Defaults to TOTAL.

Allowed:
string
enum

Predefined time window to aggregate results (e.g., TWELVE_MONTHS). Ignored if both startDate and endDate are provided. Defaults to TWELVE_MONTHS when no custom date range is specified.

models
array of strings

Optional list of AI models to filter. Valid models can be obtained using the /sources/ai/models endpoint. Omit to include all models.

models
Headers
string
enum
Defaults to application/json

Generated from available response content types

Allowed:
Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json
*/*