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

feat(providers): add Router9 and Septor Labs adapters (#1194)

Tashfeen194f5891c1e3
diff --git a/client/src/components/keys/shared.tsx b/client/src/components/keys/shared.tsx
index 68906d83..1f0a093f 100644
--- a/client/src/components/keys/shared.tsx
+++ b/client/src/components/keys/shared.tsx
@@ -32,6 +32,8 @@ export const PLATFORMS: { value: Platform; label: string; url: string; keyless?:
{ value: 'sail', label: 'Sail Research ($5 monthly with payment method)', url: 'https://app.sailresearch.com' },
{ value: 'electronhub', label: 'ElectronHub (shared weekly credits)', url: 'https://app.electronhub.ai' },
{ value: 'experiential', label: 'Experiential Labs (shared monthly credits)', url: 'https://platform.experientiallabs.ai' },
+ { value: 'router9', label: 'Router9 (shared monthly credits)', url: 'https://www.router9.com' },
+ { value: 'septor', label: 'Septor Labs (daily free-model quota)', url: 'https://septorlabs.com/dashboard' },
{ value: 'bai', label: 'B.AI (promotional free model)', url: 'https://b.ai' },
{ value: 'radeon', label: 'AMD Radeon Cloud (free shared models)', url: 'https://developer.amd.com.cn/radeon/tokenfactory' },
{ value: 'nvidia', label: 'NVIDIA NIM', url: 'https://build.nvidia.com/settings/api-keys' },
diff --git a/client/src/lib/routing.ts b/client/src/lib/routing.ts
index c446a122..a8df6c9e 100644
--- a/client/src/lib/routing.ts
+++ b/client/src/lib/routing.ts
@@ -382,6 +382,8 @@ export const platformColors: Record<string, string> = {
sail: '#0ea5e9',
electronhub: '#6366f1',
experiential: '#14b8a6',
+ router9: '#8b5cf6',
+ septor: '#0891b2',
bai: '#111827',
radeon: '#ed1c24',
nvidia: '#76b900',
diff --git a/docs/router9-septor.md b/docs/router9-septor.md
new file mode 100644
index 00000000..fa60a79e
--- /dev/null
+++ b/docs/router9-septor.md
@@ -0,0 +1,46 @@
+# Router9 and Septor Labs
+
+Both are first-class OpenAI-compatible chat providers. Select them on the Keys
+page or import `ROUTER9_API_KEY` / `SEPTOR_API_KEY`. This integration does not
+seed model rows: the signed Oracle catalog controls availability and the
+existing Premium-immediate / Free-after-30-days release gate.
+
+## Free access (checked 2026-09-10)
+
+- [Router9](https://www.router9.com/docs/token-plan/credits): 50,000 shared
+ credits (about $5) each month on Free. Only provider-allowlisted models work;
+ the tested route is `minimax/minimax-m3`. `auto` currently returns 404. Paid
+ top-ups are optional and outside the free allowance.
+- [Septor Labs](https://septorlabs.com/pricing): zero-price free models share
+ 50 requests / 500K tokens daily. Its separate $1 signup grant expires after
+ 90 days and is **not** a recurring monthly grant. Tested matching routes:
+ `hermes-3-llama-3.1-405b-free`, `minimax-m2.5-free`, `qwen3-coder-free`, and
+ `qwen3-next-80b-a3b-instruct-free`.
+
+## Integration details
+
+Router9's `/v1/models` is public even with an invalid bearer. Key validation
+instead sends an incomplete, no-generation request to `/v1/chat/completions`.
+A valid key yields `404 model_not_found` with account credit headers; an invalid
+key yields 401. Validation consumes request quota, not inference credits.
+Unknown verdicts (including generic proxy 404/429) remain inconclusive rather
+than disabling a valid key. Streaming reuses the existing think-tag filter and
+EOF handling; Router9 sends a finish reason and usage but no `[DONE]` sentinel.
+Its live request-limit headers disagree with its documentation, so no fixed
+request limit is invented. Actual credit headers feed the shared quota pool.
+
+Septor authenticates `/v1/models`. Eleven other free IDs returned MiniMax M2.5
+instead of the requested model during testing. Its adapter rejects mismatched
+or missing response model IDs with a retryable 502, including before yielding
+stream content, instead of silently reporting a substituted model. Explicit
+`auto` routing may report a different model; it is not seeded or published by
+this change. Model-ID matching is provider response evidence, not independent
+verification of underlying weights.
+
+No keys, paid plans, catalog snapshots, DB model migrations, or release-gate
+changes are included in this integration.
+
+The compiled adapters passed ten live inference checks (normal and streaming
+for all five routes), plus valid/invalid key checks for both providers. Septor
+reported zero charged cost for all eight adapter inference checks. All ten
+answers completed with the expected text; these are smoke tests, not benchmarks.
diff --git a/server/src/__tests__/lib/key-parser.test.ts b/server/src/__tests__/lib/key-parser.test.ts
index d98d1451..99296b3a 100644
--- a/server/src/__tests__/lib/key-parser.test.ts
+++ b/server/src/__tests__/lib/key-parser.test.ts
@@ -76,6 +76,11 @@ describe('key parser', () => {
expect(detectPlatform('EXPERIENTIALLABS_')).toBe('experiential');
expect(detectPlatform('EXPERIENTIAL_LABS_')).toBe('experiential');
expect(detectPlatform('EXPLABS_')).toBe('experiential');
+ expect(detectPlatform('ROUTER9_')).toBe('router9');
+ expect(detectPlatform('ROUTER_9_')).toBe('router9');
+ expect(detectPlatform('SEPTOR_')).toBe('septor');
+ expect(detectPlatform('SEPTORLABS_')).toBe('septor');
+ expect(detectPlatform('SEPTOR_LABS_')).toBe('septor');
expect(detectPlatform('SAMBANOVA_')).toBeNull();
});
@@ -97,6 +102,11 @@ describe('key parser', () => {
expect(AUTH_JSON_PROVIDER_MAP['electron-hub']).toBe('electronhub');
expect(AUTH_JSON_PROVIDER_MAP['experiential-labs']).toBe('experiential');
expect(AUTH_JSON_PROVIDER_MAP['explabs']).toBe('experiential');
+ expect(AUTH_JSON_PROVIDER_MAP['router9']).toBe('router9');
+ expect(AUTH_JSON_PROVIDER_MAP['router-9']).toBe('router9');
+ expect(AUTH_JSON_PROVIDER_MAP['septor']).toBe('septor');
+ expect(AUTH_JSON_PROVIDER_MAP['septor-labs']).toBe('septor');
+ expect(AUTH_JSON_PROVIDER_MAP['septorlabs']).toBe('septor');
const result = parseAuthJson(JSON.stringify({
credential_pool: {
gemini: [{ id: '1', label: 'Gemini', auth_type: 'api_key', access_token: 'AIza-test' }],
diff --git a/server/src/__tests__/providers/router9-septor.test.ts b/server/src/__tests__/providers/router9-septor.test.ts
new file mode 100644
index 00000000..c388f749
--- /dev/null
+++ b/server/src/__tests__/providers/router9-septor.test.ts
@@ -0,0 +1,153 @@
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import type { ChatCompletionChunk } from '@freellmapi/shared/types.js';
+import { getProvider, hasProvider } from '../../providers/index.js';
+import { isRetryableError } from '../../lib/error-classify.js';
+
+const credits = { 'x-credits-limit': '50000', 'x-credits-remaining': '49998.4484' };
+const json = (body: unknown, status = 200, headers: Record<string, string> = {}) =>
+ new Response(JSON.stringify(body), { status, headers: { 'Content-Type': 'application/json', ...headers } });
+function completion(model: string, content = '42') {
+ return { id: 'test', object: 'chat.completion', created: 1, model,
+ choices: [{ index: 0, message: { role: 'assistant', content }, finish_reason: 'stop' }],
+ usage: { prompt_tokens: 10, completion_tokens: 2, total_tokens: 12 } };
+}
+function chunk(model: string, content?: string, finish: 'stop' | null = null): ChatCompletionChunk {
+ return { id: 'test', object: 'chat.completion.chunk', created: 1, model,
+ choices: [{ index: 0, delta: content === undefined ? { role: 'assistant' } : { content }, finish_reason: finish }] };
+}
+function sse(chunks: ChatCompletionChunk[], done = false) {
+ return new Response(chunks.map(c => `data: ${JSON.stringify(c)}\n\n`).join('') + (done ? 'data: [DONE]\n\n' : ''), {
+ headers: { 'Content-Type': 'text/event-stream' },
+ });
+}
+async function collect(source: AsyncGenerator<ChatCompletionChunk>) {
+ const result: ChatCompletionChunk[] = [];
+ for await (const c of source) result.push(c);
+ return result;
+}
+
+describe('Router9 and Septor adapters', () => {
+ afterEach(() => vi.restoreAllMocks());
+
+ it.each([
+ ['router9', 'https://api.router9.com/v1'],
+ ['septor', 'https://api.septorlabs.com/v1'],
+ ] as const)('%s registers and forwards auth, model, options and usage', async (platform, base) => {
+ expect(hasProvider(platform)).toBe(true);
+ const fetch = vi.spyOn(global, 'fetch').mockResolvedValue(json(completion('test-model')));
+ const result = await getProvider(platform)!.chatCompletion('test-key', [{ role: 'user', content: 'Hi' }], 'test-model', {
+ max_tokens: 128, temperature: 0.2, top_p: 0.8,
+ tools: [{ type: 'function', function: { name: 'lookup', parameters: { type: 'object', properties: {} } } }],
+ });
+ expect(fetch.mock.calls[0][0]).toBe(`${base}/chat/completions`);
+ expect(new Headers(fetch.mock.calls[0][1]?.headers).get('authorization')).toBe('Bearer test-key');
+ expect(JSON.parse(String(fetch.mock.calls[0][1]?.body))).toMatchObject({ model: 'test-model', max_tokens: 128, temperature: 0.2, top_p: 0.8 });
+ expect(result.usage.total_tokens).toBe(12);
+ expect(result._routed_via).toEqual({ platform, model: 'test-model' });
+ });
+
+ it('Router9 validates using a no-generation auth probe, not its public roster', async () => {
+ const fetch = vi.spyOn(global, 'fetch').mockResolvedValue(json({ error: { code: 'model_not_found' } }, 404, credits));
+ await expect(getProvider('router9')!.validateKey('test-key')).resolves.toBe(true);
+ const [url, init] = fetch.mock.calls[0];
+ expect(url).toBe('https://api.router9.com/v1/chat/completions');
+ expect(init?.method).toBe('POST');
+ expect(JSON.parse(String(init?.body))).toEqual({ messages: [] });
+ expect(new Headers(init?.headers).get('authorization')).toBe('Bearer test-key');
+ });
+
+ it('Router9 rejects invalid credentials', async () => {
+ vi.spyOn(global, 'fetch').mockResolvedValue(json({ error: 'Invalid API key' }, 401));
+ await expect(getProvider('router9')!.validateKey('bad-test-key')).resolves.toMatchObject({ valid: false });
+ });
+
+ it.each([402, 429])('Router9 keeps authenticated but exhausted keys valid (%s)', async status => {
+ vi.spyOn(global, 'fetch').mockResolvedValue(json({ error: 'Quota exhausted' }, status, { ...credits, 'x-credits-remaining': '0' }));
+ await expect(getProvider('router9')!.validateKey('test-key')).resolves.toBe(true);
+ });
+
+ it.each([
+ [404, {}, { error: { code: 'model_not_found' } }],
+ [404, credits, { error: { code: 'not_found' } }],
+ [404, { ...credits, 'x-credits-limit': '' }, { error: { code: 'model_not_found' } }],
+ [404, { ...credits, 'x-credits-remaining': 'unknown' }, { error: { code: 'model_not_found' } }],
+ [403, credits, { error: 'Forbidden' }],
+ [429, {}, { error: 'Edge limit' }],
+ [503, credits, { error: 'Unavailable' }],
+ [200, {}, { data: [] }],
+ ] as const)('Router9 does not misclassify an inconclusive response as a live or revoked key (%s)', async (status, headers, body) => {
+ vi.spyOn(global, 'fetch').mockResolvedValue(json(body, status, headers));
+ await expect(getProvider('router9')!.validateKey('test-key')).rejects.toThrow('inconclusive');
+ });
+
+ it('Septor validates through its authenticated model endpoint', async () => {
+ const fetch = vi.spyOn(global, 'fetch').mockResolvedValue(json({ data: [] }));
+ await expect(getProvider('septor')!.validateKey('test-key')).resolves.toBe(true);
+ expect(fetch.mock.calls[0][0]).toBe('https://api.septorlabs.com/v1/models');
+ expect(fetch.mock.calls[0][1]?.method).toBe('GET');
+ });
+
+ it.each([401, 403])('Septor rejects invalid credentials (%s)', async status => {
+ vi.spyOn(global, 'fetch').mockResolvedValue(json({ error: { message: 'Invalid key' } }, status));
+ await expect(getProvider('septor')!.validateKey('bad-test-key')).resolves.toMatchObject({ valid: false });
+ });
+
+ it('Router9 reuses inline-reasoning normalization for non-streaming answers', async () => {
+ vi.spyOn(global, 'fetch').mockResolvedValue(json(completion('MiniMax-M3', '<think>19 + 23 = 42.</think>\n\n42')));
+ const result = await getProvider('router9')!.chatCompletion('test-key', [], 'minimax/minimax-m3');
+ expect(result.choices[0].message.content).toBe('42');
+ expect(result.choices[0].message.reasoning_content).toBe('19 + 23 = 42.');
+ });
+
+ it('Router9 normalizes split think tags and preserves EOF-terminal usage without [DONE]', async () => {
+ const model = 'MiniMax-M3';
+ const usage = { prompt_tokens: 10, completion_tokens: 2, total_tokens: 12 };
+ vi.spyOn(global, 'fetch').mockResolvedValue(sse([
+ chunk(model, '<thi'), chunk(model, 'nk>work</th'), chunk(model, 'ink>\n\n42', 'stop'),
+ { id: 'test', object: 'chat.completion.chunk', created: 1, model, choices: [], usage },
+ ]));
+ const result = await collect(getProvider('router9')!.streamChatCompletion('test-key', [], 'minimax/minimax-m3'));
+ expect(result.flatMap(c => c.choices).map(c => c.delta.content ?? '').join('')).toBe('42');
+ expect(result.flatMap(c => c.choices).map(c => c.delta.reasoning_content ?? '').join('')).toBe('work');
+ expect(result.at(-1)?.usage).toEqual(usage);
+ });
+
+ it('Router9 still rejects a genuinely truncated stream', async () => {
+ vi.spyOn(global, 'fetch').mockResolvedValue(sse([chunk('MiniMax-M3', 'unfinished')]));
+ await expect(collect(getProvider('router9')!.streamChatCompletion('test-key', [], 'minimax/minimax-m3'))).rejects.toThrow('stream ended unexpectedly');
+ });
+
+ it.each(['minimax-m2.5-free', ''])('Septor rejects substituted or missing non-streaming identity (%s)', async returned => {
+ vi.spyOn(global, 'fetch').mockResolvedValue(json(completion(returned)));
+ const error = await getProvider('septor')!.chatCompletion('test-key', [], 'qwen3-coder-free').catch(e => e);
+ expect(error.status).toBe(502);
+ expect(isRetryableError(error)).toBe(true);
+ });
+
+ it('Septor rejects a substituted stream before leaking content or tool calls', async () => {
+ vi.spyOn(global, 'fetch').mockResolvedValue(sse([chunk('minimax-m2.5-free', 'wrong model', 'stop')]));
+ const emitted: ChatCompletionChunk[] = [];
+ const consume = async () => {
+ for await (const c of getProvider('septor')!.streamChatCompletion('test-key', [], 'qwen3-coder-free')) emitted.push(c);
+ };
+ await expect(consume()).rejects.toMatchObject({ status: 502 });
+ expect(emitted).toEqual([]);
+ });
+
+ it('Septor passes matching stream identities and usage', async () => {
+ const model = 'qwen3-coder-free';
+ vi.spyOn(global, 'fetch').mockResolvedValue(sse([chunk(model, '42', 'stop')], true));
+ const result = await collect(getProvider('septor')!.streamChatCompletion('test-key', [], model));
+ expect(result[0].choices[0].delta.content).toBe('42');
+ });
+
+ it('Septor permits an explicitly requested auto route to name its chosen model', async () => {
+ vi.spyOn(global, 'fetch').mockResolvedValue(json(completion('minimax-m2.5-free')));
+ await expect(getProvider('septor')!.chatCompletion('test-key', [], 'auto')).resolves.toMatchObject({ model: 'minimax-m2.5-free' });
+ });
+
+ it.each(['router9', 'septor'] as const)('%s preserves upstream backoff', async platform => {
+ vi.spyOn(global, 'fetch').mockResolvedValue(json({ error: { message: 'Rate limit reached' } }, 429, { 'Retry-After': '60' }));
+ await expect(getProvider(platform)!.chatCompletion('test-key', [], 'test-model')).rejects.toMatchObject({ status: 429, retryAfterMs: 60_000 });
+ });
+});
diff --git a/server/src/__tests__/routes/keys.test.ts b/server/src/__tests__/routes/keys.test.ts
index 58afdfda..297a3f29 100644
--- a/server/src/__tests__/routes/keys.test.ts
+++ b/server/src/__tests__/routes/keys.test.ts
@@ -153,7 +153,7 @@ describe('Keys API', () => {
expect(status).toBe(400);
});
- it.each(['electronhub', 'experiential'])('accepts a %s key without seeding gated model rows', async platform => {
+ it.each(['electronhub', 'experiential', 'router9', 'septor'])('accepts a %s key without seeding gated model rows', async platform => {
const { status, body } = await request(app, 'POST', '/api/keys', {
platform, key: 'not-a-real-test-key-12345', label: 'Gateway test',
});
diff --git a/server/src/__tests__/services/provider-quota.test.ts b/server/src/__tests__/services/provider-quota.test.ts
index e88b1915..9c3ca8da 100644
--- a/server/src/__tests__/services/provider-quota.test.ts
+++ b/server/src/__tests__/services/provider-quota.test.ts
@@ -45,6 +45,10 @@ describe('provider-quota: pool inference', () => {
expect(inferQuotaPoolKey('electronhub', 'some-model:free')).toBe('electronhub::daily-free');
expect(inferQuotaPoolKey('experiential', 'glm-5.3')).toBe('experiential::monthly-credit');
expect(inferQuotaPoolKey('experiential', 'gpt-5.6-sol')).toBe('experiential::monthly-credit');
+ expect(inferQuotaPoolKey('router9', 'minimax/minimax-m3')).toBe('router9::monthly-credit');
+ expect(inferQuotaPoolKey('router9', 'another-model')).toBe('router9::monthly-credit');
+ expect(inferQuotaPoolKey('septor', 'qwen3-coder-free')).toBe('septor::daily-free');
+ expect(inferQuotaPoolKey('septor', 'minimax-m2.5-free')).toBe('septor::daily-free');
expect(inferQuotaPoolKey('openrouter', 'meta-llama/llama-3.1-8b-instruct:free')).toBe('openrouter::free');
expect(inferQuotaPoolKey('openrouter', 'openai/gpt-4o')).toBe('openrouter::account');
// AnyAPI's 100K tokens/day is one account-wide budget, so every model on
@@ -261,6 +265,23 @@ describe('provider-quota: parse from response headers (shared parseRetryAfterMs)
});
expect(observations.some(o => o.metric === 'credits')).toBe(false);
});
+
+ it('keeps Router9 decimal credit observations separate from tokens and undocumented request windows', () => {
+ const obs = parseQuotaObservationsFromResponse(new Response(null, { headers: {
+ 'x-credits-limit': '50000', 'x-credits-remaining': '49998.4484',
+ 'x-ratelimit-limit-4h': '1000', 'x-ratelimit-limit-weekly': '100',
+ } }), { platform: 'router9', modelId: 'minimax/minimax-m3' });
+ expect(obs).toHaveLength(1);
+ expect(obs[0]).toMatchObject({ metric: 'credits', quotaPoolKey: 'router9::monthly-credit', limit: 50000, remaining: 49998.4484, resetAt: null });
+ });
+
+ it('observes Septor reported limits without treating signup credits as a monthly grant', () => {
+ const obs = parseQuotaObservationsFromResponse(new Response(null, { headers: {
+ 'x-ratelimit-limit': '60', 'x-ratelimit-remaining': '53', 'x-ratelimit-reset': '1789074787',
+ } }), { platform: 'septor', modelId: 'qwen3-coder-free' });
+ expect(obs[0]).toMatchObject({ metric: 'requests', quotaPoolKey: 'septor::daily-free', limit: 60, remaining: 53 });
+ expect(obs.some(o => o.metric === 'credits')).toBe(false);
+ });
});
describe('provider-quota: reset_at replenishment on read (#453)', () => {
diff --git a/server/src/lib/key-parser.ts b/server/src/lib/key-parser.ts
index c5c5fb20..da84e720 100644
--- a/server/src/lib/key-parser.ts
+++ b/server/src/lib/key-parser.ts
@@ -51,6 +51,11 @@ export const PREFIX_MAP: Record<string, string> = {
EXPERIENTIALLABS_: 'experiential',
EXPERIENTIAL_LABS_: 'experiential',
EXPLABS_: 'experiential',
+ ROUTER9_: 'router9',
+ ROUTER_9_: 'router9',
+ SEPTOR_: 'septor',
+ SEPTORLABS_: 'septor',
+ SEPTOR_LABS_: 'septor',
BAI_: 'bai',
B_AI_: 'bai',
RADEON_: 'radeon',
@@ -123,6 +128,11 @@ export const AUTH_JSON_PROVIDER_MAP: Record<string, string> = {
experientiallabs: 'experiential',
'experiential-labs': 'experiential',
explabs: 'experiential',
+ router9: 'router9',
+ 'router-9': 'router9',
+ septor: 'septor',
+ septorlabs: 'septor',
+ 'septor-labs': 'septor',
bai: 'bai',
'b-ai': 'bai',
radeon: 'radeon',
diff --git a/server/src/providers/index.ts b/server/src/providers/index.ts
index b965d06a..4bdc4a7c 100644
--- a/server/src/providers/index.ts
+++ b/server/src/providers/index.ts
@@ -11,6 +11,8 @@ import { ZhipuProvider } from './zhipu.js';
import { SailProvider } from './sail.js';
import { ElectronHubProvider } from './electronhub.js';
import { ExperientialProvider } from './experiential.js';
+import { Router9Provider } from './router9.js';
+import { SeptorProvider } from './septor.js';
const providers = new Map<Platform, BaseProvider>();
@@ -49,6 +51,11 @@ register(new SailProvider());
// and tested model rows belong in Oracle, never in bundled DB migrations.
register(new ElectronHubProvider());
register(new ExperientialProvider());
+// Router9 has shared monthly credits; Septor's zero-price models share daily
+// quota (its signup credit is one-time). Model rows live only in Oracle so
+// the existing Premium-now / Free-after-30-days gate remains authoritative.
+register(new Router9Provider());
+register(new SeptorProvider());
// B.AI — OpenAI-compatible gateway. Provider support is first-class, but the
// only free catalog row currently published is a limited-time 0-credit promo;
diff --git a/server/src/providers/router9.ts b/server/src/providers/router9.ts
new file mode 100644
index 00000000..534958de
--- /dev/null
+++ b/server/src/providers/router9.ts
@@ -0,0 +1,46 @@
+import type { KeyValidationResult } from './base.js';
+import { OpenAICompatProvider } from './openai-compat.js';
+import { recordQuotaObservationsFromResponse, type QuotaObservationContext } from '../services/provider-quota.js';
+
+const BASE_URL = 'https://api.router9.com/v1';
+
+/** Router9's public /models returns 200 even for a bogus key. Authenticate
+ * with a deliberately incomplete chat request instead: no model or prompt
+ * can reach inference. Verified 2026-09-10: invalid keys get 401; a valid key
+ * gets 404 model_not_found PLUS account credit headers. This consumes one
+ * request from the provider's burst allowance, but no inference credits.
+ *
+ * The inherited adapter already splits inline <think> blocks and accepts
+ * streams ending at EOF after finish_reason (Router9 omits [DONE]). */
+export class Router9Provider extends OpenAICompatProvider {
+ constructor() {
+ super({ platform: 'router9', name: 'Router9', baseUrl: BASE_URL });
+ }
+
+ override async validateKey(apiKey: string, quotaContext?: QuotaObservationContext): Promise<KeyValidationResult> {
+ const res = await this.fetchWithTimeout(`${BASE_URL}/chat/completions`, {
+ method: 'POST',
+ headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
+ body: JSON.stringify({ messages: [] }),
+ }, 30_000, { timeoutBounds: 'request' });
+ recordQuotaObservationsFromResponse(res, {
+ platform: this.platform, keyId: quotaContext?.keyId,
+ providerAccountId: quotaContext?.providerAccountId, quotaPoolKey: quotaContext?.quotaPoolKey,
+ endpoint: 'chat/completions:auth-probe',
+ });
+ if (res.status === 401) return this.validationResult(res);
+
+ const body = await res.json().catch(() => null) as { error?: { code?: string } } | null;
+ const accountHeaders = ['x-credits-limit', 'x-credits-remaining'].every(name => {
+ const value = res.headers.get(name);
+ return value !== null && value.trim() !== '' && Number.isFinite(Number(value));
+ });
+ // A generic 404/429 from a proxy or public route is not authentication.
+ // Account headers are required; quota exhaustion does not revoke a key.
+ if (accountHeaders && (
+ (res.status === 404 && body?.error?.code === 'model_not_found') ||
+ res.status === 402 || res.status === 429
+ )) return true;
+ throw new Error(`Router9 key validation inconclusive (HTTP ${res.status}); no authenticated probe verdict`);
+ }
+}
diff --git a/server/src/providers/septor.ts b/server/src/providers/septor.ts
new file mode 100644
index 00000000..11e7abce
--- /dev/null
+++ b/server/src/providers/septor.ts
@@ -0,0 +1,42 @@
+import type { ChatCompletionChunk, ChatCompletionResponse, ChatMessage } from '@freellmapi/shared/types.js';
+import type { CompletionOptions } from './base.js';
+import type { QuotaObservationContext } from '../services/provider-quota.js';
+import { OpenAICompatProvider } from './openai-compat.js';
+
+function checkModel(requested: string, returned: string): void {
+ // Explicit auto routing may choose a model; a named model may not silently
+ // substitute another one. Live Sep 10 probes returned MiniMax M2.5 for
+ // eleven unrelated free IDs. Keep those routes out of the catalog and fail
+ // over if a previously working named route starts doing the same.
+ if (requested !== 'auto' && returned !== requested) {
+ throw Object.assign(new Error('Septor Labs returned a different or missing model identity'), { status: 502 });
+ }
+}
+
+export class SeptorProvider extends OpenAICompatProvider {
+ constructor() {
+ // /models rejects missing and invalid credentials (401), unlike Router9.
+ super({ platform: 'septor', name: 'Septor Labs', baseUrl: 'https://api.septorlabs.com/v1' });
+ }
+
+ override async chatCompletion(
+ apiKey: string, messages: ChatMessage[], modelId: string,
+ options?: CompletionOptions, quotaContext?: QuotaObservationContext,
+ ): Promise<ChatCompletionResponse> {
+ const response = await super.chatCompletion(apiKey, messages, modelId, options, quotaContext);
+ checkModel(modelId, response.model);
+ return response;
+ }
+
+ override async *streamChatCompletion(
+ apiKey: string, messages: ChatMessage[], modelId: string,
+ options?: CompletionOptions, quotaContext?: QuotaObservationContext,
+ ): AsyncGenerator<ChatCompletionChunk> {
+ for await (const chunk of super.streamChatCompletion(apiKey, messages, modelId, options, quotaContext)) {
+ // Verify before yielding even a role/content/tool preamble. Never label
+ // an upstream substitution as the requested model in the client stream.
+ checkModel(modelId, chunk.model);
+ yield chunk;
+ }
+ }
+}
diff --git a/server/src/routes/keys.ts b/server/src/routes/keys.ts
index 005171ff..6a8003fc 100644
--- a/server/src/routes/keys.ts
+++ b/server/src/routes/keys.ts
@@ -28,7 +28,7 @@ export const keysRouter = Router();
// was dropped in V4 and re-added in V13 via the router.huggingface.co route.
// SambaNova was dropped in V23 (free tier permanently retired).
const PLATFORMS = [
- 'google', 'groq', 'cerebras', 'sail', 'electronhub', 'experiential', 'bai', 'radeon', 'nvidia', 'mistral',
+ 'google', 'groq', 'cerebras', 'sail', 'electronhub', 'experiential', 'router9', 'septor', 'bai', 'radeon', 'nvidia', 'mistral',
'openrouter', 'github', 'cohere', 'cloudflare', 'zhipu', 'ollama',
'kilo', 'pollinations', 'llm7', 'huggingface', 'opencode', 'ovh', 'agnes', 'reka', 'siliconflow',
'routeway', 'bazaarlink', 'ainative', 'aion', 'anyapi', 'requesty', 'navy', 'nara', 'sealion', 'orcarouter', 'unorouter', 'xkiro', 'modelscope',
diff --git a/server/src/services/provider-quota.ts b/server/src/services/provider-quota.ts
index 51b197fc..2c2aeea2 100644
--- a/server/src/services/provider-quota.ts
+++ b/server/src/services/provider-quota.ts
@@ -118,6 +118,8 @@ function inferPoolForPlatform(platform: Platform, modelId?: string | null): stri
if (platform === 'sail') return 'sail::monthly-credit';
if (platform === 'electronhub') return normalizedModelId.endsWith(':free') ? 'electronhub::daily-free' : 'electronhub::weekly-credit';
if (platform === 'experiential') return 'experiential::monthly-credit';
+ if (platform === 'router9') return 'router9::monthly-credit';
+ if (platform === 'septor') return 'septor::daily-free';
if (platform === 'bai') return 'bai::promo';
if (platform === 'radeon') return 'radeon::daily-free';
if (platform === 'sambanova') return 'sambanova::shared';
@@ -166,13 +168,21 @@ function inferPoolForPlatform(platform: Platform, modelId?: string | null): stri
}
function isSharedPool(platform: Platform): boolean {
- if (platform === 'electronhub' || platform === 'experiential') return true;
+ if (['electronhub', 'experiential', 'router9', 'septor'].includes(platform)) return true;
return ['openrouter', 'google', 'groq', 'cerebras', 'sail', 'bai', 'radeon', 'sambanova', 'nvidia', 'mistral', 'github', 'cohere', 'cloudflare', 'zhipu', 'ollama', 'kilo', 'pollinations', 'llm7', 'huggingface', 'opencode', 'routeway', 'bazaarlink', 'ainative', 'aion', 'requesty', 'navy', 'nara', 'sealion', 'orcarouter', 'unorouter', 'xkiro', 'anyapi', 'modelscope', 'aihorde'].includes(platform);
}
type HeaderSpec = { metric: QuotaMetric; limit: string; remaining?: string; reset?: string; strategy?: QuotaResetStrategy };
const HEADER_SPECS: Partial<Record<Platform, HeaderSpec[]>> = {
+ // Observe actual headers only: Router9's documented request windows differ
+ // from live headers. No invented per-model quotas or credit-to-token math.
+ router9: [
+ { metric: 'credits', limit: 'x-credits-limit', remaining: 'x-credits-remaining', reset: 'x-credits-reset', strategy: 'provider_reported' },
+ ],
+ septor: [
+ { metric: 'requests', limit: 'x-ratelimit-limit', remaining: 'x-ratelimit-remaining', reset: 'x-ratelimit-reset', strategy: 'provider_reported' },
+ ],
// Live-observed account-wide rolling-minute headers; no invented limits or
// conversion of credit grants into token budgets.
electronhub: [
diff --git a/shared/types.ts b/shared/types.ts
index 19f33410..0cdb85d2 100644
--- a/shared/types.ts
+++ b/shared/types.ts
@@ -72,6 +72,9 @@ export type Platform =
// ElectronHub renews weekly credits; Experiential renews monthly credits.
| 'electronhub'
| 'experiential'
+ // Catalog-managed gateways: monthly shared credits vs daily free-model quota.
+ | 'router9'
+ | 'septor'
// B.AI — OpenAI-compatible gateway. Its catalog row is a live-tested,
// limited-time 0-credit promotion, not a recurring free allowance.
| 'bai'