How anythinglinux/localai works
LocalAI is a self-hosted AI server and web interface. The main workflow is a user request through the UI or compatible API, into the application, then to a model backend for inference and a response. Around that path, the README describes chats and agents using tools, MCP, files and collections; add-ons extend the assistant, while the model gallery and backend system manage model availability. The graph combines README-documented capabilities with sampled application and module references; many internal routes and service calls were not shown, so those links are omitted.
Main entry points: application.go Application · messaging Chats and agents · react-ui Web interface · endpoints HTTP and API
Components 18
Server and inference
- Server entry
cmd/local-ai/main.go - Application
core/application/application.go - HTTP and API
core/http/endpoints
Models and backends
- Model runtime
core/backend - Inference backends
backend - Model gallery
core/gallery/storage.go
Chat and collaboration
- Web interface
core/http/react-ui - Chats and agents
core/services/messaging - Knowledge collections
core/services/collections - Team and sharing
core/services
Tools and add-ons
- MCP tools
core/http/endpoints/mcp - Add-ons
core/services/addons - Files and workspace
core/services/studio/workspace - Add-on host operations
core/services/addons/hostops/engine_client_folders.go
Operations
- Fine-tuning and quantization jobs
core/http/endpoints/localai/addon_engine_jobs.go - Distributed inference
core/services/nodes - Model storage report
core/gallery/storage.go
Other components
- User
Connections 20
- User → Web interface: uses
- User → HTTP and API: requests inference
- Web interface → HTTP and API: calls API
core/http/react-ui/src/utils/api.js - Server entry → Application: starts server
- HTTP and API → Application: serves requests
core/application/application.go - Application → Model runtime: initializes
core/application/application.go - Model runtime → Inference backends: dispatches inference
- Application → Model gallery: manages models
core/application/application.go - User → Chats and agents: starts conversations
- Chats and agents → MCP tools: uses tools
- Chats and agents → Knowledge collections: uses knowledge
- Chats and agents → Files and workspace: uses files
- User → Team and sharing: collaborates
- Application → Add-ons: starts add-ons
core/application/application.go - Add-ons → Add-on host operations: requests host operations
core/services/addons/hostops/engine_client_folders.go - Add-on host operations → Files and workspace: reads and writes
core/services/addons/hostops/engine_client_folders.go - Application → Fine-tuning and quantization jobs: exposes job operations
core/application/application.go - Application → Distributed inference: supports distribution
core/application/application.go - Web interface → Model storage report: requests storage report
core/http/react-ui/src/hooks/useModelStorage.js - Model storage report → Model gallery: indexes model files
core/gallery/storage.go