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(catalog): use stored inputTokenLimit for custom model context_length

Chris Staley49ac0cadfbb0
diff --git a/src/app/api/v1/models/catalog.ts b/src/app/api/v1/models/catalog.ts
index 73d4998c6f..257df2295a 100644
--- a/src/app/api/v1/models/catalog.ts
+++ b/src/app/api/v1/models/catalog.ts
@@ -454,6 +454,9 @@ export async function getUnifiedModelsResponse(
...(endpoints.length > 1 || !endpoints.includes("chat")
? { supported_endpoints: endpoints }
: {}),
+ ...(typeof (model as any).inputTokenLimit === "number"
+ ? { context_length: (model as any).inputTokenLimit }
+ : {}),
...(visionFields || {}),
});
@@ -476,6 +479,9 @@ export async function getUnifiedModelsResponse(
parent: aliasId,
custom: true,
...(modelType ? { type: modelType } : {}),
+ ...(typeof (model as any).inputTokenLimit === "number"
+ ? { context_length: (model as any).inputTokenLimit }
+ : {}),
...(providerVisionFields || {}),
});
}