EP114 · August 2, 2026 · 5:20 · AI Dev Tools: The Crazyrouter Podcast

AI API Monitoring and Observability — Find the Failure Before Users Do

A green uptime check does not mean an AI product is healthy: an endpoint can return HTTP 200 while latency doubles, output quality drops or tool calls fail. This episode lays out a practical observability approach for AI API applications, covering end-to-end tracing, streaming and quality metrics, cost per successful task, actionable alerts and safe telemetry.

Key takeaways

  • Propagate one correlation ID from the application through the gateway, provider route, response, billing record and user-visible result.
  • Track time to first token and time to completion separately for streaming, along with tokens, retries, timeouts and cancellations.
  • Break metrics down by model, provider, region, endpoint type and tenant, but keep labels stable and push request-specific detail into traces.
  • Monitor silent quality failures such as schema violations, failed tool calls, empty outputs and language mismatches, not just availability.
  • Alert on user impact and cost per successful task rather than on every transient provider error or on total daily spend alone.
  • Keep full prompts, completions, keys and customer documents out of ordinary logs, and rehearse incidents to prove your telemetry works.

Show notes

Why uptime is not health, and why tracing comes first#

An AI endpoint can return HTTP 200 while latency doubles, output quality drops, tool calls fail, or the wrong model is selected for a tenant. Availability alone tells you very little.

Start with the request journey. Capture a correlation ID that follows the request from the application through the gateway, the provider route, the response, the billing record and the user-visible result. Without a single trace identifier, operators are left guessing whether a slow response came from the client, the gateway, the provider, a queue or a retry.

Streaming and asynchronous work need extra care. Record when a request enters a queue, when a provider accepts it, when the first token arrives, when the result is persisted and when the user receives it. For background jobs, link retries and callbacks back to the original trace instead of creating unrelated records.

The metrics that matter#

Measure more than latency:

  • Time to first token and total response time
  • Tokens per second, input tokens and output tokens
  • Payload size and queue delay
  • Retry count, timeout rate and cancellation rate

Streaming applications need both time to first token and time to completion, because a fast first token can hide a response that takes far too long to finish.

Then break the numbers down by route. Aggregates can look normal while one model, region, customer tier or feature is failing. Useful dimensions include model, provider, endpoint type, region, status class, application and, where allowed, tenant policy. Keep cardinality under control with stable labels, and put request-specific details in traces rather than metric labels.

Silent quality failures and failure attribution#

A response can be valid JSON and still be unusable. Monitor schema validation, tool-call completion, citation presence, refusal rates, empty outputs, language mismatches and task-specific evaluation scores. For important workflows, sample completed requests for offline review instead of treating availability as a proxy for quality.

Also separate provider failure from application failure. Record the selected route, the fallback decision, the upstream status, a normalized error code and whether the request was retried. That lets a team quickly answer the practical question: did the provider fail, or did our own timeout, payload transformation, authentication or rate-limit policy cause it?

Without that split, every incident turns into a debate about whose fault it was instead of a fast decision about what to fix.

Treat cost as a first-class signal#

Track spend by model, feature, tenant, route and successful outcome. A cheaper model that needs three retries can cost more than a reliable one, which is why cost per successful task is a better signal than raw spend.

Alert on sudden changes in token usage, unusually large prompts, duplicate requests and shifts in cost per successful task, not only on total daily spend. Routing everything through a single OpenAI-compatible gateway such as Crazyrouter can make route and model data easier to collect in one place, but the attribution still has to be designed into your own telemetry.

Alerts, synthetic checks and dashboards#

Build alerts around user impact: error-budget burn, time to first token, failed tool calls, queue age, schema failures and cost anomalies. Avoid paging on every transient provider error. A good alert names the affected route, the likely cause, the current fallback, sample request IDs and a link to the relevant trace or dashboard.

Use synthetic checks carefully. A scheduled request confirms that authentication, routing and a basic model response work. It cannot prove that production prompts, tools, large contexts, regional policies or billing reconciliation work. Keep a small set of synthetic scenarios that represent the real product, and label their spend clearly.

Design dashboards for decisions. The first view should show availability, latency, quality signals, spend, provider health and fallback volume; the next should compare by model and region. Operators should be able to move from an aggregate anomaly to a handful of representative request IDs without digging through raw logs.

Protect telemetry and test it under fire#

Observability is part of the security boundary, not an exception to it. Keep full prompts, completions, API keys and customer documents out of ordinary logs. Redact secrets, hash or tokenize identifiers, sample payloads selectively and apply tenant-scoped access.

Finally, test observability before a real incident does. Deliberately expire a test credential, force a provider timeout, send an invalid tool schema and route a workload to a fallback. Confirm that the right metric moves, the alert fires, the trace is complete and the support view has enough evidence without exposing customer content.

Questions from this episode

What metrics should I monitor for an LLM API?
Track time to first token, total response time, tokens per second, input and output tokens, payload size, queue delay, retry count, timeout rate and cancellation rate. Add quality signals such as schema validation and tool-call completion, and cost per successful task. Break all of them down by model, provider, region and endpoint type.
How do I monitor AI output quality, not just uptime?
Monitor schema validation, tool-call completion, citation presence, refusal rates, empty outputs, language mismatches and task-specific evaluation scores. For important workflows, sample completed requests for offline review. A 200 response with valid JSON can still be unusable.
Is it safe to log prompts and completions for debugging?
Not in ordinary logs. Keep full prompts, completions, API keys and customer documents out of standard telemetry, redact secrets, hash or tokenize identifiers, and sample payloads selectively with tenant-scoped access. Treat observability as part of your security boundary.

More episodes

All episodes with show notes →

Try it on your own traffic

Crazyrouter gives you one OpenAI-compatible API key for Claude, GPT, Gemini, DeepSeek and more, billed pay-as-you-go.

Get an API key →