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

fix: add auth token required for models endpoint

Tazrif Raim23fd42caa995
diff --git a/server/src/routes/proxy.ts b/server/src/routes/proxy.ts
index e3fc6a9b..36eb7479 100644
--- a/server/src/routes/proxy.ts
+++ b/server/src/routes/proxy.ts
@@ -103,7 +103,14 @@ export function setStickyModel(messages: ChatMessage[], modelDbId: number) {
}
// OpenAI-compatible /models endpoint (used by Hermes for metadata)
-proxyRouter.get('/models', (_req: Request, res: Response) => {
+proxyRouter.get('/models', (req: Request, res: Response) => {
+ const token = extractApiToken(req);
+ const unifiedKey = getUnifiedApiKey();
+ if (!token || !timingSafeStringEqual(token, unifiedKey)) {
+ res.status(401).json({ error: { message: 'Invalid API key', type: 'authentication_error' } });
+ return;
+ }
+
const db = getDb();
const models = db.prepare(`
SELECT platform, model_id, display_name, context_window