record_usage
Record actual token usage for a completed LLM call. Cost is computed server-side from current pricing, never trusted from the caller — this is the 'actual spend' counterpart to estimate_cost's hypothetical numbers. Usage is attributed to your org. Resubmitting the same request_id for the same org is a no-op. Use when the user wants to log or track real LLM spend, not just estimate it. Requires your service API key on the MCP connection (x-api-key or Authorization: Bearer); org_id defaults to, and must match, that key's org.
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": {
"model_name": "<model_name>",
"input_tokens": "<input_tokens>",
"output_tokens": "<output_tokens>"
},
"name": "record_usage"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| org_id | No | Optional organisation ID to attribute this usage to. Defaults to, and must match, the org of the service key on the MCP connection | |
| model_name | Yes | Name of the LLM model that was called | |
| request_id | No | Optional idempotency key — resubmitting the same value is a no-op | |
| session_id | No | Optional session ID to tag this event with, so it can later be grouped and retrieved via analyze_session_usage — e.g. a bounded burst of calls like a coding-agent run or a chat session | |
| occurred_at | No | Unix timestamp when the call happened (default: now) | |
| input_tokens | Yes | Number of input tokens actually used | |
| output_tokens | Yes | Number of output tokens actually used |