Back to blogTechnical Guide

Cost-modelling LLM workflows at SMB scale

August 9, 2026 12 min read

The real cost drivers behind AI workflows, illustrative formulas and scenarios, the optimization levers that matter, and a simple build-or-skip framework.

Most AI cost surprises at SMB scale are not caused by expensive models. They are caused by an unmodelled multiplier: a retry loop nobody capped, a context window that grew as the knowledge base grew, or an agent that makes six model calls per task when the estimate assumed one.

This guide gives you a model you can actually fill in. Every number below is illustrative and used only to demonstrate the arithmetic — substitute your own volumes and your provider's current published prices before making any decision.

The four cost layers

  • Model inference — input tokens, output tokens, and increasingly reasoning tokens, priced per million and different for each direction.
  • Supporting AI services — embeddings, reranking, transcription, text-to-speech, vision, each priced separately.
  • Tooling and SaaS — automation platform seats or execution quotas, vector database, observability, CRM API tiers.
  • Infrastructure and people — hosting, storage, egress, plus the human time to review outputs and maintain the workflow. This layer is routinely omitted and is often the largest.

The base formula

Start with cost per run, then multiply. The mistake to avoid is estimating a single model call when your workflow makes several.

textCost model — the last line is the one people forget
cost_per_call   = (input_tokens  / 1e6 * price_in)
                + (output_tokens / 1e6 * price_out)

cost_per_run    = SUM(cost_per_call for every call in the run)
                + retrieval_cost
                + tool_costs

effective_run   = cost_per_run * (1 + retry_rate) * calls_per_task

monthly_cost    = effective_run * runs_per_month
                + fixed_platform_costs
                + (review_minutes_per_run * runs_per_month / 60 * loaded_hourly_rate)

A worked example (illustrative only)

Assume a lead-qualification workflow. These figures are invented to show the arithmetic, not drawn from any provider's price list or any client engagement.

textIllustrative arithmetic — substitute your own numbers
ILLUSTRATIVE EXAMPLE - not a quote, not real pricing

Assumptions
  price_in            $0.30 per 1M input tokens   (assumed)
  price_out           $1.20 per 1M output tokens  (assumed)
  input_tokens        3,000  (system + record + retrieved context)
  output_tokens         400
  calls_per_task          2  (classify, then draft)
  retry_rate            10%
  runs_per_month      2,000
  review_minutes          1  on 20% of runs
  loaded_hourly_rate    $35

Model cost
  input   3,000 / 1e6 * 0.30 = $0.00090
  output    400 / 1e6 * 1.20 = $0.00048
  per call                    = $0.00138
  per run  x2 calls           = $0.00276
  with 10% retries            = $0.00304
  x 2,000 runs                = $6.07 / month

Human review
  2,000 * 20% = 400 reviews x 1 min = 6.7 hours x $35 = $233 / month

Platform + tooling (assumed)          = $70 / month
-----------------------------------------------------
TOTAL (illustrative)                  ~ $309 / month
  of which model inference            ~ 2%

The shape of that example is the lesson, not the total: at SMB volumes, token spend is frequently the smallest line, while human review time and fixed platform fees dominate. Optimizing the model while ignoring review time is optimizing the wrong variable.

Where costs actually escalate

  • Context growth — a prompt that stuffs the whole knowledge base grows linearly with your documentation. Retrieval with a hard top-k cap keeps it flat.
  • Agent loops — multi-step agents can make many model calls per task. Cap steps explicitly; an uncapped loop is an uncapped invoice.
  • Retries on malformed output — every schema failure is a paid call that produced nothing. Reliability and cost are the same problem.
  • Chatty conversations — resending the full history each turn means cost grows quadratically over a long thread. Summarize or window it.
  • Reasoning-heavy modes — deep reasoning settings can multiply output tokens several times over. Reserve them for the small subset of tasks that need them.
  • Per-execution platform pricing — a workflow that fires on every webhook, including irrelevant ones, burns quota. Filter at the trigger.
  • Long documents and media — transcription, OCR, and vision are priced by duration or page and add up faster than text.

Optimization levers, in order of payoff

Free 30-min audit

Want us to build this for your business?

We build n8n automations and AI agents for SMBs. Book a free 30-minute audit — we'll map your highest-ROI workflow live, no pitch.

