Files
zed/assets/icons
Umesh Yadav c9c603b1d1 Add support for OpenRouter as a language model provider (#29496)
This pull request adds full integration with OpenRouter, allowing users
to access a wide variety of language models through a single API key.

**Implementation Details:**

* **Provider Registration:** Registers OpenRouter as a new language
model provider within the application's model registry. This includes UI
for API key authentication, token counting, streaming completions, and
tool-call handling.
* **Dedicated Crate:** Adds a new `open_router` crate to manage
interactions with the OpenRouter HTTP API, including model discovery and
streaming helpers.
* **UI & Configuration:** Extends workspace manifests, the settings
schema, icons, and default configurations to surface the OpenRouter
provider and its settings within the UI.
* **Readability:** Reformats JSON arrays within the settings files for
improved readability.

**Design Decisions & Discussion Points:**

* **Code Reuse:** I leveraged much of the existing logic from the
`openai` provider integration due to the significant similarities
between the OpenAI and OpenRouter API specifications.
* **Default Model:** I set the default model to `openrouter/auto`. This
model automatically routes user prompts to the most suitable underlying
model on OpenRouter, providing a convenient starting point.
* **Model Population Strategy:**
* <strike>I've implemented dynamic population of available models by
querying the OpenRouter API upon initialization.
* Currently, this involves three separate API calls: one for all models,
one for tool-use models, and one for models good at programming.
* The data from the tool-use API call sets a `tool_use` flag for
relevant models.
* The data from the programming models API call is used to sort the
list, prioritizing coding-focused models in the dropdown.</strike>
* <strike>**Feedback Welcome:** I acknowledge this multi-call approach
is API-intensive. I am open to feedback and alternative implementation
suggestions if the team believes this can be optimized.</strike>
    * **Update: Now this has been simplified to one api call.**
* **UI/UX Considerations:**
* <strike>Authentication Method: Currently, I've implemented the
standard API key input in settings, similar to other providers like
OpenAI/Anthropic. However, OpenRouter also supports OAuth 2.0 with PKCE.
This could offer a potentially smoother, more integrated setup
experience for users (e.g., clicking a button to authorize instead of
copy-pasting a key). Should we prioritize implementing OAuth PKCE now,
or perhaps add it as an alternative option later?</strike>(PKCE is not
straight forward and complicated so skipping this for now. So that we
can add the support and work on this later.)
* <strike>To visually distinguish models better suited for programming,
I've considered adding a marker (e.g., `</>` or `🧠`) next to their
names. Thoughts on this proposal?</strike>. (This will require a changes
and discussion across model provider. This doesn't fall under the scope
of current PR).
* OpenRouter offers 300+ models. The current implementation loads all of
them. **Feedback Needed:** Should we refine this list or implement more
sophisticated filtering/categorization for better usability?

**Motivation:**

This integration directly addresses one of the most highly upvoted
feature requests/discussions within the Zed community. Adding OpenRouter
support significantly expands the range of AI models accessible to
users.

I welcome feedback from the Zed team on this implementation and the
design choices made. I am eager to refine this feature and make it
available to users.

ISSUES: https://github.com/zed-industries/zed/discussions/16576

Release Notes:

- Added support for OpenRouter as a language model provider.

---------

Signed-off-by: Umesh Yadav <umesh4257@gmail.com>
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2025-06-03 15:59:46 +00:00
..
2025-01-27 13:40:59 -05:00
2024-08-12 09:55:00 -04:00
2024-08-12 09:55:00 -04:00
2024-08-01 21:57:51 -04:00
2024-08-01 21:57:51 -04:00
kb
2023-11-20 10:46:23 -05:00
kb
2023-11-20 10:46:23 -05:00
kb
2023-11-20 10:46:23 -05:00
kb
2023-11-20 10:46:23 -05:00
2024-01-03 11:45:41 -05:00
2024-09-13 21:12:29 -04:00
2024-09-13 21:12:29 -04:00
2024-06-25 11:43:30 -04:00
2024-09-13 21:12:29 -04:00
2023-08-14 15:50:42 -04:00
2023-08-14 15:50:42 -04:00
2023-08-14 15:50:42 -04:00
2023-08-14 15:50:42 -04:00
2025-02-05 12:13:32 -07:00
2024-09-13 21:12:29 -04:00
kb
2023-11-20 10:46:23 -05:00
2024-06-11 12:39:45 +02:00
kb
2023-11-20 10:46:23 -05:00
2023-08-14 15:50:42 -04:00
2023-11-05 01:06:41 -05:00
2025-03-18 12:55:25 -04:00
2023-08-16 13:48:12 -04:00
2024-09-13 21:12:29 -04:00
2025-03-13 15:52:47 -06:00
2025-03-13 15:52:47 -06:00
2024-07-26 11:08:42 -04:00
2024-09-13 21:12:29 -04:00
2024-09-13 21:12:29 -04:00
2024-09-13 21:12:29 -04:00
2024-09-13 21:12:29 -04:00
2024-09-13 21:12:29 -04:00
2024-09-13 21:12:29 -04:00
2024-09-13 21:12:29 -04:00
2024-09-13 21:12:29 -04:00
2024-09-13 21:12:29 -04:00
2024-06-26 13:02:58 -04:00
2023-12-18 12:56:57 -05:00
2023-08-14 15:57:31 -04:00
2024-05-07 16:36:13 -04:00
2023-08-16 23:38:11 +03:00
2024-05-16 16:55:54 -04:00
2023-10-17 13:34:51 -04:00
2024-04-23 13:31:21 -04:00
2023-12-19 10:30:46 -05:00
2024-01-03 11:45:41 -05:00
kb
2023-11-20 10:46:23 -05:00
2024-01-03 11:45:41 -05:00
2024-01-03 11:45:41 -05:00
2024-04-11 18:36:58 +02:00
2024-09-05 16:00:32 -03:00
2024-12-17 09:40:16 -03:00
2023-10-17 13:30:09 -06:00
2023-12-19 10:30:46 -05:00
2024-04-11 23:07:29 -06:00
2024-06-18 12:16:54 -07:00
2024-09-13 21:12:29 -04:00
2024-04-23 15:33:09 -06:00
kb
2023-11-20 10:46:23 -05:00
2023-12-19 10:30:46 -05:00
2024-01-03 11:45:41 -05:00
2023-08-14 15:50:42 -04:00
2024-05-07 16:36:13 -04:00
2024-05-03 12:50:42 -07:00
2024-05-03 12:50:42 -07:00
2024-05-03 12:50:42 -07:00
2024-05-03 12:50:42 -07:00
2024-09-16 00:24:18 -04:00
2024-04-23 13:31:21 -04:00
2024-09-05 16:00:32 -03:00
2023-10-16 15:53:29 -04:00
2024-09-13 21:12:29 -04:00
2024-06-26 13:02:58 -04:00
2023-11-18 00:54:01 -05:00
2024-09-13 21:12:29 -04:00
2024-09-13 21:12:29 -04:00
2024-12-06 09:17:48 -03:00