Cost per Query Calculator
Calculate the average cost incurred per query or API call to an AI model.
About Cost per Query Calculator
The cost of a single AI query is the sum of its prompt (input) token cost and completion (output) token cost, each billed at the model's respective per-token rate — output tokens are almost always priced higher than input tokens. This calculator computes that per-query cost precisely, then projects it out to daily and monthly totals based on your expected query volume, giving you the building block for the Cost per User and Inference Budget calculators.
Formula
cost_per_query = (prompt_tokens / 1M) × input_rate + (completion_tokens / 1M) × output_rate
- prompt_tokens
- Number of input/prompt tokens
- completion_tokens
- Number of output/completion tokens
- input_rate
- Cost per million input tokens
- output_rate
- Cost per million output tokens
Worked example
With the default values below, Cost per Query Calculator returns Cost per Query of $0.017000. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Prompt Tokensaccepts 0–10,000,000 tokens
- 800 tokens
- Completion Tokensaccepts 0–10,000,000 tokens
- 300 tokens
- Input Rateaccepts 0–500 $/1M tokens
- 10 $/1M tokens
- Output Rateaccepts 0–500 $/1M tokens
- 30 $/1M tokens
- Queries per Day (optional)accepts 0–1,000,000,000 queries
- 1,000 queries
Results
- Cost per Query
- $0.017000
- Input Token Cost
- $0.008000
- Output Token Cost
- $0.009000
- Projected Monthly Cost
- $510.00
Step by step
- 1Input cost= $0.008000
- 2Output cost= $0.009000
- 3Cost per query= $0.017000
- 4Projected monthly cost= $510.00
Assumptions and limits
- The result is derived only from the 5 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 6 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
Why are output tokens priced higher than input tokens?
Generating output requires sequential autoregressive computation per token, which is more compute-intensive than processing input tokens in parallel, so providers typically charge 2-5x more for output.
How do I estimate my average completion length?
Sample real production responses and average their token counts, or check your provider's usage dashboard for historical completion token statistics.
Does this include system prompts?
Yes — include any system/instruction prompt tokens in your prompt token count, since providers bill for the full input context sent with each request.
