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

fix: filter registry models from auto-sync to prevent duplicates

Chris Staley8e17756bf86f
diff --git a/src/app/(dashboard)/dashboard/providers/[id]/page.tsx b/src/app/(dashboard)/dashboard/providers/[id]/page.tsx
index 7a90775412..66488b657e 100644
--- a/src/app/(dashboard)/dashboard/providers/[id]/page.tsx
+++ b/src/app/(dashboard)/dashboard/providers/[id]/page.tsx
@@ -1460,14 +1460,6 @@ export default function ProviderDetailPage() {
return;
}
- setImportProgress((prev) => ({
- ...prev,
- phase: "importing",
- total: fetchedModels.length,
- status: t("importingModelsProgress", { current: 0, total: fetchedModels.length }),
- logs: [t("foundModelsStartingImport", { count: fetchedModels.length })],
- }));
-
const existingIds = new Set([
...(modelMeta.customModels || []).map((m: any) => m.id),
...models.map((m: any) => m.id),
@@ -1483,6 +1475,8 @@ export default function ProviderDetailPage() {
status: t("allModelsAlreadyImported") || "All models already imported",
logs: [t("noNewModelsToImport") || "No new models to import"],
importedCount: 0,
+ total: 0,
+ current: 0,
}));
return;
}
@@ -1490,7 +1484,8 @@ export default function ProviderDetailPage() {
setImportProgress((prev) => ({
...prev,
phase: "importing",
- total: fetchedModels.length,
+ total: newModels.length,
+ current: 0,
status: t("importingModelsProgress", { current: 0, total: newModels.length }),
logs: [
t("foundModelsStartingImport", { count: newModels.length }),
diff --git a/src/app/api/providers/[id]/sync-models/route.ts b/src/app/api/providers/[id]/sync-models/route.ts
index c86fd1ad52..b9a4e9d4f5 100644
--- a/src/app/api/providers/[id]/sync-models/route.ts
+++ b/src/app/api/providers/[id]/sync-models/route.ts
@@ -7,6 +7,7 @@ import {
buildModelSyncInternalHeaders,
isModelSyncInternalRequest,
} from "@/shared/services/modelSyncScheduler";
+import { getModelsByProviderId } from "@/shared/constants/models";
/**
* POST /api/providers/[id]/sync-models
@@ -75,6 +76,11 @@ export async function POST(request: Request, { params }: { params: Promise<{ id:
const fetchedModels = modelsData.models || [];
+ // Filter out models already in the built-in registry
+ const registryIds = new Set(
+ getModelsByProviderId(connection.provider).map((m: any) => m.id)
+ );
+
// Replace the full model list
const models = fetchedModels
.map((m: any) => ({
@@ -82,7 +88,7 @@ export async function POST(request: Request, { params }: { params: Promise<{ id:
name: m.name || m.displayName || m.id || m.model,
source: "auto-sync",
}))
- .filter((m: any) => m.id);
+ .filter((m: any) => m.id && !registryIds.has(m.id));
const replaced = await replaceCustomModels(connection.provider, models);