Back to blog
9 min read

LLM Monitoring in Production: A Complete Guide for 2026

How to monitor LLM apps in production: what to track, what to alert on, and how to catch failures before users do. A complete guide for developers.

LLM monitoringproductionAI debuggingobservability

LLM Monitoring in Production: The Complete Guide

LLM monitoring is the practice of tracking the behavior, performance, cost, and output quality of large language model calls in a running application. It covers the full lifecycle of a request, from the prompt your code sends to the model, through the response, through any tool calls the model makes, and finally to whatever your application does with the result. If you are shipping any feature powered by GPT, Claude, Gemini, Llama, or a fine tuned open model, you need llm monitoring the same way you need logs and metrics for a database.

The reason llm monitoring exists as its own category, rather than being a subset of application performance monitoring, is non-determinism. A traditional web service given the same input returns the same output. An LLM given the same input can return a different answer every call, and sometimes that answer is wrong, refused, truncated, or formatted in a way your parser cannot handle. Traditional monitoring tools were built assuming deterministic code paths and numeric SLOs. They were not designed to answer questions like why did the model suddenly start refusing this prompt, or why did my token bill triple overnight.

This guide walks through what production llm monitoring actually looks like, what metrics matter, what to alert on, and where most teams get it wrong. It is opinionated, based on patterns we see in teams using Glassbrain to debug and monitor their AI features.

Why LLM Monitoring Is Different from App Monitoring

Monitoring llm apps breaks most assumptions baked into traditional APM tools. Here is what changes.

Non-determinism. The same prompt can return different outputs. That means you cannot use naive diffing to detect regressions, and you cannot reproduce a bug by replaying an HTTP request. You need to capture the exact inputs, the exact model version, the temperature, the system prompt, and the tool definitions, because any of those can change the output.

Opaque failures. An LLM call almost never returns HTTP 500 when something is wrong. It returns HTTP 200 with a response that happens to be garbage, a refusal, a hallucinated tool call, or a JSON object missing a required field. Your status code dashboards will show green while users see broken features.

Model drift. Providers silently update models behind the same version string, deprecate snapshots, and change default behaviors. A prompt that worked perfectly last week can start failing today with no code change on your end. Production llm monitoring has to track which exact model version responded to each request.

Refusals as silent failures. When a model says "I cannot help with that" it is a success to the API and a failure to your product. Refusal rate is a first class metric in any serious llm monitoring tool.

Token costs. Unlike CPU or memory, every request has a direct dollar cost tied to input and output tokens. A single runaway loop that retries a 50k token prompt can burn hundreds of dollars before anyone notices. Cost monitoring is not optional, it is survival.

What to Track in LLM Monitoring

These are the metrics you should capture on every LLM call, and what each one tells you.

Latency Per Model Call

Track the wall clock time for each individual model call, separate from your end to end request latency. LLM calls are typically the slowest part of any AI feature, often taking two to ten seconds, and you need to know if that latency is coming from the provider, from your network, or from your own code wrapping the call. Break latency down by model, by endpoint, and by streaming versus non streaming. Track p50, p95, and p99, because the long tail is where users rage quit. If you are chaining calls, track per step latency so you can identify which hop in the chain is dragging the whole request down.

Token Usage and Cost

Capture input tokens, output tokens, and cached tokens for every call, then multiply by the current per token price for that model. Aggregate by user, by feature, by customer, and by day. This is how you catch prompt bloat before it shows up on your invoice. Token monitoring also lets you calculate unit economics, how much each answered question actually costs you, which is essential if you are building anything with a free tier. A good llm monitoring tool should show cost trends next to request volume, so a spike is obvious at a glance.

Error and Refusal Rate

Errors include HTTP failures, rate limits, timeouts, and parse errors when the model returns malformed output. Refusals are a separate class, track them by pattern matching on phrases like "I cannot", "I am not able", or by using a small classifier. Both rates should be graphed side by side. A sudden refusal spike almost always points to a policy change on the provider side, a prompt regression on your side, or an input data distribution shift from your users.

Model Version Drift

Capture the exact model version returned in the response, including the dated snapshot, not just the alias. Then graph the distribution of versions over time. When a provider rolls out a new snapshot, you will see the distribution shift. Correlate that shift with your error and refusal graphs to catch silent regressions. This is one of the most underused features in production llm monitoring and catches the kind of bug that would otherwise take days to diagnose.

