API Reference
Log In
API Reference

Get cost by agent

Returns the total cost of your AI calls per agent over the whole date range, in USD, one item per agent. Each agent also has a second figure, runs, the number of calls. Agents are sorted by name unless you pass orderBy=totalCost. The sort runs before the cap, so a ranked read holds the true cheapest or costliest agents. Only agents with usage in the date range are listed, so an agent with no calls in the range never appears as the cheapest. Calls with no agent name are left out, and at most 5,000 agents are returned. Use costSource to count only Metered or Billed cost.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Query Params
date-time

Start of the date range, ISO 8601 in UTC, for example 2026-01-01T00:00:00Z. Defaults to 24 hours before endDate.

date-time

End of the date range, ISO 8601 in UTC. Defaults to now.

string
enum

How the values in each group are combined: sum, avg, max, min, count, median, or the percentile p50, p90, p95 or p99. Defaults to sum.

integer | null
≥ 0
Defaults to 0

Zero-based page of _embedded.items to return. Defaults to 0.

integer
≤ 100
Defaults to 20

Number of _embedded.items per page, from 1 to 100. Defaults to 20.

costSource
array of strings

Count only cost from these sources: revenium_metered (usage metered by the Revenium SDK, shown as Metered) or provider_billing (cost reported by your AI provider's billing, shown as Billed, or Invoiced on the Providers pages). Say Metered or Billed, never the raw value. Omit it to count both. Repeat the parameter to pass several values.

costSource
Allowed:
string
enum

How to order the agents. agent (the default) sorts them alphabetically by name. totalCost ranks them by cost, highest first unless direction is asc, with the agent name breaking ties. Only agents with usage in the date range are listed, so an agent with no calls in the range never appears as the cheapest.

Allowed:
string
enum

Which way to sort: asc puts the lowest first, desc the highest. Defaults to asc when sorting by name and desc when sorting by totalCost. The sort runs before the row cap, so orderBy=totalCost with direction=asc puts the cheapest first. Rows that tie on cost are in name order, A to Z, and a tie can run past the end of a page, so check the next page for more rows at the same cost.

Allowed:
string

Hashed id of the team to answer for. Optional. With a user token it may be any team the user belongs to; without it the user's default team answers. An API key always answers for its own team, and naming any other team is refused with 403.

Headers
string
enum
Defaults to application/json

Generated from available response content types

Allowed:
Responses

Language
Credentials
Bearer
API Key
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json
application/problem+json