LLM Integrations
The model is only one part of the system.
We integrate OpenAI, Anthropic and open-source models into real products, with the routing, evaluation, fallbacks, observability and cost controls that keep them fast, reliable and affordable once real users arrive.
Capabilities
Ten things a real integration needs.
Pick a capability to see what it looks like in the code we ship. Illustrative snippets from our gateway layer.
gateway.ts
const ai = createGateway({
providers: ["openai", "anthropic", "oss"],
})
const reply = await ai.generate({
task: "summarise_ticket",
input: ticket.body,
})prompts/summarise_ticket.yaml
prompt: summarise_ticket
version: 14
system: |
You are a support analyst. Be concise.
Never include customer PII.
tests: 38 passing # runs in CIschemas/triage.ts
const Triage = z.object({
intent: z.enum(["refund", "bug", "billing"]),
priority: z.number().min(1).max(4),
summary: z.string().max(280),
})
// validated before it reaches your codetools/orders.ts
tools: {
lookupOrder: {
input: z.object({ id: z.string() }),
run: ({ id }) => orders.get(id),
// scoped: read-only, own tenant
},
}stream · /v1/generate
event: token data: "Your refund"
event: token data: " has been issued"
event: tool data: lookupOrder(4821)
event: token data: " and should arrive"
event: done data: { tokens: 212 }routing.yaml
routes:
- when: task == "classify"
use: small-fast
- when: input.tokens > 50000
use: long-context
- default: frontierfallbacks.yaml
fallbacks:
frontier: [secondary, oss-hosted]
trigger: [timeout > 8s, 429, 5xx]
retries: 2 # exponential backoff
parity: eval suite must passeval · support-replies
cases 212
accuracy 0.94 ▲ +0.03
policy_safe 1.00
tone_match 0.91
p95_latency 1.8s ✓ budget 2.5strace · 7f3a
summarise_ticket
├ route frontier 4ms
├ model 1,284 → 212 tokens 1.42s
├ guardrail pii_filter ok
└ cost $0.0061budgets.yaml
budgets:
per_request: $0.02
per_user_day: $1.50
cache: semantic · 24h
downgrade_when: budget > 80%Model routing
Every request, the right model.
Hover an example request and watch the router pick a track. Same product, three very different jobs.
Small, fast model. A short classification doesn’t need frontier reasoning. Routing it to a lightweight model keeps it well under a second, at a fraction of the cost.
Frontier model. A customer-facing reply needs judgement and tone, so the router pays for the strongest model and evaluates the draft before it’s sent.
Long-context model. A 180k-token contract won’t fit most context windows. The router picks a long-context model and scores the summary for coverage.
Reliability
Models fail. Products shouldn’t.
Every model and provider will have a bad day. Production systems plan for it, so a timeout becomes a reroute your users never see.
- OutagesEvery provider has incidents. Your product shouldn’t share them.
- Rate limitsTraffic spikes hit quotas at exactly the wrong moment.
- Latency spikesA very slow answer can do as much damage as none.
- DeprecationsModels retire on the provider’s timeline, not yours.
We set up health checks, circuit breakers, retries with backoff and parity evaluations, so a fallback answer still meets your quality bar.
Cost control
Quality. Latency. Cost. Balanced per request.
No single model wins on all three. Choosing per task, and caching what repeats, moves the whole product to a better place. Figures are illustrative.
p95 3.1sper 1k requests $18.40
Excellent answers everywhere, including the thousands of simple requests that never needed them. Slow and expensive at scale.
p95 1.6sper 1k requests $6.20
Frontier quality where it matters, lighter models for routine work. Usually the best place for a customer-facing product.
p95 0.6sper 1k requests $1.10
Very fast and cheap for high-volume, repetitive tasks such as classification and extraction, backed by a semantic cache.
p95 1.2sper 1k requests $2.40
Predictable unit costs and full data control, in exchange for owning the infrastructure and a lower quality ceiling.
Process
From first API call to a system you trust.
We measure before we optimise, and we keep measuring once real traffic arrives.
- 01
Assess
Use cases, data sensitivity, latency and budget targets, and your current stack.
Integration plan - 02
Architect
Gateway, routing rules, schemas, fallbacks and the evaluation strategy.
Architecture spec - 03
Integrate
Providers, prompts, tools and streaming wired into your product and APIs.
Working integration - 04
Evaluate
Benchmarks on your own data: quality, safety, latency and cost per task.
Eval baseline - 05
Optimize
Route, cache and right-size models until the numbers hold under load.
Tuned config - 06
Monitor
Traces, alerts, drift checks and spend dashboards on live traffic.
Live dashboards
Next step
Your product. The right model. At the right time.
Tell us which models you use today, or want to. We’ll show you how to make them faster, more reliable and cheaper to run.
Integrate AI into your product