| name | cli-serve |
| description | Start, stop, and restart the AIRoute server from the CLI. Manage daemon mode, port configuration, auto-recovery, system tray integration, and the dashboard open shortcut. |
Overview
Start, stop, and restart the AIRoute server from the CLI. Manage daemon mode, port configuration, auto-recovery, system tray integration, and the dashboard open shortcut.
Quick install
npm install -g AIRoute
AIRoute --version
Subcommands
dashboard
Flags:
--url
--port <port>
--tui
Example:
AIRoute dashboard
restart
Flags:
Example:
AIRoute restart
serve
Flags:
--port <port>
--no-open
--daemon
--log
--no-recovery
--max-restarts <n>
--tray
--no-tray
--tls-cert <path>
--tls-key <path>
Example:
AIRoute serve
stop
Example:
AIRoute stop
Setup
The AIRoute binary ships with the AIRoute server. It is both the server launcher and a full management CLI with 250+ commands across 39 groups.
Install
npm install -g AIRoute
Requires Node.js ≥22.22.2 or ≥24.
Verify:
AIRoute --version
AIRoute --help
Connection
Every CLI command that talks to the server reads two values:
| Source | Variable / Flag |
|---|
| Base URL | AIRoute_BASE_URL or --base-url |
| API key | AIRoute_API_KEY or --api-key |
Default base URL: http://localhost:20128
export AIRoute_BASE_URL="http://localhost:20128"
export AIRoute_API_KEY="sk-..."
For a remote server:
export AIRoute_BASE_URL="https://your-server.com"
Global flags
| Flag | Description |
|---|
--base-url <url> | Override server URL for this invocation |
--api-key <key> | Override API key for this invocation |
--output <format> | Output format: table (default), json, jsonl, csv |
--json | Shorthand for --output json |
--non-interactive | Disable prompts — for CI / shell scripts |
--no-open | Don't auto-open the browser on start |
--port <n> | Override default port 20128 |
--help, -h | Show help for the current command |
--version, -v | Print the installed version |
Output formats
All listing commands support --output:
AIRoute combo list
AIRoute combo list --output json
AIRoute combo list --output jsonl
AIRoute combo list --output csv
Quick start: one-shot server + provider setup
AIRoute
AIRoute setup
AIRoute doctor
CLI capability skills
Errors
Connection refused → server not running; run AIRoute or AIRoute serve
401 Unauthorized → wrong or missing API key
command not found: AIRoute → not in PATH; check npm root -g or re-install
doctor reports SQLite incompatible → npm rebuild better-sqlite3 in the app directory
Admin lifecycle
Requires the AIRoute CLI. See CLI entry-point skill for install + global flags.
Server lifecycle
AIRoute
AIRoute serve
AIRoute --port 3000
AIRoute --no-open
AIRoute --mcp
AIRoute stop
AIRoute restart
AIRoute dashboard
AIRoute open
AIRoute status
Setup & provisioning
Interactive wizard
AIRoute setup
Non-interactive (CI / Docker)
AIRoute setup --non-interactive \
--password 'admin-password' \
--add-provider \
--provider openai \
--api-key 'sk-...' \
--test-provider
Environment variables for non-interactive setup:
| Variable | Purpose |
|---|
AIRoute_SETUP_PASSWORD | Admin password (≥8 chars) |
AIRoute_PROVIDER | Provider id (e.g. openai, anthropic) |
AIRoute_PROVIDER_NAME | Display name for the connection |
AIRoute_PROVIDER_BASE_URL | Optional OpenAI-compatible base URL override |
AIRoute_API_KEY | Provider API key |
AIRoute_DEFAULT_MODEL | Optional default model |
DATA_DIR | Override AIRoute data directory |
Diagnostics
AIRoute doctor
AIRoute doctor --json
AIRoute doctor --no-liveness
AIRoute doctor --host 0.0.0.0
AIRoute doctor --liveness-url <url>
Checks performed: Config, Database, Storage/encryption, Port, Node runtime, Native binary (better-sqlite3), Memory, Server liveness.
Exit code is non-zero if any check fails — useful in CI:
AIRoute doctor --json | jq '.checks[] | select(.status=="fail")'
Backup & restore
AIRoute backup
AIRoute restore
Autostart (system tray / startup)
AIRoute autostart enable
AIRoute autostart disable
AIRoute autostart status
On Linux: creates a systemd user service (~/.config/systemd/user/AIRoute.service) and enables linger so the service can start after reboot without a graphical login; on desktop sessions it also adds an XDG autostart entry with --tray. On macOS: LaunchAgent plist. On Windows: registry startup entry.
Tunnels (public URL)
Expose a local AIRoute instance via a secure tunnel:
AIRoute tunnel list
AIRoute tunnel create cloudflare
AIRoute tunnel create tailscale
AIRoute tunnel create ngrok
AIRoute tunnel stop <id>
The tunnel URL is printed and can be used as AIRoute_BASE_URL from remote machines.
Config & environment
AIRoute config show
AIRoute env show
AIRoute env get <KEY>
AIRoute env set <KEY> <value>
Recovery
AIRoute reset-password
AIRoute reset-encrypted-columns
AIRoute reset-encrypted-columns --force
Use reset-encrypted-columns --force only if STORAGE_ENCRYPTION_KEY was lost and you need to re-enter all provider API keys.
Logs
AIRoute logs
AIRoute logs --json
AIRoute logs --search <term>
AIRoute logs --follow
Update
AIRoute update
Errors
doctor shows STORAGE_ENCRYPTION_KEY missing → set the key in .env or run reset-encrypted-columns --force to wipe and re-enter credentials
doctor reports native binary fail → npm rebuild better-sqlite3 in the AIRoute app directory
tunnel create cloudflare hangs → ensure cloudflared is installed: brew install cloudflare/cloudflare/cloudflared