# vahapogut/antigravity-add-model architecture

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

- Interactive diagram: https://gitdiagram.com/vahapogut/antigravity-add-model
- Repository: https://github.com/vahapogut/antigravity-add-model

## Overview

Antigravity Custom Model Enabler adds external and local models to the Antigravity desktop app and IDE, with an optional gateway for routed requests and management. The main workflow is: configure models, select one in the host app, route requests through the local proxy or gateway, translate them for a provider, and return generated results. Separate capabilities include Google account pools, IDE integration, diagnostics and context estimates, plus gateway history and dashboard features. Some subsystem links rely on README descriptions or source-index references because their implementations were not sampled.

Main entry points: [`gateway/src/server.ts`](https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/server.ts) (Gateway API), [`src/proxy.ts`](https://github.com/vahapogut/antigravity-add-model/blob/main/src/proxy.ts) (IDE proxy), [`gateway/src/router.ts`](https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/router.ts) (Provider router), [`src/modelManagement.ts`](https://github.com/vahapogut/antigravity-add-model/blob/main/src/modelManagement.ts) (Model manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop model management"]
  node_model_ui["Model manager<br/>[modelManagement.ts]"]
  node_model_store[("Model configuration<br/>[modelStore.ts]")]
  node_desktop_service["Desktop service"]
  node_google_accounts["Google account pools<br/>[googleAccounts.ts]"]
  node_workers_setup["Workers AI setup<br/>[workersAiSetup.ts]"]
end

subgraph group_proxy["Request routing"]
  node_ide_proxy["IDE proxy<br/>[proxy.ts]"]
  node_proxy_translators["Protocol translators<br/>[anthropic.ts]"]
  node_google_routing["Google pool routing"]
end

subgraph group_gateway["Optional gateway"]
  node_gateway_api["Gateway API<br/>[server.ts]"]
  node_gateway_mapping["Request mapping<br/>[mapper.ts]"]
  node_gateway_engine["Generation engine<br/>[engine.ts]"]
  node_gateway_router["Provider router<br/>[router.ts]"]
  node_gateway_config["Provider configuration<br/>[config.ts]"]
  node_gateway_adapters["Provider adapters<br/>[adapter.ts]"]
  node_gateway_openai["OpenAI adapter<br/>[openai.ts]"]
  node_gateway_dashboard["Gateway dashboard<br/>[dashboard.ts]"]
  node_gateway_db[("Gateway history store<br/>[db.ts]")]
end

subgraph group_support["Host integration and support"]
  node_ide_install["IDE installer<br/>[service.ts]"]
  node_diagnostics["Diagnostics<br/>[diagnostics.ts]"]
  node_context_estimate["Context estimate"]
end

node_user(("User"))
node_antigravity["Antigravity host"]
node_provider["Model provider"]

node_user -->|"manages models"| node_model_ui
node_model_ui -.->|"edits configuration"| node_model_store
node_desktop_service -->|"hosts management"| node_model_ui
node_desktop_service -->|"starts proxy"| node_ide_proxy
node_antigravity -.->|"sends requests"| node_ide_proxy
node_ide_proxy -.->|"forwards requests"| node_provider
node_ide_proxy -.->|"translates protocols"| node_proxy_translators
node_google_routing -.->|"fails over"| node_provider
node_user -->|"configures accounts"| node_google_accounts
node_user -->|"configures integration"| node_workers_setup
node_user -->|"installs IDE adapter"| node_ide_install
node_user -->|"inspects requests"| node_diagnostics
node_antigravity -->|"shows context estimate"| node_context_estimate
node_user -->|"connects remotely"| node_gateway_api
node_gateway_api -->|"maps requests"| node_gateway_mapping
node_gateway_api -->|"runs generation"| node_gateway_engine
node_gateway_api -->|"serves dashboard"| node_gateway_dashboard
node_gateway_engine -->|"executes generation"| node_gateway_router
node_gateway_router -->|"creates adapters"| node_gateway_adapters
node_gateway_adapters -->|"selects adapter"| node_gateway_openai
node_gateway_config -->|"configures providers"| node_gateway_adapters
node_gateway_router -.->|"routes requests"| node_provider
node_gateway_dashboard -.->|"shows history"| node_gateway_db

click node_model_ui "https://github.com/vahapogut/antigravity-add-model/blob/main/src/modelManagement.ts"
click node_model_store "https://github.com/vahapogut/antigravity-add-model/blob/main/src/modelStore.ts"
click node_desktop_service "https://github.com/vahapogut/antigravity-add-model/blob/main/src/standaloneService.ts"
click node_google_accounts "https://github.com/vahapogut/antigravity-add-model/blob/main/src/googleAccounts.ts"
click node_workers_setup "https://github.com/vahapogut/antigravity-add-model/blob/main/src/workersAiSetup.ts"
click node_ide_install "https://github.com/vahapogut/antigravity-add-model/blob/main/src/ideInstall/service.ts"
click node_ide_proxy "https://github.com/vahapogut/antigravity-add-model/blob/main/src/proxy.ts"
click node_proxy_translators "https://github.com/vahapogut/antigravity-add-model/blob/main/src/proxy/translators/anthropic.ts"
click node_google_routing "https://github.com/vahapogut/antigravity-add-model/blob/main/src/proxy/googlePoolFailover.ts"
click node_diagnostics "https://github.com/vahapogut/antigravity-add-model/blob/main/src/diagnostics.ts"
click node_context_estimate "https://github.com/vahapogut/antigravity-add-model/blob/main/src/contextUsagePreload.ts"
click node_gateway_api "https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/server.ts"
click node_gateway_mapping "https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/mapper.ts"
click node_gateway_engine "https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/engine.ts"
click node_gateway_router "https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/router.ts"
click node_gateway_config "https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/config.ts"
click node_gateway_adapters "https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/adapter.ts"
click node_gateway_openai "https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/adapters/openai.ts"
click node_gateway_dashboard "https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/dashboard.ts"
click node_gateway_db "https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/db.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_model_ui,node_model_store,node_desktop_service,node_google_accounts,node_workers_setup,node_user toneBlue
class node_ide_proxy,node_proxy_translators,node_google_routing toneAmber
class node_gateway_api,node_gateway_mapping,node_gateway_engine,node_gateway_router,node_gateway_config,node_gateway_adapters,node_gateway_openai,node_gateway_dashboard,node_gateway_db toneMint
class node_ide_install,node_diagnostics,node_context_estimate toneRose
class node_antigravity,node_provider toneIndigo
```

## Components

### Desktop model management

- [Model manager](https://github.com/vahapogut/antigravity-add-model/blob/main/src/modelManagement.ts): `src/modelManagement.ts`
- [Model configuration](https://github.com/vahapogut/antigravity-add-model/blob/main/src/modelStore.ts): `src/modelStore.ts`
- [Desktop service](https://github.com/vahapogut/antigravity-add-model/blob/main/src/standaloneService.ts): `src/standaloneService.ts`
- [Google account pools](https://github.com/vahapogut/antigravity-add-model/blob/main/src/googleAccounts.ts): `src/googleAccounts.ts`
- [Workers AI setup](https://github.com/vahapogut/antigravity-add-model/blob/main/src/workersAiSetup.ts): `src/workersAiSetup.ts`

### Request routing

- [IDE proxy](https://github.com/vahapogut/antigravity-add-model/blob/main/src/proxy.ts): `src/proxy.ts`
- [Protocol translators](https://github.com/vahapogut/antigravity-add-model/blob/main/src/proxy/translators/anthropic.ts): `src/proxy/translators/anthropic.ts`
- [Google pool routing](https://github.com/vahapogut/antigravity-add-model/blob/main/src/proxy/googlePoolFailover.ts): `src/proxy/googlePoolFailover.ts`

### Optional gateway

- [Gateway API](https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/server.ts): `gateway/src/server.ts`
- [Request mapping](https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/mapper.ts): `gateway/src/mapper.ts`
- [Generation engine](https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/engine.ts): `gateway/src/engine.ts`
- [Provider router](https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/router.ts): `gateway/src/router.ts`
- [Provider configuration](https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/config.ts): `gateway/src/config.ts`
- [Provider adapters](https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/adapter.ts): `gateway/src/adapter.ts`
- [OpenAI adapter](https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/adapters/openai.ts): `gateway/src/adapters/openai.ts`
- [Gateway dashboard](https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/dashboard.ts): `gateway/src/dashboard.ts`
- [Gateway history store](https://github.com/vahapogut/antigravity-add-model/blob/main/gateway/src/db.ts): `gateway/src/db.ts`

### Host integration and support

- [IDE installer](https://github.com/vahapogut/antigravity-add-model/blob/main/src/ideInstall/service.ts): `src/ideInstall/service.ts`
- [Diagnostics](https://github.com/vahapogut/antigravity-add-model/blob/main/src/diagnostics.ts): `src/diagnostics.ts`
- [Context estimate](https://github.com/vahapogut/antigravity-add-model/blob/main/src/contextUsagePreload.ts): `src/contextUsagePreload.ts`

### Other components

- **User**
- **Antigravity host**
- **Model provider**

## Connections

- User → Model manager: manages models (evidence: `README.md`)
- Model manager → Model configuration: edits configuration
- Desktop service → Model manager: hosts management (evidence: `src/standaloneService.ts`)
- Desktop service → IDE proxy: starts proxy (evidence: `src/standaloneService.ts`)
- Antigravity host → IDE proxy: sends requests
- IDE proxy → Model provider: forwards requests
- IDE proxy → Protocol translators: translates protocols
- Google pool routing → Model provider: fails over
- User → Google account pools: configures accounts (evidence: `README.md`)
- User → Workers AI setup: configures integration (evidence: `README.md`)
- User → IDE installer: installs IDE adapter (evidence: `README.md`)
- User → Diagnostics: inspects requests (evidence: `README.md`)
- Antigravity host → Context estimate: shows context estimate (evidence: `README.md`)
- User → Gateway API: connects remotely (evidence: `README.md`)
- Gateway API → Request mapping: maps requests (evidence: `gateway/src/server.ts`)
- Gateway API → Generation engine: runs generation (evidence: `gateway/src/server.ts`)
- Gateway API → Gateway dashboard: serves dashboard (evidence: `gateway/src/server.ts`)
- Generation engine → Provider router: executes generation (evidence: `gateway/src/engine.ts`)
- Provider router → Provider adapters: creates adapters (evidence: `gateway/src/router.ts`)
- Provider adapters → OpenAI adapter: selects adapter (evidence: `gateway/src/adapter.ts`)
- Provider configuration → Provider adapters: configures providers (evidence: `gateway/src/config.ts`)
- Provider router → Model provider: routes requests
- Gateway dashboard → Gateway history store: shows history
