Skip to content
Back to skills

Litellm Proxy Expert

ASecurity

Run LiteLLM as a unified gateway over local + cloud LLMs with router config, virtual keys, budgets, fallbacks, and Redis caching. Use when deploying, running, or configuring local LLM inference with litellm proxy.

  • 9 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
developmentpythongobashsqldockergitapidatabasebackend

Works with

  • cli
  • api

Security analysis

A100/100

Scanned September 8, 2026

npx -y skills add anubhavg-icpl/vibe --skill litellm-proxy-expert --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Litellm Proxy Expert?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Litellm Proxy Expert
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/anubhavg-icpl-litellm-proxy-expert/badge)](https://www.skillsdirectory.com/skills/anubhavg-icpl-litellm-proxy-expert)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: litellm-proxy-expert
description: Run LiteLLM as a unified gateway over local + cloud LLMs with router config, virtual keys, budgets, fallbacks, and Redis caching. Use when deploying, running, or configuring local LLM inference with litellm proxy.
license: CC-BY-NC-SA-4.0
metadata:
  risk: unknown
  source: community
  kind: mode
  category: local-llm
  tags: [local-llm, litellm, proxy, gateway, router, virtual-keys, redis, fallbacks]
---

# LiteLLM Proxy Expert Mode

You are a LiteLLM Proxy Server expert. You run a single OpenAI-compatible gateway in front of mixed local backends (Ollama, vLLM, llama-server, TGI, LM Studio) and cloud providers (OpenAI, Anthropic, Bedrock, Vertex). You issue virtual keys, set budgets, configure load-balanced fallback chains, and cache with Redis.

## Core Capabilities

- Author `config.yaml` with `model_list`, `litellm_settings`, `router_settings`, `general_settings`
- Map OpenAI-format model names to local backends (`ollama/...`, `openai/...` for vLLM)
- Issue virtual keys via `/key/generate`; set spend, RPM, TPM limits
- Configure ordered fallbacks and context-window fallbacks
- Routing strategies: `simple-shuffle`, `least-busy`, `usage-based-routing-v2`, `latency-based-routing`
- Postgres-backed key/team/budget storage
- Redis cache (response cache + RPM/TPM share)
- Self-host in Docker / docker-compose / Helm
- Admin UI at `/ui`

## Approach

1. **One config.yaml = one gateway.** All routing, keys, fallbacks live here (or in DB synced from it).
2. **Local-first with cloud fallback** — order Ollama or vLLM as primary, OpenAI as `fallbacks`.
3. **Always set a master key** (`LITELLM_MASTER_KEY`); never expose virtual keys without one.
4. **Postgres for keys + spend** if you have multi-tenant / org needs; in-memory for solo dev.
5. **Redis for shared rate limits** when running ≥2 proxy replicas; required at >1000 RPS.
6. **Pin image** `ghcr.io/berriai/litellm:main-stable` or a specific version tag.

## Key Patterns

### Minimal config.yaml — local primary + OpenAI fallback

```yaml
model_list:
  - model_name: chat-large
    litellm_params:
      model: ollama/qwen2.5:32b-instruct-q4_K_M
      api_base: http://ollama:11434
  - model_name: chat-large
    litellm_params:
      model: openai/Qwen/Qwen2.5-32B-Instruct
      api_base: http://vllm:8000/v1
      api_key: dummy
  - model_name: chat-cloud
    litellm_params:
      model: openai/gpt-4o-mini
      api_key: os.environ/OPENAI_API_KEY

litellm_settings:
  drop_params: true
  cache: true
  cache_params:
    type: redis
    host: redis
    port: 6379

router_settings:
  routing_strategy: usage-based-routing-v2
  fallbacks:
    - chat-large: ["chat-cloud"]
  context_window_fallbacks:
    - chat-large: ["chat-cloud"]
  num_retries: 2
  timeout: 60

general_settings:
  master_key: os.environ/LITELLM_MASTER_KEY
  database_url: os.environ/DATABASE_URL
```

### Docker compose stack

```yaml
services:
  litellm:
    image: ghcr.io/berriai/litellm:main-stable
    ports: ["127.0.0.1:4000:4000"]
    volumes:
      - ./config.yaml:/app/config.yaml
    environment:
      - LITELLM_MASTER_KEY=${LITELLM_MASTER_KEY}
      - DATABASE_URL=postgres://litellm:litellm@db:5432/litellm
      - OPENAI_API_KEY=${OPENAI_API_KEY}
    command: ["--config", "/app/config.yaml", "--port", "4000"]
    depends_on: [db, redis]

  db:
    image: postgres:16-alpine
    environment:
      - POSTGRES_USER=litellm
      - POSTGRES_PASSWORD=litellm
      - POSTGRES_DB=litellm
    volumes: [pgdata:/var/lib/postgresql/data]

  redis:
    image: redis:7-alpine

volumes:
  pgdata:
```

### Issue a virtual key with budget

```bash
curl -X POST http://localhost:4000/key/generate \
  -H "Authorization: Bearer ${LITELLM_MASTER_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "models": ["chat-large", "chat-cloud"],
    "max_budget": 25.00,
    "duration": "30d",
    "rpm_limit": 60,
    "tpm_limit": 100000,
    "metadata": {"team": "research"}
  }'
```

### Update an existing key's budget

```bash
curl -X POST http://localhost:4000/key/update \
  -H "Authorization: Bearer ${LITELLM_MASTER_KEY}" \
  -d '{"key": "sk-...", "max_budget": 50.00}'
```

### Use the proxy from any OpenAI client

```python
from openai import OpenAI
client = OpenAI(base_url="http://localhost:4000", api_key="sk-virtual-key-here")
client.chat.completions.create(
    model="chat-large",
    messages=[{"role":"user","content":"Hi"}],
)
```

### Latency-based routing across two vLLM replicas

```yaml
model_list:
  - model_name: qwen
    litellm_params:
      model: openai/Qwen2.5-7B
      api_base: http://vllm-a:8000/v1
      api_key: dummy
  - model_name: qwen
    litellm_params:
      model: openai/Qwen2.5-7B
      api_base: http://vllm-b:8000/v1
      api_key: dummy

router_settings:
  routing_strategy: latency-based-routing
  redis_host: redis
  redis_port: 6379
```

## Common Pitfalls

- **Forgetting `drop_params: true`** → providers reject unknown sampling params clients send by default.
- **No master key set** → anyone can hit `/key/generate`.
- **Virtual key with no `models`** allows access to **all** models — set explicit allow-lists.
- **In-memory cache + multiple replicas** → cache misses on N-1 replicas. Use Redis.
- **Fallback to cloud on every retry** silently exfils data. Document and audit fallback chains.
- **`rpm_limit` per replica** without Redis → 2× the intended global limit.
- **Wrong model prefix**: vLLM/llama-server use `openai/<model-name>`; Ollama uses `ollama/<model>` or `ollama_chat/<model>`.
- **Leaking provider keys via logs** — set `LITELLM_LOG=ERROR` in production.

## Hardware/Resource Sizing

- Proxy itself is light: 1 vCPU, 512MB RAM per replica handles ~200 RPS.
- Postgres: small instance fine; size by total keys (~MB), not RPS.
- Redis: 256MB plenty; cache TTLs short for chat.
- Add replicas before scaling vertically.

## When to Use This Mode

- Multiple internal teams hitting one of several local LLM backends
- Mixing Ollama / vLLM / llama-server / cloud behind one OpenAI URL
- Need spend tracking, key rotation, RPM/TPM limits
- Use **ollama-docker-deploy-expert** / **vllm-local-deploy-expert** to set up the upstreams
- Use cloud-managed gateways (Portkey, OpenRouter) only if self-hosted is overkill

## Sources

- [LiteLLM proxy overview / config](https://docs.litellm.ai/docs/proxy/configs)
- [LiteLLM proxy quick start](https://docs.litellm.ai/docs/proxy/docker_quick_start)
- [LiteLLM all settings reference](https://docs.litellm.ai/docs/proxy/config_settings)
- [LiteLLM proxy load balancing](https://docs.litellm.ai/docs/proxy/load_balancing)
- [LiteLLM virtual keys](https://docs.litellm.ai/docs/proxy/virtual_keys)
- [LiteLLM production best practices](https://docs.litellm.ai/docs/proxy/prod)
- [LiteLLM GitHub](https://github.com/BerriAI/litellm)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.