chat-ui

The open source codebase powering HuggingChat

What is chat-ui?

The open source codebase powering HuggingChat

Overview of chat-ui

What it is

Chat UI is an open-source chat interface for large language models (LLMs). It is built with SvelteKit and powers the HuggingChat application available at hf.co/chat. The codebase communicates exclusively with OpenAI-compatible APIs, meaning any service that speaks the OpenAI protocol (such as llama.cpp server, Ollama, or OpenRouter) can be used as a backend.

Key features

  • OpenAI-compatible API only: Chat UI connects to any endpoint that implements the OpenAI API specification, including the Hugging Face Inference Providers router.
  • MongoDB persistence: Chat history, users, settings, files, and stats are stored in MongoDB. An embedded MongoDB fallback is available for local development when no MONGODB_URL is set.
  • Theming: Environment variables allow customization of the app name, assets (logos/favicons), and description.
  • Model discovery: Models are automatically discovered from the configured OPENAI_BASE_URL endpoint's /models list.
  • Optional LLM router: A server-side heuristic can route requests to different models based on input type (text, image, tool-enabled). A virtual model alias "Omni" is configurable.
  • Optional MCP tools: Chat UI can call tools exposed by Model Context Protocol (MCP) servers and feed results back to the model using OpenAI function calling.

Use cases

  • Running a chat interface for any OpenAI-compatible LLM backend.
  • Powering a hosted chat application like HuggingChat.
  • Local development and testing of LLM interactions with a customizable UI.
  • Deploying a multi-model chat system with smart routing and tool integration.

Getting started

  1. Create .env.local with your OpenAI-compatible endpoint:
OPENAI_BASE_URL=https://router.huggingface.co/v1
OPENAI_API_KEY=hf_************************
  1. Clone and run the development server:
git clone https://github.com/huggingface/chat-ui
cd chat-ui
npm install
npm run dev -- --open

For production builds, use npm run build and npm run preview. A Docker image (chat-ui-db) is also available.

License and pricing

Licensed under Apache-2.0. The project is open source and free to use. No pricing information is provided beyond the open-source license.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/huggingfacechat-ui.svg)](https://yunodb.com/tools/huggingfacechat-ui?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/huggingfacechat-ui?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/huggingfacechat-ui.svg" alt="Featured on YunoDB" height="20"></a>