Skip to content
MarginMeter

How to calculate LLM cost per user

Calculate LLM API cost per request and per user from tokens, model prices, caching and usage — with a worked example and the mistakes that underestimate cost.

October 3, 2026 · 1 min read

The formula

Cost per request = (input tokens × input price + output tokens × output price) ÷ 1,000,000
Cost per user per month = cost per request × requests per user per month

Prices are quoted per million tokens. If part of the input is served from a prompt cache, price that share at the cached rate.

Worked example

A model priced at $3 per million input tokens, $0.30 cached input and $15 per million output tokens. Each request sends 2,000 input tokens (half cached) and receives 500 output tokens; users make 300 requests a month.

  • Input: 1,000 × $3 + 1,000 × $0.30 = $0.0033
  • Output: 500 × $15 = $0.0075
  • Per request: $0.0108, per user: $3.24/month

At a $20 plan, AI alone takes about 16% of revenue.

Mistakes that underestimate cost

  • Forgetting the system prompt and retrieved context in input tokens.
  • Using the average user when a few heavy users drive most cost.
  • Ignoring retries, tool calls and agent loops that multiply requests.
  • Using last quarter's prices — check the provider's pricing page.

Use the LLM cost per user calculator to compare models, then track the real cost by model in MarginMeter.

Frequently asked questions

How do I estimate tokens per request?

Log token counts from your provider's API responses for a sample of real requests. Include the system prompt, retrieved context and conversation history in input tokens.

Why are output tokens more expensive?

Providers price output tokens higher because generating them is more compute-intensive than reading input. That's why long responses dominate cost for many products.

See your real margin in five minutes.

Connect Stripe and your cost providers with read-only access. Free for two connections — no card required.