# cheaper-inference/omnicopilot architecture

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

- Interactive diagram: https://gitdiagram.com/cheaper-inference/omnicopilot
- Repository: https://github.com/cheaper-inference/omnicopilot

## Overview

OmniCopilot is a VS Code language-model extension that exposes an OmniRoute server’s models in Copilot Chat. Users connect a server, choose models, and send chat requests through the extension’s provider to the server; the extension also supports connection management, status and usage reporting, and configuring coding tools through the OmniRoute CLI. The map follows documented capabilities and visible imports/calls; unsampled subsystem internals and relationships are omitted where evidence is limited.

Main entry points: [`src/provider.ts`](https://github.com/cheaper-inference/omnicopilot/blob/main/src/provider.ts) (Copilot model provider), [`src/client.ts`](https://github.com/cheaper-inference/omnicopilot/blob/main/src/client.ts) (HTTP client), [`src/extension.ts`](https://github.com/cheaper-inference/omnicopilot/blob/main/src/extension.ts) (Extension activation), [`src/panel.ts`](https://github.com/cheaper-inference/omnicopilot/blob/main/src/panel.ts) (Connection panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["VS Code experience"]
  node_extension["Extension activation<br/>[extension.ts]"]
  node_panel["Connection panel<br/>[panel.ts]"]
end

subgraph group_connection["Connection management"]
  node_connection["Connection and keys<br/>[connection.ts]"]
  node_client["HTTP client<br/>[client.ts]"]
  node_diagnostics["Probe diagnostics<br/>[diagnostics.ts]"]
end

subgraph group_chat["Model and chat"]
  node_provider["Copilot model provider<br/>[provider.ts]"]
  node_catalog["Catalog filtering<br/>[catalogFilter.ts]"]
  node_modelinfo["Model details<br/>[modelInfo.ts]"]
  node_convert["Chat conversion<br/>[convert.ts]"]
  node_params["Request parameters<br/>[requestParams.ts]"]
  node_reasoning["Reasoning options<br/>[reasoning.ts]"]
  node_retry["Retry handling<br/>[retry.ts]"]
  node_toolnames["Tool names<br/>[toolNames.ts]"]
  node_agents["Agent window support<br/>[agentsWindow.ts]"]
end

subgraph group_status["Status and usage"]
  node_statusbar["Status bar<br/>[statusBar.ts]"]
  node_usage["Usage reporting<br/>[usage.ts]"]
end

subgraph group_tools["Tool configuration"]
  node_cli["Coding CLI setup<br/>[cliBridge.ts]"]
end

node_user(("User"))
node_vscode["VS Code"]
node_server{{"OmniRoute server"}}
node_omnicli{{"OmniRoute CLI"}}

node_user -->|"uses chat"| node_vscode
node_vscode -->|"activates"| node_extension
node_extension -->|"registers provider"| node_provider
node_user -->|"manages connection"| node_panel
node_extension -->|"opens panel"| node_panel
node_panel -->|"saves keys"| node_connection
node_panel -->|"tests connection"| node_client
node_connection -->|"normalizes URL"| node_client
node_client -->|"classifies failures"| node_diagnostics
node_provider -->|"resolves connection"| node_connection
node_provider -->|"requests models and chat"| node_client
node_provider -->|"filters models"| node_catalog
node_provider -->|"builds model details"| node_modelinfo
node_provider -->|"converts messages"| node_convert
node_provider -->|"builds request options"| node_params
node_provider -->|"resolves effort"| node_reasoning
node_provider -->|"expands agent tools"| node_agents
node_provider -->|"maps tool names"| node_toolnames
node_client -->|"uses retry rules"| node_retry
node_client -->|"sends API requests"| node_server
node_provider -->|"offers models in picker"| node_server
node_extension -->|"creates status bar"| node_statusbar
node_statusbar -->|"probes server"| node_client
node_statusbar -->|"formats usage"| node_usage
node_extension -->|"loads personal usage"| node_usage
node_usage -->|"reads usage endpoints"| node_server
node_user -->|"configures coding tools"| node_cli
node_cli -->|"resolves credentials"| node_connection
node_cli -->|"runs configuration"| node_omnicli

click node_extension "https://github.com/cheaper-inference/omnicopilot/blob/main/src/extension.ts"
click node_panel "https://github.com/cheaper-inference/omnicopilot/blob/main/src/panel.ts"
click node_connection "https://github.com/cheaper-inference/omnicopilot/blob/main/src/connection.ts"
click node_client "https://github.com/cheaper-inference/omnicopilot/blob/main/src/client.ts"
click node_diagnostics "https://github.com/cheaper-inference/omnicopilot/blob/main/src/diagnostics.ts"
click node_provider "https://github.com/cheaper-inference/omnicopilot/blob/main/src/provider.ts"
click node_catalog "https://github.com/cheaper-inference/omnicopilot/blob/main/src/catalogFilter.ts"
click node_modelinfo "https://github.com/cheaper-inference/omnicopilot/blob/main/src/modelInfo.ts"
click node_convert "https://github.com/cheaper-inference/omnicopilot/blob/main/src/convert.ts"
click node_params "https://github.com/cheaper-inference/omnicopilot/blob/main/src/requestParams.ts"
click node_reasoning "https://github.com/cheaper-inference/omnicopilot/blob/main/src/reasoning.ts"
click node_retry "https://github.com/cheaper-inference/omnicopilot/blob/main/src/retry.ts"
click node_toolnames "https://github.com/cheaper-inference/omnicopilot/blob/main/src/toolNames.ts"
click node_agents "https://github.com/cheaper-inference/omnicopilot/blob/main/src/agentsWindow.ts"
click node_statusbar "https://github.com/cheaper-inference/omnicopilot/blob/main/src/statusBar.ts"
click node_usage "https://github.com/cheaper-inference/omnicopilot/blob/main/src/usage.ts"
click node_cli "https://github.com/cheaper-inference/omnicopilot/blob/main/src/cliBridge.ts"

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_extension,node_panel,node_user toneBlue
class node_connection,node_client,node_diagnostics toneAmber
class node_provider,node_catalog,node_modelinfo,node_convert,node_params,node_reasoning,node_retry,node_toolnames,node_agents,node_server,node_omnicli toneMint
class node_statusbar,node_usage toneRose
class node_cli,node_vscode toneIndigo
```

## Components

### VS Code experience

- [Extension activation](https://github.com/cheaper-inference/omnicopilot/blob/main/src/extension.ts): `src/extension.ts`
- [Connection panel](https://github.com/cheaper-inference/omnicopilot/blob/main/src/panel.ts): `src/panel.ts`

### Connection management

- [Connection and keys](https://github.com/cheaper-inference/omnicopilot/blob/main/src/connection.ts): `src/connection.ts`
- [HTTP client](https://github.com/cheaper-inference/omnicopilot/blob/main/src/client.ts): `src/client.ts`
- [Probe diagnostics](https://github.com/cheaper-inference/omnicopilot/blob/main/src/diagnostics.ts): `src/diagnostics.ts`

### Model and chat

- [Copilot model provider](https://github.com/cheaper-inference/omnicopilot/blob/main/src/provider.ts): `src/provider.ts`
- [Catalog filtering](https://github.com/cheaper-inference/omnicopilot/blob/main/src/catalogFilter.ts): `src/catalogFilter.ts`
- [Model details](https://github.com/cheaper-inference/omnicopilot/blob/main/src/modelInfo.ts): `src/modelInfo.ts`
- [Chat conversion](https://github.com/cheaper-inference/omnicopilot/blob/main/src/convert.ts): `src/convert.ts`
- [Request parameters](https://github.com/cheaper-inference/omnicopilot/blob/main/src/requestParams.ts): `src/requestParams.ts`
- [Reasoning options](https://github.com/cheaper-inference/omnicopilot/blob/main/src/reasoning.ts): `src/reasoning.ts`
- [Retry handling](https://github.com/cheaper-inference/omnicopilot/blob/main/src/retry.ts): `src/retry.ts`
- [Tool names](https://github.com/cheaper-inference/omnicopilot/blob/main/src/toolNames.ts): `src/toolNames.ts`
- [Agent window support](https://github.com/cheaper-inference/omnicopilot/blob/main/src/agentsWindow.ts): `src/agentsWindow.ts`

### Status and usage

- [Status bar](https://github.com/cheaper-inference/omnicopilot/blob/main/src/statusBar.ts): `src/statusBar.ts`
- [Usage reporting](https://github.com/cheaper-inference/omnicopilot/blob/main/src/usage.ts): `src/usage.ts`

### Tool configuration

- [Coding CLI setup](https://github.com/cheaper-inference/omnicopilot/blob/main/src/cliBridge.ts): `src/cliBridge.ts`

### Other components

- **User**
- **VS Code**
- **OmniRoute server**
- **OmniRoute CLI**

## Connections

- User → VS Code: uses chat (evidence: `README.md`)
- VS Code → Extension activation: activates (evidence: `src/extension.ts`)
- Extension activation → Copilot model provider: registers provider (evidence: `src/extension.ts`)
- User → Connection panel: manages connection (evidence: `README.md`)
- Extension activation → Connection panel: opens panel (evidence: `src/extension.ts`)
- Connection panel → Connection and keys: saves keys (evidence: `src/panel.ts`)
- Connection panel → HTTP client: tests connection (evidence: `src/panel.ts`)
- Connection and keys → HTTP client: normalizes URL (evidence: `src/connection.ts`)
- HTTP client → Probe diagnostics: classifies failures (evidence: `src/client.ts`)
- Copilot model provider → Connection and keys: resolves connection (evidence: `src/provider.ts`)
- Copilot model provider → HTTP client: requests models and chat (evidence: `src/provider.ts`)
- Copilot model provider → Catalog filtering: filters models (evidence: `src/provider.ts`)
- Copilot model provider → Model details: builds model details (evidence: `src/provider.ts`)
- Copilot model provider → Chat conversion: converts messages (evidence: `src/provider.ts`)
- Copilot model provider → Request parameters: builds request options (evidence: `src/provider.ts`)
- Copilot model provider → Reasoning options: resolves effort (evidence: `src/provider.ts`)
- Copilot model provider → Agent window support: expands agent tools (evidence: `src/provider.ts`)
- Copilot model provider → Tool names: maps tool names (evidence: `src/provider.ts`)
- HTTP client → Retry handling: uses retry rules (evidence: `src/client.ts`)
- HTTP client → OmniRoute server: sends API requests (evidence: `src/client.ts`)
- Copilot model provider → OmniRoute server: offers models in picker (evidence: `README.md`)
- Extension activation → Status bar: creates status bar (evidence: `src/extension.ts`)
- Status bar → HTTP client: probes server (evidence: `src/statusBar.ts`)
- Status bar → Usage reporting: formats usage (evidence: `src/statusBar.ts`)
- Extension activation → Usage reporting: loads personal usage (evidence: `src/extension.ts`)
- Usage reporting → OmniRoute server: reads usage endpoints (evidence: `src/usage.ts`)
- User → Coding CLI setup: configures coding tools (evidence: `README.md`)
- Coding CLI setup → Connection and keys: resolves credentials (evidence: `src/cliBridge.ts`)
- Coding CLI setup → OmniRoute CLI: runs configuration (evidence: `README.md`)
