Calculate the average cost incurred per query or API call to an AI model.
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.
cost_per_query = (prompt_tokens / 1M) × input_rate + (completion_tokens / 1M) × output_rate
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.
Sample real production responses and average their token counts, or check your provider's usage dashboard for historical completion token statistics.
Yes — include any system/instruction prompt tokens in your prompt token count, since providers bill for the full input context sent with each request.