AI Engineering
LLMs for Startups: What They Are and How to Ship One Safely
Every startup pitch now has "AI" somewhere in it, and most of the time that means a large language model behind an API call. The hard part is not calling the model. It is knowing what the model actually is, where it earns its place in your product, and how to ship it without it quietly breaking in front of customers.
This post is for founders and CTOs who want a working mental model, not a research paper.
What an LLM actually is
A large language model is a program that predicts the next piece of text given the text so far. It was trained on a very large amount of writing, and in the process it learned grammar, facts, coding patterns and a fair amount of reasoning ability.
Three properties matter for product decisions:
- It works on tokens. Text is split into chunks (roughly word fragments). You pay per token in and per token out, and every model has a maximum context window: how much text it can consider at once.
- It is probabilistic. The same prompt can give different answers. Lower temperature makes output more consistent, but never guaranteed.
- It has no memory and no live knowledge. Each request is independent. The model only knows what was in its training data plus whatever you put in the prompt.
That last point is the one teams forget. If the model needs your pricing, your docs or yesterday's orders, you have to send them in the request.
Think of it as a component, not a feature
The most useful framing: an LLM is a very capable function that turns unstructured input into output, with a known error rate. You would not ship a payment integration without validation, retries and logging. Treat the model the same way.
| Traditional code | LLM call | |
|---|---|---|
| Input | Structured, typed | Free text, documents, images |
| Output | Deterministic | Probabilistic, needs checking |
| Failure mode | Crashes or errors | Confident, plausible, wrong |
| Testing | Unit tests | Evaluation sets scored over many runs |
| Cost | Fixed compute | Per token, grows with usage |
The "confident, plausible, wrong" row is why LLM features need guardrails that ordinary features do not.
Where LLMs pay off in a startup
LLMs are strongest where the input is messy language and a human currently does tedious reading or writing. Good early candidates:
- Extraction: pull fields out of invoices, contracts, emails or support tickets into structured JSON.
- Classification and routing: tag tickets by urgency, route leads, flag risky content.
- Drafting: first drafts of replies, summaries, product descriptions or reports that a person approves.
- Search and Q&A over your own data: answer questions using your documents, usually with RAG (we covered the pipeline in RAG for startups).
- Agents and tool use: let the model call your APIs to complete multi-step tasks. Higher payoff, higher risk. What is MCP? explains the standard way to expose tools.
Where they are a poor fit: anything that must be exactly right every time with no review (calculating invoices, enforcing permissions), anything that needs sub-50ms latency, and anything a regular expression or a SQL query already solves.
A minimal, production-shaped LLM call
Here is the pattern we use for an extraction feature. The model call itself is three lines. The rest is what makes it safe to ship.
import { z } from "zod";
const Ticket = z.object({
category: z.enum(["billing", "bug", "feature_request", "other"]),
urgency: z.enum(["low", "medium", "high"]),
summary: z.string().max(200),
});
type Ticket = z.infer<typeof Ticket>;
export async function classifyTicket(text: string): Promise<Ticket | null> {
const prompt = `Classify this support ticket. Reply with JSON only, matching:
{"category": "billing|bug|feature_request|other", "urgency": "low|medium|high", "summary": string}
Ticket:
"""${text}"""`;
for (let attempt = 0; attempt < 2; attempt++) {
const raw = await callModel(prompt); // your provider's SDK
try {
const parsed = Ticket.safeParse(JSON.parse(raw));
if (parsed.success) return parsed.data;
} catch {
// invalid JSON: fall through and retry
}
}
return null; // send to a human queue instead of guessing
}
The points worth copying:
- A strict schema. The model's output is validated before your code trusts it.
- A bounded retry. One retry fixes most formatting slips. Unlimited retries burn money.
- A fallback path. When the model fails, a person handles it. The feature degrades instead of breaking.
Most providers now offer structured output or tool-calling modes that enforce a JSON schema for you. Use them, but keep the validation anyway.
Prompting, RAG or fine-tuning?
Teams often reach for fine-tuning first. It is usually the last step, not the first.
- Start with a good prompt. Clear instructions, a few examples of correct output, and the relevant context. This solves more problems than people expect.
- Add retrieval (RAG) when the model lacks knowledge. If answers depend on your data, fetch the right documents and put them in the prompt. Our vector database explainer covers when you need one.
- Fine-tune when you need a consistent style or format at scale, or to get a smaller, cheaper model to match a bigger one on a narrow task. Fine-tuning teaches behaviour; it is a poor way to teach facts that change.
A simple rule: if the problem is "the model doesn't know X", use retrieval. If it is "the model knows, but won't answer the way we need", improve the prompt, then consider fine-tuning.
Choosing a model
You do not need to pick a winner forever. Model quality and pricing change every few months, so design for switching.
- Start with a frontier model to prove the feature works at all. It removes model quality as a variable while you find product fit.
- Then try smaller, cheaper models on the same evaluation set. For classification and extraction, a small model often scores close to a large one at a fraction of the cost and latency.
- Keep the provider behind one function (like
callModelabove) so switching is a config change, not a rewrite. - Check data terms before sending customer data: retention, training use and region. Enterprise customers will ask.
Open-weight models you host yourself make sense when data cannot leave your infrastructure or when volume is high enough that GPU costs beat API pricing. For most early-stage startups, a hosted API is cheaper once you count engineering time.
Evaluation is the real product work
Because outputs vary, "it worked when I tried it" is not a test. Before shipping, build a small evaluation set:
- 50 to 200 real inputs (anonymised), with the answer you expect.
- A script that runs them through your prompt and scores the results: exact match for categories, a rubric or a second model call for free text.
- A number you track every time you change the prompt or the model.
This turns prompt changes from guesswork into engineering. It is also how you justify switching to a cheaper model: same score, lower bill.
Costs and failure modes to plan for
- Token costs grow with context. Sending a 50-page document on every request adds up. Retrieve only the relevant chunks, and cache repeated prompt prefixes where your provider supports it.
- Latency. Large models can take seconds to respond. Stream output to the UI, or run the call in a background job.
- Hallucination. The model will invent details when it lacks information. Ground it with retrieved sources, ask it to cite them, and let it say "I don't know".
- Prompt injection. Text from users or documents can contain instructions that hijack the model. Never give the model permissions the user would not have, and keep a human approval step on risky actions.
- Silent drift. Providers update models. Pin model versions and rerun your evaluation set before upgrading.
The takeaway
An LLM is a powerful, probabilistic component. It reads and writes messy language well, and it is wrong in confident ways. Startups that get value from it pick a narrow, high-volume task, wrap the model in validation and a human fallback, measure it with a real evaluation set, and keep the provider swappable.
Start small: one extraction or classification feature, one prompt, fifty test cases. Ship that, then grow into RAG and agents once you trust the numbers.
Talk to us if you want help scoping your first LLM feature or hardening one you already have.