· 10 min read

The Hidden Cost of Running AI (And How to Keep It Profitable)

Token costs kill more AI businesses than bad ideas do. Here's the real math behind AI SaaS margins and how to stay profitable.

The Hidden Cost of Running AI (And How to Keep It Profitable)

Token costs kill more AI businesses than bad ideas do.

That sounds backwards at first.

Founders worry about product quality, distribution, churn, and competition. They should. But once an AI product gets real usage, gross margin becomes a product problem, not just a finance problem. If your feature is useful but expensive to run, growth makes the business worse.

This is why AI API cost optimization matters earlier than most teams expect.

You do not need perfect pricing on day one. You do need to know your rough LLM token cost per user, your acceptable cost per successful task, and the point where a premium model destroys your margin.

💸

In AI SaaS, the fastest way to fake product-market fit is to ignore inference cost. The revenue looks real. The margin is not.

OpenAI’s current API pricing makes the spread obvious: GPT-5.4 is priced at $2.50 per 1M input tokens and $15.00 per 1M output tokens, while GPT-5.4 mini is $0.75 per 1M input and $4.50 per 1M output. GPT-5.4 nano drops to $0.20 per 1M input and $1.25 per 1M output. OpenAI also advertises cached input at a steep discount, and 50% lower pricing for asynchronous Batch API workloads (OpenAI API pricing, Prompt Caching, Batch API FAQ). Anthropic shows the same pattern: higher-end models cost materially more than fast models, and prompt caching plus batch processing exist because repeated context is expensive (Anthropic pricing).

That pricing spread is not a minor detail. It decides whether your AI SaaS pricing margins survive normal usage.

~$0.003

Cheap path

~$0.035

Premium path

50%

Batch savings

Those first two numbers are not marketing math. They are reasonable request-level examples:

  • Cheap path: 1,200 input tokens and 300 output tokens on GPT-5.4 mini costs about $0.00225 before retries and overhead. Round it to $0.003 per request to stay conservative.
  • Premium path: 8,000 input tokens and 1,000 output tokens on GPT-5.4 costs about $0.035 per request.

That is a 10x to 15x swing from one routing choice.

The margin leak most founders miss

A lot of AI products start with a simple assumption:

“If users are paying $20 to $99 per month, inference cost will be fine.”

Sometimes that is true.

Often it is not, because monthly cost is shaped by four variables at once:

  1. requests per user
  2. input tokens per request
  3. output tokens per request
  4. model class used for each step

If any one of those climbs without a pricing update, your margin gets hit. If all four climb together, the business gets ugly fast.

Here is a simple portfolio-style example for one active customer on a $29 per month plan.

Example monthly token spend per customer

Assume the customer uses three features:

  1. Chat assistant: 400 requests per month, average 1,500 input and 350 output tokens, routed to GPT-5.4 mini.
  2. Document analysis: 40 requests per month, average 10,000 input and 1,200 output tokens, routed to GPT-5.4.
  3. Background summaries: 120 async jobs per month, average 4,000 input and 250 output tokens, routed to GPT-5.4 nano through Batch API.

Approximate monthly cost:

  • Chat assistant on mini
    • Input: 400 × 1,500 = 600,000 tokens → $0.45
    • Output: 400 × 350 = 140,000 tokens → $0.63
    • Subtotal: $1.08
  • Document analysis on premium
    • Input: 40 × 10,000 = 400,000 tokens → $1.00
    • Output: 40 × 1,200 = 48,000 tokens → $0.72
    • Subtotal: $1.72
  • Background summaries on nano with Batch API
    • Base synchronous cost would be:
      • Input: 120 × 4,000 = 480,000 tokens → $0.096
      • Output: 120 × 250 = 30,000 tokens → $0.0375
      • Base subtotal: $0.1335
    • With Batch API 50% discount: about $0.067

Total monthly model cost for one customer: about $2.87.

On a $29 plan, that looks fine.

Now change only two things:

  • document analysis moves from 40 requests to 120 requests
  • average output on that premium path rises from 1,200 to 2,000 tokens

That premium feature alone becomes:

  • Input: 120 × 10,000 = 1.2M → $3.00
  • Output: 120 × 2,000 = 240,000 → $3.60
  • Subtotal: $6.60

Now the customer costs about $7.75 per month in model spend before storage, vector DB, retrieval, OCR, logging, support, failed runs, and payment fees.

On paper, the customer is still profitable.

In reality, your margin is already getting squeezed.

Output tokens are where margins quietly die

Many teams focus on prompt length first. That matters, but output often hurts more.

On OpenAI’s pricing page, GPT-5.4 output tokens cost 6x more than input tokens. GPT-5.4 mini has the same ratio. Anthropic’s current pricing shows a similar pattern, where output is far more expensive than input across model tiers (OpenAI API pricing, Anthropic pricing).

That means verbose answers are not just a UX choice. They are a margin decision.

If your product lets a model produce 2,000 tokens where 300 would do, you are not being generous. You are leaking money.

This is one reason I wrote Smart Token Consumption Is the New 10x Engineer. Good AI systems do not just think well. They know when to stop talking.

The practical model selection framework

Founders usually ask the wrong question:

“Which model is best?”

The better question is:

“Where does premium reasoning create enough value to pay for itself?”

Expensive model by default

  • Use frontier models for every chat, extraction, and summary
  • Keep one latency profile for every feature
  • Accept long outputs because they look impressive
  • Run recurring jobs synchronously
  • Price plans without a hard usage assumption

Margin-aware routing

  • Use premium models only where errors are expensive
  • Route extraction, triage, and summaries to cheaper models
  • Cap output length based on product need
  • Use batch lanes for async workloads
  • Price plans around real token budgets per user

A simple rule set works well in early AI products.

