In this article
- What You're Setting Up
- How a Request Is Routed
- What the model Field Does
- Routing Strategies
- How Failover Decides What to Skip
- Step 1: Install with Docker Compose on 127.0.0.1
- Alternative: Run from Source
- Step 2: Create the Dashboard Account
- Step 3: Add Provider Keys
- Step 4: Configure Routing
- On the Dashboard
- From a Declarative Config File
- Environment Knobs That Change Routing
- Step 5: Point Clients at It
- The openai Python SDK
- curl
- Claude Code
- Step 6: Lock It Down
- Key Encryption as Implemented
- What Is and Is Not Authenticated
- Do Not Expose It Publicly
- The "10.1 Billion Tokens per Month" Figure
- Terms-of-Service Reality Check
- Troubleshooting
- Practical Verdict
- What to Read Next
What You're Setting Up
FreeLLMAPI is an MIT-licensed Node.js server, written by Tashfeen Ahmed and contributors, that stores API keys for many free LLM tiers and puts them behind one OpenAI-compatible /v1 API. One Express process serves the API and a React admin dashboard on port 3001, and keeps its state in SQLite. For each request a router picks a provider and model, and when that call fails with a rate limit or a server error it moves to the next candidate.
The project describes itself as being for "personal experimentation only". This guide covers a single-user install on your own machine: Docker Compose bound to 127.0.0.1, provider keys, routing settings, client configuration, and what to lock down.
November 2026 status: This guide follows commit
8fcdb90onmain(22 November 2026). The newest release, v0.16.38 (21 November), is 16 commits behind it, and the Docker:latesttag follows releases, notmain. Two behaviours described below arrived in those 16 commits: the Claude Code auto-mode handling (#2049) and counting Google's daily limits from Pacific midnight (#2017). Step 1 shows how to run the exact commit.
How this guide was checked: Every command, environment variable, config key and default below was read from the repository at commit
8fcdb90. The routing, failover, authentication and encryption behaviour was traced through the server source at that commit (server/src/services/router.ts,server/src/lib/fallback-loop.ts,server/src/lib/crypto.ts,server/src/app.tsand the route files), not taken from the README alone. Open issues were reviewed on 23 November 2026. Where the README and the code disagree, this guide follows the code and says so.
Requirements:
- Docker path (recommended): Docker, Docker Compose and OpenSSL, per the project's install guide. The published image is multi-arch (
linux/amd64andlinux/arm64) and is built onnode:24.22.1-bookworm-slim. - Source path: Node.js
>=20.18.0 <25.0.0and npm>=10.0.0, from theenginesfield ofpackage.json. The repo's.nvmrcpins Node 22. - At least one free API key from a supported provider (Google, Groq, Cerebras, Mistral, OpenRouter and others), or none at all if you use only the providers that need no key (see Step 3).
- The README puts idle memory at about 40 MB RSS. That is the project's figure.
How a Request Is Routed
Every inference request goes through the same steps, whichever wire format it arrived in (/v1/chat/completions, /v1/responses, /v1/messages or /v1/completions):
| Step | What the code does |
|---|---|
| 1. Authenticate | The bearer token (or x-api-key, or x-goog-api-key) must be the unified key or an enabled client-profile key (sk-cp-…). This check also runs for requests from localhost: the code's comment notes that browser pages can reach localhost, so being local is not treated as authorisation. |
2. Resolve the model field | The value becomes either a chain to walk (auto, auto:<something>) or a strict pin to one logical model (see the next table). |
| 3. Order the candidates | The active routing strategy scores and sorts the chain. The default is balanced. |
| 4. Filter | Candidates are skipped when their provider has no enabled, healthy key, when the request has images and the model has no vision support, when it carries tools and the model cannot emit tool calls, when the estimated request exceeds the model's advertised context window, or when it exceeds the model's tokens-per-minute limit. Models that fit only without a 1.25× safety margin on the estimate are kept but tried last. |
| 5. Pick a key and dispatch | Among that provider's keys, the router prefers ones scored higher on reliability (75%) and speed (25%), skipping keys on cooldown or outside their rate windows. The key is decrypted in memory and the request is sent. |
| 6. Fail over | A shared fallback loop classifies each failure, records cooldowns and penalties, and routes again with the failed key, model or provider excluded. It stops after 20 attempts or a 45-second wall-clock budget. |
What the model Field Does
| You send | Candidates | Can it switch to a different model? |
|---|---|---|
no model, or auto | The active fallback chain, ordered by the global strategy. A conversation sticks to the model that last served it for 30 minutes. | Yes |
auto:smart, auto:fast, auto:reliable, auto:balanced, auto:cheap (and synonyms such as auto:fastest) | Every enabled model, ranked under that preset and ignoring your chain order. auto:cheap uses the balanced weights, because everything in the pool is already free. | Yes |
auto:<chain-name> | A named chain (a "profile") you built on the dashboard. An unknown name returns 400. | Yes, within that chain |
A catalog model id, e.g. llama-3.3-70b-versatile | Only the providers that serve the same logical model. Model grouping is always on in this commit (isUnifyEnabled() returns true). | No. An id that is disabled or not in the catalog returns 404 model_not_found. An id whose providers have no key returns 503 no_providers_configured. |
fusion | A panel of models answers in parallel, then a judge model writes one answer from the drafts. | Not applicable |
A Claude name on /v1/messages | Mapped on the dashboard's Keys → Anthropic tab: each family (default, opus, sonnet, haiku) goes to auto or to a model you pin. | Depends on the mapping |
That third column matters for evaluations. With auto, two requests in the same run can be answered by different models. Pin a model id when you need consistent results, and read the X-Routed-Via: <platform>/<model> response header to see which provider actually answered.
Routing Strategies
The default strategy, balanced, is not "walk the chain in order". It is a score-based ranking (the code calls it a bandit). Each model gets three normalised axes, weighted per preset (BANDIT_PRESETS in server/src/services/scoring.ts):
| Strategy | Reliability | Speed | Intelligence |
|---|---|---|---|
balanced (default) | 0.50 | 0.25 | 0.25 |
smartest | 0.35 | 0.10 | 0.55 |
fastest | 0.35 | 0.55 | 0.10 |
reliable | 0.70 | 0.15 | 0.15 |
priority | No weights. Your manual chain order, with each model pushed down by its failure penalty. | ||
custom | Your own weight vector. | ||
decision | A decision model picks one of the four presets per request. | ||
How each axis is filled, from server/src/services/router.ts:
- Reliability is drawn from a Beta distribution over the model's recent successes and failures (a 7-day window in which a 2-day-old request counts half as much), so models with little history get some randomness in their ranking.
- Speed comes from observed tokens per second and time to first byte.
- Intelligence comes from the catalog's size label and intelligence rank.
The weighted average is then multiplied by two damping factors:
- Headroom: how close the model is to its monthly budget or its per-minute and per-day windows. The worse of the two is used.
- Penalty: each rate-limit failure adds 3 points and any other upstream failure adds 1, capped at 10 and decaying by 1 every 2 minutes. A model is only penalised when no other key can still serve it.
An optional exploration mode (off by default) gives models with fewer than 5 samples a 10% chance of going first.
README vs code: The README's "How it works" section says the router "picks the highest-priority model" and retries "the next model in your chain". That describes the
prioritystrategy. The default isbalanced, which reorders the chain by score on every request, so the order you drag models into on the dashboard is only a tie-breaker unless you switch topriority.
How Failover Decides What to Skip
The decision logic is recordRetryableFailure, recordAuthFailure and cooldownDecisionForError in server/src/lib/fallback-loop.ts, with durations from server/src/services/ratelimit.ts:
| Upstream failure | Excluded for the rest of this request | Cooldown that outlives the request |
|---|---|---|
401 invalid key | That key | Model+key benched 5 minutes, and the key is revalidated immediately |
402 out of credits | That key, on every model of the provider | 1 day |
403 model not allowed for this key's tier | That model | 1 day |
429 daily quota exhausted | That model+key | Until the provider's Retry-After, else the next UTC midnight. For Google, the next Pacific midnight. |
429 per-minute limit | That key | A cooldown ladder starting at 90 seconds |
5xx, timeout, connection error | The whole provider, all keys and models. Custom endpoints are exempt, because they all share the platform id custom. | Cooldown ladder |
Context too large (413 and provider wordings) | That model | None. The reported limit is learned so the router sizes the model out next time. |
404 model not found | That model. After 3 different models from one provider return it, the whole provider. | A cooldown, plus tracking of models retired upstream |
Provider-formatted 400 or 422 request rejection | That key. If every candidate rejects the request, the client gets 400 (provider_rejected_request). | Recorded like other retryable failures. A model that keeps rejecting tools requests is tried last for tool requests. |
| Anything the classifier does not treat as retryable | No failover. The request ends with 502 provider_error. | |
Three limits bound the loop:
- At most 20 attempts (
FALLBACK_MAX_RETRIES). - A 45-second wall-clock budget (
FALLBACK_TIME_BUDGET_MS, where0disables it). The budget is checked before each retry. The first failover is always allowed, and an attempt still waiting for its first byte when the budget runs out is cancelled. - No failover once a stream has started. After a stream has sent bytes to your client, a mid-stream error is reported to the client.
When failover happens, responses carry X-Fallback-Attempts and X-Fallback-Trail, which lists each failed hop and its error class.
Step 1: Install with Docker Compose on 127.0.0.1
These commands are from the project's install guide. On macOS or Linux:
git clone https://github.com/tashfeenahmed/freellmapi.git
cd freellmapi
# Generate an encryption key for at-rest key storage
ENCRYPTION_KEY="$(openssl rand -hex 32)"
printf "ENCRYPTION_KEY=%s\nPORT=3001\n" "$ENCRYPTION_KEY" > .env
docker compose up -d
On Windows PowerShell:
git clone https://github.com/tashfeenahmed/freellmapi.git
cd freellmapi
$Bytes = New-Object Byte[] 32
[Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($Bytes)
$ENCRYPTION_KEY = -join ($Bytes | ForEach-Object { "{0:x2}" -f $_ })
"ENCRYPTION_KEY=$ENCRYPTION_KEY`nPORT=3001" | Out-File -Encoding utf8 .env
docker compose up -d
The bundled docker-compose.yml already does what this guide wants:
# Bound to localhost by default — FreeLLMAPI is single-user and must not be
# exposed to the internet. Set HOST_BIND=0.0.0.0 to reach it from your LAN.
ports:
- "${HOST_BIND:-127.0.0.1}:${PORT:-3001}:3001"
volumes:
- freellmapi-data:/app/server/data
Leave HOST_BIND unset. The image sets NODE_ENV=production, so the server refuses to start without ENCRYPTION_KEY. The SQLite database lives in the named volume freellmapi-data at /app/server/data. The code's default file name there is freeapi.db.
Running the exact commit this guide describes. The compose file pulls ghcr.io/tashfeenahmed/freellmapi:latest, which tracks releases (v0.16.38 on 23 November). To run commit 8fcdb90 instead, check it out and use the project's documented rebuild command:
git checkout 8fcdb90ec5720f8045ee886306734ae99d12d0ff
docker compose up -d --build
Alternatively, a prebuilt sha-8fcdb90 tag was present on GHCR on 23 November: set it as the image: in docker-compose.yml.
Confirm the container is healthy and read its log:
docker compose ps
docker compose logs -f freellmapi
At startup the server logs Server running on http://[::]:3001 (from server/src/index.ts), because it listens on all interfaces inside the container. Docker publishes that port on the host's loopback interface only.
Back up .env. The key in it is what decrypts your stored provider keys. Keep the same .env and the same volume across upgrades. A different key makes every stored provider key undecryptable.
Alternative: Run from Source
From the same install guide:
git clone https://github.com/tashfeenahmed/freellmapi.git
cd freellmapi
npm install
ENCRYPTION_KEY="$(node -e 'console.log(require("crypto").randomBytes(32).toString("hex"))')"
printf "ENCRYPTION_KEY=%s\nPORT=3001\n" "$ENCRYPTION_KEY" > .env
npm run dev
npm run dev serves the API on :3001 and the Vite dashboard on :5173. For a production-style build without Docker:
npm run build
node server/dist/index.js # server + dashboard both served on :3001
Add HOST=127.0.0.1 to .env on a source install. Without it the server binds ::, which is every interface over IPv4 and IPv6 (host: process.env.HOST ?? '::' in server/src/lib/config.ts). HOST_BIND affects only Docker's port publishing, not the server itself.
HOST=127.0.0.1
Step 2: Create the Dashboard Account
Open http://localhost:3001. Server installs (Docker, the one-line installer or a source run) use an email and password account. The first visitor creates it, and there are two guards on that:
- A browser whose connection the server sees as coming from the same machine can create the account directly.
- Any other caller must also enter a one-time setup code. The server prints it at every boot while no account exists:
First-run setup code: <code>
A browser on this machine can finish setup without it. From any
other device, enter this code to create the first account.
Whether a browser on your host counts as "this machine" from inside a container depends on how Docker forwards the port. If the form asks for a code, read it with docker compose logs freellmapi.
To skip the open setup window entirely, provision the admin account from the declarative config (Step 4). The config is applied before the HTTP listener starts, so no setup code is minted and POST /api/auth/setup returns 409 from the first request.
Lost the password? There is no email delivery. Forgot password? prints a reset code, valid for 15 minutes, to the same server log.
Step 3: Add Provider Keys
There are three ways to add keys. All of them store the key encrypted (Step 7).
1. The dashboard. Open Keys, add a key per provider, and copy the unified API key (freellmapi- followed by 48 hex characters) from the page header. That unified key is the only credential your clients use. It is generated on the first database migration.
2. The CLI. This uses a dashboard session token, not the unified key. From cli/README.md:
export FREELLMAPI_URL=http://localhost:3001
export FREELLMAPI_DASHBOARD_TOKEN='<dashboard-session-token>'
npx freellmapi keys add groq # hidden provider-key prompt
npx freellmapi keys add groq --key '<key>' # non-interactive alternative
npx freellmapi keys list
npx freellmapi keys test groq # check every stored Groq key
npx freellmapi keys test groq --id 7 # check one key
npx freellmapi keys remove groq --id 7
The token is the session stored in the signed-in browser's local storage as freellmapi_dashboard_token. keys add validates the key right away, and leaves it saved even when validation fails, so run keys list afterwards.
3. The declarative config. This is covered in Step 4.
Platform ids are lowercase strings such as google, groq, cerebras, mistral, openrouter, cloudflare (whose key format is account_id:token) and custom. For a local model server, the custom provider accepts any OpenAI-compatible base URL. From inside a container, a server on your host is reached through host.docker.internal, which the compose file maps.
Providers that need no key are switched on for you. On a brand-new database, after the first catalog sync,
server/src/services/keyless-defaults.tsenables every keyless provider the catalog lists (the code names Kilo, OVH and AI Horde as examples). The project's own platform notes say Kilo's anonymous routes log prompts and outputs for training, and AI Horde is served by community volunteer workers. If your prompts are not public, review the Keys page and switch these off before sending anything.
Your install's model catalog updates itself: every 12 hours it fetches a catalog signed with a pinned Ed25519 key from https://api.freellmapi.co. Free installs receive the monthly snapshot, so a new model reaches them 30 days after it enters the paid live feed. CATALOG_SYNC_DISABLED=1 turns the fetch off, which also stops the keyless defaults above from being applied.
Step 4: Configure Routing
On the Dashboard
The Models and Fallback pages set the global strategy, the chain contents and named chains. A named chain is called by sending model: "auto:<name>". New named chains start empty and are not refilled by catalog sync unless you enable auto_include_new_models for them.
From a Declarative Config File
For repeatable installs, point FREEAPI_CONFIG_PATH at a JSON file, or put the JSON inline in FREEAPI_CONFIG_JSON, which takes precedence. The server applies it after migrations on every boot, and updates existing keys, models and settings rather than duplicating them. The example from docker/README.md:
{
"admin": { "email": "ops@example.com", "password": "change-me-min-8-chars" },
"license": "premium license key from freellmapi.co",
"keys": [
{ "platform": "groq", "key": "gsk_...", "label": "main" }
],
"customProviders": [
{
"baseUrl": "http://host.docker.internal:11434/v1",
"label": "Ollama",
"models": [
{ "model": "llama3.1:8b", "displayName": "Local Llama", "supportsTools": true }
]
}
],
"routing": { "strategy": "balanced" }
}
Remove the license line unless you have bought the Premium live catalog: it is optional, and the schema requires at least 8 characters. Under Docker, the path must be readable inside the container. .env.example uses /app/server/data/freellmapi.config.json, which is inside the data volume.
The keys the config accepts, from the zod schema in server/src/services/declarative-config.ts:
| Key | Accepts |
|---|---|
admin | email, password (min 8 characters). Used only while no account exists. Ignored with a warning afterwards. |
keys[] | platform, key, label, baseUrl, enabled |
customProviders[] | baseUrl, apiKey, label, models[] |
models[] | platform, modelId, optional endpoint, rate limits (rpmLimit, rpdLimit, tpmLimit, tpdLimit), contextWindow, enabled, supportsVision, supportsTools, fallbackEnabled and more |
fallback[] | platform, modelId, endpoint, priority, enabled |
routing.strategy | priority, balanced, smartest, fastest, reliable, custom, decision |
routing.weights | reliability, speed, intelligence (non-negative numbers) |
routing.keySelectionStrategy | auto or least-remaining |
This file holds provider keys, the admin password and any license key in plaintext. Protect it as carefully as ENCRYPTION_KEY, or delete it once the first boot has imported everything.
Environment Knobs That Change Routing
| Variable | Default | Effect |
|---|---|---|
MODEL_ROUTING_OVERRIDES | unset | JSON map of model id to a 0–2 score multiplier, e.g. {"gpt-4o": 0.2, "gpt-oss-120b": 1.5}. 0 means automatic routing never picks the model. Ids match exactly and are case-sensitive. |
FALLBACK_TIME_BUDGET_MS | 45000 | Wall-clock budget for the failover chain. 0 disables it. |
FALLBACK_DETAIL_HEADER | off | 1 adds X-Fallback-Detail with per-hop timings and redacted provider error text. |
FREELLMAPI_CONTEXT_HANDOFF | off | on_model_switch injects a short system note when an auto-routed conversation moves to a different model. |
STREAM_KEEPALIVE_MS | off | SSE pings for slow reasoning models. A ping commits the response, so a stream that then fails cannot fail over. |
PROXY_RATE_LIMIT_RPM | 120 | Per-IP limit on /v1 requests per minute. 0 disables it. |
Step 5: Point Clients at It
The base URL is http://localhost:3001/v1 and the API key is the unified key. The endpoints, from server/src/app.ts and the route files:
| Surface | Endpoints |
|---|---|
| OpenAI-compatible | POST /v1/chat/completions (streaming, tools, response_format, vision), POST /v1/responses, POST /v1/completions, GET /v1/models, GET /v1/models/{id}, POST /v1/embeddings, POST /v1/images/generations, POST /v1/videos/generations, POST /v1/audio/speech, POST /v1/audio/transcriptions, POST /v1/moderations, GET /v1/usage |
| Anthropic Messages | POST /v1/messages, POST /v1/messages/count_tokens, and GET /v1/models in Anthropic shape when the request sends anthropic-version |
| Gemini | /v1beta (generateContent, streaming, token counting, models) |
| Ollama emulation | /api/tags, /api/chat, /api/generate and others. Off by default (ollama_emulation setting: off, open-loopback or key-required). |
| MCP | /mcp, authenticated with the unified key |
| Docs | GET /v1/docs and GET /v1/openapi.json, unauthenticated |
Embeddings route differently from chat. Failover never crosses models, because vectors from different models are not comparable, so /v1/embeddings only fails over between providers serving the same model family. GET /v1/models lists the whole catalog by default, including models you cannot call. Add ?available=true to list only models that can serve a request now, or ?execution_status=ready to filter by live status.
The openai Python SDK
From the README. with_raw_response gives you the response headers as well as the parsed completion:
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:3001/v1",
api_key="freellmapi-your-unified-key",
)
response = client.chat.completions.with_raw_response.create(
model="auto", # let the router pick; or "auto:fast", "auto:smart", a profile, or a model id
messages=[{"role": "user", "content": "Summarise the fall of Rome in one sentence."}],
)
completion = response.parse()
print(completion.choices[0].message.content)
print("Routed via:", response.headers.get("x-routed-via"))
Streaming, from the project's API reference:
stream = client.chat.completions.create(
model="auto",
messages=[{"role": "user", "content": "Stream me a haiku about SQLite."}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="", flush=True)
curl
curl http://localhost:3001/v1/chat/completions \
-H "Authorization: Bearer freellmapi-your-unified-key" \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"messages": [{"role": "user", "content": "hi"}]
}'
Add curl's -i flag to see X-Routed-Via and, after a failover, X-Fallback-Trail. To list only models that can answer right now:
curl "http://localhost:3001/v1/models?execution_status=ready" \
-H "Authorization: Bearer freellmapi-your-unified-key"
Claude Code
The repository documents Claude Code over the Anthropic surface. Point it at the server's origin, without /v1, because Anthropic clients append the path themselves. Use ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY: the project notes that Claude Code treats a set ANTHROPIC_API_KEY as a conflicting credential.
Claude Code's auto mode asks the server to review tool calls, and that review runs only on Anthropic's servers. FreeLLMAPI routes to other providers, so it cannot run the review. Since #2049 it reports the review as unsupported rather than inventing a verdict. The project's fix is to set CLAUDE_CODE_AUTO_MODE_SERVER=0, which makes Claude Code run its own checks through your free pool. From the API reference:
export ANTHROPIC_BASE_URL=http://localhost:3001
export ANTHROPIC_AUTH_TOKEN=freellmapi-your-unified-key # NOT ANTHROPIC_API_KEY
export CLAUDE_CODE_AUTO_MODE_SERVER=0 # auto mode: see the note above
claude
The repo's CLI can write this configuration for you. It merges into your existing settings and takes a timestamped backup, and --dry-run prints the diff first:
npx freellmapi setup-claude --url http://localhost:3001 --api-key <unified-key>
The CLI also has generators for 19 other agents, including Codex CLI, Cline, Aider, OpenCode and Cursor, plus setup-generic for any OpenAI-compatible client (npx freellmapi list). Expect weaker and more variable models than Anthropic's own: tool-heavy agent turns only route to models flagged as supporting tools, and the project's own limitations section warns that the strongest free models hit their daily caps first. For the general Claude Code gateway setup, see our Claude Code with Ollama or OpenRouter guide.
Step 6: Lock It Down
Key Encryption as Implemented
From server/src/lib/crypto.ts at commit 8fcdb90:
| Property | Implementation |
|---|---|
| Cipher | aes-256-gcm via Node's crypto |
| IV | 16 random bytes per encryption, stored hex-encoded next to the ciphertext |
| Auth tag | Stored per row. Decryption pins it to 16 bytes (authTagLength: 16), so a row edited to carry a truncated tag is rejected. |
| Master key | 32 bytes from ENCRYPTION_KEY, which must be exactly 64 hex characters, or boot fails. The .env.example placeholder your-64-char-hex-key-here is never accepted. |
Master key when NODE_ENV=production (including the Docker image) | Required. Boot fails with ENCRYPTION_KEY is required in production… |
| Master key otherwise | Checked in this order: env var, then a .encryption-key file next to the database, then a legacy key stored in the database (moved to the file, then deleted). If none exists, a new key is generated into that file with 0600 permissions. |
| Use | Provider keys are decrypted in memory at request time. Other secrets (per-key proxy overrides, client-profile credentials, Fetch Relay tokens) use the same key. |
| Mismatch check | At boot, one stored key is test-decrypted. If that fails, the log says the database and the key come from different installs. |
Where the master key lives:
- Docker: in
.envnext todocker-compose.yml(in~/freellmapi/if you used the one-line installer). It reaches the container as an environment variable. - Source run without
ENCRYPTION_KEY: inserver/data/.encryption-key, besideserver/data/freeapi.db.
Encryption protects a copied database file. It does not protect against anyone who can read .env, the process environment, or the container's memory.
Three things are not covered by that encryption:
- The unified API key is stored in plaintext in the
settingstable. Anyone with a copy of the database can call your proxy if they can reach it. Rotate it from the dashboard (it callsPOST /api/settings/api-key/regenerate) if a database copy leaks. Client-profile keys (sk-cp-…) are looked up by SHA-256 hash. - The declarative config file holds keys in plaintext (Step 4).
- Encrypted backups (
FREEAPI_DB_BACKUP_*) useENCRYPTION_KEYunless you set a separateFREEAPI_DB_BACKUP_KEY.
What Is and Is Not Authenticated
| Path | Credential |
|---|---|
/v1/* inference, /v1beta, /mcp | Unified key or client-profile key, checked on every request including from localhost. Rate-limited to 120 requests per minute per IP. |
/v1/t/<token> | A revocable URL token, for clients that cannot set headers |
/api/* (dashboard, keys, settings, backups, logs) | Dashboard session from email and password login. The unified key does not open these. |
/api/ping, /livez, /readyz, /v1/docs, /v1/openapi.json, /api/auth/status|setup|login | None |
Do Not Expose It Publicly
The project's limitations section is blunt: there is no multi-tenant auth, so run it for yourself and do not expose it to the internet. If you do expose it:
- One key guards everything. Anyone who gets the unified key can spend all your provider quotas, under your accounts.
- There is no TLS. HSTS is off by design and the server speaks plain HTTP, so on a LAN the bearer key crosses the network unencrypted.
- Source installs listen on every interface unless you set
HOST.
If you need the API from another machine, prefer a VPN or an SSH tunnel to 127.0.0.1:3001. If you must publish it, put an HTTPS reverse proxy in front and configure the server to match:
| Setting | Why |
|---|---|
TRUST_PROXY=1 | With one reverse proxy on the same host, rate limiting and analytics see the real client IP. The default is false, so a direct caller cannot spoof X-Forwarded-For. |
ALLOWED_HOSTS=<your hostnames> | Turns on the DNS-rebinding guard. Loopback names are always accepted, and any other Host header gets 403 before auth runs. Off by default. Even a loopback-only install can set ALLOWED_HOSTS=localhost. |
admin in the declarative config | Closes the first-run setup window before the listener starts. |
Leave the autoupdate compose profile off unless you accept it | Its Watchtower sidecar mounts /var/run/docker.sock, which the compose file itself calls root-equivalent on the host. |
FREELLMAPI_UPDATE_CHECK=off, CATALOG_SYNC_DISABLED=1 | Optional. Stops the GitHub update check and the twice-daily catalog fetch if you want no outbound calls beyond the providers themselves. Free-tier catalog requests carry no credentials, only a since version parameter. |
The server also redacts provider keys from its own console output (installLogRedaction() runs before anything else at startup), which helps when you paste logs into bug reports.
The "10.1 Billion Tokens per Month" Figure
The README and freellmapi.co lead with 10.1 billion tokens per month across 87 providers and 1,313 free model endpoints. This is the project's own figure. The README describes it as the "listed free-tier capacity" in the hosted catalog.
The calculation is not in the repository at commit 8fcdb90, and the project's public numbers do not agree with each other:
docs/en/providers/OVERVIEW.mdat the same commit still quotes an older headline of about 7.4 billion tokens a month, 34 providers and 635 endpoints.- On 23 November, freellmapi.co/models said "487 models across 52 providers", while the same site's metadata said 87 providers.
The closest calculation in the code is the dashboard's free-tier view (GET /api/free-tier, field documentedMonthlyTokens) and the token budget parser in server/src/lib/budget.ts. Each catalog row carries a budget label such as ~120M, ~50-100M or free · 500K tokens/day, and the code:
- takes the upper end of a range;
- multiplies a daily cap by 30;
- ignores labels that count requests (
rpd,rpm,calls) rather than tokens; - keeps one budget per provider quota pool (the largest), so models sharing an allowance are not double-counted;
- multiplies by the number of usable keys you hold for that provider;
- counts only providers for which you have an enabled key.
Read with that logic, a figure like 10.1 billion assumes:
- an account with every listed provider;
- full use of every daily allowance on every day of the month;
- the top of every published range;
- providers keeping their limits unchanged for the month;
- being content with whichever model still has quota left.
Free installs also run a catalog about 30 days behind the live one. Your realistic number is the one the dashboard's free-tier view shows after you add your own keys, and the project's limitations section adds that the strongest models run out first each day.
Terms-of-Service Reality Check
Pooling free tiers behind a proxy is not treated the same way by every provider. Some providers' terms are compatible with a private, single-user gateway. Others restrict the use case, the type of user, or proxying itself. We make no legal claims here. The project itself says:
- It is for personal experimentation and learning, not production.
- The terms you accepted with each provider still apply when your traffic goes through FreeLLMAPI, and you are responsible for complying with them.
The project published its own provider-by-provider reading of the terms, dated May 2026, in docs/en/architecture/00-high-level-index.md. It labels that review "informational, not legal advice". It is the project's interpretation, it is six months old, and terms change.
Points from the code and the project's notes that bear on terms and data use:
- Multiple keys per provider are supported. Capacity in the dashboard is multiplied by your number of keys. The project's own rule of thumb is one account per provider, no reselling, and no sharing the endpoint with other people. Several free tiers restrict multiple accounts, so check before adding a second key for the same provider.
- Keyless providers are enabled automatically on new installs (Step 3). The repo's platform notes say at least one of them logs prompts for training.
- Some free tiers are "evaluation only" in the project's own reading (it cites NVIDIA NIM's trial terms), which rules out treating them as a production backend.
Before adding a provider's key, read that provider's current terms and data-use policy on its own site. Our companion guide, Free LLM APIs: Free-Tier Limits and Data-Use Terms, lists the free tiers with their limits and data-use terms.
Troubleshooting
The first eight rows are open issues on 23 November 2026. The remaining rows are error messages from the code and the project's troubleshooting doc.
| Symptom | Source | What to do |
|---|---|---|
| Claude Code shows "this session isn't eligible" for auto mode through the gateway | #2011 (open) | Set CLAUDE_CODE_AUTO_MODE_SERVER=0, as in Step 5. The gateway-side change (#2049) is on main but not in v0.16.38, so :latest images do not have it yet. |
A custom endpoint serving gpt-5 or o-series models returns 400 unsupported_parameter: 'max_tokens' | #2056 (open) | The custom adapter always sends max_tokens, and these models require max_completion_tokens. There is no fix at 8fcdb90. Do not register reasoning models behind a custom endpoint for clients that set an output budget, such as Claude Code. |
| A client's model picker (Open WebUI was reported) lists models whose keys are all on cooldown | #2051 (open) | GET /v1/models returns the whole catalog by default, and there is no server-side setting to change that yet. Use model: "auto", or a client that can send ?available=true. |
| Keys page: selected filter tab is unreadable, and the dark-mode Add Key button is white on white | #1783 (open, Docker image) | The report says the button renders correctly in the light theme. Switch theme while adding keys, or use the CLI from Step 3. |
| The Updates dialog stays on "Checking…" | #2059 (open, reported on v0.16.37) | On Docker, update with docker compose pull then docker compose up -d. |
Windows desktop app: fetch failed (CERT_HAS_EXPIRED api.inferbase.ai) | #2041 (open, desktop only) | The maintainer attributes it to an expired certificate in the Windows store. The fix (#2048) is merged for the next desktop release. Docker installs are not affected. |
Container exits with ENCRYPTION_KEY is required in production… | crypto.ts | .env is missing or not next to docker-compose.yml. Generate it as in Step 1. |
Invalid ENCRYPTION_KEY (env): expected 64 hex chars (32 bytes) | crypto.ts | Regenerate with openssl rand -hex 32. A shortened or quoted value fails this check. |
| Every provider fails with "Unsupported state or unable to authenticate data", and the boot log says the key cannot decrypt the provider keys | db/index.ts | The database and the key come from different installs. Restore the original .env. To change keys deliberately, use the project's npm run rotate-encryption-key procedure. |
401 Invalid API key from /v1 on localhost | routes/proxy.ts | Send the unified freellmapi-… key, not a provider key. Localhost is not exempt. |
404 model_not_found: "Model '…' is not in the catalog" | routes/proxy.ts | Use an id from /v1/models?available=true, or auto. Free installs receive new models 30 days late. |
400: "The active fallback chain '…' has no enabled models" | router.ts | The active named chain is empty. Enable models in it, switch the active chain, or send auto:<other-chain>. |
| The setup form demands a code | lib/setup-code.ts | Read First-run setup code: from docker compose logs freellmapi, or provision admin in the declarative config. |
| Ollama or a proxy on the host is unreachable from the container | Troubleshooting doc | Use host.docker.internal instead of 127.0.0.1, and make the host service listen beyond loopback. |
Agent sessions get 429 from the gateway itself | middleware/rateLimit.ts | The per-IP /v1 limit is 120 requests per minute. Raise PROXY_RATE_LIMIT_RPM. |
413 request_too_large on large vision or agent payloads | lib/config.ts | The default body limit is 25 MB. Raise REQUEST_BODY_LIMIT_MB. |
Practical Verdict
FreeLLMAPI is useful as a personal endpoint for experiments: trying agent configurations, prototyping against several model families with one key, or running small, cheap evaluation sweeps. The router is more careful than a naive round-robin:
- it attributes failures to a key, a model or a whole provider;
- it learns context and output limits from provider errors;
- it keeps a 45-second ceiling on failover;
- it tells you in headers which provider answered and which ones failed.
Pay for an API instead when any of the following matters:
- You need the same model every time.
autocan change models between requests, and late in the day the strongest free models are the first to run out. For evaluations, pin a model id and checkX-Routed-Viaon every response. - Your prompts are private. Free tiers have their own data-use terms, and a fresh install enables anonymous providers on its own.
- You need uptime or latency guarantees. Free tiers have no SLA, and the project tells you to switch to a paid API before you ship.
- Your usage is commercial or shared. The project's terms review and disclaimer both assume one person's personal use.
To see what the same workload would cost on paid APIs, run your expected token volumes through our token calculator.
What to Read Next
- Free LLM APIs: Free-Tier Limits and Data-Use Terms: the free tiers this router pools, with their limits and data-use terms
- Run Claude Code with Ollama or OpenRouter: the gateway setup for Claude Code, and how to check which route served a request
- Run LLMs Locally: 6 Practical Methods: local servers you can register as a FreeLLMAPI
customprovider - Token calculator: estimate what the same traffic costs on paid APIs
Frequently asked questions
Is it safe to expose FreeLLMAPI on the internet?
The project says not to. The /v1 inference API is protected only by one unified API key (plus a 120 requests-per-minute per-IP limiter), the server speaks plain HTTP, and a source install binds every network interface by default. The Docker Compose file publishes the port on 127.0.0.1 only. Keep it there, and reach it remotely through a VPN, an SSH tunnel or a TLS reverse proxy rather than by setting HOST_BIND=0.0.0.0 on an untrusted network.
How does FreeLLMAPI encrypt provider API keys?
Each provider key is encrypted with AES-256-GCM using a random 16-byte IV and a 16-byte authentication tag, then stored in SQLite. The 32-byte master key comes from the ENCRYPTION_KEY environment variable (64 hex characters), which is mandatory when NODE_ENV is production, as it is in the Docker image. Outside production, a missing key is generated and written to a .encryption-key file next to the database with 0600 permissions. The unified freellmapi- key that clients use is stored unencrypted in the same database.
Does naming a specific model turn off failover?
It narrows it. With model set to auto, the router can fail over to any other model in your chain. With a catalog model id, it routes only across the providers that serve that same logical model and never substitutes a different one. If none of them can serve the request, you get an error, not another model.
Where does the 10.1 billion tokens per month figure come from?
It is the project's headline for the free-tier capacity listed in its hosted model catalog. The calculation is not in the repository. The closest code is the dashboard's free-tier view, which takes one documented budget per provider quota pool, uses the upper end of ranges, multiplies daily caps by 30 and scales by your number of keys. Reaching the headline assumes an account with every listed provider and full use of every daily allowance.
Is pooling free LLM tiers allowed by the providers?
It depends on the provider. FreeLLMAPI's own May 2026 review rates some providers' terms as likely compatible with a personal single-user proxy and others as cautionary or incompatible, and it states that the review is not legal advice. Your account terms still apply when traffic is proxied. Read each provider's current terms before adding its key.
Related Guides
AWS Continuum GA Prices Validation at $10 per Inference Unit
AWS's code vulnerability service is GA in two US regions, priced per line of code protected and per inference unit, with fixes still gated on human review.
OpenAI Pipeline: 948 Linux Kernel LPEs at $1,279 Each
OpenAI's autonomous Linux kernel run produced 948 unique LPEs at $1,279 each, with per-stage costs, orchestration data, and a kernelCTF comparison.
Four-Step Exploit Chain Let Attackers Hijack ChatGPT Accounts
Parameter Labs chained four weaknesses in ChatGPT's HTML preview to create a shareable URL that silently exfiltrated any signed-in user's data.