get_cost_totals
Calculate total LLM cost, tokens, and requests for a workspace or pipeline over a date range to answer spending questions.
Instructions
Reads the total LLM cost, tokens and requests of the workspace, or of one pipeline, over a date range.
Use this to answer how much a workspace or pipeline spent on LLM calls. Costs are in USD.
Without dates the range is the last 30 days. start_date is inclusive and end_date exclusive, so
for September 2026 pass 2026-09-01T00:00:00Z and 2026-10-01T00:00:00Z.
Without workspace the figures cover the whole organization, as the Cost Management page does for an
organization admin; this needs the organization admin role. Use workspace for one workspace. In that
organization view pipeline_name and Service names can't be used (they belong to a workspace); pass
Service ids instead.
Narrow the figures with services, providers and api_keys. They combine: usage must match every
kind you set, and any one value within a list.
Check is_cost_complete before reporting total_cost. When it is false, total_cost is a lower
bound, not the final figure: say so, and name the models in unpriced_models (LLM calls with no price
on file) and mention pending_generation_count (calls whose cost is still being calculated, which
usually clears within a minute). total_requests counts queries, not individual LLM calls; one query
can make several LLM calls.
:param pipeline_name: Restrict to this pipeline. Omit for the whole workspace. Needs Pipelines read as well as
Costs read.
:param start_date: Inclusive start as an ISO timestamp. Defaults to 30 days before end_date.
:param end_date: Exclusive end as an ISO timestamp. Defaults to no upper bound.
:param services: Restrict to these Services (deployment in the API; a published Service endpoint, not a
deployed pipeline, which is a pipeline). Each value is a Service name or its id, the key from
get_cost_breakdown with group_by='deployment'. Looking a Service up by name needs Services read as
well as Costs read; an id needs only Costs read.
:param providers: Restrict to these providers. Use the provider ids from get_cost_breakdown with
group_by='provider', such as bedrock_converse or openai, not their display names.
:param api_keys: Restrict to these API keys. Use the key ids from get_cost_breakdown with
group_by='api_key', never a key's secret token.
:returns: The cost totals, or an error message.
The output is automatically stored and can be referenced in other functions.
Returns a formatted preview with an object ID (e.g., @obj_123).
Use the object store tools in combination with the object ID to view nested properties of the object.
Use the returned object ID to pass this result to other functions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_keys | No | ||
| end_date | No | ||
| services | No | ||
| providers | No | ||
| start_date | No | ||
| pipeline_name | No |