Cost per Query Calculator
Calculate the exact cost of a single AI query from prompt and completion token counts and their rates.
Inputs
Cost per Query
$0.017000
Input Token Cost
$0.008000
Output Token Cost
$0.009000
Projected Monthly Cost
$510.00
Step by step
Input cost
(800 ÷ 1,000,000) × $10.0000
= $0.008000
Output cost
(300 ÷ 1,000,000) × $30.0000
= $0.009000
Cost per query
$0.008000 + $0.009000
= $0.017000
Projected monthly cost
$0.017000 × 1000 × 30
= $510.00
How it works
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
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.