How yujunzhixue/qwen2api works
qwen2API is a self-hosted gateway that exposes Qwen Web capabilities through OpenAI-, Anthropic-, and Gemini-compatible APIs, alongside an administrative React WebUI. The primary flow is an API client sending a protocol request to the Go backend, which adapts it for the Qwen account pool and upstream; the UI separately supports account/key management, runtime settings, and chat, image, and video tests. The README documents the high-level gateway flow and capabilities; where backend implementation details were not sampled, the graph avoids asserting internal call order.
Main entry points: App.tsx Admin WebUI · api Compatible APIs · SettingsPage.tsx Runtime Settings · context_pipeline.go Context Pipeline
Components 23
API Gateway
- Compatible APIs
backend/api - Protocol Adapters
backend/adapter - Context Pipeline
backend/context_pipeline.go - Tool-call Handling
backend/toolcall
Qwen Runtime
- Account Pool
backend/core/account_pool - Qwen Client
backend/services/qwen_client.go - Qwen Web
- Upstream Execution
backend/upstream - Stream Runtime
backend/runtime
Admin Console
- Admin WebUI
frontend/src/App.tsx - Navigation Layout
frontend/src/layouts/AdminLayout.tsx - Account Management
frontend/src/pages/AccountsPage.tsx - API Keys
frontend/src/pages/TokensPage.tsx - Runtime Settings
frontend/src/pages/SettingsPage.tsx - Status Dashboard
frontend/src/pages/Dashboard.tsx - Chat Testing
frontend/src/pages/TestPage.tsx - Image Testing
frontend/src/pages/ImagePage.tsx - Video Testing
frontend/src/pages/VideoPage.tsx - Model Catalog
frontend/src/lib/models.ts - Admin Auth
frontend/src/lib/auth.ts
State and Operations
- JSON Data Stores
backend/core/database.go - Health Probes
backend/api/probes.go
Other components
- API Clients
Connections 27
- API Clients → Compatible APIs: send requests
README.md - Compatible APIs → Protocol Adapters: dispatches protocols
README.md - Protocol Adapters → Context Pipeline: passes context
README.md - Context Pipeline → Tool-call Handling: processes tool calls
README.md - Context Pipeline → Account Pool: uses pool
README.md - Account Pool → Qwen Web: selects account
README.md - Account Pool → JSON Data Stores: persists accounts
README.md - Qwen Client → Upstream Execution: uses upstream
- Upstream Execution → Qwen Web: sends requests
- Compatible APIs → Stream Runtime: streams responses
- Admin WebUI → Navigation Layout: routes through
frontend/src/App.tsx - Admin WebUI → Status Dashboard: routes to
frontend/src/App.tsx - Admin WebUI → Account Management: routes to
frontend/src/App.tsx - Admin WebUI → API Keys: routes to
frontend/src/App.tsx - Admin WebUI → Runtime Settings: routes to
frontend/src/App.tsx - Admin WebUI → Chat Testing: routes to
frontend/src/App.tsx - Admin WebUI → Image Testing: routes to
frontend/src/App.tsx - Admin WebUI → Video Testing: routes to
frontend/src/App.tsx - Account Management → Admin Auth: gets credentials
frontend/src/pages/AccountsPage.tsx - Account Management → Compatible APIs: fetches accounts
frontend/src/pages/AccountsPage.tsx - Runtime Settings → Admin Auth: gets credentials
frontend/src/pages/SettingsPage.tsx - Runtime Settings → Compatible APIs: fetches settings
frontend/src/pages/SettingsPage.tsx - Chat Testing → Compatible APIs: calls chat API
frontend/src/pages/TestPage.tsx - Image Testing → Model Catalog: loads models
frontend/src/pages/ImagePage.tsx - Video Testing → Model Catalog: loads models
frontend/src/pages/VideoPage.tsx - Runtime Settings → Model Catalog: loads models
frontend/src/pages/SettingsPage.tsx - API Clients → Health Probes: checks readiness
README.md