Skip to content

calculate_estimate

Estimate the cost for a given number of input and output tokens on a specific model. Useful for budgeting API calls or comparing the cost of different approaches.

ParameterTypeRequiredDescription
model_namestringYesModel name (fuzzy matched)
input_tokensnumberYesNumber of input tokens
output_tokensnumberYesNumber of output tokens

Request:

{
"model_name": "claude-sonnet-4-5",
"input_tokens": 1000,
"output_tokens": 500
}

Response:

Cost Estimate for claude-sonnet-4-5
Input: 1K tokens × $3.00/1M = $0.003000
Output: 500 tokens × $15.00/1M = $0.007500
─────────────────────────────
Total: $0.0105
  • Token counts must be non-negative integers
  • The model name is fuzzy matched, same as get_model_details
  • Pricing is based on the per-token rates from the LiteLLM registry