Self-hosted AI gateway
One endpoint · format translation · fallback routing · token saving · spend control · access keys
Features · Quick Start · Token Savers · Config · CLI Tools
Every AI app speaks a different API format. Every provider has different keys, models, and rate limits. You juggle configs, hit quota walls mid-session, and lose track of spend.
aigloo fixes this. One local endpoint, one key. Point any app at it — Claude Code, opencode, Cursor, Codex, or anything that supports a custom base URL. It translates formats, routes across providers with automatic fallback, compresses token-heavy context, and tracks every cent.
npm install -g aigloo && aiglooFirst run bootstraps everything. Subsequent runs start instantly.
Your tools aigloo Providers
────────── ──────────────────── ──────────────
Claude Code ──┐ ┌──► Anthropic
opencode ──┤ format translation ├──► OpenAI
Cursor ──┼─► routing & fallback ─────┼──► OpenRouter
Codex ──┤ token compression ├──► Gemini
any app* ──┘ spend tracking └──► Ollama / custom
▲
│
one endpoint
one API key
* any app that supports a custom base URL + API key
- Add providers — paste your API keys, pick models. Use
provider/modeldirectly (key round-robin) or define combo aliases for multi-provider fallback chains - Point your tools at
http://localhost:18080with a gateway key - Track everything — per-request cost, token usage, budgets, alerts
- Format translation — OpenAI ↔ Anthropic on the fly, streaming included
- Routing & fallback — use
provider/modeldirectly (key round-robin) or define combo aliases for multi-provider fallback chains; auto-rotates keys on 429/5xx/timeout - Token savers — RTK compresses tool results, caveman trims prose, ponytail nudges minimal code, headroom compresses context
- Access keys — share gateway keys with model allowlist, rate limit, spend cap, and expiry
- Budgets — rolling spend caps (global/provider/model/key) with live countdown and per-token-type cost tracking
- Alert notifications — webhook, Telegram, or Discord alerts when budgets hit their threshold or run out. Deduped per budget window
- Dashboard — glassmorphic aigloo design: providers, combos, usage, budgets, CLI tools, live console, settings — all drag-to-reorder
Endpoint page — token saver toggles & endpoint config
Access Keys — model allowlist, rate limit, spend cap per key
Budgets — rolling spend caps with live countdown
npm install -g aigloo
aiglooThe CLI seeds config.yaml, builds the dashboard, opens your browser. One URL serves everything — dashboard, API, and admin: http://localhost:18080.
A terminal menu offers: Web UI / Terminal (logs) / Hide to Tray (macOS · Linux · Windows) / Exit.
Flags: -p/--port, -n/--no-browser, -y/--yes, -t/--tray.
git clone https://github.com/xk1ko/aigloo.git
cd aigloo && npm install
cp config.example.yaml config.yaml # add providers + a server key
npm install --prefix dashboard
./run.sh # Ctrl-C stops both# Claude Code (Anthropic format)
export ANTHROPIC_BASE_URL=http://localhost:18080
export ANTHROPIC_API_KEY=my-key
# opencode / Cursor / Cline / Codex (OpenAI format)
export OPENAI_BASE_URL=http://localhost:18080/v1
export OPENAI_API_KEY=my-keyThe dashboard's CLI Tools page detects installed tools and writes configs for you.
Model resolution (in order): combo alias → provider/model.
Any app that supports a custom base URL + API key can use aigloo — just set the model to provider/model.
Claude Code · opencode · Cursor · Codex · Cline · Continue · Roo · Aider · Gemini CLI · Qwen Code · Kilo Code · Crush · Droid · Copilot
Any app that supports a custom base URL + API key works — just set the model to provider/model.
Everything is configurable from the dashboard — providers, combos, budgets, token savers, access keys, and settings. No need to edit files manually.
Under the hood, config.yaml is the source of truth and hot-reloads — any change made in the dashboard writes to this file instantly. You can also edit it by hand if you prefer; changes apply without restart.
config.yaml reference (click to expand)
server:
host: 0.0.0.0
port: 18080
api_keys: [my-key] # empty = auth OFF (localhost only)
endpoint:
rtk: true # compress tool_result blocks
caveman: full # off | lite | full | ultra
ponytail: lite # off | lite | full | ultra
headroom: off # off | on — requires external headroom proxy
providers:
- id: anthropic
format: anthropic
base_url: https://api.anthropic.com/v1
api_keys: [sk-ant-xxx]
- id: opencode-free
format: openai
base_url: https://opencode.ai/zen/v1
free: true
# auto_models: false # fetch provider's /v1/models catalog (manual)
models:
- alias: claude-sonnet-4-6
target: [anthropic, opencode-free] # fallback order
model: [claude-sonnet-4-6, claude-sonnet-4-5]
price_in: 3 # USD per 1M tokens
price_out: 15
budgets:
- scope: { type: global }
unit: usd
limit: 50
window: 30dayA combo is a models entry — an alias routed to a provider chain. Strategies: fallback (default, sequential) or round-robin (spread load).
| Saver | What it does | Source | Install |
|---|---|---|---|
| RTK | Compresses bulky tool_result blocks (git/grep/ls) |
rtk-ai/rtk | built-in |
| Caveman | Terse system prompt — cuts output prose | JuliusBrussee/caveman | built-in |
| Ponytail | Nudges minimal code (YAGNI, deletion) | DietrichGebert/ponytail | built-in |
| Headroom | Pipes context through /v1/compress |
chopratejas/headroom | external |
Headroom is the only external dependency — install from chopratejas/headroom (Python ≥ 3.10), run headroom proxy. Without it the toggle stays off; everything else works.
| Variable | Purpose |
|---|---|
AIGLOO_CONFIG |
Config file path |
AIGLOO_DATA_DIR |
Usage DB directory |
AIGLOO_ADMIN_PASSWORD |
Admin password — seeds on first boot, then stored as scrypt hash in auth.json. Default 123456 |
AIGLOO_PORT |
Listen port (default 18080) |
SESSION_SECRET |
Dashboard session cookie signing key. Auto-generated and persisted if unset |
Admin password and provider keys never reach the browser — the dashboard proxies /admin/* server-side.
| OS | Path |
|---|---|
| macOS / Linux | ~/.aigloo/ |
| Windows | %APPDATA%\aigloo\ |
Contains config.yaml and usage.sqlite. Delete the folder to reset everything.
npm run typecheck # tsc, no emit
npm test # vitest (unit + synthetic E2E)
npm run build # compile to dist/If aigloo helps you, consider giving it a star — it helps others discover it.
Inspired by 9router — its feature set and dashboard shaped much of this project's direction.
MIT © xk1ko
Issues and ideas welcome: https://github.com/xk1ko/aigloo/issues