Connect OpenRouter models to your self-hosted Open WebUI and LiteLLM proxy. This guide covers getting an API key, configuring LiteLLM as a proxy, and pointing Open WebUI at it.
Go to openrouter.ai/keys and create a key. You'll need it for both LiteLLM and Open WebUI.
Install the LiteLLM proxy server:
pip install 'litellm[proxy]'bashUse the button on the models page to generate a config, or write one manually. Here's a minimal example:
model_list:
- model_name: "glm-5.2"
litellm_params:
model: "openrouter/z-ai/glm-5.2"
api_key: "os.environ/OPENROUTER_API_KEY"
- model_name: "kimi-k3"
litellm_params:
model: "openrouter/moonshotai/kimi-k3"
api_key: "os.environ/OPENROUTER_API_KEY"
- model_name: "qwen3.8"
litellm_params:
model: "openrouter/qwen/qwen3.8-2.4t-a95b"
api_key: "os.environ/OPENROUTER_API_KEY"
- model_name: "deepseek-v4-pro"
litellm_params:
model: "openrouter/deepseek/deepseek-v4-pro-0813"
api_key: "os.environ/OPENROUTER_API_KEY"
- model_name: "inkling-small"
litellm_params:
model: "openrouter/thinkingmachines/inkling-small"
api_key: "os.environ/OPENROUTER_API_KEY"
general_settings:
master_key: "os.environ/LITELLM_MASTER_KEY" # optional: protect your proxyyamlTip: The model field must start with openrouter/ followed by the model ID exactly as shown on the models page (e.g. openrouter/z-ai/glm-5.2). The model_name is what Open WebUI will display — you can pick any friendly name.
# Set your API key
export OPENROUTER_API_KEY="sk-or-v1-..."
# Optional: set a master key to protect the proxy
export LITELLM_MASTER_KEY="sk-litellm-..."
# Start the proxy on port 4000
litellm --config config.yaml --port 4000bashThe proxy exposes an OpenAI-compatible API at http://localhost:4000/v1.
In Open WebUI, go to Settings → Connections → OpenAI API and add:
# OpenAI API Base URL
http://localhost:4000/v1
# API Key (your LITELLM_MASTER_KEY, or any string if you didn't set one)
sk-litellm-...envOpen WebUI will auto-discover all model_name entries from your LiteLLM config. They'll appear in the model dropdown in the chat interface.
If you don't need LiteLLM (rate limiting, load balancing, fallbacks), you can connect Open WebUI directly:
# OpenAI API Base URL
https://openrouter.ai/api/v1
# API Key (your OpenRouter key)
sk-or-v1-...envThen in Settings → Models, add model IDs manually (use the copy button on each model card), e.g. z-ai/glm-5.2.
If you're running both in Docker:
services:
litellm:
image: ghcr.io/berriai/litellm:main-latest
ports:
- "4000:4000"
volumes:
- ./config.yaml:/app/config.yaml
environment:
- OPENROUTER_API_KEY=${OPENROUTER_API_KEY}
- LITELLM_MASTER_KEY=${LITELLM_MASTER_KEY}
command: --config /app/config.yaml --port 4000
open-webui:
image: ghcr.io/open-webui/open-webui:main
ports:
- "3000:8080"
environment:
- OPENAI_API_BASE_URL=http://litellm:4000/v1
- OPENAI_API_KEY=${LITELLM_MASTER_KEY}
depends_on:
- litellm
volumes:
- open-webui-data:/app/backend/data
volumes:
open-webui-data:yamlThe Export button on the models page also supports these formats:
🤖 Hermes Agent — generates ~/.hermes/config.yaml with OpenRouter provider and fallback models.
🦞 OpenClaw — OpenAI-compatible provider config pointing at https://openrouter.ai/api/v1.
🧭 Odysseus — cloud/API model config for Odysseus with model IDs.
💬 Open WebUI — list of model IDs to paste into Settings → Models.
Tools — supports function/tool calling. Required for Open WebUI's built-in tools and function calls.
Structured — supports JSON schema / structured output. Good for agentic pipelines.
Vision — accepts image inputs. For multimodal chat with image uploads.
Web Search — supports OpenRouter's native web search option.
Click "Load scores" on the models page to fetch Arena AI (LMArena) ELO scores from arena.ai via daily snapshots. Models are matched by name similarity and vendor. Scores appear as badges (🏆 ELO · rank) on model cards and in the comparison view.
OpenRouter Radar is a Progressive Web App — install it to your home screen for quick access and offline browsing. Model data is cached for offline use.
Chrome/Edge: click the install icon in the address bar. Safari (iOS): Share → Add to Home Screen. Safari (Mac): File → Add to Dock.