Setup guide - Documented by Zed
Use OpenRouter in Zed
Zed has OpenRouter as a built-in LLM provider for the Zed Agent and other Zed AI features. Enter the key in Settings > AI > LLM Providers (or set OPENROUTER_API_KEY), select an OpenRouter model in agent.default_model, and add custom models under language_models.open_router.
Last verified 5 steps2 official sources
Steps
- Step 1.
Create an OpenRouter account and generate an API key on the OpenRouter keys page (https://openrouter.ai/keys).
- Step 2.
Run
agent: open settingsto open Settings > AI > LLM Providers, find the OpenRouter row, and enter your API key. Zed also reads OPENROUTER_API_KEY from the local Zed process environment. - Step 3.
Explicitly select an OpenRouter model in settings.
JSON{ "agent": { "default_model": { "provider": "openrouter", "model": "openrouter/auto" } } } - Step 4.
Optional: add custom OpenRouter models.
JSON{ "language_models": { "open_router": { "api_url": "https://openrouter.ai/api/v1", "available_models": [ { "name": "google/gemini-2.0-flash-thinking-exp", "display_name": "Gemini 2.0 Flash (Thinking)", "max_tokens": 200000, "max_output_tokens": 8192, "supports_tools": true, "supports_images": true, "mode": { "type": "thinking", "budget_tokens": 8000 } } ] } } } - Step 5.
Optional: control upstream provider routing per model with a provider object.
JSON{ "language_models": { "open_router": { "available_models": [ { "name": "openrouter/auto", "display_name": "Auto Router", "max_tokens": 2000000, "supports_tools": true, "provider": { "order": ["anthropic", "openai"], "allow_fallbacks": true, "require_parameters": true, "data_collection": "allow" } } ] } } }
Caveats
- The OpenRouter provider covers Zed AI features (Zed Agent, Inline Assistant, commit generation, thread summaries). External Agents and Terminal Threads need separate configuration.
- The custom-model example name google/gemini-2.0-flash-thinking-exp is copied verbatim from Zed's docs. It is an old model, so replace it with a current slug such as ~anthropic/claude-sonnet-latest from OpenRouter's docs.
- The settings key is open_router under language_models, while the provider value in agent.default_model is openrouter.
More setup guides
Same tool, other providers
Related reading
- Model Routing Recipes: Practical Config Patterns to Cut AI SpendModel routing recipes with paste-ready OpenRouter and LiteLLM configs for task tiers, fallback chains, cost ceilings and cache-aware routing that cut AI spend.
- OpenRouter Fusion Makes Model Panels Real. Use Them Like Escalation, Not AutopilotOpenRouter Fusion turns multi-model panels into an API feature. Use it as an escalation lane for prompts where a wrong answer is expensive, not as the default.
- OpenRouter in 2026: Review, Setup, and When Model Routing PaysOpenRouter review and setup - one API key for 300+ models with fallbacks and provider routing, what it costs, and when to go direct to a provider instead.
- LLM Routers Compared: LiteLLM vs Portkey vs OpenRouter in 2026LiteLLM vs Portkey vs OpenRouter compared for production AI apps: cost tracking, fallbacks, caching, and load balancing, plus when to use each router.
- Zed Just Made Parallel AI Agents a Native Editor PrimitiveZed Parallel Agents adds a native Threads Sidebar that runs multiple AI agents in one window, with per-thread agent choice and worktree isolation.
- Zed: The Open Source Agentic IDEZed is not another Electron-based editor. It's built from the ground up in Rust, which means real performance without the memory bloat that plagues other IDEs.
FAQ
How do I use OpenRouter in Zed?
Zed has OpenRouter as a built-in LLM provider for the Zed Agent and other Zed AI features. Enter the key in Settings > AI > LLM Providers (or set OPENROUTER_API_KEY), select an OpenRouter model in agent.default_model, and add custom models under language_models.open_router.
Which OpenRouter model ids work in Zed?
The official docs read for this guide list openrouter/auto and google/gemini-2.0-flash-thinking-exp. Requests go to https://openrouter.ai/api/v1.
Is this an official OpenRouter and Zed setup?
Zed documents this setup in its own docs. It was last checked against 2 official pages on October 17, 2026.
Sources
Last verified against 2 official pages.
Newsletter
New models, set up the day they ship
One email per week. New model releases, the coding tools that support them and how to wire them up.