SSiddiq.in
LLMs, shipped like production software

The gap between an OpenAI demo and OpenAI in production is entirely in the boring parts.

Evals. Cost caps. Fallback models. Grounding. Refusal criteria. Retry logic. The prompt is 10% of the work. This page is the other 90% — what we build around the model to make it survive real users on Monday morning.

Anatomy of a production LLM call

Twelve steps between the user and the model.

01
Rate limit — per user, per endpoint
Blocks abuse before we spend a token
02
Auth + role check
Not every user can hit every prompt
03
Input validation (Zod)
The model isn't your validation layer
04
PII redaction
Emails, phone numbers, ids stripped or hashed
05
Prompt-injection screen
Reject inputs that try to override system prompt
06
Model router
Cheap model first · escalate on failure
07
Retrieval (RAG) if grounded
Fetch relevant docs · rank · window
08
System prompt assembly
Persona · constraints · refusal criteria · examples
09
Call with timeout + retry
3s timeout · 1 retry · fallback provider
10
Output validation (schema)
Structured outputs so we can actually use them
11
Guardrail pass
Off-topic · toxic · policy · confidence check
12
Log to eval store
So we can grade this response later
Cost control · the model routing table

The right model for the task cuts bills 60–90%.

TaskFirst choiceEscalate toWhy
Classify a support ticketgpt-4o-minigpt-4o (rare)Cheap, fast, 95%+ accurate with a good prompt
Extract structured data from a PDFgpt-4o-mini + Structured Outputsgpt-4o on parse failureCheap does 90% of it
Answer from a knowledge base (RAG)gpt-4o-minigpt-4o for multi-hopRetrieval matters more than model size here
Write a customer-facing emailgpt-4o—Brand voice matters, don't cheap out
Reasoning / multi-step agento-series (or Claude Sonnet)gpt-4o for costDepth of thought is what you're paying for
Embeddingstext-embedding-3-small-large for high-precision RAGSmall is 5× cheaper, ~95% as good
Whisper transcriptionwhisper-1gpt-4o-transcribe for diarisationWhisper is a bargain
Evals · the boring superpower

Prompts without evals are just vibes.

Every prompt change opens a PR that runs against our eval set. If accuracy drops on any category, CI fails. This is how we tell "the demo felt great" from "the app is actually better."

evals/support-classifier.jsonl · 84 cases
in: Where's my order?
expect: shipping
in: How do I cancel my subscription?
expect: billing
in: The button on step 3 does nothing.
expect: bug
in: Do you integrate with Zoho?
expect: sales · got: support
in: 🔥🔥🔥
expect: junk
Accuracy83/84 · 98.8%

OpenAI FAQ

Hard per-user and per-endpoint token caps, cheap models for cheap tasks (routing 80% of calls to gpt-4o-mini or similar), aggressive prompt caching, and daily anomaly alerts. Predictable spend is a design decision, not a hope.

Model economics · Nov 2025 reference

Six models. Cost, latency, and where each earns its keep.

Prices per 1M tokens, input / output. Latency is p50 first-token for streaming completions of ~500 tokens. Numbers move — the shape stays the same.

gpt-4o
$2.50 / $10 · ~800ms · Reasoning, code review, complex tool calls. Default when quality matters more than budget.
gpt-4o-mini
$0.15 / $0.60 · ~400ms · Classification, extraction, routing. The workhorse — 90% of production calls.
o1 / o1-mini (reasoning)
$15 / $60 · ~5–15s · Multi-step planning, verification, math. Use behind a queue; never on hot user paths.
Claude Sonnet 3.5
$3 / $15 · ~700ms · Long context, careful writing, structured refactors. Excellent when 4o hallucinates on your domain.
Gemini Flash 2
$0.10 / $0.40 · ~350ms · High-volume classification, cheap RAG. Free tier is generous for internal tools.
Local (Llama 3.3 70B on Groq)
$0.59 / $0.79 · ~200ms · Latency-sensitive workloads, data-residency needs. Quality below 4o but improving quarterly.

Ship AI you can defend in a board meeting.

Scope an AI project
Right tech, honest advice

Not sure if this is the right stack for you?

Tell us your goals — we'll recommend the right technology honestly, even if it isn't this one.

  • Personal reply from Siddiq within 24 hours
  • Honest advice — no pushy sales, no fake urgency
  • Clear next steps, timeline, and estimate

We only use your details to reply to this enquiry. Privacy.