Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

feat(favicon): add custom favicon support

oyi771d47cadae881
diff --git a/src/app/(dashboard)/dashboard/settings/components/AppearanceTab.tsx b/src/app/(dashboard)/dashboard/settings/components/AppearanceTab.tsx
index e9ddfcdb06..687b3f511c 100644
--- a/src/app/(dashboard)/dashboard/settings/components/AppearanceTab.tsx
+++ b/src/app/(dashboard)/dashboard/settings/components/AppearanceTab.tsx
@@ -383,6 +383,78 @@ export default function AppearanceTab() {
</div>
)}
</div>
+
+ <div className="flex flex-col gap-2 pt-4 border-t border-border">
+ <div>
+ <p className="font-medium">{t("customFavicon")}</p>
+ <p className="text-sm text-text-muted">{t("customFaviconDesc")}</p>
+ </div>
+ <div className="flex items-center gap-2">
+ <input
+ type="text"
+ value={settings.customFaviconUrl || ""}
+ onChange={(e) => updateSetting("customFaviconUrl", e.target.value)}
+ className="flex-1 h-10 px-3 rounded-lg bg-surface border border-border text-sm text-text-main focus:outline-none focus:border-primary"
+ placeholder="https://example.com/favicon.ico"
+ maxLength={2000}
+ />
+ {(settings.customFaviconUrl || settings.customFaviconBase64) && (
+ <img
+ src={settings.customFaviconBase64 || settings.customFaviconUrl}
+ alt="Favicon preview"
+ className="h-10 w-10 rounded border border-border object-contain bg-surface"
+ onError={(e) => {
+ e.currentTarget.style.display = "none";
+ }}
+ />
+ )}
+ </div>
+ </div>
+
+ <div className="flex flex-col gap-2">
+ <p className="font-medium">{t("uploadFavicon")}</p>
+ <div className="flex items-center gap-2">
+ <input
+ type="file"
+ accept="image/*"
+ onChange={(e) => {
+ const file = e.target.files?.[0];
+ if (file) {
+ if (file.size > 50 * 1024) {
+ alert("Favicon file must be less than 50KB");
+ return;
+ }
+ const reader = new FileReader();
+ reader.onload = (event) => {
+ const base64 = event.target?.result as string;
+ updateSetting("customFaviconBase64", base64);
+ };
+ reader.readAsDataURL(file);
+ }
+ }}
+ className="text-sm text-text-muted"
+ />
+ <Button
+ variant="secondary"
+ onClick={() => {
+ updateSetting("customFaviconUrl", "");
+ updateSetting("customFaviconBase64", "");
+ }}
+ >
+ {t("resetFavicon")}
+ </Button>
+ </div>
+ {(settings.customFaviconBase64 || settings.customFaviconUrl) && (
+ <div className="mt-2 p-3 bg-black/5 dark:bg-white/5 rounded-lg">
+ <p className="text-xs text-text-muted mb-2">{t("faviconPreview")}</p>
+ <img
+ src={settings.customFaviconBase64 || settings.customFaviconUrl}
+ alt="Favicon preview"
+ className="h-8 w-8 rounded"
+ />
+ </div>
+ )}
+ </div>
</div>
</div>
</div>
diff --git a/src/app/api/settings/favicon/route.ts b/src/app/api/settings/favicon/route.ts
new file mode 100644
index 0000000000..de9390cba0
--- /dev/null
+++ b/src/app/api/settings/favicon/route.ts
@@ -0,0 +1,55 @@
+import { NextResponse } from "next/server";
+import { getSettings } from "@/lib/db/settings";
+
+export const dynamic = "force-dynamic";
+
+export async function GET() {
+ try {
+ const settings = await getSettings();
+
+ const customFaviconBase64 = settings?.customFaviconBase64;
+ const customFaviconUrl = settings?.customFaviconUrl;
+
+ let faviconData: string | null = null;
+
+ if (customFaviconBase64) {
+ faviconData = customFaviconBase64;
+ } else if (customFaviconUrl) {
+ try {
+ const response = await fetch(customFaviconUrl);
+ if (response.ok) {
+ const arrayBuffer = await response.arrayBuffer();
+ const uint8Array = new Uint8Array(arrayBuffer);
+ const base64 = Buffer.from(uint8Array).toString("base64");
+ const contentType = response.headers.get("content-type") || "image/png";
+ faviconData = `data:${contentType};base64,${base64}`;
+ }
+ } catch (error) {
+ console.error("Failed to fetch custom favicon:", error);
+ }
+ }
+
+ if (!faviconData) {
+ return NextResponse.redirect("/favicon.svg");
+ }
+
+ const match = faviconData.match(/^data:([^;]+);base64,(.+)$/);
+ if (!match) {
+ return NextResponse.redirect("/favicon.svg");
+ }
+
+ const contentType = match[1];
+ const base64Data = match[2];
+ const buffer = Buffer.from(base64Data, "base64");
+
+ return new NextResponse(buffer, {
+ headers: {
+ "Content-Type": contentType,
+ "Cache-Control": "public, max-age=3600",
+ },
+ });
+ } catch (error) {
+ console.error("Favicon API error:", error);
+ return NextResponse.redirect("/favicon.svg");
+ }
+}
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 809cef587a..c184aa720b 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -5,21 +5,28 @@ import "@/lib/initCloudSync"; // Auto-initialize cloud sync
import { NextIntlClientProvider } from "next-intl";
import { getMessages, getLocale } from "next-intl/server";
import { RTL_LOCALES } from "@/i18n/config";
+import { getSettings } from "@/lib/db/settings";
const inter = Inter({
subsets: ["latin"],
variable: "--font-inter",
});
-export const metadata = {
- title: "OmniRoute — AI Gateway for Multi-Provider LLMs",
- description:
- "OmniRoute is an AI gateway for multi-provider LLMs. One endpoint for all your AI providers.",
- icons: {
- icon: "/favicon.svg",
- apple: "/apple-touch-icon.svg",
- },
-};
+export async function generateMetadata() {
+ const settings = await getSettings();
+ const instanceName = settings?.instanceName || "OmniRoute";
+ const customFaviconUrl = settings?.customFaviconUrl || settings?.customFaviconBase64;
+
+ return {
+ title: `${instanceName} — AI Gateway for Multi-Provider LLMs`,
+ description:
+ "OmniRoute is an AI gateway for multi-provider LLMs. One endpoint for all your AI providers.",
+ icons: {
+ icon: customFaviconUrl ? "/api/settings/favicon" : "/favicon.svg",
+ apple: "/apple-touch-icon.svg",
+ },
+ };
+}
export default async function RootLayout({ children }) {
const locale = await getLocale();
diff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.json
index 5afdda66ed..693ffdcdc4 100644
--- a/src/i18n/messages/en.json
+++ b/src/i18n/messages/en.json
@@ -1798,6 +1798,11 @@
"uploadLogo": "Upload Logo",
"resetLogo": "Reset to Default",
"logoPreview": "Preview",
+ "customFavicon": "Browser Favicon",
+ "customFaviconDesc": "URL to your custom favicon (shown in browser tab)",
+ "uploadFavicon": "Upload Favicon",
+ "resetFavicon": "Reset Favicon",
+ "faviconPreview": "Favicon Preview",
"promptCache": "Prompt Cache",
"flushCache": "Flush Cache",
"flushing": "Flushing…",
diff --git a/src/shared/validation/settingsSchemas.ts b/src/shared/validation/settingsSchemas.ts
index 76c86b332d..de5c1fc53c 100644
--- a/src/shared/validation/settingsSchemas.ts
+++ b/src/shared/validation/settingsSchemas.ts
@@ -18,6 +18,8 @@ export const updateSettingsSchema = z.object({
instanceName: z.string().max(100).optional(),
customLogoUrl: z.string().max(2000).optional(),
customLogoBase64: z.string().max(100000).optional(),
+ customFaviconUrl: z.string().max(2000).optional(),
+ customFaviconBase64: z.string().max(50000).optional(),
corsOrigins: z.string().max(500).optional(),
cloudUrl: z.string().max(500).optional(),
baseUrl: z.string().max(500).optional(),