GUIDE深度 · Deep dive
How to Calculate LLM Cost
LLM cost is not a price per million tokens. Input vs output, cache hit rate, retries, tool calls, embeddings and fine-tuning change true cost; use real requests for per-user margin.
Formula
Per-call cost = input tokens x input price + output tokens x output price + extras.
Monthly cost = requests x average cost + fixed/platform fees.
Margin = revenue - monthly cost; split by user/task.
Often missed
Retries and failures consume tokens.
Tool calls/long context amplify input.
Cache hit rate is not 100%.
FAQ
Why is output more expensive?
Most providers price output tokens higher than input; long answers add cost.
How do I reduce cost?
Shorten context, cache, batch, choose the right model, cap retries and output length.
Sources
More guides
LLM Production Cost ChecklistRead guideKEEP READING
继续读
按顺序读,或跳到同主题的其他指南。