Book a free call
  • 1. Do not call the model at all when a rule will do. Deterministic routing, regex, and lookups are free and more reliable.
  • 2. Filter at the trigger so only relevant events start a run.
  • 3. Cache aggressively — cache identical requests, and use provider prompt caching for the stable system-prompt prefix where available.
  • 4. Trim context — retrieve the top few chunks instead of pasting whole documents; strip boilerplate from records.
  • 5. Route by difficulty — a small model handles the routine majority, escalating only ambiguous cases to a larger one.
  • 6. Constrain output length — cap max tokens and ask for structured fields instead of prose. Output tokens usually cost several times input tokens.
  • 7. Batch offline work where the provider offers a discounted asynchronous tier.
  • 8. Fix schema failures first — they are pure waste, and fixing them cuts cost and improves reliability at once.
  • 9. Reduce human review time by improving draft quality and one-click approval ergonomics; this is usually the biggest dollar lever at SMB scale.

Instrument before you optimize

Log token counts per run and attribute them to a workflow and step. Without attribution, cost reduction is guesswork.

typescriptPer-step usage logging, priced from a table you maintain
type UsageLog = {
  workflow: string;
  step: string;
  correlationId: string;
  model: string;
  inputTokens: number;
  outputTokens: number;
  cachedInputTokens?: number;
  retries: number;
  latencyMs: number;
};

// PRICES: fill in from your provider's current published pricing,
// keyed by model, in dollars per 1M tokens. Review monthly.
const PRICES: Record<string, { in: number; out: number }> = {};

export function costOf(u: UsageLog): number {
  const pr = PRICES[u.model];
  if (!pr) return 0; // unknown model: surface it rather than guessing
  return (u.inputTokens / 1e6) * pr.in + (u.outputTokens / 1e6) * pr.out;
}

Then set budgets that actually bite: a per-run cap that aborts and escalates, a daily cap per workflow, and an alert on cost per run rising week over week. Provider dashboards tell you what you spent; per-step attribution tells you why.

A simple decision framework

Before building any AI workflow, answer five questions in order. Stop at the first no.

  • 1. Volume — does this task happen often enough that automating it matters? Below a few hundred times a month, the maintenance cost usually exceeds the savings.
  • 2. Value per run — what is the current cost in labour minutes or lost revenue per occurrence?
  • 3. Determinism — can a rule solve it? If yes, build the rule; it is cheaper and more reliable.
  • 4. Tolerance for error — what happens when the output is wrong, and is that recoverable? Low tolerance means a review step, which belongs in the cost model.
  • 5. Total cost of ownership — model plus tooling plus review plus maintenance, compared against question 2 over twelve months.
textBuild-or-skip arithmetic (illustrative structure, your numbers)
monthly_value  = runs_per_month * minutes_saved_per_run / 60 * loaded_hourly_rate
monthly_cost   = model + tooling + infra + review_time
payback_months = build_cost / max(monthly_value - monthly_cost, 1)

Rule of thumb: if payback is beyond 12 months on conservative
assumptions, either narrow the scope or do not build it yet.
Model pricing changes every few months. Your volume, your review time, and your maintenance burden change far more slowly — model those first.

If you want the same arithmetic applied to a specific workflow, our ROI calculator walks through the inputs, and the agency pricing page shows how build and retainer costs are structured. For a like-for-like comparison against hiring, see agency vs in-house.

Need this built for you? We scope, build, and hand over automation systems as a done-for-you engagement — see what an AI automation agency actually delivers, the published pricing ranges, or book a 30-minute call.

Share this article

Frequently asked questions

⚡ Free 3-Minute Quiz

What's your AI Readiness Score?

10 questions. A personalized score, profile, and a 90-day automation roadmap built for your business. No email required.

Take the free quiz →✓ 3 min · ✓ Free forever · ✓ Instant results

0 Comments

Be the first to comment. Start the conversation below.

30-minute working session

Find the highest-ROI automation in your business

Bring one workflow that is slow, repetitive, or leaking opportunities. We will map the bottleneck, the systems involved, and whether automation is actually worth implementing.

Book an AI systems assessment

No obligation. If automation is not the right answer, we will say so.