calculate_cost
Use when you have one exact offer ID and token usage and want its USD text-token subtotal. Discover the ID with list_models first. Total input includes cached input; do not add cached tokens twice. Excludes cache writes, storage, search, tool fees and taxes. Requires current reviewed, supported rates; does not invoke a model. Use compare_model_costs for several known offers.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| usage | Yes | Token totals for the period or scenario being estimated, not dollars or request counts. Supply input and output separately; cached input is a subset of total input. | |
| model_id | Yes | Exact pricing-offer ID returned by list_models or find_cheapest_models. Do not substitute a display name or guessed API model name. | |
| expected_dataset_revision | No | Optional consistency check: copy meta.dataset_revision from a prior tool response to require the same current pricing snapshot. Omit to use the current snapshot. A mismatch returns DATASET_CHANGED; refresh pricing and retry. This cannot retrieve a historical snapshot. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||