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 CLōD, Speechify and BlazeAPI adapters (#1209)

Tashfeen496ec4ef1bd1
diff --git a/client/src/components/keys/shared.tsx b/client/src/components/keys/shared.tsx
index 1f0a093f..3d9b8f25 100644
--- a/client/src/components/keys/shared.tsx
+++ b/client/src/components/keys/shared.tsx
@@ -34,6 +34,9 @@ export const PLATFORMS: { value: Platform; label: string; url: string; keyless?:
{ 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: 'clod', label: 'CLōD (shared daily free requests)', url: 'https://newapp.clod.io' },
+ { value: 'speechify', label: 'Speechify (monthly free TTS characters)', url: 'https://platform.speechify.ai' },
+ { value: 'blaze', label: 'BlazeAPI (daily free tokens; Discord verification)', url: 'https://blazeapi.org/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 b92ea391..9620a43a 100644
--- a/client/src/lib/routing.ts
+++ b/client/src/lib/routing.ts
@@ -405,6 +405,9 @@ export const platformColors: Record<string, string> = {
experiential: '#14b8a6',
router9: '#8b5cf6',
septor: '#0891b2',
+ clod: '#16a34a',
+ speechify: '#7c3aed',
+ blaze: '#f97316',
bai: '#111827',
radeon: '#ed1c24',
nvidia: '#76b900',
diff --git a/server/src/__tests__/lib/key-parser.test.ts b/server/src/__tests__/lib/key-parser.test.ts
index 99296b3a..ce66e995 100644
--- a/server/src/__tests__/lib/key-parser.test.ts
+++ b/server/src/__tests__/lib/key-parser.test.ts
@@ -127,6 +127,12 @@ describe('key parser', () => {
expect(result.skipped).toEqual(['PORT: value does not look like an API key']);
});
+ it.each([['CLOD', 'clod'], ['SPEECHIFY', 'speechify'], ['BLAZE', 'blaze'], ['BLAZEAPI', 'blaze']])('imports %s environment keys', (prefix, platform) => {
+ const result = parseKeysFromFile(`${prefix}_API_KEY=not-a-real-provider-key`, 'keys.env');
+ expect(result.keys).toHaveLength(1);
+ expect(result.keys[0].platform).toBe(platform);
+ });
+
it('filters obvious non-key values', () => {
expect(looksLikeApiKey('true')).toBe(false);
expect(looksLikeApiKey('https://example.com')).toBe(false);
diff --git a/server/src/__tests__/providers/clod-speechify-blaze.test.ts b/server/src/__tests__/providers/clod-speechify-blaze.test.ts
new file mode 100644
index 00000000..408b9db3
--- /dev/null
+++ b/server/src/__tests__/providers/clod-speechify-blaze.test.ts
@@ -0,0 +1,80 @@
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { getProvider, hasProvider } from '../../providers/index.js';
+
+const json = (body: unknown, status = 200, headers: Record<string, string> = {}) =>
+ new Response(JSON.stringify(body), { status, headers: { 'Content-Type': 'application/json', ...headers } });
+const completion = (model: string) => ({ id: 'test', object: 'chat.completion', created: 1, model,
+ choices: [{ index: 0, message: { role: 'assistant', content: '17' }, finish_reason: 'stop' }],
+ usage: { prompt_tokens: 8, completion_tokens: 1, total_tokens: 9 } });
+const stream = (model: string) => new Response(`data: ${JSON.stringify({ id: 'test', object: 'chat.completion.chunk', created: 1, model,
+ choices: [{ index: 0, delta: { content: '17' }, finish_reason: 'stop' }] })}\n\ndata: [DONE]\n\n`, { headers: { 'Content-Type': 'text/event-stream' } });
+
+describe('CLōD, Speechify and BlazeAPI adapters', () => {
+ afterEach(() => vi.restoreAllMocks());
+
+ it.each([
+ ['clod', 'https://api.clod.io/v1/models'],
+ ['speechify', 'https://api.speechify.ai/v1/workspaces/current/entitlements'],
+ ['blaze', 'https://api.blazeapi.org/paid/v1/usage'],
+ ] as const)('%s validates on an authenticated, non-generating endpoint', async (platform, endpoint) => {
+ expect(hasProvider(platform)).toBe(true);
+ const fetch = vi.spyOn(globalThis, 'fetch').mockResolvedValue(json({ data: [] }));
+ await expect(getProvider(platform)!.validateKey('test-key')).resolves.toBe(true);
+ expect(fetch.mock.calls[0][0]).toBe(endpoint);
+ expect(fetch.mock.calls[0][1]?.method).toBe('GET');
+ expect(new Headers(fetch.mock.calls[0][1]?.headers).get('Authorization')).toBe('Bearer test-key');
+ fetch.mockResolvedValue(json({ error: 'Invalid key' }, 401));
+ await expect(getProvider(platform)!.validateKey('test-key')).resolves.toMatchObject({ valid: false });
+ fetch.mockResolvedValue(json({ error: 'Unavailable' }, 503));
+ await expect(getProvider(platform)!.validateKey('test-key')).rejects.toThrow();
+ });
+
+ it.each([
+ ['clod', 'Gemma 4 31B IT', 'google/gemma-4-31B-it', 'https://api.clod.io/v1'],
+ ['clod', 'GPT OSS 120B', 'accounts/fireworks/models/gpt-oss-120b', 'https://api.clod.io/v1'],
+ ['clod', 'GPT OSS 20B', 'OpenAI/gpt-oss-20B', 'https://api.clod.io/v1'],
+ ['clod', 'Qwen 3.5 9B', 'Qwen/Qwen3.5-9B', 'https://api.clod.io/v1'],
+ ['blaze', 'tok/deepseek-v4-pro', 'tok/deepseek-v4-pro', 'https://api.blazeapi.org/paid/v1'],
+ ] as const)('%s sends exact requested IDs and accepts a matching upstream identity (%s)', async (platform, requested, returned, base) => {
+ const fetch = vi.spyOn(globalThis, 'fetch').mockResolvedValue(json(completion(returned)));
+ const provider = getProvider(platform)!;
+ const result = await provider.chatCompletion('test-key', [{ role: 'user', content: '8+9' }], requested, { max_tokens: 64, temperature: 0.2 });
+ expect(result.model).toBe(returned);
+ expect(result.usage.total_tokens).toBe(9);
+ expect(result._routed_via).toEqual({ platform, model: requested });
+ expect(fetch.mock.calls[0][0]).toBe(`${base}/chat/completions`);
+ expect(JSON.parse(String(fetch.mock.calls[0][1]?.body))).toMatchObject({ model: requested, max_tokens: 64, temperature: 0.2 });
+ fetch.mockResolvedValue(stream(returned));
+ const emitted = [];
+ for await (const chunk of provider.streamChatCompletion('test-key', [], requested)) emitted.push(chunk);
+ expect(emitted.flatMap(c => c.choices).map(c => c.delta.content ?? '').join('')).toBe('17');
+ });
+
+ it.each(['clod', 'blaze'] as const)('%s rejects substitutions and missing identity before emitting content', async platform => {
+ const fetch = vi.spyOn(globalThis, 'fetch');
+ const provider = getProvider(platform)!;
+ for (const returned of ['google/gemma-4-31B-it', '']) {
+ fetch.mockResolvedValue(json(completion(returned)));
+ await expect(provider.chatCompletion('test-key', [], 'Llama 3.3 70B')).rejects.toMatchObject({ status: 502 });
+ fetch.mockResolvedValue(stream(returned));
+ const emitted = [];
+ const consume = async () => { for await (const c of provider.streamChatCompletion('test-key', [], 'Llama 3.3 70B')) emitted.push(c); };
+ await expect(consume()).rejects.toMatchObject({ status: 502 });
+ expect(emitted).toEqual([]);
+ }
+ });
+
+ it.each(['clod', 'blaze'] as const)('%s preserves provider backoff and never retries a paid route', async platform => {
+ const fetch = vi.spyOn(globalThis, 'fetch').mockResolvedValue(json({ error: { message: 'Quota exhausted' } }, 429, { 'Retry-After': '60' }));
+ await expect(getProvider(platform)!.chatCompletion('test-key', [], 'test-model')).rejects.toMatchObject({ status: 429, retryAfterMs: 60000 });
+ expect(fetch).toHaveBeenCalledTimes(1);
+ });
+
+ it('Speechify never calls an imaginary chat endpoint', async () => {
+ const fetch = vi.spyOn(globalThis, 'fetch');
+ const provider = getProvider('speechify')!;
+ await expect(provider.chatCompletion('test-key', [], 'simba-3.2')).rejects.toMatchObject({ status: 400 });
+ await expect(provider.streamChatCompletion('test-key', [], 'simba-3.2').next()).rejects.toMatchObject({ status: 400 });
+ expect(fetch).not.toHaveBeenCalled();
+ });
+});
diff --git a/server/src/__tests__/routes/keys.test.ts b/server/src/__tests__/routes/keys.test.ts
index 297a3f29..9a0e647a 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', 'router9', 'septor'])('accepts a %s key without seeding gated model rows', async platform => {
+ it.each(['electronhub', 'experiential', 'router9', 'septor', 'clod', 'speechify', 'blaze'])('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/catalog-sync.test.ts b/server/src/__tests__/services/catalog-sync.test.ts
index 7780e7b4..c3f41e31 100644
--- a/server/src/__tests__/services/catalog-sync.test.ts
+++ b/server/src/__tests__/services/catalog-sync.test.ts
@@ -241,6 +241,19 @@ describe('applyCatalog', () => {
expect(getDb().prepare("SELECT id FROM models WHERE platform = 'some-future-provider'").get()).toBeUndefined();
});
+ it('imports the new chat providers and keeps Speechify exclusively in audio', () => {
+ const models = existingAsCatalogModels();
+ models.push(baseModel({ platform: 'clod', modelId: 'test-clod' }));
+ models.push(baseModel({ platform: 'blaze', modelId: 'test-blaze' }));
+ models.push(baseModel({ platform: 'speechify', modelId: 'test-simba', modality: 'audio' }));
+ applyCatalog(getDb(), catalogOf(models));
+ for (const platform of ['clod', 'blaze']) {
+ expect(getDb().prepare('SELECT enabled FROM models WHERE platform = ?').get(platform)).toEqual({ enabled: 1 });
+ }
+ expect(getDb().prepare("SELECT id FROM models WHERE platform = 'speechify'").get()).toBeUndefined();
+ expect(getDb().prepare("SELECT model_id, modality, enabled FROM media_models WHERE platform = 'speechify'").get()).toEqual({ model_id: 'test-simba', modality: 'audio', enabled: 1 });
+ });
+
it('applies the full embedding snapshot and retires a replaced provider id', () => {
const embeddings = existingAsCatalogEmbeddings();
const openRouter = embeddings.find(
diff --git a/server/src/__tests__/services/media.test.ts b/server/src/__tests__/services/media.test.ts
index 7de62660..2dfa68b3 100644
--- a/server/src/__tests__/services/media.test.ts
+++ b/server/src/__tests__/services/media.test.ts
@@ -405,6 +405,42 @@ describe('media service', () => {
});
describe('text-to-speech', () => {
+ it.each(['simba-3.0', 'simba-3.2'])('Speechify %s sends native fields and decodes JSON audio', async model => {
+ addMedia('speechify', model, 'audio');
+ addKey('speechify');
+ const audio = Buffer.from('ID3test-audio');
+ const fetchMock = vi.spyOn(globalThis, 'fetch').mockResolvedValue(jsonResponse({ audio_data: audio.toString('base64'), audio_format: 'mp3', billable_characters_count: 5 }));
+ const result = await runSpeech(model, { input: 'Hello', voice: 'alloy' });
+ expect(result.audio).toEqual(audio);
+ expect(result.contentType).toBe('audio/mpeg');
+ const [url, init] = fetchMock.mock.calls[0];
+ expect(url).toBe('https://api.speechify.ai/v1/audio/speech');
+ expect(new Headers(init?.headers).get('Speechify-Version')).toBe('2026-09-08');
+ expect(new Headers(init?.headers).get('Authorization')).toBe('Bearer speechify-test-key');
+ expect(JSON.parse(String(init?.body))).toEqual({ model, input: 'Hello', voice_id: 'alec', audio_format: 'mp3' });
+ });
+
+ it('Speechify preserves native voices and requested supported formats', async () => {
+ addMedia('speechify', 'test-simba', 'audio'); addKey('speechify');
+ const fetchMock = vi.spyOn(globalThis, 'fetch').mockResolvedValue(jsonResponse({ audio_data: 'T2dnUw==', audio_format: 'ogg' }));
+ const result = await runSpeech('test-simba', { input: 'Hello', voice: 'native-voice-id', format: 'ogg' });
+ expect(JSON.parse(String(fetchMock.mock.calls[0][1]?.body))).toMatchObject({ voice_id: 'native-voice-id', audio_format: 'ogg' });
+ expect(result.contentType).toBe('audio/ogg');
+ });
+
+ it.each(['pcm', 'flac', 'opus'])('Speechify rejects unsupported %s without sending a request', async format => {
+ addMedia('speechify', 'test-simba', 'audio'); addKey('speechify');
+ const fetchMock = vi.spyOn(globalThis, 'fetch');
+ await expect(runSpeech('test-simba', { input: 'Hello', format })).rejects.toThrow('Speechify supports');
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+
+ it.each([{}, { audio_data: 'not base64', audio_format: 'mp3' }, { audio_data: '', audio_format: 'mp3' }, { audio_data: 'SUQz', audio_format: 'wav' }])('Speechify rejects malformed audio instead of returning JSON as sound', async body => {
+ addMedia('speechify', 'test-simba', 'audio'); addKey('speechify');
+ vi.spyOn(globalThis, 'fetch').mockResolvedValue(jsonResponse(body));
+ await expect(runSpeech('test-simba', { input: 'Hello' })).rejects.toThrow('Speechify returned');
+ });
+
it('Cloudflare MeloTTS: base64 audio → audio/mpeg bytes', async () => {
addMedia('cloudflare', '@cf/myshell-ai/melotts', 'audio');
addKey('cloudflare', 'acct:tok');
diff --git a/server/src/__tests__/services/provider-quota.test.ts b/server/src/__tests__/services/provider-quota.test.ts
index 9c3ca8da..f13eb9da 100644
--- a/server/src/__tests__/services/provider-quota.test.ts
+++ b/server/src/__tests__/services/provider-quota.test.ts
@@ -49,6 +49,11 @@ describe('provider-quota: pool inference', () => {
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');
+ for (const model of ['first-model', 'another-model']) {
+ expect(inferQuotaPoolKey('clod', model)).toBe('clod::daily-free');
+ expect(inferQuotaPoolKey('blaze', model)).toBe('blaze::daily-free');
+ expect(inferQuotaPoolKey('speechify', model)).toBe('speechify::monthly-characters');
+ }
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
@@ -200,6 +205,23 @@ describe('provider-quota: record + read round-trip', () => {
});
describe('provider-quota: parse from response headers (shared parseRetryAfterMs)', () => {
+ it('records Blaze token headers without fabricating a reset or per-model grant', () => {
+ const obs = parseQuotaObservationsFromResponse(new Response(null, { headers: {
+ 'x-ratelimit-limit-tokens': '200000', 'x-ratelimit-remaining-tokens': '199499',
+ } }), { platform: 'blaze', modelId: 'test-model' });
+ expect(obs).toHaveLength(1);
+ expect(obs[0]).toMatchObject({ metric: 'tokens', limit: 200000, remaining: 199499, resetAt: null, quotaPoolKey: 'blaze::daily-free' });
+ });
+
+ it('records only CLōD\'s observed request window, not an invented daily token quota', () => {
+ const obs = parseQuotaObservationsFromResponse(new Response(null, { headers: {
+ 'x-ratelimit-limit': '5', 'x-ratelimit-remaining': '4', 'x-ratelimit-reset': '1789230900',
+ } }), { platform: 'clod', modelId: 'test-model' });
+ expect(obs).toHaveLength(1);
+ expect(obs[0]).toMatchObject({ metric: 'requests', limit: 5, remaining: 4, quotaPoolKey: 'clod::daily-free' });
+ const speech = parseQuotaObservationsFromResponse(new Response(null), { platform: 'speechify' });
+ expect(speech.every(o => o.limit == null && o.remaining == null)).toBe(true);
+ });
beforeAll(() => {
process.env.ENCRYPTION_KEY = '0'.repeat(64);
initDb(':memory:');
diff --git a/server/src/lib/key-parser.ts b/server/src/lib/key-parser.ts
index da84e720..8254f5ca 100644
--- a/server/src/lib/key-parser.ts
+++ b/server/src/lib/key-parser.ts
@@ -56,6 +56,10 @@ export const PREFIX_MAP: Record<string, string> = {
SEPTOR_: 'septor',
SEPTORLABS_: 'septor',
SEPTOR_LABS_: 'septor',
+ CLOD_: 'clod',
+ SPEECHIFY_: 'speechify',
+ BLAZE_: 'blaze',
+ BLAZEAPI_: 'blaze',
BAI_: 'bai',
B_AI_: 'bai',
RADEON_: 'radeon',
@@ -133,6 +137,10 @@ export const AUTH_JSON_PROVIDER_MAP: Record<string, string> = {
septor: 'septor',
septorlabs: 'septor',
'septor-labs': 'septor',
+ clod: 'clod',
+ speechify: 'speechify',
+ blaze: 'blaze',
+ blazeapi: 'blaze',
bai: 'bai',
'b-ai': 'bai',
radeon: 'radeon',
diff --git a/server/src/providers/blaze.ts b/server/src/providers/blaze.ts
new file mode 100644
index 00000000..991d0899
--- /dev/null
+++ b/server/src/providers/blaze.ts
@@ -0,0 +1,45 @@
+import type { ChatCompletionChunk, ChatCompletionResponse, ChatMessage } from '@freellmapi/shared/types.js';
+import { providerHttpError, type CompletionOptions, type KeyValidationResult } from './base.js';
+import type { QuotaObservationContext } from '../services/provider-quota.js';
+import { OpenAICompatProvider } from './openai-compat.js';
+
+function checkModel(requested: string, returned: string): void {
+ if (!returned || returned !== requested) {
+ throw Object.assign(new Error('BlazeAPI returned a different or missing model identity'), { status: 502 });
+ }
+}
+
+export class BlazeProvider extends OpenAICompatProvider {
+ protected override async validationResult(response: Response): Promise<KeyValidationResult> {
+ if (!response.ok && ![401, 403].includes(response.status)) {
+ throw providerHttpError(response, 'BlazeAPI key validation is temporarily inconclusive');
+ }
+ return super.validationResult(response);
+ }
+
+ constructor() {
+ // Despite its name, /paid/v1 is also the documented Free-plan endpoint.
+ // Named catalog routes only: no fallback to a paid or automatic route.
+ super({ platform: 'blaze', name: 'BlazeAPI', baseUrl: 'https://api.blazeapi.org/paid/v1',
+ validateUrl: 'https://api.blazeapi.org/paid/v1/usage' });
+ }
+
+ 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)) {
+ checkModel(modelId, chunk.model);
+ yield chunk;
+ }
+ }
+}
diff --git a/server/src/providers/clod.ts b/server/src/providers/clod.ts
new file mode 100644
index 00000000..d54948c2
--- /dev/null
+++ b/server/src/providers/clod.ts
@@ -0,0 +1,46 @@
+import type { ChatCompletionChunk, ChatCompletionResponse, ChatMessage } from '@freellmapi/shared/types.js';
+import { providerHttpError, type CompletionOptions, type KeyValidationResult } from './base.js';
+import type { QuotaObservationContext } from '../services/provider-quota.js';
+import { OpenAICompatProvider } from './openai-compat.js';
+
+function checkModel(requested: string, returned: string): void {
+ // CLōD accepts friendly names including spaces, then reports the upstream
+ // namespaced ID. Compare their significant characters, not a hardcoded
+ // roster. Never accept the observed Llama/Trinity -> Gemma substitution.
+ const normalize = (id: string) => id.split('/').at(-1)!.toLowerCase().replace(/[\s._-]/g, '');
+ if (typeof returned !== 'string' || !returned || normalize(requested) !== normalize(returned)) {
+ throw Object.assign(new Error('CLōD returned a different or missing model identity'), { status: 502 });
+ }
+}
+
+export class ClodProvider extends OpenAICompatProvider {
+ protected override async validationResult(response: Response): Promise<KeyValidationResult> {
+ if (!response.ok && ![401, 403].includes(response.status)) {
+ throw providerHttpError(response, 'CLōD key validation is temporarily inconclusive');
+ }
+ return super.validationResult(response);
+ }
+
+ constructor() {
+ super({ platform: 'clod', name: 'CLōD', baseUrl: 'https://api.clod.io/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)) {
+ checkModel(modelId, chunk.model);
+ yield chunk;
+ }
+ }
+}
diff --git a/server/src/providers/index.ts b/server/src/providers/index.ts
index 4bdc4a7c..eb62a5d2 100644
--- a/server/src/providers/index.ts
+++ b/server/src/providers/index.ts
@@ -13,6 +13,9 @@ import { ElectronHubProvider } from './electronhub.js';
import { ExperientialProvider } from './experiential.js';
import { Router9Provider } from './router9.js';
import { SeptorProvider } from './septor.js';
+import { ClodProvider } from './clod.js';
+import { SpeechifyProvider } from './speechify.js';
+import { BlazeProvider } from './blaze.js';
const providers = new Map<Platform, BaseProvider>();
@@ -56,6 +59,9 @@ register(new ExperientialProvider());
// the existing Premium-now / Free-after-30-days gate remains authoritative.
register(new Router9Provider());
register(new SeptorProvider());
+register(new ClodProvider());
+register(new SpeechifyProvider());
+register(new BlazeProvider());
// 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/speechify.ts b/server/src/providers/speechify.ts
new file mode 100644
index 00000000..f47c8d29
--- /dev/null
+++ b/server/src/providers/speechify.ts
@@ -0,0 +1,33 @@
+import type { ChatCompletionChunk, ChatCompletionResponse } from '@freellmapi/shared/types.js';
+import { BaseProvider, providerHttpError, type KeyValidationResult } from './base.js';
+
+export const SPEECHIFY_BASE_URL = 'https://api.speechify.ai/v1';
+export const SPEECHIFY_VERSION = '2026-09-08';
+
+/** Speechify is TTS-only. Synthesis is dispatched by services/media.ts;
+ * registration here provides credential management, not a fake chat API. */
+export class SpeechifyProvider extends BaseProvider {
+ readonly platform = 'speechify' as const;
+ readonly name = 'Speechify';
+
+ async validateKey(apiKey: string): Promise<KeyValidationResult> {
+ const response = await this.fetchWithTimeout(`${SPEECHIFY_BASE_URL}/workspaces/current/entitlements`, {
+ method: 'GET',
+ headers: { Authorization: `Bearer ${apiKey}`, 'Speechify-Version': SPEECHIFY_VERSION },
+ });
+ if (!response.ok && ![401, 403].includes(response.status)) {
+ throw providerHttpError(response, 'Speechify key validation is temporarily inconclusive');
+ }
+ return this.validationResult(response);
+ }
+
+ async chatCompletion(): Promise<ChatCompletionResponse> {
+ throw Object.assign(new Error('Speechify supports /v1/audio/speech, not chat completions'), { status: 400 });
+ }
+
+ // An unsupported operation must reject before yielding any stream data.
+ // eslint-disable-next-line require-yield
+ async *streamChatCompletion(): AsyncGenerator<ChatCompletionChunk> {
+ throw Object.assign(new Error('Speechify supports /v1/audio/speech, not chat completions'), { status: 400 });
+ }
+}
diff --git a/server/src/routes/keys.ts b/server/src/routes/keys.ts
index 6a8003fc..ab8e4b8b 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', 'router9', 'septor', 'bai', 'radeon', 'nvidia', 'mistral',
+ 'google', 'groq', 'cerebras', 'sail', 'electronhub', 'experiential', 'router9', 'septor', 'clod', 'speechify', 'blaze', '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/media.ts b/server/src/services/media.ts
index dcc4e922..afc43908 100644
--- a/server/src/services/media.ts
+++ b/server/src/services/media.ts
@@ -13,10 +13,11 @@ import { decrypt } from '../lib/crypto.js';
import { proxyFetch } from '../lib/proxy.js';
import { assessProviderUrl } from '../lib/url-guard.js';
import { isOnCooldown, setCooldown } from './ratelimit.js';
+import { SPEECHIFY_BASE_URL, SPEECHIFY_VERSION } from '../providers/speechify.js';
/** Platforms with a media adapter below. catalog-sync gates media rows on this
* (decoupled from the chat provider registry — e.g. SiliconFlow is media-only). */
-export const MEDIA_PLATFORMS = new Set(['nvidia', 'pollinations', 'cloudflare', 'siliconflow', 'google']);
+export const MEDIA_PLATFORMS = new Set(['nvidia', 'pollinations', 'cloudflare', 'siliconflow', 'google', 'speechify']);
/** Video uses a dedicated optional catalog registry so binaries that predate
* this modality ignore the rows instead of accidentally ingesting them as
@@ -610,6 +611,28 @@ async function callSpeechProvider(
): Promise<{ audio: Buffer; contentType: string }> {
const key = credential.key;
switch (row.platform) {
+ case 'speechify': {
+ const fmt = p.format ?? 'mp3';
+ // Speechify exposes ogg, not OpenAI's opus name. Do not silently return
+ // a different codec for unsupported formats such as pcm or flac.
+ if (!['mp3', 'wav', 'ogg', 'aac'].includes(fmt)) {
+ throw new MediaError('Speechify supports mp3, wav, ogg and aac audio formats', 400);
+ }
+ const standardVoices = new Set(['alloy', 'ash', 'ballad', 'coral', 'echo', 'fable', 'nova', 'onyx', 'sage', 'shimmer', 'verse', 'marin', 'cedar']);
+ const voice = !p.voice || standardVoices.has(p.voice.toLowerCase()) ? 'alec' : p.voice;
+ const r = await mediaFetch(`${SPEECHIFY_BASE_URL}/audio/speech`, 'speechify', 'audio', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${key}`, 'Speechify-Version': SPEECHIFY_VERSION },
+ body: JSON.stringify({ model: row.model_id, input: p.input, voice_id: voice, audio_format: fmt }),
+ });
+ const j = await r.json() as { audio_data?: unknown; audio_format?: unknown };
+ const b64 = j.audio_data;
+ if (typeof b64 !== 'string' || !b64 || b64.length % 4 !== 0 || !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(b64)) {
+ throw new MediaError('Speechify returned missing or invalid base64 audio', 502);
+ }
+ if (j.audio_format !== fmt) throw new MediaError('Speechify returned a different audio format', 502);
+ return { audio: Buffer.from(b64, 'base64'), contentType: fmt === 'ogg' ? 'audio/ogg' : contentTypeFor(fmt) };
+ }
case 'custom': {
if (!credential.baseUrl) throw new MediaError('custom audio provider is missing base_url', 500);
const fmt = p.format ?? 'mp3';
diff --git a/server/src/services/provider-quota.ts b/server/src/services/provider-quota.ts
index 2c2aeea2..b76345a1 100644
--- a/server/src/services/provider-quota.ts
+++ b/server/src/services/provider-quota.ts
@@ -120,6 +120,9 @@ function inferPoolForPlatform(platform: Platform, modelId?: string | null): stri
if (platform === 'experiential') return 'experiential::monthly-credit';
if (platform === 'router9') return 'router9::monthly-credit';
if (platform === 'septor') return 'septor::daily-free';
+ if (platform === 'clod') return 'clod::daily-free';
+ if (platform === 'speechify') return 'speechify::monthly-characters';
+ if (platform === 'blaze') return 'blaze::daily-free';
if (platform === 'bai') return 'bai::promo';
if (platform === 'radeon') return 'radeon::daily-free';
if (platform === 'sambanova') return 'sambanova::shared';
@@ -168,13 +171,22 @@ function inferPoolForPlatform(platform: Platform, modelId?: string | null): stri
}
function isSharedPool(platform: Platform): boolean {
- if (['electronhub', 'experiential', 'router9', 'septor'].includes(platform)) return true;
+ if (['electronhub', 'experiential', 'router9', 'septor', 'clod', 'speechify', 'blaze'].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 upstream limits without inventing per-model budgets. CLōD's
+ // rate window is distinct from its daily grant; Speechify bills characters,
+ // not tokens, and does not publish token headers.
+ clod: [
+ { metric: 'requests', limit: 'x-ratelimit-limit', remaining: 'x-ratelimit-remaining', reset: 'x-ratelimit-reset', strategy: 'provider_reported' },
+ ],
+ blaze: [
+ { metric: 'tokens', limit: 'x-ratelimit-limit-tokens', remaining: 'x-ratelimit-remaining-tokens', strategy: 'provider_reported' },
+ ],
// Observe actual headers only: Router9's documented request windows differ
// from live headers. No invented per-model quotas or credit-to-token math.
router9: [
diff --git a/shared/types.ts b/shared/types.ts
index 0cdb85d2..3a02c913 100644
--- a/shared/types.ts
+++ b/shared/types.ts
@@ -75,6 +75,9 @@ export type Platform =
// Catalog-managed gateways: monthly shared credits vs daily free-model quota.
| 'router9'
| 'septor'
+ | 'clod'
+ | 'speechify'
+ | 'blaze'
// B.AI — OpenAI-compatible gateway. Its catalog row is a live-tested,
// limited-time 0-credit promotion, not a recurring free allowance.
| 'bai'