A production LLM endpoint can return HTTP 200 OK all afternoon while still hiding expensive failures.
The request completed. The dashboard is green. The application sees a response.
But the system behind that response may be retrying the same request multiple times, sending unnecessary tokens, or losing visibility into what happened between the prompt and the final output.
Consider a retry loop with ten agents sending 8,000-token prompts every two seconds. At an assumed input cost of $3 per million tokens, that loop costs roughly $430 an hour. This is an example calculation, not a measured production incident, and actual billing depends on the provider.
Traditional APM tools usually show status codes and latency. They do not automatically show why an LLM request became expensive, which step in a chain failed, or whether the output was useful.
Short version: put a gateway in front of every caller first, add tracing second, and add everything else only when a measured problem demands it.
The failure most roundups skip: retry stacking
The most expensive failures in this stack are often not model failures. They are timeout mismatches.
The problem appears when multiple layers retry the same request.
Say your gateway allows 60 seconds per upstream attempt with two retries. That is three attempts in total, so one request can occupy the gateway for up to 180 seconds. Now add an application HTTP client that gives up after 30 seconds and retries three times, for four attempts in total.
Unless cancellation is propagated correctly, the gateway may keep working on the abandoned request while the application starts another attempt.
In the worst case, one user action becomes:
4 client attempts × 3 gateway attempts = 12 upstream calls
During a provider slowdown, that multiplier affects both cost and rate limits. The original request may eventually succeed, but the system has already created extra load.
The approach I would take is simple: one layer should be responsible for retries. Usually, that should be the gateway. Keep application retries to zero or one, set timeouts deliberately, and test failure behaviour before production traffic reaches the system.
Make the client timeout longer than the gateway’s total retry window:
upstream timeout × (retries + 1)
If the system cannot finish inside that window, failing fast with a 429 or 503 is often better than keeping more requests alive.
The order I would build this stack
Most teams should solve control and visibility before adding more infrastructure.
The stack at a glance
The tools below solve different production problems. They are not a checklist to deploy together. Start with the layer that removes your biggest operational risk, then add the next one when the problem appears.
| Layer | Tool choices | Use it when | Skip it when |
|---|---|---|---|
| Gateway and routing | LiteLLM, TrueFoundry | Multiple applications need shared model access, provider routing, budgets, or fallback handling. | One service directly calls one model provider. |
| Tracing and evaluation | Langfuse, LangSmith, Ragas | You need visibility into prompts, retrieval steps, costs, or model quality changes. | Your LLM usage is a small number of simple completion calls. |
| Experiment tracking | MLflow | You fine-tune models or manage LoRA experiments and need a registry. | You only call hosted model APIs. |
| Output validation | Guardrails AI | Applications depend on structured responses, validation rules, or PII filtering. | Humans review outputs and malformed responses do not break workflows. |
| Model serving | vLLM | You run open-weight models on your own GPUs and need an OpenAI-compatible endpoint. | All traffic goes through hosted model APIs. |
| Kubernetes model operations | KServe, Gateway API Inference Extension | You operate multiple model replicas and need Kubernetes-native rollout and routing controls. | A single model server handles your workload. |
| Distributed inference | llm-d | GPU scheduling and inference throughput become the bottleneck. | One vLLM deployment is enough for your traffic. |
A team running one internal chatbot does not need distributed inference. A team serving multiple RAG applications probably needs tracing before it needs another GPU.
Applications
|
v
+-------------------+
| LLM Gateway |
| LiteLLM |
+-------------------+
|
+---------+---------+
| |
v v
Model providers Self-hosted models
OpenAI, Anthropic, vLLM
Bedrock, Vertex AI
| |
+---------+---------+
|
v
+-------------------+
| Validation |
| Guardrails AI |
+-------------------+
|
v
Response to application
Alongside the request path:
Tracing (Langfuse, LangSmith): prompts, latency, cost per step
Evaluation (Ragas in CI, MLflow for experiments): quality, offline
A simplified LLMOps production stack. The gateway provides control, validation protects downstream applications, tracing explains behaviour, and evaluation measures quality offline.
1. Gateway: LiteLLM first, TrueFoundry if you would rather buy
LiteLLM

