How fruitbars/simple-one-api works
simple-one-api is a multi-provider LLM gateway with OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages interfaces, plus a web chat/configuration console and Wails desktop app. The main user path is client or web chat → gateway protocol handling → provider-specific upstream → streamed/result response. Administrators initialize or edit configuration, test providers, and inspect capacity, logs, and usage statistics. README statements establish several backend capabilities; sampled frontend excerpts show chat and admin API calls. Backend routing details and most provider implementations were not sampled, so those links are documented at subsystem level.
Main entry points: apis Admin APIs · App.tsx Web application · router.go HTTP gateway server · handler Provider handlers
Components 22
Gateway
- Client protocols
pkg/handler - Models and embeddings
pkg/embedding/embeddings_handler.go - Provider handlers
pkg/handler - Key scheduling and limits
pkg/mylimiter/limiter.go - HTTP gateway server
pkg/appserver/router.go
Provider integrations
- LLM providers
pkg/adapter - Provider protocols
pkg/llm
Configuration and operations
- Admin APIs
pkg/apis - Runtime configuration
pkg/config/runtime.go - SQLite configuration
pkg/configstore/store.go - Usage statistics
pkg/statistics - Logs and capacity
pkg/apis/admin_capacity_handler.go
Web experience
- Web application
web/src/App.tsx - Chat API client
web/src/api/client.ts - Local conversations
web/src/conversationStore.ts - Markdown rendering
web/src/MarkdownMessage.tsx - Configuration console
web/src/AdminWorkspace.tsx - Setup wizard
web/src/SetupWizard.tsx - Statistics panel
web/src/StatisticsPanel.tsx
Desktop runtime
- Wails desktop app
cmd/desktop/main.go
Other components
- API client
- Chat user
Connections 23
- API client → HTTP gateway server: sends requests
README.md - HTTP gateway server → Client protocols: routes protocols
- HTTP gateway server → Models and embeddings: serves models
README.md - Client protocols → Provider handlers: dispatches requests
- Provider handlers → Key scheduling and limits: schedules keys
README.md - Provider handlers → LLM providers: calls provider
README.md - LLM providers → Provider protocols: uses protocols
- Admin APIs → SQLite configuration: persists configuration
README.md - Admin APIs → Runtime configuration: publishes configuration
README.md - Admin APIs → Usage statistics: queries usage
README.md - Admin APIs → Logs and capacity: reports status
README.md - Chat user → Web application: uses chat
README.md - Web application → Chat API client: requests models and chat
web/src/App.tsx - Chat API client → HTTP gateway server: calls gateway
web/src/api/client.ts - Web application → Local conversations: loads and saves
web/src/App.tsx - Web application → Markdown rendering: renders messages
web/src/App.tsx - Web application → Configuration console: opens console
web/src/App.tsx - Web application → Setup wizard: opens setup
web/src/App.tsx - Configuration console → Admin APIs: calls admin endpoints
web/src/AdminWorkspace.tsx - Setup wizard → Admin APIs: tests and publishes
web/src/SetupWizard.tsx - Configuration console → Statistics panel: shows statistics
web/src/AdminWorkspace.tsx - Statistics panel → Admin APIs: requests statistics
- Wails desktop app → HTTP gateway server: starts gateway
README.md