How echoping07/buddy-2api-go works
Buddy 2API Go is a single-account CodeBuddy/WorkBuddy-to-OpenAI-compatible gateway with a built-in web admin. The main workflow is an OpenAI client authenticating with an API key, sending chat or model requests through the proxy to the configured upstream, and receiving compatible results; request metadata is logged for admin views. Administrators manage OAuth credentials, keys, resources, settings, and scheduled check-in/growth tasks through the web panel. The graph combines sampled call sites with README-documented capabilities; some subsystem links are therefore documented rather than verified from implementation excerpts.
Main entry points: main.go HTTP Application · admin.go Admin API · client.go Upstream Client · proxy.go OpenAI Endpoints
Components 18
OpenAI Gateway
- HTTP Application
main.go - OpenAI Endpoints
internal/proxy/proxy.go - API Key Auth
internal/apikey/apikey.go
Admin Panel
- Web Admin UI
internal/web/web.go - Admin API
internal/admin/admin.go - Growth Controls
internal/admin/growth.go - Admin Sessions
internal/admin/session.go
Account and Upstream
- OAuth Credentials
internal/auth/token.go - Upstream Client
internal/upstream/client.go - Model Catalog
internal/upstream/models.go - Client Fingerprint
internal/upstream/fingerprint.go - Growth Operations
internal/upstream/growth.go
Scheduled Tasks
- Task Scheduler
internal/scheduler/scheduler.go - Growth Chain
internal/scheduler/growth.go
Configuration and State
- Runtime Settings
internal/config/config.go - SQLite State
internal/store/store.go
Other components
- OpenAI Client
- CodeBuddy Service
Connections 31
- OpenAI Client → HTTP Application: sends requests
README.md - HTTP Application → OpenAI Endpoints: routes API
main.go - HTTP Application → Admin API: mounts routes
main.go - HTTP Application → Web Admin UI: mounts pages
main.go - HTTP Application → Runtime Settings: initializes
main.go - HTTP Application → SQLite State: initializes
main.go - HTTP Application → Upstream Client: initializes
main.go - HTTP Application → API Key Auth: initializes
main.go - HTTP Application → Task Scheduler: initializes
main.go - OpenAI Endpoints → API Key Auth: uses authenticated key
internal/proxy/proxy.go - OpenAI Endpoints → Upstream Client: forwards chat
README.md - OpenAI Endpoints → Model Catalog: serves models
README.md - OpenAI Endpoints → SQLite State: writes request logs
internal/proxy/proxy.go - API Key Auth → SQLite State: reads and updates keys
internal/apikey/apikey.go - Admin API → Admin Sessions: authenticates sessions
internal/admin/admin.go - Admin API → OAuth Credentials: manages credentials
README.md - Admin API → Upstream Client: fetches account data
internal/admin/admin.go - Admin API → Model Catalog: refreshes catalog
README.md - Admin API → API Key Auth: manages keys
internal/admin/admin.go - Admin API → SQLite State: reads admin data
internal/admin/admin.go - Growth Controls → Growth Chain: triggers tasks
README.md - Admin API → Growth Controls: routes growth controls
README.md - Task Scheduler → Growth Chain: runs scheduled chain
internal/scheduler/growth.go - Growth Chain → Growth Operations: executes growth steps
internal/scheduler/growth.go - Growth Chain → SQLite State: persists daily state
internal/scheduler/growth.go - Task Scheduler → Runtime Settings: reads task settings
- Upstream Client → OAuth Credentials: refreshes tokens
internal/upstream/client.go - Upstream Client → CodeBuddy Service: calls upstream API
README.md - Growth Operations → CodeBuddy Service: reports activity
README.md - Model Catalog → CodeBuddy Service: loads model config
README.md - Client Fingerprint → Upstream Client: sets request headers