Getting started
ZeroFare has two entry points. Pick one — your application code is the same against both.
Run the edge locally
For development, privacy, or offline use. Your provider keys stay in a local vault; nothing leaves your machine except calls to the providers themselves.
Use the hosted gateway
For production apps without ops. Point your client at our TLS endpoint and authenticate with a ZeroFare API key.
Path A — the local edge
-
Build and install
Clone the public repo, install with pnpm, and build. Validation and installation should run from a fast mirror, not the source drive:
git clone https://github.com/zerofare/free-llm && cd free-llm tools/fast-mirror.sh "$PWD" /tmp/zerofare-validation/public cd /tmp/zerofare-validation/public corepack pnpm install pnpm build -
Initialize the edge
zerofare initcreates a schema-enforced config and an encrypted local vault, and prints the local bearer token once:umask 077 printf '%s\n' 'a-long-unique-vault-passphrase' | \ pnpm zerofare init --config "$HOME/.config/zerofare/config.json"Easiest path: add a certified free provider from ZeroFare's curated catalog in two commands —
zerofare onboard provider --preset groqthenzerofare onboard credential --preset groq(key from the providers list, validated by shape before it reaches the vault). Prefer hand-rolling? Write the passphrase, a newline, and the provider key to stdin forzerofare credentials set --id … --provider …, and add providers from a non-secret JSON file withzerofare providers add --file. -
Check and serve
pnpm zerofare doctor printf '%s\n' 'a-long-unique-vault-passphrase' | pnpm zerofare serveThe edge binds
127.0.0.1:8787, authenticates before parsing request bodies, and exposes the compat surfaces, model listing, receipt, health/readiness routes. -
Make a request
curl http://127.0.0.1:8787/v1/chat/completions \ -H "Authorization: Bearer $ZEROFARE_LOCAL_TOKEN" \ -H 'content-type: application/json' \ -d '{"model":"…","messages":[{"role":"user","content":"hi"}]}'
false,
and /v1/models is empty until routes are provisioned. The served receipt is
a minimal denial/finalization record. The hosted gateway path below is the one that's
commercially wired today.
Path B — the hosted gateway
-
Create your tenant
Open the console and sign in with a management credential. On the early-access deployment tenants are provisioned for you — contact us and you'll receive your API key and console credential.
-
Store your key
Keys look like
zf_…and are shown exactly once at creation. Put one in your environment:export ZERFARE_API_KEY=zf_… # shown once — store it in your secret manager -
Call the gateway
curl https://150-136-150-135.sslip.io:8443/v1/messages \ -H "Authorization: Bearer $ZERFARE_API_KEY" \ -H 'content-type: application/json' \ -d '{"model":"…","max_tokens":64, "messages":[{"role":"user","content":"hi"}]}'Or with the TypeScript SDK:
import { ZeroFareClient } from "@zerofare/sdk"; const zf = new ZeroFareClient({ baseUrl: "https://150-136-150-135.sslip.io:8443", apiKey: process.env.ZERFARE_API_KEY!, }); const reply = await zf.messages({ model: "…", max_tokens: 64, messages: [{ role: "user", content: "hi" }], });
Verify authentication
# no / wrong key -> terse 401 (fail-closed, nothing enumerable)
curl -s -o /dev/null -w '%{http_code}\n' \
https://150-136-150-135.sslip.io:8443/management/v1/sessions
# real key -> 200 with your key metadata
curl -s https://150-136-150-135.sslip.io:8443/management/v1/api-keys \
-H "Authorization: Bearer $ZERFARE_API_KEY"
Next steps
- Explore the full surface in the API reference.
- Learn streaming, errors, and limits on the hosted gateway page.
- Running your own VM? See self-hosting.