End-to-End Request Cost

A single user action often triggers multiple LLM calls, embeddings, reranking, and tool use. Sum all of that into one number per request, then aggregate per user and per feature. This is the only honest way to answer the question of how much a feature costs to run. If you only track cost per call, you will miss the compounding effect of agent loops and retries. End to end cost is what matters when pricing your product.

Output Quality Metrics

Quality is the hardest thing to monitor because it is subjective. Proxies that work include schema validation rate for structured outputs, tool call success rate, user thumbs up and thumbs down signals, follow up question rate, and retry rate. If a user sends the same question twice in a row, that is a strong negative signal. For high stakes features, sample a percentage of traffic for human review or run an LLM judge against a rubric and track its score over time.

What to Alert On

Alerts are where llm monitoring earns its keep. The goal is to wake you up when something is actually broken, not when your p99 blipped for thirty seconds. Here are the alerts we recommend every team set up on day one.

  • Error rate over 2 percent for 5 minutes. Covers provider outages, rate limits, and malformed response spikes.
  • Refusal rate over 5 percent for 10 minutes. Catches prompt regressions and provider policy changes.
  • p95 latency over 15 seconds for 10 minutes. Adjust the threshold to your model, but alert when the tail goes sideways.
  • Daily spend over 1.5x the 7 day trailing average. Catches runaway loops and prompt bloat before the month ends.
  • Model version distribution change greater than 20 percent. Fires when a provider ships a new snapshot.
  • Schema validation failure rate over 1 percent. Critical for structured outputs and tool calling.
  • Zero traffic for 15 minutes on a production feature. Catches silent outages where your code is swallowing exceptions.
  • Token usage per request over 3x the median. Points to prompts that are accidentally stuffing full documents into context.

Route these alerts to the same place your on call lives, Slack, PagerDuty, Opsgenie, whatever you already use. Do not create a separate channel nobody reads. And tune thresholds after the first week, because the defaults above will be too loud or too quiet for your specific traffic pattern.

Why Most LLM Monitoring Setups Fail

When we talk to teams that tried to roll their own llm monitoring and gave up, the same mistakes come up over and over.

Monitoring at the HTTP layer. Teams instrument the outbound HTTPS request to the provider API and call it done. That gives you status codes and latency, but not prompts, not responses, not token counts, not tool calls, not model versions. When something breaks you have no way to see what the model actually said, so you cannot debug. HTTP level openai monitoring is better than nothing but it is not enough.

No trace context. Each LLM call is logged in isolation with no link to the user request that caused it. When a user reports a bad answer, you have no way to find the specific call chain. A proper llm monitoring tool groups related calls into a trace so you can see the full sequence, including embeddings, retrieval, reranking, and any retries.

No refusal detection. Teams track errors but not refusals, so they miss the single most common failure mode in LLM apps. The model says no, your code treats it as success, and the user sees a useless response. Refusal detection has to be baked in.

No model version tracking. The response from OpenAI includes the exact snapshot that answered the call. Most custom setups throw that field away. When a provider silently rolls a new version and your quality drops, you have no way to correlate the two events and you waste days chasing phantom bugs in your own code.

Logs without search. Dumping prompts to a log aggregator works until you need to find the one trace where the model returned the wrong JSON. Without structured fields and a purpose built viewer, you are grepping blind.

How to Set Up LLM Monitoring Without Building It Yourself

Building llm monitoring in house is a six month project that competes with whatever real product you are supposed to be shipping. Unless observability is your core business, use a tool. Here is what a good setup looks like with Glassbrain.

Install the SDK with one line. Glassbrain ships a JS SDK and a Python SDK, both of which auto instrument OpenAI, Anthropic, and the common frameworks. You drop in an import, set an API key, and every LLM call in your app starts flowing into a visual trace tree without you writing instrumentation code. Traces include prompts, responses, token counts, model versions, latency, tool calls, and any errors or refusals.

