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(github): route GitHub Models via models.github.ai/inference (#18)

Tashfeena7c72418cc72
diff --git a/server/src/providers/index.ts b/server/src/providers/index.ts
index 13318797..7de4261a 100644
--- a/server/src/providers/index.ts
+++ b/server/src/providers/index.ts
@@ -61,11 +61,13 @@ register(new OpenAICompatProvider({
},
}));
-// GitHub Models - OpenAI-compatible via Azure endpoint
+// GitHub Models — OpenAI-compatible. Catalog uses `<publisher>/<model>` ids
+// (e.g. `openai/gpt-4.1`); the old Azure endpoint rejects that prefix with
+// "Unknown model", so route to the current models.github.ai endpoint.
register(new OpenAICompatProvider({
platform: 'github',
name: 'GitHub Models',
- baseUrl: 'https://models.inference.ai.azure.com',
+ baseUrl: 'https://models.github.ai/inference',
}));
// Cohere - OpenAI-compatible via Cohere compatibility endpoint
diff --git a/server/src/routes/proxy.ts b/server/src/routes/proxy.ts
index 8cc05f2d..1c60cee6 100644
--- a/server/src/routes/proxy.ts
+++ b/server/src/routes/proxy.ts
@@ -191,7 +191,7 @@ proxyRouter.post('/chat/completions', async (req: Request, res: Response) => {
return;
}
- const { temperature, max_tokens, top_p, stream, tools, tool_choice, parallel_tool_calls } = parsed.data;
+ const { model: requestedModel, temperature, max_tokens, top_p, stream, tools, tool_choice, parallel_tool_calls } = parsed.data;
const messages: ChatMessage[] = parsed.data.messages.map((m): ChatMessage => {
if (m.role === 'assistant') {
return {
@@ -224,8 +224,17 @@ proxyRouter.post('/chat/completions', async (req: Request, res: Response) => {
}, 0);
const estimatedTotal = estimatedInputTokens + (max_tokens ?? 1000);
- // Sticky session: prefer the same model for multi-turn conversations
- const preferredModel = getStickyModel(messages);
+ // Explicit `model` field pins routing; sticky-session is the fallback.
+ let preferredModel: number | undefined;
+ if (requestedModel) {
+ const row = getDb()
+ .prepare('SELECT id FROM models WHERE model_id = ? AND enabled = 1')
+ .get(requestedModel) as { id: number } | undefined;
+ if (row) preferredModel = row.id;
+ }
+ if (preferredModel === undefined) {
+ preferredModel = getStickyModel(messages);
+ }
// Retry loop: on 429/rate limit, skip that model+key and try the next one
const skipKeys = new Set<string>();