« All posts

Scaling LLM Usage with LiteLLM: Monitoring, Quotas and Spend

Midas engineers explain how they built a unified LiteLLM gateway to centralize LLM observability, spend tracking, and per-environment quotas.

As LLM usage at Midas expanded from internal prototypes to full production features, the engineering team lost visibility into spend and ownership. Shared provider keys, scattered logs, and no way to trace cost spikes to a specific team or model made it impossible to validate whether optimizations like smaller models or prompt tweaks actually worked.

To solve this, they built a unified LLM control plane on top of the open-source LiteLLM gateway, routing all traffic through a single entry point. LiteLLM supports OpenAI-compatible APIs while also transparently proxying native SDKs like Anthropic and Gemini with minimal client-side changes. Behind the proxy, PostgreSQL handles request logging and spend analytics, while Redis manages response caching to cut down redundant provider calls.

Midas deployed four fully isolated environments — testing, development, staging, and production — so load tests and experimentation never touch real user traffic. Every request is authenticated via virtual keys, enabling per-environment budgets and quotas, while all secrets flow through HashiCorp Vault into Kubernetes rather than being committed to Git or Helm values.

The approach offers a practical blueprint for teams scaling LLM infrastructure: standardizing multiple providers behind one gateway, tracking spend in real time, and enforcing strict environment isolation are key building blocks for a governable, cost-transparent LLM platform.