From there you get the full picture in one place. Cost dashboards, latency charts, error and refusal graphs, and a searchable trace view where you can click any request and see exactly what happened. Built in replay lets you re run a trace against the same or a different model with a single click, no user API keys required, which makes debugging prompt regressions trivial. AI fix suggestions look at failing traces and propose concrete changes to your prompt or logic. The free tier gives you 1,000 traces per month with no credit card, which is enough for small projects and prototypes to run in production indefinitely.

LLM Monitoring vs LLM Observability vs LLM Evaluation

These three terms get thrown around as if they were interchangeable. They are not.

LLM monitoring is about watching your production system and knowing when something is wrong. It answers questions like is my error rate spiking, is my latency within budget, am I burning too much money, did the refusal rate jump. Monitoring is numeric, aggregated, and alert driven.

LLM observability is the deeper capability of being able to investigate any specific request and understand exactly what happened and why. It includes traces, prompts, responses, tool calls, intermediate steps, and the ability to replay. Observability is what you reach for when monitoring tells you something is wrong and you need to figure out the root cause. Good llm monitoring tools include observability, because metrics without drill down are useless.

LLM evaluation is the offline practice of scoring your system against a fixed test set before you ship. You build a dataset of inputs and expected behaviors, you run your prompt or chain against it, and you measure quality. Evaluation happens in CI or before a prompt change goes live, not in production. It is how you know a change is safe to deploy.

You need all three. Monitoring tells you the house is on fire. Observability helps you find the source. Evaluation keeps you from starting the fire in the first place. A mature AI team runs all three as a continuous loop.

Frequently Asked Questions

What is llm monitoring?

LLM monitoring is the practice of tracking metrics, errors, costs, and output quality of large language model calls in a production application. It covers latency, token usage, refusal rates, model version drift, and end to end request cost, and it alerts you when any of those metrics move outside expected ranges.

What metrics should I track for LLM apps?

At minimum, track latency per call, input and output tokens, cost per call and per request, error rate, refusal rate, model version distribution, and schema validation rate for structured outputs. Add user feedback signals and retry rate as quality proxies. Break everything down by model and by feature.

How do I monitor OpenAI API usage?

The OpenAI dashboard shows aggregate spend and rate limits, but not per request detail and not prompts or responses. For real openai monitoring you need an SDK level instrumentation that captures each call, the exact model version, token counts, and the full prompt and completion. Glassbrain auto instruments the OpenAI client with a one line install.

What is a good error rate for LLM apps?

For production features, keep combined error and refusal rate under 2 percent. Raw API errors should be well under 1 percent in steady state, anything above that usually means rate limiting or provider issues. Refusals depend on your use case, but a sudden jump of more than a few percentage points almost always indicates a regression.

How do I detect when an LLM model version changes?

Capture the model field from every response, including the dated snapshot rather than just the alias, and graph the distribution over time. When a provider rolls a new snapshot, the distribution shifts and you can correlate the change with any quality regression you see in the same window. This is standard in any serious llm monitoring tool.

Can I use Datadog for LLM monitoring?

Datadog has added some LLM features but it is fundamentally a general purpose APM tool, and its pricing and data model are not optimized for capturing full prompts and responses at scale. For teams that need deep LLM specific features like replay, refusal detection, and visual trace trees, a purpose built llm monitoring tool is a better fit. For teams already deep in the Datadog ecosystem, you can use both, send metrics to Datadog and traces to a dedicated tool.

Conclusion

LLM monitoring is not optional anymore. If you are shipping AI features to real users, you need to know when the model is wrong, when it is slow, when it is expensive, and when the provider changed something under you. The cost of not knowing is measured in broken features, angry users, surprise invoices, and weeks of debugging sessions that would have been five minute fixes with the right data.

The good news is that you do not have to build any of this yourself. Modern llm monitoring tools auto instrument your SDK calls, capture full traces including prompts and responses, detect refusals, track model versions, calculate costs, and surface problems before your users do. The bar to get started is a single import and an API key.

If you take one thing from this guide, take this. Treat every LLM call as a first class event worth capturing in full, not as an opaque HTTP request. Everything else, the alerts, the dashboards, the debugging workflows, the quality metrics, follows naturally once you have that foundation. Start with traces, then add metrics, then add alerts, then add evaluation. That order works. Skipping steps does not.

Related Reading

Monitor your LLM apps with traces, metrics, and replay.

Try Glassbrain Free