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 AnyAPI as an OpenAI-compatible provider (#732) (#772)
suantea (asuan_suan)5999d48a8e3a
diff --git a/client/src/components/keys/shared.tsx b/client/src/components/keys/shared.tsxindex c7d3349c..bb2fddcc 100644--- a/client/src/components/keys/shared.tsx+++ b/client/src/components/keys/shared.tsx@@ -54,6 +54,7 @@ export const PLATFORMS: { value: Platform; label: string; url: string; keyless?:{ value: 'navy', label: 'NavyAI (free key)', url: 'https://api.navy' },{ value: 'nara', label: 'NaraRouter (free key)', url: 'https://router.bynara.id' },{ value: 'sealion', label: 'SEA-LION (free key)', url: 'https://sea-lion.ai' },+ { value: 'anyapi', label: 'AnyAPI (free key, 100K tokens/day)', url: 'https://anyapi.ai' },{ value: 'modelscope', label: 'ModelScope (free key, needs Aliyun cn binding)', url: 'https://modelscope.cn/my/myaccesstoken' },{ value: 'aihorde', label: 'AI Horde (no key needed, slow)', url: 'https://aihorde.net/register', keyless: true },]diff --git a/client/src/lib/routing.ts b/client/src/lib/routing.tsindex df78574d..a09e2d37 100644--- a/client/src/lib/routing.ts+++ b/client/src/lib/routing.ts@@ -304,6 +304,7 @@ export const platformColors: Record<string, string> = {navy: '#1d4ed8',nara: '#2563eb',sealion: '#0ea5e9',+ anyapi: '#0891b2',modelscope: '#624aff',aihorde: '#dc2626',}diff --git a/server/src/__tests__/lib/key-parser.test.ts b/server/src/__tests__/lib/key-parser.test.tsindex 6c299f6a..25698471 100644--- a/server/src/__tests__/lib/key-parser.test.ts+++ b/server/src/__tests__/lib/key-parser.test.ts@@ -56,6 +56,8 @@ describe('key parser', () => {expect(detectPlatform('NAVYAI_')).toBe('navy');expect(detectPlatform('SEALION_')).toBe('sealion');expect(detectPlatform('MODELSCOPE_')).toBe('modelscope');+ expect(detectPlatform('ANYAPI_')).toBe('anyapi');+ expect(detectPlatform('ANY_API_')).toBe('anyapi');expect(detectPlatform('SAMBANOVA_')).toBeNull();});@@ -67,6 +69,7 @@ describe('key parser', () => {expect(AUTH_JSON_PROVIDER_MAP['api-navy']).toBe('navy');expect(AUTH_JSON_PROVIDER_MAP['sea-lion']).toBe('sealion');expect(AUTH_JSON_PROVIDER_MAP['model-scope']).toBe('modelscope');+ expect(AUTH_JSON_PROVIDER_MAP['any-api']).toBe('anyapi');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/openai-compat.test.ts b/server/src/__tests__/providers/openai-compat.test.tsindex 7f2b222f..6457e439 100644--- a/server/src/__tests__/providers/openai-compat.test.ts+++ b/server/src/__tests__/providers/openai-compat.test.ts@@ -498,6 +498,7 @@ describe('OpenAICompatProvider - platform instances', () => {const platforms = [{ platform: 'groq', name: 'Groq', baseUrl: 'https://api.groq.com/openai/v1' },{ platform: 'cerebras', name: 'Cerebras', baseUrl: 'https://api.cerebras.ai/v1' },+ { platform: 'anyapi', name: 'AnyAPI', baseUrl: 'https://api.anyapi.ai/v1' },{ platform: 'nvidia', name: 'NVIDIA NIM', baseUrl: 'https://integrate.api.nvidia.com/v1' },{ platform: 'mistral', name: 'Mistral', baseUrl: 'https://api.mistral.ai/v1' },{ platform: 'openrouter', name: 'OpenRouter', baseUrl: 'https://openrouter.ai/api/v1' },diff --git a/server/src/__tests__/services/provider-quota.test.ts b/server/src/__tests__/services/provider-quota.test.tsindex f6e8f18e..88295f3d 100644--- a/server/src/__tests__/services/provider-quota.test.ts+++ b/server/src/__tests__/services/provider-quota.test.ts@@ -41,6 +41,10 @@ describe('provider-quota: pool inference', () => {expect(inferQuotaPoolKey('groq')).toBe('groq::account');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+ // the platform shares a single pool.+ expect(inferQuotaPoolKey('anyapi')).toBe('anyapi::free');+ expect(inferQuotaPoolKey('anyapi', 'qwen/qwen3-coder:free')).toBe('anyapi::free');// Unknown platform falls back to platform::model or platform::account.expect(inferQuotaPoolKey('acme' as any, 'x')).toBe('acme::x');expect(inferQuotaPoolKey('acme' as any)).toBe('acme::account');diff --git a/server/src/lib/key-parser.ts b/server/src/lib/key-parser.tsindex b3433623..45522c65 100644--- a/server/src/lib/key-parser.ts+++ b/server/src/lib/key-parser.ts@@ -74,6 +74,8 @@ export const PREFIX_MAP: Record<string, string> = {SEA_LION_: 'sealion',MODELSCOPE_: 'modelscope',MODEL_SCOPE_: 'modelscope',+ ANYAPI_: 'anyapi',+ ANY_API_: 'anyapi',AIHORDE_: 'aihorde',};@@ -101,6 +103,8 @@ export const AUTH_JSON_PROVIDER_MAP: Record<string, string> = {'sea-lion': 'sealion',modelscope: 'modelscope','model-scope': 'modelscope',+ anyapi: 'anyapi',+ 'any-api': 'anyapi',};export function detectPlatform(prefix: string): string | null {diff --git a/server/src/providers/index.ts b/server/src/providers/index.tsindex da6ccfe9..082580bc 100644--- a/server/src/providers/index.ts+++ b/server/src/providers/index.ts@@ -33,6 +33,26 @@ register(new OpenAICompatProvider({baseUrl: 'https://api.cerebras.ai/v1',}));+// AnyAPI - OpenAI-compatible gateway (anyapi.ai). Free tier (checked against+// anyapi.ai/pricing 2026-08-10): $0, no card, recurring — but the binding limit+// is 100K TOKENS PER DAY, and only "free and basic" models are in scope. AnyAPI+// publishes no RPM/RPD numbers at all; the 20 RPM / 200 RPD figures in #732 are+// OpenRouter's, not AnyAPI's, so nothing here asserts a request rate.+//+// Model rows are NOT seeded here or in migrations — they are authored in the+// hosted catalog and arrive via catalog-sync once the platform is registered+// (see services/catalog-sync.ts, which gates on hasProvider). The ids proposed+// in #732 (meta-llama/llama-3.3-70b-instruct:free, qwen/qwen3-coder:free,+// nvidia/nemotron-3-ultra-550b-a55b:free, google/gemma-4-26b-a4b-it:free) came+// from a third-party list and are UNVERIFIED against the live /v1/models, which+// needs a key; treat them as candidates for catalog authoring, where a bad id+// is caught by the health check instead of shipped as a default.+register(new OpenAICompatProvider({+ platform: 'anyapi',+ name: 'AnyAPI',+ baseUrl: 'https://api.anyapi.ai/v1',+}));+// SambaNova was dropped in V23 (June 2026): the free tier is permanently gone.// The always-free tier was retired in early 2025 for a one-time $5 trial// credit (expires in 3 months); once it lapses, every chat call 402sdiff --git a/server/src/routes/keys.ts b/server/src/routes/keys.tsindex 8e9539d3..44dbc9ec 100644--- a/server/src/routes/keys.ts+++ b/server/src/routes/keys.ts@@ -29,7 +29,7 @@ const PLATFORMS = ['google', 'groq', 'cerebras', 'nvidia', 'mistral','openrouter', 'github', 'cohere', 'cloudflare', 'zhipu', 'ollama','kilo', 'pollinations', 'llm7', 'huggingface', 'opencode', 'ovh', 'agnes', 'reka', 'siliconflow',- 'routeway', 'bazaarlink', 'ainative', 'aion', 'requesty', 'navy', 'nara', 'sealion', 'modelscope', 'aihorde', 'custom',+ 'routeway', 'bazaarlink', 'ainative', 'aion', 'anyapi', 'requesty', 'navy', 'nara', 'sealion', 'modelscope', 'aihorde', 'custom',] as const;const ALLOWED_IMPORT_EXTENSIONS = new Set(['.env', '.json', '.jsonc', '.md', '.txt', '.csv']);diff --git a/server/src/services/provider-quota.ts b/server/src/services/provider-quota.tsindex 81873f71..5f6b1c72 100644--- a/server/src/services/provider-quota.ts+++ b/server/src/services/provider-quota.ts@@ -141,13 +141,16 @@ function inferPoolForPlatform(platform: Platform, modelId?: string | null): striif (platform === 'navy') return 'navy::free';if (platform === 'nara') return 'nara::free';if (platform === 'sealion') return 'sealion::free';+ // AnyAPI: the free tier is one 100K-tokens/day budget for the whole account,+ // shared across every free/basic model — so one pool, not one per model.+ if (platform === 'anyapi') return 'anyapi::free';// ModelScope: one 2000-requests/day quota across the whole account.if (platform === 'modelscope') return 'modelscope::account';return normalizedModelId ? `${platform}::${normalizedModelId}` : `${platform}::account`;}function isSharedPool(platform: Platform): boolean {- return ['openrouter', 'google', 'groq', 'cerebras', 'sambanova', 'nvidia', 'mistral', 'github', 'cohere', 'cloudflare', 'zhipu', 'ollama', 'kilo', 'pollinations', 'llm7', 'huggingface', 'opencode', 'routeway', 'bazaarlink', 'ainative', 'aion', 'requesty', 'navy', 'nara', 'sealion', 'modelscope', 'aihorde'].includes(platform);+ return ['openrouter', 'google', 'groq', 'cerebras', 'sambanova', 'nvidia', 'mistral', 'github', 'cohere', 'cloudflare', 'zhipu', 'ollama', 'kilo', 'pollinations', 'llm7', 'huggingface', 'opencode', 'routeway', 'bazaarlink', 'ainative', 'aion', 'requesty', 'navy', 'nara', 'sealion', 'anyapi', 'modelscope', 'aihorde'].includes(platform);}type HeaderSpec = { metric: QuotaMetric; limit: string; remaining?: string; reset?: string; strategy?: QuotaResetStrategy };diff --git a/shared/types.ts b/shared/types.tsindex 1ee1f0dd..0c36908e 100644--- a/shared/types.ts+++ b/shared/types.ts@@ -60,6 +60,11 @@ export type Platform =| 'google'| 'groq'| 'cerebras'+ // AnyAPI — OpenAI-compatible gateway. Free tier is $0/no card/recurring but+ // capped at 100K tokens/day over "free and basic" models only; no RPM/RPD is+ // published. Catalog rows live in the hosted catalog (premium now, free after+ // 30 days).+ | 'anyapi'| 'nvidia'| 'mistral'| 'sambanova'