If you use more than one coding agent; say Claude Code for some work, Codex CLI and OpenCode for others; configuring DeepSeek, Qwen, GLM, and Kimi separately in each gets tedious fast. LiteLLM solves that by being one gateway: configure your providers once, and serve every tool from a single endpoint, with spend tracking and budgets on top.
This guide covers the Windows setup and the configuration for each CLI. The per-model guides are simpler if you use only one tool. LiteLLM is more useful when several tools share the same providers.
What LiteLLM gives you
LiteLLM is an open-source gateway that fronts 100+ providers behind a unified API. The key feature for this use case: it can present both an OpenAI-compatible endpoint (for Codex and OpenCode) and an Anthropic-compatible one (for Claude Code), mapping both to the same underlying models. Configure DeepSeek once; use it everywhere.
Why a gateway for multiple tools
| One config | Define providers/keys once, not per tool |
|---|---|
| Dual format | Serves OpenAI and Anthropic clients |
| Spend tracking | See and cap usage across all tools |
| Model mapping | Friendly names that map to any backend |
Step 1: Run the gateway
LiteLLM runs via Python or Docker. On Windows, Docker Desktop or WSL is the cleanest way to keep it running as a local service. Install per the LiteLLM repository; for Docker, that’s pulling the image and providing a config file.
# illustrative; see LiteLLM docs for exact commands
pip install litellm[proxy]
litellm --config litellm.config.yaml
Step 2: Configure providers
In LiteLLM’s config, map model names to backends with their keys. For example, expose deepseek-v4-flash and the current Qwen or GLM model you use. Keep provider keys in environment variables rather than client configurations.
Step 3: Point each tool at the gateway
Now every tool uses the same local gateway:
Claude Code (Anthropic-format endpoint):
export ANTHROPIC_BASE_URL="http://127.0.0.1:4000"
export ANTHROPIC_AUTH_TOKEN="your-litellm-key"
claude
Codex CLI (config.toml, OpenAI-format):
model = "deepseek-v4-flash"
model_provider = "litellm"
[model_providers.litellm]
name = "LiteLLM"
base_url = "http://127.0.0.1:4000/v1"
env_key = "LITELLM_KEY"
wire_api = "responses"
OpenCode (opencode.json, OpenAI-format):
{
"provider": {
"litellm": {
"npm": "@ai-sdk/openai-compatible",
"options": { "baseURL": "http://127.0.0.1:4000/v1", "apiKey": "{env:LITELLM_KEY}" },
"models": { "deepseek-v4-flash": { "name": "DeepSeek via LiteLLM" } }
}
}
}
All three now share one provider config and one spend view.
Track and cap spend
A real benefit of the gateway is visibility: LiteLLM can record usage per model and tool and enforce budgets. If you’re running cheap models across several agents, that’s the simplest way to see total spend and stop surprises.
Troubleshooting
- Tool can’t connect; gateway not running, or wrong port/base URL.
- Auth errors; the LiteLLM key the tool sends doesn’t match the gateway’s.
- Model not found; the model name isn’t mapped in the LiteLLM config.
- Codex format errors; use a current LiteLLM release and set
wire_api = "responses". LiteLLM’s/v1/responsesbridge translates the request for providers that only expose Chat Completions.
LiteLLM gateway checklist
- Gateway running via Python or Docker (WSL/Docker Desktop)
- Providers and model names mapped in the config
- Keys via environment variables; master key set
- Claude Code on the Anthropic endpoint; Codex on /v1/responses; OpenCode on /v1
- Spend tracking reviewed; gateway bound to localhost
Verify the setup
LiteLLM is the right tool when you run multiple coding agents: one gateway fronts all your cheap providers, serves both Anthropic and OpenAI formats, and tracks spend, so Claude Code, Codex, and OpenCode share a single config. Run it via Docker or Python on Windows, map your models, point each tool at the local endpoint, and secure it with a master key on localhost.
For lighter, single-tool routing, see Claude Code Router or claude-code-mux.