Use a cheap model when the task is:

  • classification
  • extraction into a fixed schema
  • short summarization
  • spam or fraud pre-filtering
  • support triage
  • background enrichment
  • first-pass ranking

Use a more expensive model when the task is:

  • user-facing analysis where quality changes retention
  • complex document reasoning
  • multi-step planning with ambiguous inputs
  • code generation or review tied to business risk
  • high-value workflows where one good answer replaces real labor

This is the same systems view behind The API Is the Product for AI Features. Model routing is part of product design. It should be explicit, versioned, and observable.

How to calculate LLM token cost per user

If you want a fast operating model, use this formula:

Monthly cost per user = Σ(feature requests × average input cost + average output cost + retries + tool overhead)

That is enough to decide pricing, limits, and routing.

For each feature, track:

  • active users touching the feature
  • requests per active user
  • average input tokens
  • average output tokens
  • model used
  • retry rate
  • fallbacks triggered
  • cached-token share
  • async vs sync share
1

Measure by feature, not only by account

A blended account average hides the real problem. One expensive feature can wreck your margins while everything else looks healthy.

2

Price around your 80th percentile user

If you price from the median but your product attracts heavy usage, the best customers can become the least profitable.

3

Set a hard budget per successful outcome

Do not ask whether a request feels cheap. Ask whether the request is cheap relative to the value and plan price.

4

Revisit routing before changing pricing

Most early margin problems can be improved faster with better model routing, output caps, caching, and async processing than with a pricing page rewrite.

The four fastest ways to reduce LLM inference costs

1. Cut repeated context with caching

OpenAI states that Prompt Caching automatically discounts reused prompt prefixes longer than 1,024 tokens on supported models, with caches typically cleared after 5 to 10 minutes of inactivity and always within one hour of last use (Prompt Caching). Anthropic also publishes separate prompt caching rates because repeated context is common enough to price directly (Anthropic pricing).

This matters any time your app keeps sending the same system instructions, policy blocks, product docs, or conversation prefix.

Use caching when you have:

  • stable system prompts
  • repeated workspace or tenant context
  • long document prefixes reused across turns
  • multi-step workflows with shared setup context

Do not rely on caching to save a bad architecture. It helps. It does not excuse waste.

2. Move async workloads into a batch lane

OpenAI’s Batch API offers a 50% discount relative to synchronous APIs for jobs processed within 24 hours (Batch API FAQ). Anthropic markets the same 50% batch discount for supported batch processing workloads (Anthropic pricing).

That is one of the cleanest ways to reduce LLM inference costs when the user does not need an immediate answer.

Good batch candidates:

  • daily summaries
  • enrichment jobs
  • topic clustering
  • moderation backfills
  • CRM note generation
  • long-running report generation

If a task is not user-blocking, do not pay realtime prices for it.

3. Cap output length at the product layer

A product that needs a short answer should enforce a short answer.

Do not leave token length to prompt vibes alone. Add hard response budgets by feature. For example:

  • triage label: under 50 tokens
  • support answer draft: under 250 tokens
  • executive summary: under 400 tokens
  • extraction result: structured JSON only

This protects both cost and consistency.

4. Split one smart path into two cheaper paths

A lot of teams overpay because one model call is doing too many jobs.

Instead of one expensive request that classifies, retrieves, reasons, and writes, try:

  1. cheap model for routing or extraction
  2. retrieval layer for context selection
  3. premium model only for the final reasoning pass

That pattern often drops cost per task without hurting quality.

A simple way to think about AI SaaS pricing margins

For founder math, start here:

Gross margin before infrastructure overhead = (plan price - model spend) / plan price

Examples:

  • $29 plan, $2.87 model spend → about 90% gross margin before other infra
  • $29 plan, $7.75 model spend → about 73% gross margin before other infra
  • $29 plan, $12 model spend → about 59% gross margin before other infra

That last number is where many AI products start feeling uncomfortable, because model spend is not your only variable cost.

You still have:

  • compute
  • storage
  • retrieval systems
  • third-party APIs
  • support
  • payment fees
  • failed job waste
  • engineering time spent chasing cost regressions

This is why a product can grow users and still feel financially worse every month.

If you are building on lean infrastructure, The $0 Stack: Shipping SaaS on Free Tiers is useful for the rest of the cost base. But free hosting will not save a product whose model routing is upside down.

Where observability fits in

Most teams only notice inference cost when the provider invoice spikes.

That is late.

You want cost visibility at the same level you want latency and error visibility:

  • by feature
  • by workspace or tenant
  • by customer tier
  • by model
  • by prompt version
  • by success vs failure path

That is also where a tool like TraceRaven fits naturally. Not as a magic saver, but as part of the discipline. If you can see security events, background-job behavior, and unusual request patterns in one place, you catch both abuse and margin leaks earlier.

The takeaway

AI products do not usually die because one request was too expensive.

They die because nobody owned the math.

The fix is not complicated:

  • measure cost per feature
  • route tasks to the cheapest model that clears quality
  • cap outputs
  • cache repeated context
  • batch async jobs
  • price plans around real usage, not a hopeful average

🧮

Healthy AI SaaS margins come from design discipline. If you know your token budget per user and enforce it in the product, growth gets better. If you do not, growth exposes the problem.

That is the hidden cost of running AI.

The model bill is never just a vendor problem. It is your business model, written in tokens.

Roger Chappel

Roger Chappel

CTO and founder building AI-native SaaS at Axislabs.dev. Writing about shipping products, working with AI agents, and the solo founder grind.

New posts, shipping stories, and nerdy links straight to your inbox.

2× per month, pure signal, zero fluff.


#ai #saas #cost #engineering

Share this post on:


Steal this post → CC BY 4.0 · Code MIT