Skip to content

7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.

TypeScript

filter v1 models by connected providers

hmm1832180eadf7a3d
diff --git a/server/src/routes/proxy.ts b/server/src/routes/proxy.ts
index 23881a7b..35264061 100644
--- a/server/src/routes/proxy.ts
+++ b/server/src/routes/proxy.ts
@@ -114,7 +114,8 @@ export function setStickyModel(messages: ChatMessage[], modelDbId: number, sessi
}
}
-// OpenAI-compatible /models endpoint (used by Hermes for metadata)
+// OpenAI-compatible /models endpoint (used by Hermes for metadata)
+// shows API models which is linked by the user
proxyRouter.get('/models', (req: Request, res: Response) => {
const token = extractApiToken(req);
const unifiedKey = getUnifiedApiKey();
@@ -132,8 +133,14 @@ proxyRouter.get('/models', (req: Request, res: Response) => {
PARTITION BY model_id
ORDER BY intelligence_rank ASC, id ASC
) AS rn
- FROM models
- WHERE enabled = 1
+ FROM models m
+ WHERE m.enabled = 1
+ AND EXISTS (
+ SELECT 1 FROM api_keys k
+ WHERE k.platform = m.platform
+ AND k.enabled = 1
+ AND (m.key_id IS NULL OR k.id = m.key_id)
+ )
)
WHERE rn = 1
ORDER BY intelligence_rank ASC, id ASC
@@ -162,6 +169,7 @@ proxyRouter.get('/models', (req: Request, res: Response) => {
});
});
+
const MAX_RETRIES = 20;
// Echo-tolerant tool calls: agents replay OUR responses back as history, and