Inspired by 9router, built with Go for maximum performance and ultra-low footprint.
This tutorial guides you through compiling, running, and configuring your myAiRouter gateway and dashboard.
| Router | Runtime | Memory (idle) |
|---|---|---|
| MyAiRouter | Native Go | ~14 MB - 23 MB |
| 9Router Next.js | Next.js server | ~132 MB |
| 9Router Node process | Node.js | ~58 MB |
| Total 9Router | Node + Next | ~190 MB |
MyAiRouter: 14 MB - 23 MB — 9Router: ~190 MB — ≈8× less memory
Because myAiRouter embeds all frontend assets directly into the Go executable, you only need to run a simple build step to generate the final standalone binary.
Navigate to the web folder, install dependencies, and build the static production distribution:
cd web
npm install
npm run build
cd ..This creates the static HTML, JS, and CSS files inside web/dist/.
Compile the Go entry code to produce a standalone executable binary named myAiRouter:
go build -o myAiRouter .This packages the Go web server, the SQLite database migrations, local agent skills, and embedded Vite assets into a single binary.
curl -fsSL https://haslab-dev.github.io/MyAiRouter/website/install.sh | bashInstalls to $HOME/.local/bin/myairouter (or /usr/local/bin/myairouter).
myairouter # start server (foreground)
myairouter start # start server (foreground)
myairouter start -d # start server (background daemon)
myairouter status # show server status, running PIDs & listening ports
myairouter stop # stop all running server processes (auto-sweeps duplicates)
myairouter restart # restart background daemon
myairouter bg # background alias
myairouter version # print versionBy default, the server runs on port 20128. Set PORT to change:
PORT=8080 myairouterOn startup, myAiRouter will:
- Initialize a SQLite database at
~/.myairouter/db.sqlite. - Apply database migrations and seed default configuration settings.
- Automatically sweep and terminate any duplicate process instances.
- Start the API gateway at
http://localhost:20128/v1/. - Host the space-dark dashboard at
http://localhost:20128/.
make installOr manually:
cd web && npm install && npm run build && cd ..
go build -o myairouter .
./website/install.shThe Request Traces dashboard (http://localhost:20128/traces) displays routing-focused analytics organized into four distinct sections:
- Summary: High-level execution metrics (Latency, TTFB, Input/Output/Cached Tokens, Cost, Prompt Compression %, Cache Hit, Streaming, Attempts count, Fallback & Retry counts).
- Route Graph: Visual node tree for Fallback, Race, Parallel, and Smart routing strategies showing per-node execution status (✔ Success, ↷ Skipped, ✖ Failed).
- Pipeline: Clean 6 routing-focused steps (
Resolve Model,Prompt Rewrite,Optimizer,Cache,Route,Provider). Noisy internal middleware logs (Auth, Rate Limit, Guardrails) are hidden. - Request / Response Preview: Request metadata (
system,user,messages,chars,tokens) and Response metadata (preview,finish_reason).
make patch-version # bump patch (0.1.0 → 0.1.1)
make minor-version # bump minor, reset patch (0.1.0 → 0.2.0)
make major-version # bump major, reset minor+patch (0.1.0 → 1.0.0)
make set-version V=x.y.z # set explicit versionUpdates both main.go (backend) and web/package.json (client).
- Open your web browser and navigate to the dashboard at:
http://localhost:20128/. - Go to the Providers section using the sidebar navigation.
- Click Add Connection in the top right.
- Select your provider (e.g. OpenAI, Anthropic (Claude), Google Gemini, DeepSeek, NVIDIA, Groq, etc.).
- Enter a display name, paste your API Key, and set a priority.
- Click Save Connection.
- Click Test next to the newly created connection to verify connectivity.
By default, API gateway authentication is disabled. You can query completions directly:
Query the completions endpoint using curl:
curl -N http://localhost:20128/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [
{"role": "user", "content": "Hello! What is your name?"}
],
"stream": true
}'Your gateway hosts local instructions that autonomous agents (such as Cline, Roo Code, or Claude Code) can load.
- Entry point skill:
http://localhost:20128/skills/myairouter/SKILL.md - Chat skill:
http://localhost:20128/skills/myairouter-chat/SKILL.md - Token Saving details:
http://localhost:20128/skills/myairouter-token-saver/SKILL.md
You can view, read, and copy these skill URLs directly under the Agent Skills section of the web dashboard.