# kazmallar/omniroute architecture

> Architecture diagram of the GitHub repository kazmallar/omniroute, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kazmallar/omniroute
- Repository: https://github.com/kazmallar/omniroute

## Overview

OmniRoute is a local-first AI gateway that presents a unified API across many model providers, with routing, fallback, and request/response features. The main user workflow is an AI client sending a request to the gateway, which routes it to a provider and returns a normalized or streamed response. Separate capabilities include combo pipelines, compression, MCP tools, dashboard management, and CLI/desktop access. Some subsystem links are documented in the README; unsampled implementation details are represented at supported directory paths, and their internal call relationships are not assumed.

Main entry points: [`open-sse/index.ts`](https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/index.ts) (Unified API), [`open-sse/executors`](https://github.com/kazmallar/omniroute/tree/release/v3.8.49/open-sse/executors) (Provider executors), [`open-sse/handlers/chatCore/streamingPipeline.ts`](https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/handlers/chatCore/streamingPipeline.ts) (Chat handling), [`open-sse/mcp-server/server.ts`](https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/mcp-server/server.ts) (MCP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gateway["Gateway and routing"]
  node_api["Unified API<br/>[index.ts]"]
  node_auth["Request authorization<br/>[pipeline.ts]"]
  node_chat["Chat handling"]
  node_stream["Stream transforms"]
end

subgraph group_providers["Provider integrations"]
  node_catalog["Provider registry"]
  node_executors["Provider executors"]
  node_upstreams(("AI providers"))
end

subgraph group_features["Routing features"]
  node_combos["Combo routing<br/>[steps.ts]"]
  node_pipeline["Pipeline engine<br/>[pipeline.ts]"]
  node_pipeline_combo["Sequential combo<br/>[pipeline.ts]"]
  node_compression["Compression services"]
  node_translator["Format translation"]
end

subgraph group_interfaces["User interfaces"]
  node_dashboard["Web dashboard"]
  node_cli["CLI"]
  node_desktop["Desktop app<br/>[main.js]"]
end

subgraph group_operations["Operations and access"]
  node_mcp["MCP server<br/>[server.ts]"]
  node_mcp_tools["MCP advanced tools<br/>[advancedTools.ts]"]
  node_audit["Tool-call audit<br/>[audit.ts]"]
  node_database[("Application database")]
end

node_client(("AI client"))

node_client -->|"sends requests"| node_api
node_api -.->|"authorizes requests"| node_auth
node_auth -.->|"routes requests"| node_chat
node_chat -.->|"dispatches models"| node_executors
node_executors -->|"calls providers"| node_upstreams
node_chat -->|"transforms streams"| node_stream
node_catalog -.->|"configures providers"| node_executors
node_combos -->|"supports combo routing"| node_pipeline_combo
node_pipeline_combo -.->|"runs model steps"| node_executors
node_pipeline -.->|"delegates stages"| node_executors
node_client -->|"uses compression"| node_compression
node_client -->|"uses translation"| node_translator
node_dashboard -->|"manages gateway"| node_api
node_cli -->|"manages gateway"| node_api
node_desktop -.->|"hosts gateway"| node_api
node_mcp -->|"registers tools"| node_mcp_tools
node_mcp -->|"logs tool calls"| node_audit
node_audit -->|"reads and writes"| node_database

click node_api "https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/index.ts"
click node_auth "https://github.com/kazmallar/omniroute/blob/release/v3.8.49/src/server/authz/pipeline.ts"
click node_chat "https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/handlers/chatCore/streamingPipeline.ts"
click node_stream "https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/handlers/chatCore/streamingPipeline.ts"
click node_catalog "https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/config/providerRegistry.ts"
click node_executors "https://github.com/kazmallar/omniroute/tree/release/v3.8.49/open-sse/executors"
click node_combos "https://github.com/kazmallar/omniroute/blob/release/v3.8.49/src/lib/combos/steps.ts"
click node_pipeline "https://github.com/kazmallar/omniroute/blob/release/v3.8.49/src/domain/pipeline.ts"
click node_pipeline_combo "https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/services/pipeline.ts"
click node_compression "https://github.com/kazmallar/omniroute/tree/release/v3.8.49/open-sse/services/compression"
click node_translator "https://github.com/kazmallar/omniroute/tree/release/v3.8.49/open-sse/translator"
click node_dashboard "https://github.com/kazmallar/omniroute/tree/release/v3.8.49/src/app/(dashboard)"
click node_cli "https://github.com/kazmallar/omniroute/tree/release/v3.8.49/bin/cli"
click node_desktop "https://github.com/kazmallar/omniroute/blob/release/v3.8.49/electron/main.js"
click node_mcp "https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/mcp-server/server.ts"
click node_mcp_tools "https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/mcp-server/tools/advancedTools.ts"
click node_audit "https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/mcp-server/audit.ts"
click node_database "https://github.com/kazmallar/omniroute/tree/release/v3.8.49/src/lib/db"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_auth,node_chat,node_stream,node_client toneBlue
class node_catalog,node_executors,node_upstreams toneAmber
class node_combos,node_pipeline,node_pipeline_combo,node_compression,node_translator toneMint
class node_dashboard,node_cli,node_desktop toneRose
class node_mcp,node_mcp_tools,node_audit,node_database toneIndigo
```

## Components

### Gateway and routing

- [Unified API](https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/index.ts): `open-sse/index.ts`
- [Request authorization](https://github.com/kazmallar/omniroute/blob/release/v3.8.49/src/server/authz/pipeline.ts): `src/server/authz/pipeline.ts`
- [Chat handling](https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/handlers/chatCore/streamingPipeline.ts): `open-sse/handlers/chatCore/streamingPipeline.ts`
- [Stream transforms](https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/handlers/chatCore/streamingPipeline.ts): `open-sse/handlers/chatCore/streamingPipeline.ts`

### Provider integrations

- [Provider registry](https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/config/providerRegistry.ts): `open-sse/config/providerRegistry.ts`
- [Provider executors](https://github.com/kazmallar/omniroute/tree/release/v3.8.49/open-sse/executors): `open-sse/executors`
- **AI providers**

### Routing features

- [Combo routing](https://github.com/kazmallar/omniroute/blob/release/v3.8.49/src/lib/combos/steps.ts): `src/lib/combos/steps.ts`
- [Pipeline engine](https://github.com/kazmallar/omniroute/blob/release/v3.8.49/src/domain/pipeline.ts): `src/domain/pipeline.ts`
- [Sequential combo](https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/services/pipeline.ts): `open-sse/services/pipeline.ts`
- [Compression services](https://github.com/kazmallar/omniroute/tree/release/v3.8.49/open-sse/services/compression): `open-sse/services/compression`
- [Format translation](https://github.com/kazmallar/omniroute/tree/release/v3.8.49/open-sse/translator): `open-sse/translator`

### User interfaces

- [Web dashboard](https://github.com/kazmallar/omniroute/tree/release/v3.8.49/src/app/(dashboard)): `src/app/(dashboard)`
- [CLI](https://github.com/kazmallar/omniroute/tree/release/v3.8.49/bin/cli): `bin/cli`
- [Desktop app](https://github.com/kazmallar/omniroute/blob/release/v3.8.49/electron/main.js): `electron/main.js`

### Operations and access

- [MCP server](https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/mcp-server/server.ts): `open-sse/mcp-server/server.ts`
- [MCP advanced tools](https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/mcp-server/tools/advancedTools.ts): `open-sse/mcp-server/tools/advancedTools.ts`
- [Tool-call audit](https://github.com/kazmallar/omniroute/blob/release/v3.8.49/open-sse/mcp-server/audit.ts): `open-sse/mcp-server/audit.ts`
- [Application database](https://github.com/kazmallar/omniroute/tree/release/v3.8.49/src/lib/db): `src/lib/db`

### Other components

- **AI client**

## Connections

- AI client → Unified API: sends requests (evidence: `README.md`)
- Unified API → Request authorization: authorizes requests
- Request authorization → Chat handling: routes requests
- Chat handling → Provider executors: dispatches models
- Provider executors → AI providers: calls providers (evidence: `README.md`)
- Chat handling → Stream transforms: transforms streams (evidence: `open-sse/handlers/chatCore/streamingPipeline.ts`)
- Provider registry → Provider executors: configures providers
- Combo routing → Sequential combo: supports combo routing (evidence: `README.md`)
- Sequential combo → Provider executors: runs model steps
- Pipeline engine → Provider executors: delegates stages
- AI client → Compression services: uses compression (evidence: `README.md`)
- AI client → Format translation: uses translation (evidence: `README.md`)
- Web dashboard → Unified API: manages gateway (evidence: `README.md`)
- CLI → Unified API: manages gateway (evidence: `README.md`)
- Desktop app → Unified API: hosts gateway
- MCP server → MCP advanced tools: registers tools (evidence: `open-sse/mcp-server/server.ts`)
- MCP server → Tool-call audit: logs tool calls (evidence: `open-sse/mcp-server/server.ts`)
- Tool-call audit → Application database: reads and writes (evidence: `open-sse/mcp-server/audit.ts`)
