huggingface/chat-ui
Self-hosted SvelteKit chat for OpenAI-compatible model backends
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
Hugging Face Chat UI is the TypeScript/SvelteKit application behind HuggingChat. It handles the browser-facing conversation experience and server-side orchestration, while a separate OpenAI-compatible backend performs inference. The openai dependency matches that API boundary: the application discovers models at ${OPENAI_BASE_URL}/models and streams responses from the selected model. MongoDB is the application’s persistence layer for chat history, users, settings, files, and statistics.
MCP provides a separate extension path for tools, backed by @modelcontextprotocol packages. Chat UI exposes tools to the model through OpenAI-style function calling, calls the relevant MCP server, and feeds the result back to the model. The optional Omni router is local server-side logic rather than another inference service: it selects a route based on request signals and sends the resulting model request through the configured API base URL.
Key Capabilities & Differentiators
The backend can be a hosted endpoint such as the Hugging Face Inference Providers router, OpenRouter, or Poe, or a separately operated service such as llama.cpp server or Ollama’s OpenAI-compatible endpoint. MODELS can override discovered metadata in JSON5 but no longer defines legacy provider integrations or discovers GGUF files. Users can override tool-calling and image-input capability flags per model; those flags do not add missing backend features. v0.10.0 adds per-model reasoning controls, effort settings on capable models, and a bounded viewport for streamed reasoning.
Omni can direct image requests to a multimodal model and requests with MCP enabled to a tool-capable model. Its policy file defines primary and optional fallback models by route; failures can trigger those fallbacks and then a configured global fallback. The UI can display the route and model used. Separately, experimental ML Intern runs machine-learning tasks through Hugging Face Jobs and sandboxes with a per-conversation compute budget.
Trade-offs & Limitations
Compared with ChatGPT, Chat UI gives operators control over the chat interface, branding, application database, and choice of compatible inference endpoint. In exchange, they must operate the app and database and separately manage local inference capacity or hosted API usage. A shared OpenAI-compatible interface reduces integration work, but compatibility is not all-or-nothing: test model discovery, streaming, image input, and tools against the actual endpoint. Omni can select among models exposed behind one API base URL; it does not independently connect to multiple provider endpoints.
Self-hosting the app is not the same as keeping inference and tools on premises. Prompts or files can reach the configured model provider, tool arguments can reach MCP servers, and optional Hugging Face token forwarding introduces an additional credential boundary. Decide which MCP servers users may add and whether to enable token forwarding before a shared rollout. Apache-2.0 covers the application code, not third-party model licenses or service terms.
Hardware & Deployment Guide
For local development, install the Node.js dependencies with npm install, configure OPENAI_BASE_URL and OPENAI_API_KEY in .env.local, and run npm run dev (port 5173 by default). With no MONGODB_URL, embedded MongoDB persists to ./db. The ghcr.io/huggingface/chat-ui-db image bundles MongoDB, listens on port 3000, and uses a volume mounted at /data. The root docker-compose.yml is a development-only MongoDB 8 replica-set service, not a full-stack deployment; the external database guidance names MongoDB 6/7, so validate the database version against the application release you pin.
For a source build, use npm run build and select a SvelteKit adapter if the target runtime requires one; npm run preview is for checking the build. Node.js and MongoDB need capacity for concurrent streams and stored data, while any GPU requirement belongs to the chosen inference backend. v0.9.6 brought API and data-loading refactors, and v0.10.0 expanded the reasoning UI. Before upgrading, verify that older provider-specific configurations have been migrated to the OpenAI-compatible model discovery path.
${OPENAI_BASE_URL}/models and supports JSON5 metadata overrides through MODELS../db.Teams that already have, or plan to operate, an OpenAI-compatible endpoint and want a branded chat workspace with control over application data, optional model routing, and MCP tools.
You want a fully managed assistant, a single package that also runs the models, or direct integrations with providers that do not expose the compatible API.
Quick Start & Installation
git clone https://github.com/huggingface/chat-ui cd chat-ui npm install npm run dev -- --open
Comparison vs. Top Chat UI & AI Apps Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| chat-ui ★ | 11.1k | +16 | TypeScript | Apache-2.0 | Self-hosted SvelteKit chat for OpenAI-compatible model backends |
| LibreChat | 47.7k | +222 | TypeScript | MIT | A self-hosted AI chat workspace for multiple model providers and MCP tools |
| jan | 46.3k | +226 | Rust | — | Tauri desktop chat with local LLM inference and an OpenAI-compatible API |
| NextChat | 89k | +40 | TypeScript | MIT | Self-host a Next.js chat client for cloud and private model APIs |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/huggingface/chat-ui.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about chat-ui
How do I connect an existing inference server?
OPENAI_BASE_URL to the backend’s OpenAI-compatible API root and supply OPENAI_API_KEY as required by that backend. Check that /models lists the intended models, then test streaming chat and any capabilities you plan to expose, such as image input or function calling. MODELS accepts JSON5 metadata overrides for discovered models; it does not restore legacy provider-specific configuration.Does Chat UI need a GPU or dedicated VRAM?
Can we deploy a branded version commercially, and what does self-hosting cover?
When is Chat UI a better fit than ChatGPT?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy