How yanstd888/9routerx works
9RouterX is a self-hosted Go LLM gateway with an embedded Svelte dashboard. A client sends a compatible inference request to the local gateway; the gateway handles compatibility and policy, routes it to a provider, and returns the response. Its broader product includes provider connections, quota-aware cascades, token reduction, governance, caching, health recovery, and operational dashboards. The README supports the product-level flow and capabilities; sampled source shows dashboard routing and API-client responsibilities, but not the gateway’s internal call chain, so those links are omitted or marked unverified.
Main entry points: chat Chat Routing · proxy Provider Execution · router.go API Routes · server.go Local Gateway
Components 21
Gateway and Routing
- Local Gateway
internal/app/server.go - API Routes
internal/handlers/router.go - Format Translation
internal/translator/client_format.go - Chat Routing
internal/handlers/chat - Provider Execution
internal/proxy - Token Saver
internal/tokensaver - Output Compression
internal/compression
Providers and Accounts
- Provider Connections
internal/handlers/oauth - Provider Catalog
internal/providers
Governance and Reliability
- Keys and Guardrails
internal/guardrails - Per-key Budgets
internal/budget - Health and Recovery
internal/resilience - Request Caches
internal/semanticcache
Operations and Dashboard
- SQLite State
internal/db - Web Dashboard
web/src/App.svelte - Dashboard API Client
web/src/api/client.ts - Admin Handlers
internal/handlers/dashboard/routes.go - MCP and A2A
internal/mcpserver - MITM Inspector
internal/mitm/server.go
Other components
- AI Client
- AI Providers
Connections 21
- AI Client → Local Gateway: sends requests
README.md - Local Gateway → API Routes: routes requests
- API Routes → Format Translation: adapts formats
- API Routes → Chat Routing: dispatches inference
- Chat Routing → Provider Execution: forwards upstream
- Provider Execution → AI Providers: sends provider calls
README.md - Provider Execution → AI Client: returns responses
- Chat Routing → Token Saver: reduces context
README.md - Chat Routing → Output Compression: compresses output
README.md - AI Client → Web Dashboard: configures gateway
README.md - Web Dashboard → Dashboard API Client: calls API
web/src/App.svelte - Dashboard API Client → Admin Handlers: requests admin operations
web/src/api/client.ts - Admin Handlers → SQLite State: reads and writes
- Provider Connections → SQLite State: stores credentials
- Provider Catalog → Provider Execution: selects providers
- Chat Routing → Keys and Guardrails: enforces policies
README.md - Chat Routing → Per-key Budgets: checks spend limits
README.md - Chat Routing → Health and Recovery: avoids degraded nodes
README.md - Chat Routing → Request Caches: checks semantic cache
README.md - AI Client → MCP and A2A: uses tool protocols
README.md - AI Providers → MITM Inspector: traffic inspection