L

LiteLLM Gateway Settings

Route Claude Code requests through a local LiteLLM proxy server for centralized model management, logging, and cost tracking. Perfect for teams that need to manage API keys centrally, enforce usage policies, or route between multiple model providers.

SettingCommunityinfrastructurev1.0.0MIT
0 views0 copies

Provider Configuration

# Point Claude Code at your LiteLLM gateway export ANTHROPIC_BASE_URL=http://localhost:4000 export ANTHROPIC_API_KEY=sk-litellm-master-key

Settings File

{ "env": { "ANTHROPIC_BASE_URL": "http://localhost:4000", "ANTHROPIC_API_KEY": "sk-litellm-master-key" } }

LiteLLM Proxy Setup

1. Install LiteLLM

pip install litellm[proxy]

2. Create Configuration (litellm_config.yaml)

model_list: - model_name: claude-sonnet-4-20250514 litellm_params: model: anthropic/claude-sonnet-4-20250514 api_key: sk-ant-your-key - model_name: claude-haiku-4-20250514 litellm_params: model: anthropic/claude-haiku-4-20250514 api_key: sk-ant-your-key general_settings: master_key: sk-litellm-master-key database_url: sqlite:///litellm.db litellm_settings: max_budget: 100 # Monthly budget cap in USD budget_duration: monthly

3. Start the Proxy

litellm --config litellm_config.yaml --port 4000

Team Features

  • Centralized API keys: Team members don't need individual provider keys
  • Budget controls: Set per-user and per-team spending limits
  • Usage logging: Track token usage and costs per user
  • Model routing: Route different models to different providers
  • Fallback chains: Auto-failover between providers

Troubleshooting

IssueSolution
Connection refusedEnsure LiteLLM proxy is running on port 4000
Auth failedCheck master_key matches ANTHROPIC_API_KEY
Model not foundVerify model_name in litellm_config.yaml
Slow responsesCheck proxy logs with litellm --debug

Security Notes

  • Run the proxy on localhost only, or behind a reverse proxy with TLS
  • Use unique API keys per team member for usage tracking
  • The proxy stores all API keys - secure the config file appropriately
Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates