SuperAPIAI Directory

chat-ui

github.com · AI assistants

chat-ui is Hugging Face's open-source chat interface codebase, used to power HuggingChat. It is built on SvelteKit and only supports connecting to OpenAI-compatible APIs via OPENAI_BASE_URL and the /models endpoint, and can be used with services such as Hugging Face inference routing, llama.cpp, Ollama, and OpenRouter. Chat history, users, settings, files, and statistics are stored in MongoDB, falling back to embedded MongoDB when not configured. The project provides an optional Docker image, model metadata overrides, server-side smart routing (Omni alias), MCP tool calling, and an experimental ML Intern mode.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

chat-ui is a chat interface for large language models, built with SvelteKit, and is the open-source codebase of the HuggingChat application.

Purpose: to provide a self-hostable chat frontend for LLMs and support connecting to any OpenAI-compatible API.

Main capabilities:

  • Communicates with OpenAI-compatible APIs only via OPENAI_BASE_URL and the /models endpoint, supporting services such as llama.cpp server, Ollama, and OpenRouter.
  • Chat history, users, settings, files, and statistics are stored in MongoDB 6/7; when MONGODB_URL is not set, embedded MongoDB is used and persisted to ./db.
  • Provides an optional Docker image chat-ui-db with MongoDB bundled in the container.
  • App name, assets, data-sharing toggle, and other appearance and behavior can be customized via environment variables.
  • Models are discovered from ${OPENAI_BASE_URL}/models, and metadata can be overridden via the MODELS environment variable (JSON5).
  • Optional server-side smart routing: the UI exposes a virtual model alias "Omni", which locally selects a route/model based on request signals (image input, MCP tools enabled, etc.), supporting route policy JSON configuration, fallback models, and multimodal and tool fast paths.
  • Optional MCP tool calling: supports preconfigured trusted MCP servers, user-added servers, health checks, and returns tool results to the model via OpenAI function calling; supports per-model overrides of tool calling and multimodal input settings.
  • Experimental ML Intern mode: plans and runs machine learning work on the Hugging Face Hub, including reproducing papers, fine-tuning and evaluating models, building datasets, deploying demos as Spaces, and running scripts with Hugging Face Jobs and sandboxes within a user-set compute budget.

Usage:

  1. Create .env.local and set variables such as OPENAI_API_KEY.
  2. Install dependencies and start the development server, which by default listens on http://localhost:5173;生产构建使用 npm run build / npm run preview.
  3. Configure MongoDB (Atlas or a local container) as needed and set MONGODB_URL.
  4. Optionally configure variables such as LLM_ROUTER_ROUTES_PATH to enable smart routing, or configure MCP servers to enable tool calling.

Use cases: developers, teams, or cloud deployment environments that need a self-hosted LLM chat interface; scenarios that want unified access to multiple OpenAI-compatible backends; chat applications that need tool calling or multimodal input.

Limitations: only OpenAI-compatible APIs are supported; legacy provider-specific integrations, GGUF discovery, embeddings, web search assistance, etc. have been removed; smart routing uses local heuristics and does not call an independent routing service or model selector; ML Intern is an experimental feature; some configurations require creating JSON files yourself, and the repository does not include example files.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools