Skip to main content

Usage

MCP tools for the Usage module. See the Usage module docs for permissions and data model.

list-usage-events​

List usage events

Arguments​

ArgumentTypeRequiredDescription
agent_idstringnoFilter by agent public ID
generation_idstringnoFilter by generation public ID
trace_idstringnoFilter by trace public ID
actor_idstringnoFilter by the actor (end user) the usage is attributed to. An actor that does not exist in scope yields an empty page.
session_idstringnoFilter by the session the usage was produced in. A session that does not exist in scope yields an empty page.
ai_provider_idstringnoFilter by the provider record the spend was billed against. A provider that does not exist in scope yields an empty page.
orchestration_run_idstringnoFilter by the orchestration run that metered the event. A run that does not exist in scope yields an empty page.
orchestration_idstringnoFilter by orchestration — the events of the runs it started itself, not the subtree its loop or sub_orchestration nodes started. An orchestration that does not exist in scope yields an empty page.
modelstringnoFilter by the as-billed SKU the event recorded. Matched as recorded, so it still selects events whose provider has since been deleted.
trigger_idstringnoFilter by the trigger that initiated the generation
action_idstringnoFilter by logical action id
tool_idstringnoFilter by the tool a tool_execution event metered, including a tool another project shares with one in scope. A tool that does not exist in scope yields an empty page.
publisher_project_idstringnoFilter to the calls made through a share of a resource the named project owns. A project that does not exist yields an empty page.
outcomestringnoFilter by how a tool_execution call ended: ok, error or timeout. Every other meter carries no outcome and is matched by none of them.
meter_typestringnoFilter by meter type (e.g. llm_tokens, compute_execution, api_request, storage, tool_execution)
sourcestringnoFilter by what the spend was incurred for. eval is an eval run's item generations, eval_judge an llm_judge scorer's own completion and eval_scorer a tool scorer's call, so verification spend is source in (eval, eval_judge, eval_scorer); decider is a decision's evaluation; embedding is any embedding call. Ordinary agent traffic carries no source and is matched by none of them.
limitnumbernoResults per page. Above the maximum it is clamped, and limit in the response reports the page served; below 1 or not an integer it is 400 VALIDATION_FAILED.
offsetnumbernoResults to skip. Negative or not an integer it is 400 VALIDATION_FAILED.

get-usage-aggregate​

Get aggregated usage for a project

Arguments​

