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(gemini): extract metadata from models API response
Chris Staleyf1805c853631
diff --git a/src/app/api/providers/[id]/models/route.ts b/src/app/api/providers/[id]/models/route.tsindex 78d098a567..4c6a5da111 100644--- a/src/app/api/providers/[id]/models/route.ts+++ b/src/app/api/providers/[id]/models/route.ts@@ -131,12 +131,52 @@ const PROVIDER_MODELS_CONFIG: Record<string, ProviderModelsConfigEntry> = {method: "GET",headers: { "Content-Type": "application/json" },authQuery: "key", // Use query param for API key- parseResponse: (data) =>- (data.models || []).map((m) => ({- ...m,- id: (m.name || m.id || "").replace(/^models\//, ""),- name: m.displayName || (m.name || "").replace(/^models\//, ""),- })),+ parseResponse: (data) => {+ const METHOD_TO_ENDPOINT: Record<string, string> = {+ generateContent: "chat",+ embedContent: "embeddings",+ predict: "images",+ predictLongRunning: "images",+ bidiGenerateContent: "audio",+ generateAnswer: "chat",+ };+ const IGNORED_METHODS = new Set([+ "countTokens",+ "countTextTokens",+ "createCachedContent",+ "batchGenerateContent",+ "asyncBatchEmbedContent",+ ]);++ return (data.models || []).map((m: Record<string, unknown>) => {+ const methods: string[] = Array.isArray(m.supportedGenerationMethods)+ ? m.supportedGenerationMethods+ : [];+ const endpoints = [+ ...new Set(+ methods+ .filter((method) => !IGNORED_METHODS.has(method))+ .map((method) => METHOD_TO_ENDPOINT[method] || "chat")+ ),+ ];+ if (endpoints.length === 0) endpoints.push("chat");++ return {+ ...m,+ id: ((m.name as string) || (m.id as string) || "").replace(/^models\//, ""),+ name: (m.displayName as string) || ((m.name as string) || "").replace(/^models\//, ""),+ supportedEndpoints: endpoints,+ ...(typeof m.inputTokenLimit === "number"+ ? { inputTokenLimit: m.inputTokenLimit }+ : {}),+ ...(typeof m.outputTokenLimit === "number"+ ? { outputTokenLimit: m.outputTokenLimit }+ : {}),+ ...(typeof m.description === "string" ? { description: m.description } : {}),+ ...(m.thinking === true ? { supportsThinking: true } : {}),+ };+ });+ },},// gemini-cli handled via retrieveUserQuota (see GET handler)qwen: {