How router-for-me/cliproxyapi works
CLIProxyAPI is a multi-provider proxy that exposes OpenAI-, Gemini-, and Claude-compatible APIs for CLI clients. The principal flow is a client request entering the HTTP server, being routed to a protocol handler, translated as needed, and served through provider-specific execution; authenticated provider accounts supply access to upstream models. The repository also includes account management, model discovery, plugins, and configuration capabilities. Some runtime links are documented in the README or source index but their exact call paths were not sampled, so those links are marked unverified.
Main entry points: server.go HTTP server · handlers Protocol handlers · pipeline.go Translation pipeline · executor Provider executors
Components 17
API entry
- HTTP server
internal/api/server.go - API routes
internal/api/server_routes.go - Protocol handlers
sdk/api/handlers
Model runtime
- Protocol translation
internal/translator - Translation pipeline
sdk/translator/pipeline.go - Provider executors
internal/runtime/executor - Model registry
internal/registry
Accounts and config
- Authentication manager
sdk/auth/manager.go - Provider authentication
internal/auth - Account watcher
internal/watcher/clients.go - Configuration
internal/config
Management and extensions
- Management API
internal/api/handlers/management/handler.go - Plugin host
internal/pluginhost - Plugin store
internal/pluginstore - Home service
internal/home/client.go
Other components
- API client
- AI providers
Connections 17
- API client → HTTP server: sends requests
README.md - HTTP server → API routes: registers routes
internal/api/server.go - API routes → Protocol handlers: routes requests
internal/api/server_routes.go - Protocol handlers → Provider executors: dispatches models
- Provider executors → AI providers: calls providers
- Protocol handlers → Translation pipeline: translates requests
- Translation pipeline → Protocol translation: applies mappings
sdk/translator/pipeline.go - Translation pipeline → Model registry: uses translations
sdk/translator/pipeline.go - Provider executors → Model registry: uses model catalog
- Authentication manager → Provider authentication: registers authenticators
sdk/auth/manager.go - HTTP server → Authentication manager: configures authentication
- Account watcher → Authentication manager: dispatches auth updates
- HTTP server → Management API: registers management API
internal/api/server.go - HTTP server → Plugin host: configures plugin host
internal/api/server.go - Management API → Plugin store: manages plugins
internal/api/handlers/management/handler.go - HTTP server → Configuration: configures server
internal/api/server.go - HTTP server → Home service: integrates home service