Record LLM usage
record_usageRecord token usage for one LLM call against a session and get the call's cost in US dollars, so per-call spend can be priced and tracked in a persistent cost ledger.
Instructions
Record token usage of one LLM call against a session. Returns the cost of this call in US dollars.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"session_id": "<session_id>",
"model": "<model>",
"input_tokens": "<input_tokens>",
"output_tokens": "<output_tokens>"
},
"name": "record_usage"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | No | Optional tag, for example 'report' or 'chat-turn' | |
| model | Yes | Model name as listed by list_models | |
| session_id | Yes | Your session or customer-run identifier | |
| input_tokens | Yes | Uncached input tokens | |
| output_tokens | Yes | Output tokens | |
| cache_read_tokens | No | Tokens read from prompt cache | |
| cache_write_tokens | No | Tokens written to prompt cache |