How gmagl/omniroute works
OmniRoute is a self-hosted AI gateway: compatible AI tools send requests to a unified API, which authenticates and routes them to a large provider catalog, then streams results back. Its broader product includes automatic fallback, token compression, quota-aware routing, multimodal bridges, dashboard management, and CLI/MCP interfaces. The graph combines documented capabilities with relationships visible in sampled source and the SOURCE INDEX; unsampled subsystems are represented at supported directory paths, and their internal call links are omitted where unverified.
Main entry points: index.ts Unified API · providerExecutionPipeline.ts Provider Execution · pipeline.ts Request Auth · streamHandler.ts Response Streaming
Components 16
Gateway Runtime
- Unified API
open-sse/index.ts - Request Auth
src/server/authz/pipeline.ts - Provider Execution
open-sse/handlers/chatCore/providerExecutionPipeline.ts - Response Streaming
open-sse/utils/streamHandler.ts - Error Handling
open-sse/utils/error.ts
Provider Routing
- Provider Catalog
open-sse/config/providerRegistry.ts - Provider Connections
src/lib/db/providers.ts - Fallback Routing
open-sse/services/accountFallback.ts
Routing Capabilities
- Token Compression
open-sse/services/compression - Quota Scheduling
open-sse/services/usage - Modality Bridge
src/lib/guardrails/videoBridgePipeline.ts
Product Interfaces
- Management Dashboard
src/app/(dashboard) - CLI
bin/cli - MCP Tools
open-sse/mcp-server/server.ts
Other components
- AI Clients
- AI Providers
Connections 15
- AI Clients → Unified API: send requests
README.md - Unified API → Request Auth: authorize requests
- Request Auth → Provider Execution: admit requests
- Provider Execution → Provider Catalog: resolve providers
- Provider Execution → Provider Connections: read connections
open-sse/handlers/chatCore/providerExecutionPipeline.ts - Provider Execution → Fallback Routing: retry alternatives
open-sse/handlers/chatCore/providerExecutionPipeline.ts - Provider Execution → AI Providers: dispatch requests
- Provider Execution → Response Streaming: stream response
- Response Streaming → Error Handling: format errors
open-sse/utils/streamHandler.ts - Unified API → Token Compression: compress prompts
README.md - Unified API → Quota Scheduling: schedule by quota
README.md - Unified API → Modality Bridge: bridge modalities
README.md - Management Dashboard → Unified API: manage gateway
- CLI → Unified API: operate gateway
- MCP Tools → Unified API: expose tools