estimate_cost
Calculate the USD cost of a Perplexity API request upfront, with a breakdown by input tokens, output tokens, and tool calls.
Instructions
Estimate the USD cost of a request before sending it. Returns a breakdown by input tokens, output tokens, and tool invocations.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | Model ID to estimate cost for (e.g. 'sonar', 'sonar-pro'). | |
| input_tokens | Yes | Number of input (prompt) tokens. | |
| output_tokens | No | Number of output (completion) tokens. | |
| tool_invocations | No | Tool invocation counts (for models that bill per tool call). |