Skip to main content
Watch: I Built an AI App Without Leaving Databricks

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

  1. Step 1.

    Create an OpenRouter account and generate an API key on the OpenRouter keys page (https://openrouter.ai/keys).

  2. Step 2.

    Run agent: open settings to 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.

  3. Step 3.

    Explicitly select an OpenRouter model in settings.

    JSON
    {
      "agent": {
        "default_model": {
          "provider": "openrouter",
          "model": "openrouter/auto"
        }
      }
    }
  4. 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
              }
            }
          ]
        }
      }
    }
  5. 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.

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.