How azhar457/9router works
9Router Plinian is an AI gateway for coding tools: clients send requests to one local endpoint, which the Go entry proxy forwards to the Next.js/Open-SSE core for provider selection, translation, execution, and responses. The README also documents combos and fallback, quota and usage tracking, media services, dashboard configuration, and fork-specific Red Team and token-saving features. Some subsystem links are documented rather than visible in sampled source; unsampled implementation details are not inferred.
Main entry points: chatCore.js Chat request handling · open-sse/index.js Open-SSE gateway · executors/index.js Provider executors · page.js Dashboard
Components 21
Gateway entry
- Go entry proxy
go/main.go - Open-SSE gateway
open-sse/index.js - Chat request handling
open-sse/handlers/chatCore.js
Provider routing
- Provider catalog
open-sse/providers/registry/index.js - Provider service
open-sse/services/provider.js - Provider executors
open-sse/executors/index.js - Models endpoint
src/app/api/v1/models/route.js - Combos and fallback
open-sse/services/combo.js
Request capabilities
- Format translation
open-sse/translator/index.js - RTK token saver
open-sse/rtk/index.js - Red Team injection
open-sse/rtk/globalInject.js - Media services
open-sse/handlers/imageGenerationCore.js
Configuration and state
- Local database
src/lib/localDb.js - OAuth and credentials
src/lib/oauth/utils/server.js - Quota and usage
open-sse/services/usage.js
User interface
- Dashboard
src/app/(dashboard)/dashboard/page.js - Provider management
src/app/(dashboard)/dashboard/providers/page.js - Transparency console
src/app/(dashboard)/dashboard/developer/TransparencyClient.js
Other components
- Coding tools
- AI providers
- Provider APIs
Connections 20
- Coding tools → Go entry proxy: sends requests
- Go entry proxy → Open-SSE gateway: forwards requests
- Open-SSE gateway → Chat request handling: routes chat
open-sse/index.js - Chat request handling → Provider service: selects provider
open-sse/handlers/chatCore.js - Chat request handling → Format translation: translates formats
open-sse/handlers/chatCore.js - Chat request handling → Provider executors: dispatches requests
open-sse/handlers/chatCore.js - Provider service → Provider catalog: reads definitions
open-sse/services/provider.js - Provider executors → AI providers: calls provider
- Chat request handling → RTK token saver: compresses context
open-sse/handlers/chatCore.js - Chat request handling → Red Team injection: adds prompt payload
open-sse/handlers/chatCore.js - Coding tools → Models endpoint: lists models
- Models endpoint → Local database: reads connections
src/app/api/v1/models/route.js - Open-SSE gateway → Combos and fallback: uses combos
- Open-SSE gateway → Quota and usage: tracks quota and usage
- Open-SSE gateway → Media services: serves media requests
- Dashboard → Provider management: manages providers
- Provider management → Local database: configures connections
- Dashboard → OAuth and credentials: connects accounts
- Transparency console → Red Team injection: shows injection order
- Provider executors → Provider APIs: sends upstream requests