Skip to content

Commit a39c6c3

Browse files
Added the OpenRouter provider (#595)
1 parent cfad42d commit a39c6c3

File tree

10 files changed

+495
-14
lines changed

10 files changed

+495
-14
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Since November 2024: Work on RAG (integration of your data and files) has begun.
3232
- [x] ~~App: Implement dialog for checking & handling [pandoc](https://pandoc.org/) installation ([PR #393](https://github.com/MindWorkAI/AI-Studio/pull/393), [PR #487](https://github.com/MindWorkAI/AI-Studio/pull/487))~~
3333
- [ ] App: Implement external embedding providers
3434
- [ ] App: Implement the process to vectorize one local file using embeddings
35-
- [ ] Runtime: Integration of the vector database [LanceDB](https://github.com/lancedb/lancedb)
35+
- [ ] Runtime: Integration of the vector database [Qdrant](https://github.com/qdrant/qdrant)
3636
- [ ] App: Implement the continuous process of vectorizing data
3737
- [x] ~~App: Define a common retrieval context interface for the integration of RAG processes in chats (PR [#281](https://github.com/MindWorkAI/AI-Studio/pull/281), [#284](https://github.com/MindWorkAI/AI-Studio/pull/284), [#286](https://github.com/MindWorkAI/AI-Studio/pull/286), [#287](https://github.com/MindWorkAI/AI-Studio/pull/287))~~
3838
- [x] ~~App: Define a common augmentation interface for the integration of RAG processes in chats (PR [#288](https://github.com/MindWorkAI/AI-Studio/pull/288), [#289](https://github.com/MindWorkAI/AI-Studio/pull/289))~~
@@ -78,7 +78,7 @@ Since March 2025: We have started developing the plugin system. There will be la
7878
Features we have recently released
7979
</h3>
8080
</summary>
81-
81+
- v0.9.55: Added support for newer models like Mistral 3 & GPT 5.2, OpenRouter as LLM and embedding provider, and the possibility to use file attachments in chats.
8282
- v0.9.51: Added support for [Perplexity](https://www.perplexity.ai/); citations added so that LLMs can provide source references (e.g., some OpenAI models, Perplexity); added support for OpenAI's Responses API so that all text LLMs from OpenAI now work in MindWork AI Studio, including Deep Research models; web searches are now possible (some OpenAI models, Perplexity).
8383
- v0.9.50: Added support for self-hosted LLMs using [vLLM](https://blog.vllm.ai/2023/06/20/vllm.html).
8484
- v0.9.46: Released our plugin system, a German language plugin, early support for enterprise environments, and configuration plugins. Additionally, we added the Pandoc integration for future data processing and file generation.
@@ -114,6 +114,7 @@ MindWork AI Studio is a free desktop app for macOS, Windows, and Linux. It provi
114114
- [xAI](https://x.ai/) (Grok)
115115
- [DeepSeek](https://www.deepseek.com/en)
116116
- [Alibaba Cloud](https://www.alibabacloud.com) (Qwen)
117+
- [OpenRouter](https://openrouter.ai/)
117118
- [Hugging Face](https://huggingface.co/) using their [inference providers](https://huggingface.co/docs/inference-providers/index) such as Cerebras, Nebius, Sambanova, Novita, Hyperbolic, Together AI, Fireworks, Hugging Face
118119
- Self-hosted models using [llama.cpp](https://github.com/ggerganov/llama.cpp), [ollama](https://github.com/ollama/ollama), [LM Studio](https://lmstudio.ai/), and [vLLM](https://github.com/vllm-project/vllm)
119120
- [Groq](https://groq.com/)

app/MindWork AI Studio/Pages/Home.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private void InitializeAdvantagesItems()
3131
{
3232
this.itemsAdvantages = [
3333
new(this.T("Free of charge"), this.T("The app is free to use, both for personal and commercial purposes.")),
34-
new(this.T("Independence"), this.T("You are not tied to any single provider. Instead, you might choose the provider that best suits your needs. Right now, we support OpenAI (GPT5, o1, etc.), Perplexity, Mistral, Anthropic (Claude), Google Gemini, xAI (Grok), DeepSeek, Alibaba Cloud (Qwen), Hugging Face, and self-hosted models using vLLM, llama.cpp, ollama, LM Studio, Groq, or Fireworks. For scientists and employees of research institutions, we also support Helmholtz and GWDG AI services. These are available through federated logins like eduGAIN to all 18 Helmholtz Centers, the Max Planck Society, most German, and many international universities.")),
34+
new(this.T("Independence"), this.T("You are not tied to any single provider. Instead, you might choose the provider that best suits your needs. Right now, we support OpenAI (GPT5, o1, etc.), Perplexity, Mistral, Anthropic (Claude), Google Gemini, xAI (Grok), DeepSeek, Alibaba Cloud (Qwen), OpenRouter, Hugging Face, and self-hosted models using vLLM, llama.cpp, ollama, LM Studio, Groq, or Fireworks. For scientists and employees of research institutions, we also support Helmholtz and GWDG AI services. These are available through federated logins like eduGAIN to all 18 Helmholtz Centers, the Max Planck Society, most German, and many international universities.")),
3535
new(this.T("Assistants"), this.T("You just want to quickly translate a text? AI Studio has so-called assistants for such and other tasks. No prompting is necessary when working with these assistants.")),
3636
new(this.T("Unrestricted usage"), this.T("Unlike services like ChatGPT, which impose limits after intensive use, MindWork AI Studio offers unlimited usage through the providers API.")),
3737
new(this.T("Cost-effective"), this.T("You only pay for what you use, which can be cheaper than monthly subscription services like ChatGPT Plus, especially if used infrequently. But beware, here be dragons: For extremely intensive usage, the API costs can be significantly higher. Unfortunately, providers currently do not offer a way to display current costs in the app. Therefore, check your account with the respective provider to see how your costs are developing. When available, use prepaid and set a cost limit.")),

app/MindWork AI Studio/Provider/LLMProviders.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public enum LLMProviders
1515
DEEP_SEEK = 11,
1616
ALIBABA_CLOUD = 12,
1717
PERPLEXITY = 14,
18-
18+
OPEN_ROUTER = 15,
19+
1920
FIREWORKS = 5,
2021
GROQ = 6,
2122
HUGGINGFACE = 13,

app/MindWork AI Studio/Provider/LLMProvidersExtensions.cs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using AIStudio.Provider.HuggingFace;
1010
using AIStudio.Provider.Mistral;
1111
using AIStudio.Provider.OpenAI;
12+
using AIStudio.Provider.OpenRouter;
1213
using AIStudio.Provider.Perplexity;
1314
using AIStudio.Provider.SelfHosted;
1415
using AIStudio.Provider.X;
@@ -42,7 +43,8 @@ public static class LLMProvidersExtensions
4243
LLMProviders.DEEP_SEEK => "DeepSeek",
4344
LLMProviders.ALIBABA_CLOUD => "Alibaba Cloud",
4445
LLMProviders.PERPLEXITY => "Perplexity",
45-
46+
LLMProviders.OPEN_ROUTER => "OpenRouter",
47+
4648
LLMProviders.GROQ => "Groq",
4749
LLMProviders.FIREWORKS => "Fireworks.ai",
4850
LLMProviders.HUGGINGFACE => "Hugging Face",
@@ -92,7 +94,9 @@ public static class LLMProvidersExtensions
9294
LLMProviders.ALIBABA_CLOUD => Confidence.CHINA_NO_TRAINING.WithRegion("Asia").WithSources("https://www.alibabacloud.com/help/en/model-studio/support/faq-about-alibaba-cloud-model-studio").WithLevel(settingsManager.GetConfiguredConfidenceLevel(llmProvider)),
9395

9496
LLMProviders.PERPLEXITY => Confidence.USA_NO_TRAINING.WithRegion("America, U.S.").WithSources("https://www.perplexity.ai/hub/legal/perplexity-api-terms-of-service").WithLevel(settingsManager.GetConfiguredConfidenceLevel(llmProvider)),
95-
97+
98+
LLMProviders.OPEN_ROUTER => Confidence.USA_HUB.WithRegion("America, U.S.").WithSources("https://openrouter.ai/privacy", "https://openrouter.ai/terms").WithLevel(settingsManager.GetConfiguredConfidenceLevel(llmProvider)),
99+
96100
LLMProviders.SELF_HOSTED => Confidence.SELF_HOSTED.WithLevel(settingsManager.GetConfiguredConfidenceLevel(llmProvider)),
97101

98102
LLMProviders.HELMHOLTZ => Confidence.GDPR_NO_TRAINING.WithRegion("Europe, Germany").WithSources("https://helmholtz.cloud/services/?serviceID=d7d5c597-a2f6-4bd1-b71e-4d6499d98570").WithLevel(settingsManager.GetConfiguredConfidenceLevel(llmProvider)),
@@ -128,7 +132,8 @@ public static class LLMProvidersExtensions
128132
LLMProviders.DEEP_SEEK => false,
129133
LLMProviders.HUGGINGFACE => false,
130134
LLMProviders.PERPLEXITY => false,
131-
135+
LLMProviders.OPEN_ROUTER => true,
136+
132137
//
133138
// Self-hosted providers are treated as a special case anyway.
134139
//
@@ -171,7 +176,8 @@ private static IProvider CreateProvider(this LLMProviders provider, string insta
171176
LLMProviders.DEEP_SEEK => new ProviderDeepSeek { InstanceName = instanceName, AdditionalJsonApiParameters = expertProviderApiParameter },
172177
LLMProviders.ALIBABA_CLOUD => new ProviderAlibabaCloud { InstanceName = instanceName, AdditionalJsonApiParameters = expertProviderApiParameter },
173178
LLMProviders.PERPLEXITY => new ProviderPerplexity { InstanceName = instanceName, AdditionalJsonApiParameters = expertProviderApiParameter },
174-
179+
LLMProviders.OPEN_ROUTER => new ProviderOpenRouter { InstanceName = instanceName, AdditionalJsonApiParameters = expertProviderApiParameter },
180+
175181
LLMProviders.GROQ => new ProviderGroq { InstanceName = instanceName, AdditionalJsonApiParameters = expertProviderApiParameter },
176182
LLMProviders.FIREWORKS => new ProviderFireworks { InstanceName = instanceName, AdditionalJsonApiParameters = expertProviderApiParameter },
177183
LLMProviders.HUGGINGFACE => new ProviderHuggingFace(inferenceProvider, model) { InstanceName = instanceName, AdditionalJsonApiParameters = expertProviderApiParameter },
@@ -201,7 +207,8 @@ private static IProvider CreateProvider(this LLMProviders provider, string insta
201207
LLMProviders.DEEP_SEEK => "https://platform.deepseek.com/sign_up",
202208
LLMProviders.ALIBABA_CLOUD => "https://account.alibabacloud.com/register/intl_register.htm",
203209
LLMProviders.PERPLEXITY => "https://www.perplexity.ai/account/api",
204-
210+
LLMProviders.OPEN_ROUTER => "https://openrouter.ai/keys",
211+
205212
LLMProviders.GROQ => "https://console.groq.com/",
206213
LLMProviders.FIREWORKS => "https://fireworks.ai/login",
207214
LLMProviders.HUGGINGFACE => "https://huggingface.co/login",
@@ -224,8 +231,9 @@ private static IProvider CreateProvider(this LLMProviders provider, string insta
224231
LLMProviders.DEEP_SEEK => "https://platform.deepseek.com/usage",
225232
LLMProviders.ALIBABA_CLOUD => "https://usercenter2-intl.aliyun.com/billing",
226233
LLMProviders.PERPLEXITY => "https://www.perplexity.ai/account/api/",
234+
LLMProviders.OPEN_ROUTER => "https://openrouter.ai/activity",
227235
LLMProviders.HUGGINGFACE => "https://huggingface.co/settings/billing",
228-
236+
229237
_ => string.Empty,
230238
};
231239

@@ -241,8 +249,9 @@ private static IProvider CreateProvider(this LLMProviders provider, string insta
241249
LLMProviders.DEEP_SEEK => true,
242250
LLMProviders.ALIBABA_CLOUD => true,
243251
LLMProviders.PERPLEXITY => true,
252+
LLMProviders.OPEN_ROUTER => true,
244253
LLMProviders.HUGGINGFACE => true,
245-
254+
246255
_ => false,
247256
};
248257

@@ -288,7 +297,8 @@ private static IProvider CreateProvider(this LLMProviders provider, string insta
288297
LLMProviders.DEEP_SEEK => true,
289298
LLMProviders.ALIBABA_CLOUD => true,
290299
LLMProviders.PERPLEXITY => true,
291-
300+
LLMProviders.OPEN_ROUTER => true,
301+
292302
LLMProviders.GROQ => true,
293303
LLMProviders.FIREWORKS => true,
294304
LLMProviders.HELMHOLTZ => true,
@@ -310,7 +320,8 @@ private static IProvider CreateProvider(this LLMProviders provider, string insta
310320
LLMProviders.DEEP_SEEK => true,
311321
LLMProviders.ALIBABA_CLOUD => true,
312322
LLMProviders.PERPLEXITY => true,
313-
323+
LLMProviders.OPEN_ROUTER => true,
324+
314325
LLMProviders.GROQ => true,
315326
LLMProviders.FIREWORKS => true,
316327
LLMProviders.HELMHOLTZ => true,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace AIStudio.Provider.OpenRouter;
2+
3+
/// <summary>
4+
/// A data model for an OpenRouter model from the API.
5+
/// </summary>
6+
/// <param name="Id">The model's ID.</param>
7+
/// <param name="Name">The model's human-readable display name.</param>
8+
public readonly record struct OpenRouterModel(string Id, string? Name);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace AIStudio.Provider.OpenRouter;
2+
3+
/// <summary>
4+
/// A data model for the response from the OpenRouter models endpoint.
5+
/// </summary>
6+
/// <param name="Data">The list of models.</param>
7+
public readonly record struct OpenRouterModelsResponse(IList<OpenRouterModel> Data);

0 commit comments

Comments
 (0)