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
feat(db): extend replaceCustomModels with metadata fields
Chris Staleybd5f39e1c6a8
diff --git a/src/lib/db/models.ts b/src/lib/db/models.tsindex 74234a7f12..9e2bc118b9 100644--- a/src/lib/db/models.ts+++ b/src/lib/db/models.ts@@ -383,6 +383,10 @@ export async function replaceCustomModels(source?: string;apiFormat?: string;supportedEndpoints?: string[];+ inputTokenLimit?: number;+ outputTokenLimit?: number;+ description?: string;+ supportsThinking?: boolean;}>,{ allowEmpty = false }: { allowEmpty?: boolean } = {}) {@@ -412,6 +416,27 @@ export async function replaceCustomModels(source: m.source || "auto-sync",apiFormat: m.apiFormat || (prev as any)?.apiFormat || "chat-completions",supportedEndpoints: m.supportedEndpoints || (prev as any)?.supportedEndpoints || ["chat"],+ // Preserve metadata from provider API (or previous sync)+ ...(m.inputTokenLimit != null+ ? { inputTokenLimit: m.inputTokenLimit }+ : (prev as any)?.inputTokenLimit != null+ ? { inputTokenLimit: (prev as any).inputTokenLimit }+ : {}),+ ...(m.outputTokenLimit != null+ ? { outputTokenLimit: m.outputTokenLimit }+ : (prev as any)?.outputTokenLimit != null+ ? { outputTokenLimit: (prev as any).outputTokenLimit }+ : {}),+ ...(m.description != null+ ? { description: m.description }+ : (prev as any)?.description != null+ ? { description: (prev as any).description }+ : {}),+ ...(m.supportsThinking != null+ ? { supportsThinking: m.supportsThinking }+ : (prev as any)?.supportsThinking != null+ ? { supportsThinking: (prev as any).supportsThinking }+ : {}),// Preserve existing compat flags...(prev && (prev as any).normalizeToolCallId !== undefined? { normalizeToolCallId: (prev as any).normalizeToolCallId }