中文

Chat UI

Chat UI is a chat interface for LLMs and a SvelteKit app.

Verified

Core facts

Read by a script from the official API, not rewritten by a model.

License
Apache-2.0
Languages
TypeScript
Maintainer
huggingface
Verified

What it is

Chat UI is a chat interface for LLMs. Chat UI is a SvelteKit app. Chat UI powers the HuggingChat app. Chat UI speaks to OpenAI-compatible APIs only.

Main features

  1. Chat UI can perform server-side smart routing using a local heuristic, and no separate router service or selection model is called.

  2. When the Omni alias is selected, image inputs go to a multimodal route, MCP-tool-enabled requests go to an agentic route, and everything else goes to a default route.

  3. Chat UI can call tools exposed by Model Context Protocol (MCP) servers and feed results back to the model using OpenAI function calling.

  4. ML Intern is an experimental mode that plans and runs machine-learning work on the Hugging Face Hub.

  5. ML Intern reads papers, models and datasets, writes scripts, and runs them as Hugging Face Jobs and sandboxes, within a compute budget set for each conversation.

  6. In the model section of the settings, “Tool calling (functions)” and “Multimodal input” can be toggled per model.

Getting started

  1. The dev server listens on localhost port 5173 by default.

  2. The chat-ui-db image bundles MongoDB inside the container.

  3. Environment variables accepted in the local env file can be provided to the chat-ui-db image as -e flags.

  4. A production version of the app can be created.

  5. The production build can be previewed.

  6. To deploy the app, an adapter for the target environment may need to be installed.

From the README · env
OPENAI_BASE_URL=https://router.huggingface.co/v1
OPENAI_API_KEY=hf_************************
From the README · bash
git clone https://github.com/huggingface/chat-ui
cd chat-ui
npm install
npm run dev -- --open
From the README · bash
npm install
npm run dev
From the README · bash
docker run \
  -p 3000:3000 \
  -e OPENAI_BASE_URL=https://router.huggingface.co/v1 \
  -e OPENAI_API_KEY=hf_*** \
  -v chat-ui-data:/data \
  ghcr.io/huggingface/chat-ui-db:latest
From the README · bash
npm run build

Who it is for

Chat history, users, settings, files, and stats all live in MongoDB. Chat UI can be pointed at a MongoDB 6/7 deployment. When the MongoDB URL variable is not set, Chat UI falls back to an embedded MongoDB.

Models are discovered from the models endpoint of the base URL, and their metadata can optionally be overridden via the MODELS env var (JSON5). Authorization uses the OpenAI API key variable, which is preferred. The app name variable sets the name used as a title throughout the app.

The data sharing variable can be set to 1 to add a toggle in the user settings that lets users opt in to data sharing with the models creator. The app assets variable is used to find logos and favicons, and its current options are chatui and huggingchat. A routes policy JSON is provided via the routes path variable.

The router recognizes the route names default, multimodal, and agentic. If the tools option is true and the user has at least one MCP server enabled, the router bypasses the policy file and uses the tools model. If the selected route's models all fail, calls fall back to the model set by the fallback model variable.

The old version is still available on the legacy branch.

Sources

This page is written from the official sources below. Open them to check the original text.

Verified ·

This page is written by AI from the official sources above and checked automatically. This site has not tested it. Found a mistake? Tell us.