OpenRouter Load Balancer API

This service provides an OpenAI-compatible API that load-balances across multiple free / low-cost AI providers with automatic fallback. Model lists are discovered dynamically from each provider's /models endpoint (24h cache) with static lists as fallback.

Providers (plug-and-play)

Each provider is a module under src/providers/. Add or remove a provider by editing src/providers/index.ts.

ProviderBase URLNotes
emperohttps://free.empero.org/v1Free community endpoint (Germany). Any API key accepted. Prompts logged (hashed IP) for training. 503s common when busy — retry.
tokenharborhttps://tokenharbor.ai/v1Aggregator with free tier models (:free suffix). deepseek-v4-flash:free and mimo-v2.5:free confirmed working. Register at tokenharbor.ai for TOKENHARBOR_API_KEY.
tokenrouterhttps://api.tokenrouter.io/v1OpenAI-compatible gateway (BYOK). Free plan needs explicit model ids (no auto-routing). Key format tr_... from tokenrouter.io console.
hilinkuphttps://api.hilinkup.com/v1OpenAI-compatible gateway. GLM-5.3-Flash had a限时免费 promo (8/27–9/2 GMT+8). Get HILINKUP_API_KEY from the HiLinkup console.
baihttps://api.b.ai/v1OpenAI-compatible. GLM-5.3-Flash currently 0 credits (限时活动). Register at b.ai for BAI_API_KEY. Good for Cursor / Claude Code.
openrouterhttps://openrouter.ai/api/v1Primary aggregator. Free models are also discovered dynamically from /models and injected at runtime.
vercelhttps://ai-gateway.vercel.sh/v1Vercel AI Gateway. Bring-your-own-key aggregator over many providers.
cloudflarehttps://api.cloudflare.com/client/v4/accounts/{account_id}/ai/v1Cloudflare Workers AI. Requires CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID. Dynamic discovery via /accounts/{id}/ai/models/search (needs Workers AI Read permission; falls back to static list otherwise).
nvidiahttps://integrate.api.nvidia.com/v1NVIDIA NIM free developer tier. ~40 RPM account-wide. Get an nvapi- key at build.nvidia.com (free, no card). Many catalog models 404 on free accounts; fallbackModels are confirmed working.

GET /free/models

Fetch free models from OpenRouter plus each provider's dynamically-discovered model list.

GET /providers

List all configured providers, their base URLs, env vars, dynamically-discovered models, and availability.

GET /status · GET /status.html

Health check: probes every provider's /models endpoint and sends a minimal chat request. /status returns JSON, /status.html renders a visual status page (auto-refresh 60s).

POST /chat/completions

Create a chat completion with automatic fallback across all available providers. Providers that explicitly support the requested model are tried first, then the rest in priority order. Model matching uses dynamically-discovered lists.

Example Request:

{
  "model": "glm-5.3-flash",
  "messages": [
    { "role": "user", "content": "What is the meaning of life?" }
  ]
}

Add "stream": true for SSE streaming.

Cross-Origin Support

CORS is enabled for all origins.