The gateway is the control point between applications and model providers.
Without one, every application manages its own provider keys, retries, rate limits, and fallback logic. That works for a single service. It becomes harder when multiple applications share models or different teams need separate usage controls.
LiteLLM works as an OpenAI-compatible proxy in front of model providers. Provider keys stay inside the gateway, while applications receive their own virtual keys with model access rules, budgets, and rate limits.
That separation reduces the blast radius of a leaked application credential. You can disable one virtual key without replacing provider credentials across every application.
Two operational details matter.
LiteLLM virtual key management requires PostgreSQL. If you run multiple proxy instances, shared state is needed so usage tracking and limits remain consistent.
Retries and fallbacks are different mechanisms. Retries handle failures within the same model group. Fallbacks move traffic to another model group after retry attempts are exhausted. Mixing them up can multiply failed requests during a provider outage, a close cousin of the retry stacking problem described earlier.
A simplified routing example (key names follow the LiteLLM docs, so confirm them against your version):
model_list:
- model_name: chat-primary
litellm_params:
model: <your-primary-model>
api_key: os.environ/PRIMARY_API_KEY
- model_name: chat-fallback
litellm_params:
model: <your-fallback-model>
api_key: os.environ/FALLBACK_API_KEY
router_settings:
num_retries: 2
timeout: 60
fallbacks: [{"chat-primary": ["chat-fallback"]}]
Before production use, test the failure path. Send traffic through the proxy while the primary provider returns a controlled failure such as 429. Verify that fallback routing works and that the total retry time stays inside your application timeout.
TrueFoundry
TrueFoundry takes a broader platform approach. It combines model gateway features with deployment workflows, GPU management, and platform controls.

