# automazeio/vibeproxy architecture

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

- Interactive diagram: https://gitdiagram.com/automazeio/vibeproxy
- Repository: https://github.com/automazeio/vibeproxy

## Overview

VibeProxy is a native macOS menu-bar controller for CLIProxyAPIPlus: users connect provider accounts, manage proxy settings and start the local service, then coding clients send requests through the proxy. The app monitors credentials and user configuration, composes effective configuration, and launches its bundled backend. A separate thinking proxy handles Claude thinking-model request adjustments and documented Amp login forwarding. The README also documents Vercel Gateway routing, multi-account behavior, provider controls, and live configuration reload. Some wiring is based on README documentation because the corresponding source excerpts are incomplete.

Main entry points: [`src/Sources/ServerManager.swift`](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/ServerManager.swift) (Server manager), [`src/Sources/SettingsView.swift`](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/SettingsView.swift) (Settings UI), [`src/Sources/AppDelegate.swift`](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/AppDelegate.swift) (App lifecycle), [`src/Sources/ThinkingProxy.swift`](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/ThinkingProxy.swift) (Thinking proxy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Menu Bar App"]
  node_main["App entry<br/>[main.swift]"]
  node_delegate["App lifecycle<br/>[AppDelegate.swift]"]
  node_settings["Settings UI<br/>[SettingsView.swift]"]
end

subgraph group_control["Service Control"]
  node_server["Server manager"]
  node_backend["CLIProxyAPIPlus"]
  node_configcomposer["Config composer"]
  node_bundledconfig["Bundled defaults<br/>[config.yaml]"]
  node_userconfig["User overrides"]
  node_fingerprint["Config fingerprint"]
  node_capabilities["Backend capabilities"]
end

subgraph group_identity["Accounts And Providers"]
  node_authstatus["Auth status<br/>[AuthStatus.swift]"]
  node_connectionaction["Connection actions"]
  node_customproviders["Custom providers"]
  node_credentialstore["Custom credentials"]
  node_zaistore["Z.AI key store"]
  node_authfiles["Auth files"]
end

subgraph group_requests["Request Routing"]
  node_thinking["Thinking proxy"]
  node_tunnel["Tunnel manager"]
end

node_user(("Mac user"))
node_provider(("AI provider services"))
node_browser(("OAuth browser"))
node_codingclient(("Coding clients"))
node_vercel["Vercel AI Gateway"]
node_cloudflared["Cloudflare tunnel"]

node_user -->|"launches"| node_main
node_main -->|"instantiates"| node_delegate
node_delegate -->|"opens"| node_settings
node_user -->|"configures"| node_settings
node_settings -->|"manages service"| node_server
node_settings -->|"selects action"| node_connectionaction
node_settings -->|"shows accounts"| node_authstatus
node_delegate -->|"starts backend"| node_server
node_server -->|"launches"| node_backend
node_server -->|"probes flags"| node_capabilities
node_server -->|"composes config"| node_configcomposer
node_configcomposer -->|"reads defaults"| node_bundledconfig
node_configcomposer -->|"reads overrides"| node_userconfig
node_delegate -->|"checks changes"| node_fingerprint
node_server -->|"checks inputs"| node_fingerprint
node_settings -->|"manages keys"| node_credentialstore
node_settings -->|"adds API key"| node_zaistore
node_server -->|"loads credentials"| node_credentialstore
node_server -->|"loads keys"| node_zaistore
node_authstatus -->|"reads and updates"| node_authfiles
node_server -->|"writes auth"| node_authfiles
node_server -->|"starts OAuth"| node_browser
node_browser -->|"authenticates"| node_provider
node_codingclient -->|"sends requests"| node_thinking
node_thinking -->|"forwards requests"| node_backend
node_thinking -.->|"forwards Amp login"| node_provider
node_thinking -.->|"routes Claude requests"| node_vercel
node_server -->|"configures providers"| node_customproviders
node_settings -->|"manages providers"| node_customproviders
node_delegate -->|"starts and stops"| node_thinking
node_server -.->|"exposes local port"| node_tunnel
node_tunnel -.->|"starts tunnel"| node_cloudflared
node_cloudflared -.->|"provides public endpoint"| node_codingclient

click node_main "https://github.com/automazeio/vibeproxy/blob/main/src/Sources/main.swift"
click node_delegate "https://github.com/automazeio/vibeproxy/blob/main/src/Sources/AppDelegate.swift"
click node_settings "https://github.com/automazeio/vibeproxy/blob/main/src/Sources/SettingsView.swift"
click node_authstatus "https://github.com/automazeio/vibeproxy/blob/main/src/Sources/AuthStatus.swift"
click node_connectionaction "https://github.com/automazeio/vibeproxy/blob/main/src/Sources/ServiceType%2BConnectionAction.swift"
click node_server "https://github.com/automazeio/vibeproxy/blob/main/src/Sources/ServerManager.swift"
click node_backend "https://github.com/automazeio/vibeproxy/blob/main/src/Sources/Resources/cli-proxy-api-plus"
click node_configcomposer "https://github.com/automazeio/vibeproxy/blob/main/src/Sources/ConfigComposer.swift"
click node_bundledconfig "https://github.com/automazeio/vibeproxy/blob/main/src/Sources/Resources/config.yaml"
click node_fingerprint "https://github.com/automazeio/vibeproxy/blob/main/src/Sources/ConfigInputFingerprint.swift"
click node_capabilities "https://github.com/automazeio/vibeproxy/blob/main/src/Sources/BackendCapabilities.swift"
click node_customproviders "https://github.com/automazeio/vibeproxy/blob/main/src/Sources/CustomProviders.swift"
click node_credentialstore "https://github.com/automazeio/vibeproxy/blob/main/src/Sources/CustomProviderCredentialStore.swift"
click node_zaistore "https://github.com/automazeio/vibeproxy/blob/main/src/Sources/ZAIAPIKeyStore.swift"
click node_thinking "https://github.com/automazeio/vibeproxy/blob/main/src/Sources/ThinkingProxy.swift"
click node_tunnel "https://github.com/automazeio/vibeproxy/blob/main/src/Sources/TunnelManager.swift"

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_main,node_delegate,node_settings,node_user,node_browser,node_codingclient toneBlue
class node_server,node_backend,node_configcomposer,node_bundledconfig,node_userconfig,node_fingerprint,node_capabilities toneAmber
class node_authstatus,node_connectionaction,node_customproviders,node_credentialstore,node_zaistore,node_authfiles toneMint
class node_thinking,node_tunnel toneRose
class node_provider,node_vercel,node_cloudflared toneIndigo
```

## Components

### Menu Bar App

- [App entry](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/main.swift): `src/Sources/main.swift`
- [App lifecycle](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/AppDelegate.swift): `src/Sources/AppDelegate.swift`
- [Settings UI](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/SettingsView.swift): `src/Sources/SettingsView.swift`

### Service Control

- [Server manager](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/ServerManager.swift): `src/Sources/ServerManager.swift`
- [CLIProxyAPIPlus](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/Resources/cli-proxy-api-plus): `src/Sources/Resources/cli-proxy-api-plus`
- [Config composer](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/ConfigComposer.swift): `src/Sources/ConfigComposer.swift`
- [Bundled defaults](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/Resources/config.yaml): `src/Sources/Resources/config.yaml`
- **User overrides**
- [Config fingerprint](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/ConfigInputFingerprint.swift): `src/Sources/ConfigInputFingerprint.swift`
- [Backend capabilities](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/BackendCapabilities.swift): `src/Sources/BackendCapabilities.swift`

### Accounts And Providers

- [Auth status](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/AuthStatus.swift): `src/Sources/AuthStatus.swift`
- [Connection actions](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/ServiceType%2BConnectionAction.swift): `src/Sources/ServiceType+ConnectionAction.swift`
- [Custom providers](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/CustomProviders.swift): `src/Sources/CustomProviders.swift`
- [Custom credentials](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/CustomProviderCredentialStore.swift): `src/Sources/CustomProviderCredentialStore.swift`
- [Z.AI key store](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/ZAIAPIKeyStore.swift): `src/Sources/ZAIAPIKeyStore.swift`
- **Auth files**

### Request Routing

- [Thinking proxy](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/ThinkingProxy.swift): `src/Sources/ThinkingProxy.swift`
- [Tunnel manager](https://github.com/automazeio/vibeproxy/blob/main/src/Sources/TunnelManager.swift): `src/Sources/TunnelManager.swift`

### Other components

- **Mac user**
- **AI provider services**
- **OAuth browser**
- **Coding clients**
- **Vercel AI Gateway**
- **Cloudflare tunnel**

## Connections

- Mac user → App entry: launches
- App entry → App lifecycle: instantiates
- App lifecycle → Settings UI: opens
- Mac user → Settings UI: configures
- Settings UI → Server manager: manages service
- Settings UI → Connection actions: selects action
- Settings UI → Auth status: shows accounts
- App lifecycle → Server manager: starts backend
- Server manager → CLIProxyAPIPlus: launches
- Server manager → Backend capabilities: probes flags
- Server manager → Config composer: composes config
- Config composer → Bundled defaults: reads defaults
- Config composer → User overrides: reads overrides
- App lifecycle → Config fingerprint: checks changes
- Server manager → Config fingerprint: checks inputs
- Settings UI → Custom credentials: manages keys
- Settings UI → Z.AI key store: adds API key
- Server manager → Custom credentials: loads credentials
- Server manager → Z.AI key store: loads keys
- Auth status → Auth files: reads and updates
- Server manager → Auth files: writes auth
- Server manager → OAuth browser: starts OAuth
- OAuth browser → AI provider services: authenticates
- Coding clients → Thinking proxy: sends requests
- Thinking proxy → CLIProxyAPIPlus: forwards requests
- Thinking proxy → AI provider services: forwards Amp login
- Thinking proxy → Vercel AI Gateway: routes Claude requests
- Server manager → Custom providers: configures providers
- Settings UI → Custom providers: manages providers
- App lifecycle → Thinking proxy: starts and stops
- Server manager → Tunnel manager: exposes local port
- Tunnel manager → Cloudflare tunnel: starts tunnel
- Cloudflare tunnel → Coding clients: provides public endpoint
