Price a Call Before You Make It
ledger_priceCalculates model-call cost from token usage using the same pricing table as spend caps, helping agents report honest costs and plan before spending.
Instructions
What will this call cost? Priced from the same table the caps use.
Exists because ledger_track requires the CALLER to supply amount_cents, so an agent whose spend is capped could under-report its own cost and stay under the cap. This returns the number the enforcement path would use, so an agent can report honestly (and plan before it spends).
Cost = (tokens_in * in_rate + tokens_out * out_rate) / 1_000_000. If the model has cache rates, the standard in-rate is used, which is the conservative direction for a spend cap.
Every price carries the source it came from and the date it was read, and
verified: false means the number was NOT read off the provider's own
pricing page. Treat an unverified price as an estimate, not a measurement.
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": "<model>"
},
"name": "ledger_price"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | the model id you are about to call (e.g. gpt-4o, claude-sonnet-4) | |
| tokens_in | No | expected input tokens | |
| tokens_out | No | expected output tokens, e.g. your max_tokens |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||