# LiteLLM Proxy (VYAGENT Radar #07)

> Unify 100+ cloud and local LLM providers behind one OpenAI-compatible gateway with fallbacks, retries, and hard spend caps.

- **URL**: https://vyagent.com/radar/litellm
- **Published**: 2026-11-26
- **Category**: Gateway · Routing & Budgets
- **License**: MIT
- **Pricing**: Free & Open Source core (MIT; optional enterprise features)
- **Agent Ready**: REST API, Local-first, Open Source
- **Source**: https://github.com/BerriAI/litellm
- **Package / Docs**: https://docs.litellm.ai/

## 1. Friction Solved
Every AI provider speaks slightly different auth headers, rate-limit codes, and model IDs, and wiring fallback logic across free tiers plus paid backups inside application code quickly becomes brittle spaghetti. LiteLLM Proxy centralizes provider keys, automatic failover on 429/5xx, and per-key budget limits in one YAML config.

## 2. Best-Fit Scenarios
- Routing side projects across free cloud tiers (Gemini, Groq, OpenRouter) with automatic fallback to local Ollama on 429.
- Issuing virtual API keys with strict dollar/RPM caps to autonomous agents so a runaway loop can never drain your billing account.
- Swapping underlying models or A/B testing providers without modifying or redeploying client applications.

## 3. Setup (Minimal Fallback Router Config (config.yaml))
```
model_list:
  - model_name: default-chat
    litellm_params:
      model: groq/llama-3.3-70b-versatile
      api_key: os.environ/GROQ_API_KEY
  - model_name: default-chat
    litellm_params:
      model: ollama/qwen2.5-coder:7b
      api_base: http://localhost:11434

router_settings:
  routing_strategy: simple-shuffle
  num_retries: 2
  timeout: 30
# Start gateway: litellm --config config.yaml --port 4000
```

## 4. Reality Check & Trade-offs
- Running the full proxy with spend tracking and virtual keys requires PostgreSQL; for solo local routing without persistence, a stateless YAML config is much lighter.
- Adds a local network hop and a Python service to keep running—overkill if you only call a single stable provider in a quick script.
- Provider parameter quirks (like tool-call schemas or reasoning_effort) still vary; always test structured outputs on every fallback target.

## 5. Editorial Verdict
Essential infrastructure once you graduate from one API key to a multi-provider stack or autonomous agents that need hard spend guardrails.

## 6. FAQ
### Does LiteLLM Proxy work without a database?
Yes. Stateless routing, retries, and fallbacks work directly from config.yaml without PostgreSQL. A database is only needed for virtual key management and persistent spend logs.

### How does it protect against runaway agent loops?
You can set max_budget, rpm_limit, and tpm_limit per virtual key or model group, automatically rejecting requests once the threshold is reached.
