tools

Get Tool Spend

Spend attributed to each tool over a date range, for the Cost Optimization dashboard.

Reads the LiteLLM_DailyToolSpend rollup, written at request time from invoked tools only (MCP tool calls and response tool_calls; declaring a tool without invoking it does not count). A request that invoked multiple tools counts its full spend toward each of them, so per-tool numbers are attributions and do not sum to a deduplicated total.

by_tool is the top TOOL_SPEND_TOP_TOOLS tools by spend, aggregated in SQL, and daily covers only those tools, so the response is bounded by days x TOOL_SPEND_TOP_TOOLS regardless of the requested range or how many distinct tool names exist.

get/v1/tool/spend

Query parameters

start_datestring nullable

YYYY-MM-DD (defaults to 30 days ago)

YYYY-MM-DD (defaults to 30 days ago)

end_datestring nullable

YYYY-MM-DD (defaults to today)

YYYY-MM-DD (defaults to today)

Response

Successful Response

end_datestring nullable
start_datestring nullable

Changes