How quorinex/freebuff2api works
Freebuff2API is a proxy that accepts OpenAI-compatible requests and translates them to Freebuff’s backend API. Clients can list models, request chat completions, or use the documented Claude-compatible endpoints; chat requests resolve a model to an agent, acquire a managed run, call upstream, and return a compatible response. Token counting is another API capability. Run management handles token pools, session readiness, rotation, and run cleanup. The README documents API-key authentication and outbound proxy support. Some handler and conversion wiring is omitted because excerpts are partial; uncertain links are left out.
Main entry points: server.go HTTP API · upstream.go Upstream client · main.go Process entry · run_manager.go Run manager
Components 14
API server
- Process entry
main.go - Configuration
config.go - HTTP API
server.go
Compatibility
- Model registry
models.go - Claude translation
anthropic.go - Token counting
token_count.go
Run orchestration
- Run manager
run_manager.go - Free-session handling
free_session.go
Backend access
- Upstream client
upstream.go
Other components
- OpenAI clients
- Claude clients
- Freebuff backend
- Agent model source
- HTTP proxy
Connections 16
- Process entry → Configuration: loads settings
- Process entry → HTTP API: starts server
- Process entry → Model registry: starts registry
- OpenAI clients → HTTP API: sends API requests
- Claude clients → HTTP API: sends API requests
- HTTP API → Model registry: resolves models
- HTTP API → Claude translation: translates Claude requests
- HTTP API → Token counting: counts tokens
- HTTP API → Run manager: acquires run
- HTTP API → Upstream client: sends chat request
- Model registry → Agent model source: fetches agent mapping
- Run manager → Free-session handling: manages sessions
- Run manager → Upstream client: starts and finishes runs
- Free-session handling → Upstream client: calls session APIs
- Upstream client → Freebuff backend: sends backend requests
- Upstream client → HTTP proxy: routes outbound traffic