How to Calculate LLM API Cost per Request
·
LLM CostToken PricingAI FinanceAPI Metrics
Cost per request is one of the most useful AI product metrics. It tells you whether a feature is economically sustainable.
Basic formula
Estimate:
- input token cost
- output token cost
- retry cost
- embedding cost
- reranking cost
- gateway overhead
Cost per successful task
A failed request still costs money. Compare cost per successful task, not just cost per API call.
Segment by feature
Calculate cost by feature, customer, model, and plan. This shows which workflows need optimization.
Final thoughts
LLM cost per request helps connect engineering choices to business margin. Track it from the beginning.