Estimate cost
estimate_costCalculate the USD cost of a model request from published per-million-token rates. Specify input, output, and cache token counts to get an exact estimate.
Instructions
Estimate the USD cost of a request to one model from its published per-million-token rates. Use get_model first if you need to pick an id.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Model id, e.g. 'anthropic/claude-sonnet-4-5' or 'gpt-5.2'. | |
| inputTokens | No | Number of prompt/input tokens. | |
| outputTokens | No | Number of completion/output tokens. | |
| cacheReadTokens | No | Number of cached-input tokens read at the cache-read rate. | |
| cacheWriteTokens | No | Number of tokens written to cache at the cache-write rate. |