Architecture
client
▼
cloudflared (CLOUDFLARED=1) │ tailscale (TAILSCALE=1, tailnet-only)
▼
nginx :4000 ┌──────────── always on ────────────┐
├─► /claudebox/ → claudebox │ nginx, LiteLLM, PostgreSQL, Redis │
├─► /pibox-zai/ → pibox-zai │ proxq, everything else is opt-in │
├─► /pibox/ → pibox │ │
├─► /stealthy-auto-browse/ → HAProxy → [browser ×5]└───────────────────────────────────┘
├─► /storage/ → hybrids3
├─► /q/ → proxq → LiteLLM (async, returns job ID)
├─► /librechat/ → LibreChat (web UI, LIBRECHAT=1)
├─► /searxng/ → SearXNG (meta-search, SEARXNG=1)
├─► /telethon/ → Telethon (Telegram client, TELETHON=1)
├─► /predictalot/ → predictalot (time-series forecasting, CPU, PREDICTALOT=1)
├─► /predictalot-cuda/ → predictalot (time-series forecasting, NVIDIA GPU, PREDICTALOT_CUDA=1)
├─► /decidealot/ → decidealot (typed decisions REST + MCP, CPU, DECIDEALOT=1)
├─► /decidealot-cuda/ → decidealot (typed decisions REST + MCP, NVIDIA GPU, DECIDEALOT_CUDA=1)
├─► /audiolla/ → audiolla (audio-production REST + MCP, CPU, AUDIOLLA=1)
├─► /audiolla-cuda/ → audiolla (audio-production REST + MCP, NVIDIA GPU, AUDIOLLA_CUDA=1)
├─► /flickies/ → flickies (video toolkit REST + MCP, CPU, FLICKIES=1)
├─► /flickies-cuda/ → flickies (video toolkit REST + MCP, NVIDIA GPU, FLICKIES_CUDA=1)
├─► /mailbox/ → mailbox (IMAP+SMTP gateway, MAILBOX=1)
├─► /piston/ → piston (sandboxed multi-language code execution, PISTON=1)
└─► / → LiteLLM (sync)
├─ Groq (free: 30 RPM, 1K-14.4K RPD per model, GROQ=1)
├─ Cerebras (paid plan required, CEREBRAS=1)
├─ OpenRouter (free: 50 RPD $0 / 1K RPD with $10+, OPENROUTER=1)
├─ HuggingFace (free: $0.10/mo credits, eval only, HUGGINGFACE=1)
├─ Mistral (free "Experiment" tier, exact limits not published, MISTRAL=1)
├─ Cohere (trial: 1K calls/MONTH, runs out fast, COHERE=1)
├─ Ollama CPU (local, OLLAMA=1)
├─ Ollama CUDA (local, NVIDIA, OLLAMA_CUDA=1)
├─ Talkies CPU (local, unified ASR + Kokoro TTS, TALKIES=1)
├─ Talkies CUDA (local, NVIDIA, full ASR + Kokoro + Qwen3-TTS voice cloning, TALKIES_CUDA=1)
├─ Imagies CPU (local, image gen, IMAGIES=1)
├─ Imagies CUDA (local, image gen, IMAGIES_CUDA=1)
├─ vLLM CPU (local, text LLM + embeddings, VLLM=1)
├─ vLLM CUDA (local, NVIDIA, text LLM + embeddings, VLLM_CUDA=1)
├─ llama.cpp CPU (local, GGUF + vision-VLM incl. Surya OCR 2, LLAMACPP=1)
├─ llama.cpp CUDA (local, NVIDIA, Surya OCR 2 + Qwen3-8B embeddings, LLAMACPP_CUDA=1)
├─ claudebox (subscription, CLAUDEBOX=1)
├─ pibox-zai (subscription, PIBOX_ZAI=1)
├─ pibox (this stack's own models, PIBOX=1)
├─ Anthropic (pay-per-token, ANTHROPIC=1)
└─ OpenAI (pay-per-token, OPENAI=1)
MCP servers (all optional):
├─ stealthy_auto_browse , run_script: multi-step browser automation (BROWSER=1)
├─ hybrids3 , file upload, download, list, delete, presign (HYBRIDS3=1)
├─ claudebox , agentic Claude Code via OAuth or API key (CLAUDEBOX=1)
├─ pibox_zai , agentic pi-coding-agent via z.ai/GLM (PIBOX_ZAI=1)
├─ mcp_tools , generate_image + generate_tts + search_web + execute_code (auto-enabled when HuggingFace, OpenAI, talkies[-cuda], Imagies[-cuda], or SearXNG is active, PISTON=1 alone does NOT enable it; execute_code only appears once mcp_tools is already active for one of those other reasons)
├─ telethon , Telegram send/read/edit messages, dialogs, files, group management (TELETHON=1)
├─ predictalot , time-series forecasting via 5 foundation models × 6 type-routed endpoints + per-type ensemble (PREDICTALOT=1 and/or PREDICTALOT_CUDA=1)
├─ decidealot typed decisions with Laya, Von, CLM, and hosted Jev via system_one, system_one_batch, list_models, unload_models (DECIDEALOT=1 and/or DECIDEALOT_CUDA=1)
├─ audiolla , audio-production: stem separation, restoration, mastering, MIR, DSP, loudness, speech enhancement, diarization, MIDI compose + render, workflow presets + ad-hoc pipelines (AUDIOLLA=1 / AUDIOLLA_CUDA=1)
├─ flickies , video toolkit: lipsync (LatentSync 1.5 + Wav2Lip), face restore (GFPGAN), ffmpeg ops, trim/concat/transcode/scale/mux_audio/extract_audio/thumbnail_grid (FLICKIES=1 / FLICKIES_CUDA=1)
├─ mailbox , IMAP+SMTP gateway: inbox, list/search/send across N accounts (MAILBOX=1)
└─ piston (via mcp_tools), execute_code: sandboxed multi-language code execution via nsjail (requires PISTON=1 AND mcp_tools already active per above, hosted by the mcp_tools aggregator, not a standalone MCP server)
Most persistent data lives under .data/ via bind mounts. Set DATA_DIR to change the base path or set a service-specific variable such as DATA_DIR_OLLAMA=/mnt/nas/ollama. See .env.example for the full list. The default directory structure is tracked in git via .gitkeep files so the right directories exist on a fresh clone, contents are gitignored.
Default writable locations:
Mailbox also uses the mailbox-state named volume for its SQLite audit log, send limits, checkpoints and webhook delivery state. Back up that volume alongside the account config. Read the Mailbox migration notes and browser migration notes before upgrading older deployments.
| Path | Used by | Notes |
|---|---|---|
.data/claudebox/config/.always-skills/ | claudebox | Drop <name>/SKILL.md files here, injected into every Claude session automatically |
.data/claudebox/workspace/ | claudebox | Persistent task workspaces |
.data/pibox-zai/config/ | pibox-zai | pi config dir (telegram.yml, cron history, etc.) |
.data/pibox-zai/workspace/ | pibox-zai | Persistent workspace root (subdirs per task) |
.data/pibox/config/ | pibox | pi config dir for the stack-backed agent |
.data/pibox/workspace/ | pibox | Persistent workspace root (subdirs per task) |
.data/hybrids3/ | hybrids3 | Object storage data |
.data/nginx/ | nginx-auth-init | Generated htpasswd (from LITELLM_UI_BASIC_AUTH) |
.data/ollama/ | ollama, ollama-cuda | Downloaded model weights (shared, CPU and CUDA instances read the same blobs) |
.data/talkies/ | talkies, talkies-cuda | HuggingFace cache for all talkies models (Whisper × 3, Parakeet, Canary × 3, Kokoro). Shared between CPU and CUDA; CPU image loads a subset, CUDA loads the full set. |
.data/talkies-voices/ | talkies-cuda | User-supplied Qwen3-TTS reference voices, drop <name>.wav (10-30s clean speech) and use as voice=<name> on /v1/audio/speech (nested paths supported) |
.data/imagies/ | imagies, imagies-cuda | Downloaded stable-diffusion model weights (shared between CPU and CUDA) |
.data/librechat/ | librechat, librechat-mongodb | Conversation data (MongoDB), file uploads |
.data/cloudflared/ | cloudflared | Tunnel config and credentials (if using named tunnel) |
.data/tailscale/ | tailscale | Tailscale node state (machine key, DERP info), auto-created on first run |
.data/predictalot/models/ | predictalot, predictalot-cuda | Downloaded HuggingFace snapshots for the 5 forecasters (~1.4GB total) |
.data/decidealot/models/ | decidealot, decidealot-cuda | Enabled Laya, Von, and CLM model bundles, downloaded on first start. Must be owned by DECIDEALOT_UID/GID (default 1000) |
.data/audiolla/ | audiolla, audiolla-cuda | Demucs weights (~6GB) + UVR models + torch hub + staged files (bind-mounted as /data; CPU and CUDA variants share the same cache) |
.data/flickies/ | flickies, flickies-cuda | Model weights (~6GB total: S3FD + Wav2Lip ×2 + GFPGAN v1.4 + LatentSync 1.5) + staged file uploads (bind-mounted as /data; CPU and CUDA variants share the same cache) |
.data/vllm/models/<org>/<repo>/ | vllm, vllm-cuda, vllm-pull | Flat HF-repo layout (no blobs/snapshots dedup), vllm-pull populates via huggingface-cli download --local-dir. Shared by CPU and CUDA wrappers and by any other service that mounts the same dir. Default: Nomic embed v2 + Qwen3-0.6B. |
.data/mailbox/ | mailbox | Recommended host path for the mailbox YAML config (config.yaml, gitignored, holds plaintext IMAP/SMTP creds) |
Security and Exposure
Network isolation. Internal services live on the private aigate-internal Docker network with no host port bindings. PostgreSQL, Redis, and LiteLLM are always internal. Optional services (hybrids3, HAProxy, Ollama, talkies, vllm-wrap, llamacpp-wrap, imagies, piston, audiolla, predictalot, decidealot, etc.) join the same private network when enabled. Services that need to reach the public internet (e.g. cloud LLM providers, HuggingFace model pulls) also join aigate-public; the rest are internal-only. Only nginx is exposed.
Auth on everything. Every service requires a bearer token. LiteLLM needs LITELLM_MASTER_KEY. Claudebox instances each have their own token. Hybrids3 uses per-bucket keys. The stealthy browser cluster has an AUTH_TOKEN. The MCP tools server validates MCP_TOOLS_AUTH_TOKEN. LibreChat has its own email/password auth, and the first registered user becomes admin; set LIBRECHAT_ALLOW_REGISTRATION=false in .env and restart after creating your account. The admin UI supports HTTP basic auth.
No new privileges. Application containers carry security_opt: no-new-privileges:true by default. Two unavoidable exceptions: piston requires privileged: true to set up nsjail user namespaces + chroots inside the sandbox (the code-execution isolation lives one level deeper, inside nsjail itself), and tailscale requires NET_ADMIN for the userspace tun device. Both are documented in their service pages.
Pre-flight validation. make run and make run-bg validate that any file paths set in .env (e.g. CLOUDFLARED_CONFIG, CLOUDFLARED_CREDS) actually exist before starting Docker. If a path is set but missing, the stack refuses to start with a clear error rather than silently creating a broken directory mount.
Public exposure. Use Cloudflare Tunnel to reach the gateway from outside your network. Set CLOUDFLARED=1 in .env for a quick *.trycloudflare.com URL (no account needed), or configure a named tunnel for a fixed custom domain. Cloudflare terminates TLS and handles DDoS protection before forwarding traffic to nginx.
Tailnet-only access. Set TAILSCALE=1 for an HTTP proxy through tailscale serve, accessible only from the tailnet. It preserves each caller's IP. Headscale users set TS_SERVE_FQDN to the node's actual MagicDNS name. Access http://<node-hostname>/ from your tailnet; the connection is encrypted by WireGuard.
MCP OAuth. Optional browser authorization needs PROXY_BASE_URL set to your browser-facing HTTPS origin. It can be private; it just has to be reachable from the browser. Bearer-key clients keep working without OAuth setup. See OAuth, trusted proxies and upgrade instructions.