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
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
chore(release): merge PR 937 and fix catalog models context length types
diegosouzapw954c40067e7c
diff --cc CHANGELOG.mdindex acd62261ca,dbdb434295..2a3dba18b5--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -4,27 -4,6 +4,30 @@@---+## [3.4.7] — 2026-04-03++### Features++- Added `Cryptography` node to Monitoring and MCP health checks (#798)+- Hardened model-catalog route permissions mapping (`/models`) (#781)++### Bug Fixes+++- Fixed Claude OAuth token refreshes failing to preserve cache contexts (#937)++- Fixed CC-Compatible provider errors rendering cached models unreachable (#937)++- Fixed GitHub Executor errors related to invalid context arrays (#937)+- Fixed NPM-installed CLI tools healthcheck failures on Windows (#935)+- Fixed payload translation dropping valid content due to invalid API fields (#927)+- Fixed runtime crash in Node 25 regarding API key execution (#867)+- Fixed MCP standalone module-resolution (`ERR_MODULE_NOT_FOUND`) via `esbuild` (#936)+- Fixed NVIDIA NIM routing credential resolution alias mismatch (#931)++### Security++- Added safe strict input boundary protection against raw `shell: true` remote-code execution injections.++---+## [3.4.6] - 2026-04-02### ✨ New Featuresdiff --cc open-sse/handlers/chatCore.tsindex c536220dcb,9d74cf0997..ca0d493c49--- a/open-sse/handlers/chatCore.ts+++ b/open-sse/handlers/chatCore.ts@@@ -1377,12 -1377,16 +1379,20 @@@ export async function handleChatCore(`[provider] Node ${connectionId} account deactivated (${statusCode}) — disabling permanently`);} else if (errorType === PROVIDER_ERROR_TYPES.RATE_LIMITED) {- // For passthrough providers (e.g. Antigravity), each model has independent- // quota. A 429 on one model must NOT lock out the entire connection — other- // models may still have quota available. Use lockModel() instead.- const isPassthrough = provider && getPassthroughProviders().has(provider);- if (isPassthrough) {- const { lockModel } = await import("../services/accountFallback.ts");- const cooldown = retryAfterMs || 120_000; // 2 min default, same as COOLDOWN_MS.rateLimit- lockModel(provider, connectionId, model, "rate_limited", cooldown);+ // For providers with per-model quotas (passthrough providers, Gemini),+ // each model has independent quota. A 429 on one model must NOT lock out+ // the entire connection — other models may still have quota available.- if (lockModelIfPerModelQuota(provider, connectionId, model, "rate_limited", retryAfterMs || COOLDOWN_MS.rateLimit)) {++ if (++ lockModelIfPerModelQuota(++ provider,++ connectionId,++ model,++ "rate_limited",++ retryAfterMs || COOLDOWN_MS.rateLimit++ )++ ) {console.warn(- `[provider] Node ${connectionId} model-only rate limited (${statusCode}) for ${model} - ${Math.ceil(cooldown / 1000)}s (connection stays active)`+ `[provider] Node ${connectionId} model-only rate limited (${statusCode}) for ${model} - ${Math.ceil((retryAfterMs || COOLDOWN_MS.rateLimit) / 1000)}s (connection stays active)`);} else {const rateLimitedUntil = new Date(Date.now() + retryAfterMs).toISOString();@@@ -1400,20 -1404,13 +1410,28 @@@);}} else if (errorType === PROVIDER_ERROR_TYPES.QUOTA_EXHAUSTED) {- await updateProviderConnection(connectionId, {- testStatus: "credits_exhausted",- lastErrorType: errorType,- lastError: message,- errorCode: statusCode,- });- console.warn(`[provider] Node ${connectionId} exhausted quota (${statusCode})`);+ // Providers with per-model quotas — lock the model only, not the connection- if (lockModelIfPerModelQuota(provider, connectionId, model, "quota_exhausted", retryAfterMs || COOLDOWN_MS.rateLimit)) {++ if (++ lockModelIfPerModelQuota(++ provider,++ connectionId,++ model,++ "quota_exhausted",++ retryAfterMs || COOLDOWN_MS.rateLimit++ )++ ) {+ console.warn(+ `[provider] Node ${connectionId} model-only quota exhausted (${statusCode}) for ${model} - ${Math.ceil((retryAfterMs || COOLDOWN_MS.rateLimit) / 1000)}s (connection stays active)`+ );+ } else {+ await updateProviderConnection(connectionId, {+ testStatus: "credits_exhausted",+ lastErrorType: errorType,+ lastError: message,+ errorCode: statusCode,+ });+ console.warn(`[provider] Node ${connectionId} exhausted quota (${statusCode})`);+ }} else if (errorType === PROVIDER_ERROR_TYPES.ACCOUNT_DEACTIVATED) {await updateProviderConnection(connectionId, {isActive: false,diff --cc src/app/api/v1/models/catalog.tsindex 2cd0e8465b,5bc841e6af..c39df2f274--- a/src/app/api/v1/models/catalog.ts+++ b/src/app/api/v1/models/catalog.ts@@@ -18,7 -18,7 +18,8 @@@ import { getAllModerationModels } fromimport { getAllVideoModels } from "@omniroute/open-sse/config/videoRegistry.ts";import { getAllMusicModels } from "@omniroute/open-sse/config/musicRegistry.ts";import { REGISTRY } from "@omniroute/open-sse/config/providerRegistry.ts";+import { getSyncedAvailableModels } from "@/lib/db/models";+ import { getCompatibleFallbackModels } from "@/lib/providers/managedAvailableModels";const FALLBACK_ALIAS_TO_PROVIDER = {ag: "antigravity",@@@ -297,63 -297,6 +298,61 @@@ export async function getUnifiedModelsR}}+ // Gemini: synced API models exclusively (outside PROVIDER_MODELS loop since registry is empty)+ if (activeAliases.has("gemini") && !blockedProviders.has("gemini")) {+ try {+ const syncedModels = await getSyncedAvailableModels("gemini");+ for (const sm of syncedModels) {+ const aliasId = `gemini/${sm.id}`;+ if (getModelIsHidden("gemini", sm.id)) continue;++ // Convert supportedEndpoints to type/subtype for endpoint categorization- const endpoints = Array.isArray(sm.supportedEndpoints)- ? sm.supportedEndpoints- : ["chat"];++ const endpoints = Array.isArray(sm.supportedEndpoints) ? sm.supportedEndpoints : ["chat"];+ let modelType: string | undefined;+ if (endpoints.includes("embeddings")) modelType = "embedding";+ else if (endpoints.includes("images")) modelType = "image";+ else if (endpoints.includes("audio")) modelType = "audio";++ models.push({+ id: aliasId,+ object: "model",+ created: timestamp,+ owned_by: "gemini",+ permission: [],+ root: sm.id,+ parent: null,+ ...(modelType ? { type: modelType } : {}),+ ...(modelType === "audio" ? { subtype: "transcription" } : {}),+ ...(sm.inputTokenLimit ? { context_length: sm.inputTokenLimit } : {}),+ ...(endpoints.length > 1 || !endpoints.includes("chat")+ ? { supported_endpoints: endpoints }+ : {}),+ });++ // For audio models, also add a speech variant so they appear in both sections+ if (modelType === "audio") {+ models.push({+ id: aliasId,+ object: "model",+ created: timestamp,+ owned_by: "gemini",+ permission: [],+ root: sm.id,+ parent: null,+ type: "audio",+ subtype: "speech",+ ...(sm.inputTokenLimit ? { context_length: sm.inputTokenLimit } : {}),+ ...(endpoints.length > 1 || !endpoints.includes("chat")+ ? { supported_endpoints: endpoints }+ : {}),+ });+ }+ }+ } catch (err) {+ console.error("[catalog] Error fetching synced Gemini models:", err);+ }+ }+// Helper: check if a provider is active (by provider id or alias)const isProviderActive = (provider: string) => {if (activeAliases.size === 0) return false; // No active connections = show nothing@@@ -551,6 -486,45 +550,47 @@@console.log("Could not fetch custom models");}+ // Add managed fallback models for compatible providers that don't import a model list.+ for (const conn of connections) {+ const providerId = typeof conn.provider === "string" ? conn.provider : null;+ if (!providerId) continue;+ if (blockedProviders.has(providerId)) continue;++ const fallbackModels = getCompatibleFallbackModels(providerId);+ if (!Array.isArray(fallbackModels) || fallbackModels.length === 0) continue;++ const prefix = providerIdToPrefix[providerId];+ const alias = prefix || providerIdToAlias[providerId] || providerId;++ for (const model of fallbackModels) {+ const modelId = typeof model.id === "string" ? model.id : null;+ if (!modelId) continue;+ if (getModelIsHidden(providerId, modelId)) continue;++ const aliasId = `${alias}/${modelId}`;+ if (models.some((m) => m.id === aliasId)) continue;++ const visionFields =+ getVisionCapabilityFields(aliasId) || getVisionCapabilityFields(modelId);+ const contextLength =- typeof model.contextLength === "number" ? model.contextLength : undefined;++ typeof (model as any).contextLength === "number"++ ? (model as any).contextLength++ : undefined;++ models.push({+ id: aliasId,+ object: "model",+ created: timestamp,+ owned_by: providerId,+ permission: [],+ root: modelId,+ parent: null,+ ...(contextLength ? { context_length: contextLength } : {}),+ ...(visionFields || {}),+ });+ }+ }+// Filter by API key permissions if requestedconst authHeader = request.headers.get("authorization");let finalModels = models;