AI platform lab · 2026

Testing an LLM gateway's controls instead of trusting its config

When AI coding agents send every model call through one gateway, that gateway enforces budgets, model access and cost reporting. I built a LiteLLM lab with production-style settings (retries, fallback, a cache, budgets, MCP access and spend tags) and checked what each control actually does. Most did what their configuration said. Two didn't.

9experiments, results logged and reproducible
~25×faster on a cache hit, logged at zero cost
3team-level controls not enforced with an auth hook and one default setting
0cost-attribution tags recorded on one API route

Context

An LLM gateway sits between engineers' tools and the model providers. It issues each person a virtual key, exposes tools to agents through the Model Context Protocol (MCP), groups keys into teams with budgets and allowed models, retries and falls back when a provider fails, caches repeat requests, and logs spend. Teams rely on those settings without seeing them work. I wanted to test the behavior, not read the YAML.

The lab setup Clients (a coding-agent CLI, an agent backend and an MCP client) call a LiteLLM gateway that holds keys, teams and budgets, retries and fallbacks, a Redis cache, spend logs and an MCP server registry. The gateway calls Anthropic and Google models. Clients Coding-agent CLI Agent backend MCP client LiteLLM gateway virtual keys · teams · budgets per-error retries · fallback Redis response cache spend logs · cost tags MCP server registry custom auth hook Anthropic models Google models fallback target Docker Compose: gateway, Postgres, Redis
The lab. Each experiment toggled one setting and measured what the gateway did.

What worked as configured

Two gaps that config review wouldn't catch

Team-level controls under three auth setups Without a custom auth hook, team blocks, team budgets and team model allowlists are enforced. With the hook and the default setting, none of the three are enforced. With the hook and custom_auth_run_common_checks set to true, all three are enforced again. No hook Hook, default Hook + setting on Team blocked Team budget Team model allowlist green = enforced · red = request allowed anyway
Key-level controls held in all three setups. Only the team level changed.

Smaller lessons

My part: I built the sandbox (a LiteLLM gateway and Postgres in Docker Compose), set the goal of a production-style configuration, directed the investigation, ran the interactive client tests and reviewed every result. An AI coding agent (Claude Code) added the Redis cache, upgraded the stack, built the test scripts and ran the matrix under my direction. That's how I work day to day.

What I carry forward

A control you haven't seen fire is an assumption. For anything that enforces money or access, I now want a small test that proves it blocks what it should, re-run after every upgrade, not just a config review.