I would consider it when a team wants RBAC, SSO, and model deployment workflows handled together. I would choose LiteLLM when the team already operates Kubernetes tooling such as Helm or GitOps and only needs a gateway layer.
The decision is less about features. It is about how much infrastructure your team wants to operate itself.
2. Tracing and evaluation: Langfuse, LangSmith, Ragas, MLflow
Once an LLM application grows beyond a single prompt, logs stop telling the whole story. You need one way to inspect what happened during a request, and another way to catch regressions before they reach production.
Langfuse is the option I would reach for if I wanted to self-host. Running it is more than standing up a PostgreSQL container. Version 3 also requires ClickHouse, Redis (or Valkey), S3-compatible object storage, and separate web and worker services. PostgreSQL and ClickHouse should run in UTC, or queries can return incorrect or empty results. If nobody on your team wants to operate that stack, Langfuse Cloud keeps the same SDKs with less operational overhead.
In return, you get complete request traces, including prompts, retrieved documents, tool calls, latency for every step, and token cost.
LangSmith is no longer limited to LangChain. It can ingest OpenTelemetry traces from other frameworks, although LangChain’s support notes (last updated August 2025) say it ingests traces only, not metrics or logs. If your applications already use LangGraph, LangSmith is the easier choice. If prompts cannot leave your network, evaluate its self-hosted option before committing.
Ragas solves a different problem. It evaluates RAG systems by measuring faithfulness, answer relevancy, and context precision, making it useful in CI when prompt templates or retrieval pipelines change.
MLflow belongs beside model development rather than prompt debugging. If you are fine-tuning models or managing LoRA experiments, experiment tracking and a model registry are valuable. If you only consume hosted APIs, it is usually unnecessary.
If your application is one stateless completion endpoint with no retrieval, no tools, and no requirement to inspect past requests, you probably do not need any of these yet.
3. Guardrails AI: validating model output
Telling a model to “return valid JSON only” eventually fails in production. One stray markdown fence and json.loads() throws.
Guardrails AI sits between the model and your application. Instead of trusting every response, it validates the output against rules you define before downstream code sees it. Those rules can enforce response structure, detect PII, run custom validators, or ask the model to regenerate an invalid response.
Do not add another dependency unless you need it.
If your model provider already supports strict JSON Schema outputs, malformed JSON is mostly handled without another validation layer. Guardrails becomes more useful when you need inline PII redaction, custom business rules, or validation that goes beyond response structure. It does not solve prompt injection, which is covered at the end of this article.
4. vLLM: where self-hosting usually starts
vLLM loads model weights onto your GPUs and exposes an OpenAI-compatible endpoint.
Its biggest advantage is PagedAttention. Instead of reserving one large block of KV cache for every request, vLLM manages it in smaller pages. That wastes less VRAM, which means continuous batching can keep more requests running on the same GPU before memory becomes the bottleneck.
This is where I would start if I were self-hosting open-weight models. It is also the default model server in llm-d, so starting with vLLM keeps the upgrade path simple if you later need distributed inference.
SGLang and TensorRT-LLM are strong alternatives, and they may beat vLLM on some workloads. Benchmark them with your own prompts and hardware before committing to one.
If every request already goes to Bedrock, Vertex AI, Anthropic, or OpenAI, vLLM has no role in your stack.
5. KServe, Gateway API Inference Extension, and llm-d
Once you run several replicas, simple load balancing starts leaving performance on the table. A request sent to a random pod may miss useful model state already stored on another GPU.
A pod holding a warm cache for a shared 10,000-token system prompt can skip much of the prefill stage. Sending the same request to an idle pod throws that work away and increases time to first token.
KServe becomes useful when model deployment turns into a platform problem. It gives Kubernetes a standard way to manage model rollouts through the InferenceService custom resource, including canary deployments, autoscaling, and different serving runtimes such as vLLM and Triton. For a team running many models across Kubernetes, that abstraction is valuable. For a single vLLM deployment with a few replicas, it is usually more machinery than you need.
The next problem appears after deployment: routing. A normal load balancer only knows whether a backend is healthy. It does not know which GPU already has the right cache, how deep the queue is, or whether a LoRA adapter is already loaded.
Incoming request
|
v
+--------------------------------------+
| Gateway API Inference Extension |
| checks queue depth, LoRA adapter, |
| and KV-cache state |
+--------------------------------------+
| |
preferred |
v v
+---------------+ +---------------+
| GPU Pod A | | GPU Pod B |
| warm cache | | empty cache |
| (10k context) | | needs prefill |
+---------------+ +---------------+
With llm-d, serving itself is split (covered below):
+---------------+ KV cache +---------------+
| Prefill GPUs | ---------> | Decode GPUs |
+---------------+ +---------------+
Inference-aware routing tries to send requests where useful state already exists instead of treating every GPU as identical.
Gateway API Inference Extension adds that awareness. It lets compatible gateways such as Envoy Gateway, Istio, and kgateway route on GPU queue depth, LoRA adapter locality, and KV-cache state. The goal is better cache reuse and lower latency. llm-d’s release notes say the Inference Gateway reached v1.0 GA in 2025.
llm-d is the next step when one model server is no longer enough. It builds on vLLM and the Inference Gateway to separate the prefill stage from the decode stage. Prefill is compute-heavy, while token generation is limited more by memory bandwidth, so splitting them lets each GPU pool focus on the part it handles best. Long prompts no longer compete with active token generation on the same GPUs. The project joined the CNCF as a sandbox project in March 2026, and v1.0 was released on October 20, 2026.
Published gains come mostly from vendors and cloud providers. AWS, for example, reports up to 70% more tokens per second than standard vLLM for one model and GPU combination. Your results will depend on your workload, and short, unique prompts tend to benefit less. Benchmark your own prompts before redesigning your inference stack.
My rule of thumb, not a benchmark: if you are running fewer than four GPU replicas, or your prompts are mostly short, standard Kubernetes HPA and a normal ingress controller are usually enough. Add KServe, inference-aware routing, or distributed serving only when you can measure that scheduling and routing have become the bottleneck.
What this stack does not cover
One final rollout step: lock down egress. The gateway holds your provider keys, so it should be the only workload allowed to reach external model endpoints. Then run the 429 failure test from the gateway section under load before moving real traffic.
The goal of an LLMOps stack is not to deploy every available component. It is to know exactly why each layer exists before it becomes another thing your team has to operate.
