Skip to content

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(onboarding): one-line install script + LAN dev docs (#250, #247)

Tashfeen90811b0573b3
diff --git a/README.md b/README.md
index a4efa6fd..f041fffd 100644
--- a/README.md
+++ b/README.md
@@ -104,7 +104,15 @@ PRs that add any of these are very welcome. See [Contributing](#contributing).
## Quick start
-**Recommended:** Docker Compose. It runs the API and dashboard together on port 3001 and persists SQLite in a named volume.
+**One-liner** (Docker required — sets up `~/freellmapi`, generates an encryption key, pulls the image, and starts the container):
+
+```bash
+curl -fsSL https://tashfeenahmed.github.io/freellmapi/install.sh | bash
+```
+
+Prefer to read before you pipe to bash? [The script is here](docs/install.sh). Re-running it is safe: your `.env` (and encryption key) is preserved and the container updates to `:latest`. Override the defaults with `FREELLMAPI_DIR`, `PORT`, or `HOST_BIND` env vars.
+
+**Or manually with Docker Compose.** It runs the API and dashboard together on port 3001 and persists SQLite in a named volume.
**Prerequisites:** Docker, Docker Compose, OpenSSL.
@@ -153,6 +161,8 @@ whichever limit prunes first. Set `REQUEST_ANALYTICS_RETENTION_DAYS=0` or
Open http://localhost:5173 (the Vite dev UI), add your provider keys on the **Keys** page, reorder the **Fallback Chain** to taste, and grab your unified API key from the **Keys** page header. That unified key is what you point your OpenAI SDK at.
+> **Reaching the dev UI from another device on your LAN?** Use `npm run dev:lan` — it passes `--host` through to Vite, which then prints a `Network: http://<your-ip>:5173` URL you can open from a phone or another machine. (Plain `npm run dev -- --host` does *not* work here: the root `dev` script is a `concurrently` wrapper, so the flag never reaches Vite.) API calls go through Vite's dev proxy, so no extra server config is needed.
+
For a production build without Docker:
```bash
@@ -464,6 +474,8 @@ PRs should include a test, keep the existing test suite green, and match the `.e
<a href="https://github.com/ita333"><img src="https://images.weserv.nl/?url=github.com/ita333.png&w=60&h=60&fit=cover&mask=circle" width="60" alt="@ita333" /></a>
<a href="https://github.com/barbotkonv"><img src="https://images.weserv.nl/?url=github.com/barbotkonv.png&w=60&h=60&fit=cover&mask=circle" width="60" alt="@barbotkonv" /></a>
<a href="https://github.com/Naster17"><img src="https://images.weserv.nl/?url=github.com/Naster17.png&w=60&h=60&fit=cover&mask=circle" width="60" alt="@Naster17" /></a>
+<a href="https://github.com/StealthTensor"><img src="https://images.weserv.nl/?url=github.com/StealthTensor.png&w=60&h=60&fit=cover&mask=circle" width="60" alt="@StealthTensor" /></a>
+<a href="https://github.com/EmranAhmed"><img src="https://images.weserv.nl/?url=github.com/EmranAhmed.png&w=60&h=60&fit=cover&mask=circle" width="60" alt="@EmranAhmed" /></a>
## Terms of Service review
diff --git a/docs/index.html b/docs/index.html
index 963a90ac..0d047f68 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -412,8 +412,8 @@
<div class="steps" style="margin-bottom: 32px;">
<div class="step">
<div class="step-num">1</div>
- <h3>Clone &amp; install</h3>
- <p>Node 20+ required. <code>better-sqlite3</code> brings prebuilt binaries — no compile step.</p>
+ <h3>Install</h3>
+ <p>One command with Docker. Or clone + <code>npm run dev</code> for development (Node 20+, dev UI on :5173).</p>
</div>
<div class="step">
<div class="step-num">2</div>
@@ -432,17 +432,18 @@
<span class="dot"></span><span class="dot"></span><span class="dot"></span>
<span class="filename">~/freellmapi · zsh</span>
</div>
- <pre class="terminal-body"><span class="c"># 1. clone, install, run</span>
-<span class="prompt">$</span><span class="k">git</span> clone https://github.com/tashfeenahmed/freellmapi.git
-<span class="prompt">$</span><span class="k">cd</span> freellmapi
-<span class="prompt">$</span>npm install <span class="k">&amp;&amp;</span> npm run dev
+ <pre class="terminal-body"><span class="c"># 1. one-line install (Docker; generates your encryption key, starts the container)</span>
+<span class="prompt">$</span><span class="k">curl</span> -fsSL https://tashfeenahmed.github.io/freellmapi/install.sh | bash
<span class="blank"></span>
-<span class="c"># 2. open http://localhost:3001 — paste keys in the UI</span>
+<span class="c"># 2. open http://localhost:3001 — paste provider keys, copy your unified API key</span>
<span class="blank"></span>
<span class="c"># 3. call it like OpenAI</span>
<span class="prompt">$</span><span class="k">curl</span> http://localhost:3001/v1/chat/completions \
+ -H <span class="s">"Authorization: Bearer $FREELLMAPI_KEY"</span> \
-H <span class="s">"Content-Type: application/json"</span> \
- -d <span class="s">'{"messages":[{"role":"user","content":"hi"}]}'</span></pre>
+ -d <span class="s">'{"messages":[{"role":"user","content":"hi"}]}'</span>
+<span class="blank"></span>
+<span class="c"># developing instead? clone the repo, then: npm install &amp;&amp; npm run dev (UI on :5173)</span></pre>
</div>
</section>
diff --git a/docs/install.sh b/docs/install.sh
new file mode 100644
index 00000000..e394a7fe
--- /dev/null
+++ b/docs/install.sh
@@ -0,0 +1,149 @@
+#!/usr/bin/env bash
+#
+# FreeLLMAPI one-line installer (#250, idea by @StealthTensor).
+#
+# curl -fsSL https://tashfeenahmed.github.io/freellmapi/install.sh | bash
+#
+# What it does:
+# 1. Checks for Docker + Compose.
+# 2. Creates an install dir (default ~/freellmapi, override FREELLMAPI_DIR).
+# 3. Writes a docker-compose.yml pinned to ghcr.io/tashfeenahmed/freellmapi:latest
+# and a .env with a freshly generated ENCRYPTION_KEY (kept on re-runs).
+# 4. Pulls the image, starts the container, waits for the health endpoint.
+#
+# Options (env vars):
+# FREELLMAPI_DIR install directory (default: ~/freellmapi)
+# PORT host port for the dashboard (default: 3001)
+# HOST_BIND host interface to publish on (default: 127.0.0.1).
+# Set HOST_BIND=0.0.0.0 to reach it from your LAN — only on
+# a trusted network; the proxy is single-user.
+#
+# Re-running is safe: existing .env (and your encryption key) is preserved,
+# the compose file is refreshed, and the container is updated to :latest.
+
+set -euo pipefail
+
+INSTALL_DIR="${FREELLMAPI_DIR:-$HOME/freellmapi}"
+PORT="${PORT:-3001}"
+HOST_BIND="${HOST_BIND:-127.0.0.1}"
+IMAGE="ghcr.io/tashfeenahmed/freellmapi:latest"
+
+say() { printf '\033[1;32m==>\033[0m %s\n' "$*"; }
+warn() { printf '\033[1;33mWARN\033[0m %s\n' "$*" >&2; }
+die() { printf '\033[1;31mERROR\033[0m %s\n' "$*" >&2; exit 1; }
+
+# ── 1. prerequisites ─────────────────────────────────────────────────────────
+command -v docker >/dev/null 2>&1 || die "Docker is required. Install it from https://docs.docker.com/get-docker/ and re-run."
+
+if docker compose version >/dev/null 2>&1; then
+ COMPOSE=(docker compose)
+elif command -v docker-compose >/dev/null 2>&1; then
+ COMPOSE=(docker-compose)
+else
+ die "Docker Compose is required (the 'docker compose' plugin or 'docker-compose')."
+fi
+
+docker info >/dev/null 2>&1 || die "Docker daemon isn't running (or you lack permission). Start Docker and re-run."
+
+# ── 2. install dir ───────────────────────────────────────────────────────────
+mkdir -p "$INSTALL_DIR"
+cd "$INSTALL_DIR"
+say "Installing into $INSTALL_DIR"
+
+# ── 3. .env (generated once — your at-rest encryption key lives here) ────────
+if [ -f .env ]; then
+ say "Keeping existing .env (encryption key preserved)"
+else
+ if command -v openssl >/dev/null 2>&1; then
+ KEY="$(openssl rand -hex 32)"
+ else
+ # /dev/urandom fallback when openssl isn't installed
+ KEY="$(od -vN 32 -An -tx1 /dev/urandom | tr -d ' \n')"
+ fi
+ umask 077
+ cat > .env <<EOF
+# Generated by install.sh on $(date -u +%Y-%m-%dT%H:%M:%SZ)
+# At-rest encryption key for your stored provider keys. Losing it means
+# re-entering your provider keys, so back this file up.
+ENCRYPTION_KEY=$KEY
+PORT=$PORT
+HOST_BIND=$HOST_BIND
+EOF
+ umask 022
+ say "Wrote .env with a fresh ENCRYPTION_KEY"
+fi
+
+# ── 4. compose file (image-only; refreshed on every run) ─────────────────────
+cat > docker-compose.yml <<EOF
+# Written by install.sh — safe to edit; re-running the installer rewrites it.
+services:
+ freellmapi:
+ image: $IMAGE
+ env_file:
+ - .env
+ environment:
+ NODE_ENV: production
+ PORT: 3001
+ # Bound to localhost by default — FreeLLMAPI is single-user and must not
+ # be exposed to the internet. Set HOST_BIND=0.0.0.0 in .env for LAN access.
+ ports:
+ - "\${HOST_BIND:-127.0.0.1}:\${PORT:-3001}:3001"
+ volumes:
+ - freellmapi-data:/app/server/data
+ restart: unless-stopped
+ healthcheck:
+ test:
+ [
+ "CMD",
+ "node",
+ "-e",
+ "fetch('http://127.0.0.1:3001/api/ping').then((res) => { if (!res.ok) process.exit(1); }).catch(() => process.exit(1));"
+ ]
+ interval: 30s
+ timeout: 5s
+ start_period: 15s
+ retries: 3
+
+volumes:
+ freellmapi-data:
+EOF
+
+# ── 5. pull + start ──────────────────────────────────────────────────────────
+say "Pulling $IMAGE"
+"${COMPOSE[@]}" pull --quiet 2>/dev/null || "${COMPOSE[@]}" pull
+say "Starting FreeLLMAPI"
+"${COMPOSE[@]}" up -d
+
+# ── 6. wait for health ───────────────────────────────────────────────────────
+say "Waiting for the server to come up"
+HEALTH_HOST="127.0.0.1"
+[ "$HOST_BIND" != "0.0.0.0" ] && [ "$HOST_BIND" != "127.0.0.1" ] && HEALTH_HOST="$HOST_BIND"
+for i in $(seq 1 30); do
+ if curl -fsS "http://$HEALTH_HOST:$PORT/api/ping" >/dev/null 2>&1; then
+ HEALTHY=1
+ break
+ fi
+ sleep 2
+done
+
+if [ "${HEALTHY:-0}" = "1" ]; then
+ cat <<EOF
+
+ FreeLLMAPI is running.
+
+ Dashboard http://localhost:$PORT
+ Next steps add provider keys on the Keys page, then grab your
+ unified API key from the page header — that's the
+ Bearer token your OpenAI-compatible client uses.
+ API endpoint http://localhost:$PORT/v1
+
+ Update cd $INSTALL_DIR && docker compose pull && docker compose up -d
+ Logs cd $INSTALL_DIR && docker compose logs -f
+ Uninstall cd $INSTALL_DIR && docker compose down -v && cd .. && rm -rf $INSTALL_DIR
+
+EOF
+else
+ warn "Container started but the health endpoint didn't answer within 60s."
+ warn "Check logs with: cd $INSTALL_DIR && ${COMPOSE[*]} logs -f"
+ exit 1
+fi
diff --git a/package.json b/package.json
index bcd71117..7509a06c 100644
--- a/package.json
+++ b/package.json
@@ -8,6 +8,7 @@
],
"scripts": {
"dev": "concurrently --kill-others-on-fail --names server,client \"npm run dev -w server\" \"npm run dev -w client\"",
+ "dev:lan": "concurrently --kill-others-on-fail --names server,client \"npm run dev -w server\" \"npm run dev -w client -- --host\"",
"test": "npm run test -w server && npm run test -w client --if-present",
"build": "npm run build -w server && npm run build -w client",
"build:server": "npm run build -w server",