ArgumentTypeRequiredDescription
project_idstringyesProject public ID to aggregate usage for
group_bystringnoDimension to bucket by. Omit it to skip bucketing entirely: totals still describes the whole window and groups is an empty page, which is what "what did this one thing cost" wants. A value naming no dimension is a 400. day buckets on the event's UTC calendar day; the others bucket on the matching column. ai_provider buckets on the provider the spend was billed against — a routed generation's serving target, or the agent's pinned provider. model buckets on the model id and the provider that served it, so one model name served by two providers is two groups (see ai_provider_id). source buckets by what the spend was incurred for (eval, eval_judge), which is how verification spend is priced apart from the traffic serving real users; unlabelled traffic collapses into the single null bucket. orchestration_run buckets on the orchestration run the event belongs to — a standalone generation runs no orchestration and collapses into the single null bucket, so the bucket count under this dimension is not a count of runs.
includestringnoOptional extras to compute. The only value is distinct, which adds totals.distinct — one distinct-entity count per attribution column. It is opt-in because each key costs the database one extra sort of the window, so the default response keeps its cost whatever the event table grows to carry; a caller counting entities sends one request at limit=1&include=distinct. Any other value is a 400.
fromstringnoInclusive lower bound (ISO-8601 timestamp) on the event created_at. Omit for no lower bound.
tostringnoInclusive upper bound (ISO-8601 timestamp) on the event created_at. Omit for no upper bound.
meter_typestringnoNarrow the rollup to one meter type (e.g. llm_tokens, compute_execution, api_request, storage, tool_execution). Omit to include every meter. An unknown type yields an empty rollup, not an error.
session_idstringnoNarrow the whole rollup — every bucket, totals and totals.distinct alike — to one session's traffic. Combines with group_by: group_by=day&session_id=… is a conversation's spend per day, group_by=model is the same spend split by model. An id naming no session in this project yields an empty rollup, never the project total.
actor_idstringnoThe same narrowing, for one end user across every session they appear in. This is the figure behind a scope: actor, metric: cost_usd quota — what that actor has spent, against the cap it is held to.
agent_idstringnoNarrow to one agent's traffic, across every session, run and trigger that dispatched it.
ai_provider_idstringnoNarrow to the spend billed against one provider record — a routed generation's serving target, or the agent's pinned provider.
orchestration_run_idstringnoNarrow to the events one orchestration run metered.
orchestration_idstringnoNarrow to the runs of one orchestration — the runs it started itself, never the subtree a loop or sub_orchestration node started under it, which is metered against the child orchestration where it was incurred. Additive: summed across a project's orchestrations the figures reach the project total exactly once. For the subtree figure of a single invocation, read usage on the run.
generation_idstringnoNarrow to one generation's events. A generation writes more than one when it meters several dimensions (tokens and compute).
trace_idstringnoNarrow to the events recorded under one trace.
modelstringnoNarrow to one model, matched against the as-billed SKU the event recorded. A value naming no model yields an empty rollup, not an error. Under group_by=model this is a single-bucket rollup; under any other dimension it is that model's spend split by the dimension.
sourcestringnoNarrow by what the spend was incurred for — eval and eval_judge are verification spend, decider is decision spend. Ordinary traffic carries no source, so it cannot be selected by this filter; omit the filter for everything.
trigger_idstringnoNarrow to the spend one trigger initiated. Matched as recorded rather than resolved, so it still selects the spend of a trigger that has since been deleted.
action_idstringnoNarrow to one caller-supplied action label, for per-action spend. Matched as recorded, like trigger_id.
tool_idstringnoNarrow to the executions of one tool, including one another project shares with this one. An id naming no tool in reach yields an empty rollup.
publisher_project_idstringnoNarrow to the calls made through a share of a resource the named project owns. A project that does not exist yields an empty rollup.
outcomestringnoNarrow tool_execution events by how the call ended — ok, error or timeout — matched as recorded. outcome=error is a tool's failures without a second meter.
limitnumbernoResults per page. Above the maximum it is clamped, and limit in the response reports the page served; below 1 or not an integer it is 400 VALIDATION_FAILED.
offsetnumbernoResults to skip. Negative or not an integer it is 400 VALIDATION_FAILED.

list-usage-thresholds​

List usage thresholds

Arguments​

ArgumentTypeRequiredDescription
project_idstringnoFilter by project public ID
limitnumbernoResults per page. Above the maximum it is clamped, and limit in the response reports the page served; below 1 or not an integer it is 400 VALIDATION_FAILED.
offsetnumbernoResults to skip. Negative or not an integer it is 400 VALIDATION_FAILED.

create-usage-threshold​

Create a usage threshold

Arguments​

ArgumentTypeRequiredDescription
project_idstringyes—
metricstringyes—
windowstringyes—
thresholdnumberyesMust be greater than 0

delete-usage-threshold​

Delete a usage threshold

Arguments​

ArgumentTypeRequiredDescription
threshold_idstringyesThreshold public ID

get-usage-receipt​

Get a generation or orchestration-run billing receipt

Arguments​

ArgumentTypeRequiredDescription
generation_idstringnoGeneration public ID. Mutually exclusive with orchestration_run_id.
orchestration_run_idstringnoOrchestration run public ID. Returns the receipt summed across every generation the run metered. Mutually exclusive with generation_id.

get-price-book​

Get the price book

Arguments​

This tool takes no arguments.

upsert-price-book​

Upsert price-book rows

Arguments​

ArgumentTypeRequiredDescription
pricesarray<object>yes—