How steve3184/new-api works
New API is an LLM gateway and AI asset-management platform: clients send model or media requests through its API, which applies routing and access controls before relay handling and upstream-provider communication. The product also documents usage accounting, billing, dashboards, and permission management; task plugins and scheduled system work are distinct supporting capabilities. The graph combines documented capabilities with relationships visible in the sampled startup, router, and relay references. Several feature implementations were not sampled, so their internal call paths are intentionally omitted.
Main entry points: main.go Application startup · api-router.go HTTP API routes · embedding_handler.go Embedding handler · controller API controllers
Components 18
API entry and access
- HTTP API routes
router/api-router.go - Access controls
middleware/access_token_routes.go - API controllers
controller
Inference gateway
- Inference relay
relay - Embedding handler
relay/embedding_handler.go - Model providers
relay/channel - File handling
service/file_service.go - Plugin runtime
pkg/jsplugin/engine.go - Task plugins
plugins/tasks
Accounts and operations
- Usage and billing
service - Accounts and permissions
model - Payments
controller - Dashboard and metrics
model/usedata.go - Scheduled tasks
controller/system_task_handlers.go
Runtime foundation
- Application startup
main.go - Persistent models
model/main.go - Web console
web/src/main.tsx
Other components
- API clients
Connections 14
- API clients → HTTP API routes: sends requests
- HTTP API routes → API controllers: routes to
router/api-router.go - HTTP API routes → Access controls: uses middleware
router/api-router.go - Application startup → HTTP API routes: starts routes
- Application startup → Persistent models: initializes database
main.go - Application startup → Scheduled tasks: registers tasks
main.go - Application startup → Plugin runtime: loads runtime
main.go - Application startup → Inference relay: loads relay
main.go - Embedding handler → Model providers: dispatches upstream
- Embedding handler → Usage and billing: records usage
relay/embedding_handler.go - API controllers → Inference relay: invokes inference
- Task plugins → Plugin runtime: uses runtime
- API clients → Web console: uses console
- Payments → Usage and billing: funds accounts
controller/system_task_handlers.go