Estimate Token Cost
tokencost_estimate_costCalculate token usage costs for AI models by specifying model, input tokens, and output tokens to get a detailed cost breakdown in USD.
Instructions
Calculate the cost for a specific number of input and output tokens with a given model.
Args:
model (string): Model ID or name
input_tokens (number): Number of input tokens (0 to 100B)
output_tokens (number): Number of output tokens (0 to 100B)
Returns: Cost breakdown with input cost, output cost, and total cost in USD.
Examples:
model="gpt-5", input_tokens=1000, output_tokens=500 → Cost for a typical API call
model="claude-sonnet-4.6", input_tokens=100000, output_tokens=4000 → Cost for a long context call
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>",
"input_tokens": "<input_tokens>",
"output_tokens": "<output_tokens>"
},
"name": "tokencost_estimate_cost"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | Model ID or name | |
| input_tokens | Yes | Number of input tokens | |
| output_tokens | Yes | Number of output tokens |