█

AI/TLDR

Buy me a coffee
Buy me a coffee

Hugging Face Chat UI

Self-hosted chat interface for open LLMs, the SvelteKit app behind HuggingChat

Chat UIsOpen source
Language
TypeScript
IN SHORT

What is Hugging Face Chat UI?

Hugging Face Chat UI is Self-hosted chat interface for open LLMs, the SvelteKit app behind HuggingChat. It gives you a web chat interface in front of large language models, and you run it on your own machine or server. It sits in the Chat UIs category of the App UIs & Builders tools and is open-source, written in TypeScript.

Overview

Chat UI is the open-source SvelteKit application that powers HuggingChat at hf.co/chat. It gives you a web chat interface in front of large language models, and you run it on your own machine or server.

It talks to any OpenAI-compatible API through the OPENAI_BASE_URL and /models endpoints. That means it works with the Hugging Face Inference Providers router, a local llama.cpp server, Ollama, OpenRouter, and similar services without provider-specific code. Chat history, users, settings, and files are stored in MongoDB.

It fits the Chat UIs category as a full front end you host yourself, rather than a hosted product. It suits developers and teams who want a private chat app over open models, with control over branding, the model list, and where data is stored.

What it does

  • Works with any OpenAI-compatible API: Hugging Face router, llama.cpp, Ollama, OpenRouter, Poe, and others
  • Discovers available models from the ${OPENAI_BASE_URL}/models endpoint, with optional metadata overrides via the MODELS env var
  • Stores chat history, users, settings, files, and stats in MongoDB, with an embedded fallback that persists to ./db for local dev
  • Theming through environment variables (app name, assets, description, data-sharing toggle)
  • Optional server-side LLM routing via an 'Omni' alias that sends image inputs, MCP-tool requests, and other messages to configured routes
  • Ships an optional chat-ui-db Docker image that bundles MongoDB inside the container

Getting started

Chat UI speaks to OpenAI-compatible APIs only. The fastest start uses the Hugging Face Inference Providers router with your personal access token.

Create .env.local

Point Chat UI at an OpenAI-compatible endpoint and supply a matching key. This example uses the Hugging Face router.

texttext
OPENAI_BASE_URL=https://router.huggingface.co/v1
OPENAI_API_KEY=hf_************************

Install and launch the dev server

Clone the repo, install dependencies, and start the dev server. It opens in your browser so you can start chatting.

bashbash
git clone https://github.com/huggingface/chat-ui
cd chat-ui
npm install
npm run dev -- --open

Database (optional for local dev)

When MONGODB_URL is not set, Chat UI falls back to an embedded MongoDB that persists to ./db. To run MongoDB in a container, start one and point Chat UI at it.

bashbash
docker run -d -p 27017:27017 --name mongo-chatui mongo:latest

Build for production

Use the build and preview scripts to run a production build instead of the dev server.

bashbash
npm run build
npm run preview

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Self-host a private chat app over open models from the Hugging Face Hub for a team or organization
  • Put a browser chat interface in front of a local llama.cpp server or Ollama instance during development
  • Run a branded internal assistant where chat history and user data stay in your own MongoDB
  • Deploy a containerized chat app quickly using the chat-ui-db Docker image that bundles MongoDB

How Hugging Face Chat UI compares

Hugging Face Chat UI alongside other open-source chat uis tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
Open WebUI★ 160kA self-hosted web interface for chatting with local and API-based LLMs (Ollama, OpenAI-compatible) that adds RAG, web search, image generation, and multi-user access.
Lobe Chat★ 86.3kAn open-source chat UI with a plugin and agent marketplace, multi-model support, voice, vision, and one-click self-hosting.
AnythingLLM★ 68.8kA desktop and self-hosted chat app focused on document Q&A and agents, letting you build private RAG workspaces over your own files and data sources.
Cherry Studio★ 54kA cross-platform desktop chat client that connects to many cloud and local model providers and ships with hundreds of preset assistants and MCP support.
LibreChat★ 47.7kA self-hostable ChatGPT-style chat app that unifies many AI providers and adds agents, MCP support, artifacts, a code interpreter, and multi-user authentication.
Chatbox★ 42.6kA desktop and web chat client for ChatGPT, Claude, Gemini, Ollama, and other models, with local message storage and multi-provider switching.
Buzz★ 37.9kA self-hostable team workspace built on a Nostr relay where AI agents join channels as members with their own keys, and messages, patches, workflow runs and approvals are all signed events in one log.
Hugging Face Chat UI★ 11.1kSelf-hosted chat interface for open LLMs, the SvelteKit app behind HuggingChat