feat: add OpenRouter as AI provider (#2906)

Co-authored-by: Amruth Pillai <im.amruth@gmail.com>
This commit is contained in:
iago macedo
2026-04-25 19:00:14 -03:00
committed by GitHub
parent 9b3916d43e
commit 77ad14b359
61 changed files with 378 additions and 132 deletions
+25 -14
View File
@@ -8,6 +8,8 @@ import { useMemo } from "react";
import { toast } from "sonner";
import { useIsClient } from "usehooks-ts";
import type { AIProvider } from "@/integrations/ai/types";
import { Button } from "@/components/ui/button";
import { Combobox, type ComboboxOption } from "@/components/ui/combobox";
import { Input } from "@/components/ui/input";
@@ -15,7 +17,7 @@ import { Label } from "@/components/ui/label";
import { Separator } from "@/components/ui/separator";
import { Spinner } from "@/components/ui/spinner";
import { Switch } from "@/components/ui/switch";
import { type AIProvider, useAIStore } from "@/integrations/ai/store";
import { useAIStore } from "@/integrations/ai/store";
import { orpc } from "@/integrations/orpc/client";
import { getOrpcErrorMessage } from "@/utils/error-message";
import { cn } from "@/utils/style";
@@ -36,15 +38,6 @@ const providerOptions: (ComboboxOption<AIProvider> & { defaultBaseURL: string })
keywords: ["openai", "gpt", "chatgpt"],
defaultBaseURL: "https://api.openai.com/v1",
},
{
value: "ollama",
label: t({
comment: "AI provider option label in dashboard AI settings",
message: "Ollama",
}),
keywords: ["ollama", "ai", "local"],
defaultBaseURL: "http://localhost:11434",
},
{
value: "anthropic",
label: t({
@@ -54,6 +47,15 @@ const providerOptions: (ComboboxOption<AIProvider> & { defaultBaseURL: string })
keywords: ["anthropic", "claude", "ai"],
defaultBaseURL: "https://api.anthropic.com/v1",
},
{
value: "gemini",
label: t({
comment: "AI provider option label in dashboard AI settings",
message: "Google Gemini",
}),
keywords: ["gemini", "google", "bard"],
defaultBaseURL: "https://generativelanguage.googleapis.com/v1beta",
},
{
value: "vercel-ai-gateway",
label: t({
@@ -64,13 +66,22 @@ const providerOptions: (ComboboxOption<AIProvider> & { defaultBaseURL: string })
defaultBaseURL: "https://ai-gateway.vercel.sh/v1/ai",
},
{
value: "gemini",
value: "openrouter",
label: t({
comment: "AI provider option label in dashboard AI settings",
message: "Google Gemini",
message: "OpenRouter",
}),
keywords: ["gemini", "google", "bard"],
defaultBaseURL: "https://generativelanguage.googleapis.com/v1beta",
keywords: ["openrouter", "router", "multi", "proxy"],
defaultBaseURL: "https://openrouter.ai/api/v1",
},
{
value: "ollama",
label: t({
comment: "AI provider option label in dashboard AI settings",
message: "Ollama",
}),
keywords: ["ollama", "ai", "local"],
defaultBaseURL: "https://ollama.com/api",
},
];