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 Typhoon chat and transcription adapter (#1434)
Tashfeen03663cc19b48
diff --git a/client/src/components/keys/shared.tsx b/client/src/components/keys/shared.tsxindex f6b91402..d5ff3e4e 100644--- a/client/src/components/keys/shared.tsx+++ b/client/src/components/keys/shared.tsx@@ -29,6 +29,7 @@ export function GetKeyLink({ url }: { url: string }) {export const PLATFORMS: { value: Platform; label: string; url: string; keyless?: boolean }[] = [{ value: 'aclide', label: 'ACLIDE (shared monthly credits)', url: 'https://aclide.com/en/dashboard/api-keys' },{ value: 'speka', label: 'Speka ($1 shared monthly credits)', url: 'https://speka.me/dashboard/keys' },+ { value: 'typhoon', label: 'Typhoon (free research API)', url: 'https://playground.opentyphoon.ai' },{ value: 'llmtr', label: 'LLMTR (daily free-model quotas)', url: 'https://llmtr.com' },{ value: 'gizmo', label: 'Gizmo (monthly free-model requests)', url: 'https://gizmoplatforms.com/developers' },{ value: 'blockrun', label: 'BlockRun (zero-priced models)', url: 'https://user.blockrun.ai/dashboard/keys' },diff --git a/client/src/lib/routing.ts b/client/src/lib/routing.tsindex 3eff7d17..ae109dc4 100644--- a/client/src/lib/routing.ts+++ b/client/src/lib/routing.ts@@ -405,6 +405,7 @@ export const platformColors: Record<string, string> = {sail: '#0ea5e9',aclide: '#6366f1',speka: '#0d9488',+ typhoon: '#e11d48',llmtr: '#0f766e',gizmo: '#7c3aed',blockrun: '#2563eb',diff --git a/docs/providers/typhoon.md b/docs/providers/typhoon.mdnew file mode 100644index 00000000..a71efd90--- /dev/null+++ b/docs/providers/typhoon.md@@ -0,0 +1,43 @@+# Typhoon++Typhoon uses `https://api.opentyphoon.ai/v1` with bearer authentication for+OpenAI-compatible chat completions (including streaming) and audio transcription.+Create a key at [Typhoon Playground](https://playground.opentyphoon.ai), add it on+the Keys page, or import `TYPHOON_API_KEY` / `OPENTYPHOON_API_KEY`. Auth JSON+recognizes `typhoon`, `opentyphoon`, and `open-typhoon`.++The hosted API is an **ongoing free research showcase**, not a monthly credit+grant. It is rate limited, provided without a production SLA, and collects usage+data to improve its models and API. Do not send sensitive content without+reviewing its data-use terms. The provider recommends its paid infrastructure+partner for production-grade availability.++This integration covers chat and transcription only. Live-tested on 2026-10-07:++- `typhoon-v2.5-30b-a3b-instruct`: chat, SSE streaming, and tool calling.+- `typhoon-asr-realtime`: Thai speech transcription.+- `typhoon-isan-asr-realtime`: Thai / Isan speech transcription (smoke-tested+ with a standard Thai sample, not an Isan accuracy benchmark).++OCR is intentionally excluded. The older `typhoon-v2.1-12b-instruct` still+appears in documentation but returned `400: Model not found` during testing.++Model rows are published only through the signed hosted catalog. No migration,+bundled seed, or automatic model discovery bypasses the existing Premium-now /+Free-after-30-days gate. Older app versions must update to recognize Typhoon.++Key validation deliberately requests a nonexistent model against the chat+endpoint: the public `/models` endpoint cannot validate a key. Live controls+confirmed the exact `400 {"detail":"Model not found"}` response follows+successful authentication; invalid/missing credentials return 401/403. Other+responses, including rate limits and outages, remain inconclusive.++Transcription sends only multipart `file` and `model`, and consumes the upstream+JSON `text` field. The existing route renders JSON/plain text locally. Whisper+decoding options are not forwarded, and no native VTT/SRT or timestamps are+advertised. The existing global upload ceiling is unchanged.++Sources: [FAQ](https://docs.opentyphoon.ai/en/faq/),+[authentication](https://docs.opentyphoon.ai/en/authentication/),+[ASR](https://docs.opentyphoon.ai/en/asr/),+[rate limits](https://docs.opentyphoon.ai/en/rate-limits/).diff --git a/server/src/__tests__/providers/typhoon.test.ts b/server/src/__tests__/providers/typhoon.test.tsnew file mode 100644index 00000000..b7b82c01--- /dev/null+++ b/server/src/__tests__/providers/typhoon.test.ts@@ -0,0 +1,83 @@+import { afterEach, describe, expect, it, vi } from 'vitest';+import type { ChatCompletionChunk } from '@freellmapi/shared/types.js';+import { TyphoonProvider, TYPHOON_BASE_URL } from '../../providers/typhoon.js';+import { getProvider } from '../../providers/index.js';+import { AUTH_JSON_PROVIDER_MAP, parseKeysFromFile } from '../../lib/key-parser.js';++const model = 'typhoon-v2.5-30b-a3b-instruct';+const completion = {+ id: 'typhoon-test', object: 'chat.completion', created: 1, model,+ choices: [{ index: 0, message: { role: 'assistant', content: 'OK' }, finish_reason: 'stop' }],+ usage: { prompt_tokens: 4, completion_tokens: 2, total_tokens: 6 },+};+const json = (body: unknown, status = 200, headers = {}) => new Response(JSON.stringify(body), { status, headers });++describe('Typhoon provider', () => {+ afterEach(() => vi.restoreAllMocks());++ it('registers a keyed provider and recognizes explicit key-file names', () => {+ expect(getProvider('typhoon')).toBeInstanceOf(TyphoonProvider);+ expect(getProvider('typhoon')!.keyless).toBe(false);+ for (const prefix of ['TYPHOON', 'OPENTYPHOON', 'OPEN_TYPHOON']) {+ expect(parseKeysFromFile(`${prefix}_API_KEY=sk-test-not-a-real-key`, 'keys.env').keys[0].platform).toBe('typhoon');+ }+ for (const alias of ['typhoon', 'opentyphoon', 'open-typhoon']) expect(AUTH_JSON_PROVIDER_MAP[alias]).toBe('typhoon');+ });++ it('preserves chat parameters, usage, and provider attribution', async () => {+ const fetch = vi.spyOn(global, 'fetch').mockResolvedValue(json(completion));+ const response = await getProvider('typhoon')!.chatCompletion('test-key', [{ role: 'user', content: 'Hi' }], model, {+ max_tokens: 128, temperature: 0.2,+ tools: [{ type: 'function', function: { name: 'lookup', parameters: { type: 'object', properties: {} } } }],+ });+ expect(fetch.mock.calls[0][0]).toBe(`${TYPHOON_BASE_URL}/chat/completions`);+ const init = fetch.mock.calls[0][1]!;+ expect(new Headers(init.headers).get('authorization')).toBe('Bearer test-key');+ expect(JSON.parse(String(init.body))).toMatchObject({ model, max_tokens: 128, temperature: 0.2, tools: [{ function: { name: 'lookup' } }] });+ expect(response.choices[0].message.content).toBe('OK');+ expect(response.usage).toEqual(completion.usage);+ expect(response._routed_via).toEqual({ platform: 'typhoon', model });+ });++ it('handles Typhoon SSE ending at EOF without a DONE sentinel or usage chunk', async () => {+ const chunks = [+ { id: 's', object: 'chat.completion.chunk', created: 1, model, choices: [{ index: 0, delta: { content: 'OK', tool_calls: [] }, finish_reason: null }] },+ { id: 's', object: 'chat.completion.chunk', created: 1, model, choices: [{ index: 0, delta: { content: null, tool_calls: null }, finish_reason: 'stop' }] },+ ];+ const fetch = vi.spyOn(global, 'fetch').mockResolvedValue(new Response(chunks.map(c => `data: ${JSON.stringify(c)}\n\n`).join(''), { headers: { 'Content-Type': 'text/event-stream' } }));+ const output: ChatCompletionChunk[] = [];+ for await (const chunk of getProvider('typhoon')!.streamChatCompletion('test-key', [{ role: 'user', content: 'Hi' }], model)) output.push(chunk);+ expect(output.flatMap(c => c.choices).map(c => c.delta.content ?? '').join('')).toBe('OK');+ expect(output.some(c => c.choices.some(x => x.finish_reason === 'stop'))).toBe(true);+ expect(JSON.parse(String(fetch.mock.calls[0][1]?.body)).stream).toBe(true);+ });++ it('validates using the exact authenticated model-not-found response, not public models', async () => {+ const fetch = vi.spyOn(global, 'fetch').mockResolvedValue(json({ detail: 'Model not found' }, 400));+ await expect(getProvider('typhoon')!.validateKey('test-key')).resolves.toBe(true);+ expect(fetch).toHaveBeenCalledTimes(1);+ expect(fetch.mock.calls[0][0]).toBe(`${TYPHOON_BASE_URL}/chat/completions`);+ expect(JSON.parse(String(fetch.mock.calls[0][1]?.body))).toMatchObject({ model: '__freellmapi_key_validation__', max_tokens: 1, stream: false });+ expect(new Headers(fetch.mock.calls[0][1]?.headers).get('authorization')).toBe('Bearer test-key');+ });++ it.each([401, 403])('rejects invalid credentials (%s)', async status => {+ vi.spyOn(global, 'fetch').mockResolvedValue(json({ detail: 'Invalid API Key' }, status));+ await expect(getProvider('typhoon')!.validateKey('invalid')).resolves.toMatchObject({ valid: false });+ });++ it.each([200, 400, 402, 404, 429, 500])('leaves other validation responses inconclusive (%s)', async status => {+ vi.spyOn(global, 'fetch').mockResolvedValue(json({ detail: 'Something else' }, status, { 'Retry-After': '17' }));+ await expect(getProvider('typhoon')!.validateKey('test-key')).rejects.toMatchObject({ status, retryAfterMs: 17_000 });+ });++ it('does not accept malformed validation JSON', async () => {+ vi.spyOn(global, 'fetch').mockResolvedValue(new Response('not JSON', { status: 400 }));+ await expect(getProvider('typhoon')!.validateKey('test-key')).rejects.toMatchObject({ status: 400 });+ });++ it('preserves rate limits and their retry delay', async () => {+ vi.spyOn(global, 'fetch').mockResolvedValue(json({ detail: 'Rate limit exceeded' }, 429, { 'Retry-After': '30' }));+ await expect(getProvider('typhoon')!.chatCompletion('test-key', [], model)).rejects.toMatchObject({ status: 429, retryAfterMs: 30_000 });+ });+});diff --git a/server/src/__tests__/routes/keys-providers-checklist.test.ts b/server/src/__tests__/routes/keys-providers-checklist.test.tsindex ac99297b..d170a665 100644--- a/server/src/__tests__/routes/keys-providers-checklist.test.ts+++ b/server/src/__tests__/routes/keys-providers-checklist.test.ts@@ -57,6 +57,8 @@ describe('GET /api/keys/providers — provider checklist (#543)', () => {.toMatchObject({ platform: 'moondream', name: 'Moondream', configured: false, keyless: false });expect(body.providers.find((p: { platform: string }) => p.platform === 'llmtr')).toMatchObject({ platform: 'llmtr', name: 'LLMTR', configured: false, keyless: false });+ expect(body.providers.find((p: { platform: string }) => p.platform === 'typhoon'))+ .toMatchObject({ platform: 'typhoon', name: 'Typhoon', configured: false, keyless: false });for (const [platform, name] of [['gizmo', 'Gizmo'], ['blockrun', 'BlockRun']]) {expect(body.providers.find((p: { platform: string }) => p.platform === platform)).toMatchObject({ platform, name, configured: false, keyless: false });diff --git a/server/src/__tests__/services/typhoon-transcription.test.ts b/server/src/__tests__/services/typhoon-transcription.test.tsnew file mode 100644index 00000000..33e35ec5--- /dev/null+++ b/server/src/__tests__/services/typhoon-transcription.test.ts@@ -0,0 +1,94 @@+import { beforeEach, afterEach, describe, expect, it, vi } from 'vitest';+import { initDb, getDb } from '../../db/index.js';+import { encrypt } from '../../lib/crypto.js';+import { runTranscription, TRANSCRIPTION_PLATFORMS } from '../../services/media.js';+import { clearCooldownsForKey, isOnCooldown } from '../../services/ratelimit.js';+import { applyCatalog } from '../../services/catalog-sync.js';+import { isBuiltinDiscoveryEligible } from '../../services/builtin-model-discovery.js';++const models = ['typhoon-asr-realtime', 'typhoon-isan-asr-realtime'];+const audio = Buffer.from('RIFFfakewavbytes');+const params = { file: audio, filename: 'sample.wav', mimeType: 'audio/wav', responseFormat: 'json' };++function seed() {+ const db = getDb();+ const encrypted = encrypt('typhoon-test-key');+ const key = db.prepare("INSERT INTO api_keys (platform,label,encrypted_key,iv,auth_tag,status,enabled) VALUES ('typhoon','test',?,?,?,'healthy',1)").run(encrypted.encrypted, encrypted.iv, encrypted.authTag);+ for (const [i, model] of models.entries()) {+ db.prepare("INSERT INTO media_models (platform,model_id,display_name,modality,priority,enabled,quota_label) VALUES ('typhoon',?,?,'transcription',?,1,'Free research API')").run(model, model, i);+ }+ return Number(key.lastInsertRowid);+}++describe('Typhoon transcription and catalog integration', () => {+ beforeEach(() => {+ process.env.ENCRYPTION_KEY = '0'.repeat(64);+ initDb(':memory:');+ for (let id = 1; id <= 10; id++) clearCooldownsForKey(id);+ });+ afterEach(() => vi.restoreAllMocks());++ it('has no bundled models or automatic discovery that could bypass catalog gating', () => {+ const db = getDb();+ expect(TRANSCRIPTION_PLATFORMS.has('typhoon')).toBe(true);+ expect(db.prepare("SELECT COUNT(*) AS n FROM models WHERE platform='typhoon'").get()).toEqual({ n: 0 });+ expect(db.prepare("SELECT COUNT(*) AS n FROM media_models WHERE platform='typhoon'").get()).toEqual({ n: 0 });+ expect(isBuiltinDiscoveryEligible(db, 'typhoon')).toBe(false);+ });++ it.each(models)('posts multipart file/model and normalizes %s', async model => {+ seed();+ const fetch = vi.spyOn(global, 'fetch').mockResolvedValue(new Response(JSON.stringify({ text: 'สวัสดี', usage: { total_tokens: 10 } })));+ const result = await runTranscription(model, { ...params, language: 'th', prompt: 'hint', temperature: 0.2 });+ expect(result).toEqual({ platform: 'typhoon', modelId: model, text: 'สวัสดี' });+ const [url, init] = fetch.mock.calls[0];+ expect(url).toBe('https://api.opentyphoon.ai/v1/audio/transcriptions');+ expect(new Headers(init?.headers).get('authorization')).toBe('Bearer typhoon-test-key');+ expect(new Headers(init?.headers).has('content-type')).toBe(false);+ const form = init?.body as FormData;+ expect([...form.keys()]).toEqual(['file', 'model']);+ expect(form.get('model')).toBe(model);+ const file = form.get('file') as File;+ expect(file.name).toBe('sample.wav');+ expect(file.type).toBe('audio/wav');+ expect(Buffer.from(await file.arrayBuffer())).toEqual(audio);+ });++ it.each(['text', 'verbose_json'])('normalizes output for the existing %s route formatter', async responseFormat => {+ seed();+ vi.spyOn(global, 'fetch').mockResolvedValue(new Response(JSON.stringify({ text: 'สวัสดี' })));+ await expect(runTranscription(models[0], { ...params, responseFormat })).resolves.toMatchObject({ text: 'สวัสดี' });+ });++ it('does not advertise native VTT support', async () => {+ seed();+ const fetch = vi.spyOn(global, 'fetch');+ await expect(runTranscription(models[0], { ...params, responseFormat: 'vtt' })).rejects.toMatchObject({ status: 400 });+ expect(fetch).not.toHaveBeenCalled();+ });++ it.each([{}, { text: 123 }, null])('rejects a successful response without transcription text (%j)', async body => {+ seed();+ vi.spyOn(global, 'fetch').mockResolvedValue(new Response(JSON.stringify(body)));+ await expect(runTranscription(models[0], params)).rejects.toMatchObject({ status: 502 });+ });++ it('preserves a 429 retry delay and benches the affected key/model', async () => {+ const key = seed();+ vi.spyOn(global, 'fetch').mockResolvedValue(new Response('Rate limited', { status: 429, headers: { 'Retry-After': '20' } }));+ await expect(runTranscription(models[0], params)).rejects.toMatchObject({ status: 429, retryAfterMs: 20_000 });+ expect(isOnCooldown('typhoon', models[0], key)).toBe(true);+ });++ it('ingests one chat and two transcription rows into separate registries, with no OCR', () => {+ const db = getDb();+ const counts = applyCatalog(db, {+ version: '2099.01.01', generatedAt: new Date().toISOString(), tier: 'live', quirks: [],+ models: [{ platform: 'typhoon', modelId: 'typhoon-v2.5-30b-a3b-instruct', displayName: 'Typhoon 2.5', intelligenceRank: 50, speedRank: 20, sizeLabel: '30B A3B', limits: { rpm: null, rpd: null, tpm: null, tpd: null }, monthlyTokenBudget: 'Ongoing free research API', contextWindow: 131072, enabled: true, supportsVision: false, supportsTools: true }],+ transcriptionModels: models.map((modelId, priority) => ({ platform: 'typhoon', modelId, displayName: modelId, priority, enabled: true })),+ });+ expect(counts.skippedUnknownPlatform).toBe(0);+ expect(db.prepare("SELECT model_id FROM models WHERE platform='typhoon'").all()).toEqual([{ model_id: 'typhoon-v2.5-30b-a3b-instruct' }]);+ expect(db.prepare("SELECT model_id,modality FROM media_models WHERE platform='typhoon' ORDER BY priority").all()).toEqual(models.map(model_id => ({ model_id, modality: 'transcription' })));+ });+});diff --git a/server/src/lib/key-parser.ts b/server/src/lib/key-parser.tsindex e418807e..85975ff0 100644--- a/server/src/lib/key-parser.ts+++ b/server/src/lib/key-parser.ts@@ -46,6 +46,9 @@ export interface ParseResult {export const PREFIX_MAP: Record<string, string> = {ACLIDE_: 'aclide',SPEKA_: 'speka',+ TYPHOON_: 'typhoon',+ OPENTYPHOON_: 'typhoon',+ OPEN_TYPHOON_: 'typhoon',LLMTR_: 'llmtr',GIZMO_: 'gizmo',BLOCKRUN_: 'blockrun',@@ -145,6 +148,9 @@ export const AUTH_JSON_PROVIDER_MAP: Record<string, string> = {sail: 'sail',aclide: 'aclide',speka: 'speka',+ typhoon: 'typhoon',+ opentyphoon: 'typhoon',+ 'open-typhoon': 'typhoon',llmtr: 'llmtr',gizmo: 'gizmo',blockrun: 'blockrun',diff --git a/server/src/providers/index.ts b/server/src/providers/index.tsindex c2d60d33..0110a310 100644--- a/server/src/providers/index.ts+++ b/server/src/providers/index.ts@@ -11,6 +11,7 @@ import { ZhipuProvider } from './zhipu.js';import { SailProvider } from './sail.js';import { AclideProvider } from './aclide.js';import { SpekaProvider } from './speka.js';+import { TyphoonProvider } from './typhoon.js';import { LlmtrProvider } from './llmtr.js';import { GizmoProvider } from './gizmo.js';import { BlockRunProvider } from './blockrun.js';@@ -62,6 +63,7 @@ register(new OpenAICompatProvider({register(new SailProvider());register(new AclideProvider());register(new SpekaProvider());+register(new TyphoonProvider());register(new LlmtrProvider());register(new GizmoProvider());register(new BlockRunProvider());diff --git a/server/src/providers/typhoon.ts b/server/src/providers/typhoon.tsnew file mode 100644index 00000000..4ccc3b72--- /dev/null+++ b/server/src/providers/typhoon.ts@@ -0,0 +1,33 @@+import { providerHttpError, type KeyValidationResult } from './base.js';+import { OpenAICompatProvider } from './openai-compat.js';+import { providerTimeoutMs } from '../lib/provider-timeout.js';+import { recordQuotaObservationsFromResponse, type QuotaObservationContext } from '../services/provider-quota.js';++export const TYPHOON_BASE_URL = 'https://api.opentyphoon.ai/v1';++/** Ongoing free, rate-limited research API, not a monthly credit grant.+ * Model rows arrive only through the signed catalog; OCR is not included.+ * https://docs.opentyphoon.ai/en/faq/ */+export class TyphoonProvider extends OpenAICompatProvider {+ constructor() {+ super({ platform: 'typhoon', name: 'Typhoon', baseUrl: TYPHOON_BASE_URL });+ }++ override async validateKey(apiKey: string, quotaContext?: QuotaObservationContext): Promise<KeyValidationResult> {+ // /models is public. Live controls returned 401 for an invalid key, 403+ // without a key, and this exact 400 only after successful authentication.+ // The nonexistent model avoids consuming inference tokens during checks.+ const res = await this.fetchWithTimeout(`${TYPHOON_BASE_URL}/chat/completions`, {+ method: 'POST',+ headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' },+ body: JSON.stringify({ model: '__freellmapi_key_validation__', messages: [{ role: 'user', content: 'key validation' }], max_tokens: 1, stream: false }),+ }, providerTimeoutMs('typhoon', 30_000), { timeoutBounds: 'request' });+ recordQuotaObservationsFromResponse(res, { ...quotaContext, platform: 'typhoon', endpoint: 'key-validation' });+ if ([401, 403].includes(res.status)) return this.validationResult(res);+ if (res.status === 400) {+ const body = await res.clone().json().catch(() => null) as { detail?: unknown } | null;+ if (body?.detail === 'Model not found') return true;+ }+ throw providerHttpError(res, 'Typhoon key validation is temporarily inconclusive');+ }+}diff --git a/server/src/routes/keys.ts b/server/src/routes/keys.tsindex 2b2224d2..41809223 100644--- a/server/src/routes/keys.ts+++ b/server/src/routes/keys.ts@@ -44,6 +44,7 @@ export const keysRouter = Router();const PLATFORMS = ['aclide','speka',+ 'typhoon','llmtr','gizmo','blockrun',diff --git a/server/src/services/media.ts b/server/src/services/media.tsindex f25e3e9e..93ace331 100644--- a/server/src/services/media.ts+++ b/server/src/services/media.ts@@ -18,6 +18,7 @@ import { bearerAuthHeader } from '../lib/credential.js';import { assessProviderUrl } from '../lib/url-guard.js';import { isOnCooldown, setCooldown } from './ratelimit.js';import { SPEECHIFY_BASE_URL, SPEECHIFY_VERSION } from '../providers/speechify.js';+import { TYPHOON_BASE_URL } from '../providers/typhoon.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). */@@ -34,7 +35,7 @@ const KEYLESS_CAPABLE = new Set(['pollinations']);/** Platforms with a speech-to-text adapter below. catalog-sync gates the* catalog's `transcriptionModels` entries on this, the way MEDIA_PLATFORMS* gates the generative-media rows. */-export const TRANSCRIPTION_PLATFORMS = new Set(['groq', 'cloudflare']);+export const TRANSCRIPTION_PLATFORMS = new Set(['groq', 'cloudflare', 'typhoon']);// 'transcription' rows live in media_models like the other modalities; they// arrive via the catalog's dedicated `transcriptionModels` array (see@@ -985,6 +986,22 @@ async function callTranscriptionProvider(): Promise<Omit<TranscriptionResult, 'platform' | 'modelId'>> {const key = credential.key;switch (m.platform) {+ case 'typhoon': {+ // The tested API accepts file + model and returns {text, usage}.+ // Do not forward Whisper-only options or claim native subtitle support.+ // The route derives text/JSON response formats from this normalized result.+ const form = new FormData();+ form.append('file', new Blob([p.file], { type: p.mimeType || 'application/octet-stream' }), p.filename);+ form.append('model', m.modelId);+ const r = await mediaFetch(`${TYPHOON_BASE_URL}/audio/transcriptions`, 'typhoon', 'transcription', {+ method: 'POST',+ headers: { ...bearerAuthHeader(key) },+ body: form,+ });+ const j = (await r.json()) as { text?: unknown } | null;+ if (!j || typeof j.text !== 'string') throw new MediaError('typhoon returned no transcription text', 502);+ return { text: j.text };+ }case 'custom': {// Any OpenAI-compatible STT server (faster-whisper-server, LocalAI,// whisper.cpp's server, vLLM…). Same multipart shape as groq below;diff --git a/shared/types.ts b/shared/types.tsindex c731b18b..f1b8e662 100644--- a/shared/types.ts+++ b/shared/types.ts@@ -72,6 +72,8 @@ export type Platform =| 'aclide'// OpenAI-compatible chat and embeddings; one shared $1 monthly allowance.| 'speka'+ // Ongoing free research API for chat and speech recognition; catalog only.+ | 'typhoon'// Selected zero-priced routes have daily/rolling quotas without a top-up;// signed catalog only. The public roster also includes paid/promotional IDs.| 'llmtr'