chat-ui
CLAUDE.md11k starsChanged 4 months agoApache-2.0View on GitHub
Chat UI is a SvelteKit application that provides a chat interface for LLMs. It powers HuggingChat (hf.co/chat). The app speaks exclusively to OpenAI-compatible APIs via OPENAI_BASE_URL. Tests are split into three workspaces (configured in vite.config.ts): MCP servers are configured via MCP_SERVERS env var. When enabled, tools are exposed as OpenAI function calls. The router can auto-select tools-capable models when LLM_ROUTER_ENABLE_TOOLS=true. Smart routing via Arch-Router model. Configured with: Copy .env to .env.local and configure: See .env for full list of variables…
- Reads credentials
Trending
More talk lately.about the whole repository
Who's talking about huggingface/chat-ui
- A Hacker News story“Chat-UI, the codebase of HuggingChat, is open sourced”Hacker News · May 11, 2023 · 141 points
- infiniflow/ragflow“[Feature Request]: SAML/OAUTH/OpenID connect integration for Authentication”GitHub · Nov 19, 2024 · 7 reactions
- h2oai/h2ogpt“Improve UI”GitHub · Jun 13, 2023 · 4 reactions
- @mongodb.activitypub.awakari.com.ap.brid.gy“huggingface/chat-ui Open source codebase powering the HuggingChat app Chat UI A chat interface for LLMs. It …”Bluesky · Oct 20, 2025 · 2 likes
- @github-trending.bsky.social“📦 huggingface / chat-ui ⭐ 9,290 (+25) 🗒 TypeScript Open source codebase powering the HuggingChat app”Bluesky · Oct 19, 2025 · 2 likes
The biggest 5 of 38 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 38
Talked about on GitHub, Bluesky and Hacker News (38 times).
On GitHub · 27
- Nov 19, 2024[Feature Request]: SAML/OAUTH/OpenID connect integration for Authentication — infiniflow/ragflow7 reactions · 1 comment
- Jun 13, 2023Improve UI — h2oai/h2ogpt4 reactions
- Jan 25, 2024HF chat-ui Prompt Template (DeepSeek Coder 6.7B) — deepseek-ai/DeepSeek-Coder2 reactions · 1 comment
- Jan 11, 2024Please add descriptions and features for each — JShollaj/awesome-llm-web-ui2 reactions
- Jun 20, 2023Servermode for working as endpoint for VSCode Addon "HF Code Autocomplete" — bigcode-project/starcoder.cpp2 reactions · 2 comments
22 more on GitHub
- Jan 24, 2024Bug in Mistral prompt template — zylon-ai/private-gpt1 reaction · 2 comments
- Dec 1, 2023[FEATURE_REQUEST] Web search craft query option — SillyTavern/SillyTavern1 reaction · 18 comments
- Nov 25, 2023Add Large language models frontends ? — sindresorhus/awesome1 reaction · 2 comments
- Oct 6, 2026Messages get permanently stuck / fail to send — forpublicai/chat.publicai.co0 reactions · 4 comments
- Sep 28, 2026agent-skills.github.huggingface.chat-ui: init at 0.10.0 — sudosubin/agents.nix0 reactions
- Sep 10, 2026Add resource group billing to Jobs and Sandboxes — huggingface/hf-mcp-server0 reactions · 1 comment
- Jun 6, 2026[Add] HuggingChat (huggingface/chat-ui) — PyTorchKR/landscape0 reactions
- Oct 18, 2025HuggingChat Omni Support 🤗 — vllm-project/semantic-router0 reactions · 6 comments
- Sep 14, 2025Assess Alternatives to FastOpp — Oppkey/fastopp0 reactions · 2 comments
- Jul 10, 2025💡 [REQUEST] - Add Chat UI Channel Extension with Thread Support and Authentication — hexabot-ai/Hexabot0 reactions · 1 comment
- Feb 5, 2025Fix text composition — huggingface/transformers.js-examples0 reactions
- Jan 26, 2025[Feature]: Openrouter reasoning field and include_reasoning key — CherryHQ/cherry-studio0 reactions · 5 comments
- Jan 14, 2025Compose: Fix .env.local definition — morganhein/sponge0 reactions · 1 comment
- Jan 2, 2025Create docker-compose.yml project for [HuggingChat] — Websoft9/docker-library0 reactions
- Nov 19, 2024[Question]: How to Embed Agent or Chat on Website — infiniflow/ragflow0 reactions · 7 comments
- Nov 4, 2024Proposal to add production-level UI tools — EthicalML/awesome-production-machine-learning0 reactions · 2 comments
- Sep 4, 2024Fixes 4145: Add support for huggingface models — gmarcostam/neo4j-apoc-procedures0 reactions
- Jul 1, 2024Biobricks chat MVP — biobricks-ai/biobricks-agent0 reactions · 4 comments
- Apr 3, 2024voir pour intégrer d'autres interface chat — scenaristeur/igora0 reactions
- Nov 12, 2023Build GPT-like chat interface to Pyserini/Anserini — castorini/ura-projects0 reactions · 5 comments
- Oct 5, 2023Chat-UI with RAG websearch from huggingface. — irthomasthomas/undecidability0 reactions
- May 23, 2023HF chat UI — hltcoe/sandle0 reactions
On Bluesky · 9
- Oct 20, 2025huggingface/chat-ui Open source codebase powering the HuggingChat app Chat UI A chat interface for LLMs. It is a SvelteKit app and it… — @mongodb.activitypub.awakari.com.ap.brid.gy2 likes and reposts
- Oct 19, 2025📦 huggingface / chat-ui ⭐ 9,290 (+25) 🗒 TypeScript Open source codebase powering the HuggingChat app — @github-trending.bsky.social2 likes and reposts
- Feb 6, 2024📦 huggingface / chat-ui ⭐ 5,005 (+34) 🗒 TypeScript Open source codebase powering the HuggingChat app — @github-trending.bsky.social2 likes and reposts
- Feb 5, 2024📦 huggingface / chat-ui ⭐ 4,977 (+37) 🗒 TypeScript Open source codebase powering the HuggingChat app — @github-trending-js.bsky.social2 likes and reposts
- Oct 20, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 huggingface / chat-ui ⭐ 9,510 (+224) 🗒 TypeScript Open source codebase powering the HuggingChat app — @github-trending-js.bsky.social1 likes and repost
4 more on Bluesky
- Sep 5, 2025https://github.com/huggingface/chat-ui — @tom-doerr.bsky.social1 likes and repost
- Apr 30, 2024🔥 Hot Repo! 🔥 (100+ new stars) 📦 huggingface / chat-ui ⭐ 6,208 (+129) 🗒 TypeScript Open source codebase powering the HuggingChat app — @github-trending-js.bsky.social1 likes and repost · 1 reply
- Sep 29, 2026Does the huggingface/chat-ui repository really support chatting without signing in? — @andysmith.ai0 likes and reposts · 1 reply
- Nov 24, 2023I'm using this locally right now with my hf token. I subscribed to Pro because $9/month to support open source models is a steal. Oh and… — @phytomech.com0 likes and reposts · 1 reply
On Hacker News · 2
- May 11, 2023Chat-UI, the codebase of HuggingChat, is open sourced141 points · 30 comments
- Sep 8, 2024A chat interface using open source models, e.g. OpenAssistant or Llama2 points
In this repositoryOne other file it gives its agents.
- sync-modelsSkill
The file
We split this CLAUDE.md into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 119
When building new features, consider:
- Very specific: line 122
Settings persistence: Add new fields to src/lib/types/Settings.ts, update API endpoint at src/routes/api/v2/user/settings/+server.ts
- Very specific: line 123
Rich dropdowns: Use bits-ui (Select, DropdownMenu) instead of native elements when you need icons/images in options
- Very specific: line 124
Scrollbars: Use scrollbar-custom class for styled scrollbars
- Very specific: line 126
Provider avatars: Use PROVIDERS_HUB_ORGS from @huggingface/inference for HF provider avatar URLs
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Overview
Chat UI is a SvelteKit application that provides a chat interface for LLMs. It powers HuggingChat (hf.co/chat). The app speaks exclusively to OpenAI-compatible APIs via OPENAI_BASE_URL.
Commands
npm run dev # Start dev server on localhost:5173
npm run build # Production build
npm run preview # Preview production build
npm run check # TypeScript validation (svelte-kit sync + svelte-check)
npm run lint # Check formatting (Prettier) and linting (ESLint)
npm run format # Auto-format with Prettier
npm run test # Run all tests (Vitest)Running a Single Test
npx vitest run path/to/file.spec.ts # Run specific test file
npx vitest run -t "test name" # Run test by name
npx vitest --watch path/to/file.spec.ts # Watch mode for single fileTest Environments
Tests are split into three workspaces (configured in vite.config.ts):
- Client tests (
*.svelte.test.ts): Browser environment with Playwright - SSR tests (
*.ssr.test.ts): Node environment for server-side rendering - Server tests (
*.test.ts,*.spec.ts): Node environment for utilities
Architecture
Stack
- SvelteKit 2 with Svelte 5 (uses runes:
$state,$effect,$bindable) - MongoDB for persistence (auto-fallback to in-memory with MongoMemoryServer when
MONGODB_URLnot set) - TailwindCSS for styling
Key Directories
src/
├── lib/
│ ├── components/ # Svelte components (chat/, mcp/, voice/, icons/)
│ ├── server/
│ │ ├── api/utils/ # Shared API helpers (auth, superjson, model/conversation resolvers)
│ │ ├── textGeneration/ # LLM streaming pipeline
│ │ ├── mcp/ # Model Context Protocol integration
│ │ ├── router/ # Smart model routing (Omni)
│ │ ├── database.ts # MongoDB collections
│ │ ├── models.ts # Model registry from OPENAI_BASE_URL/models
│ │ └── auth.ts # OpenID Connect authentication
│ ├── types/ # TypeScript interfaces (Conversation, Message, User, Model, etc.)
│ ├── stores/ # Svelte stores for reactive state
│ └── utils/ # Helpers (tree/, marked.ts, auth.ts, etc.)
├── routes/ # SvelteKit file-based routing
│ ├── conversation/[id]/ # Chat page + streaming endpoint
│ ├── settings/ # User settings pages
│ ├── api/ # Legacy v1 API endpoints (mcp, transcribe, fetch-url)
│ ├── api/v2/ # REST API endpoints (+server.ts)
│ └── r/[id]/ # Shared conversation viewText Generation Flow
- User sends message via
POST /conversation/[id] - Server validates user, fetches conversation history
- Builds message tree structure (see
src/lib/utils/tree/) - Calls LLM endpoint via OpenAI client
- Streams response back, stores in MongoDB
Model Context Protocol (MCP)
MCP servers are configured via MCP_SERVERS env var. When enabled, tools are exposed as OpenAI function calls. The router can auto-select tools-capable models when LLM_ROUTER_ENABLE_TOOLS=true.
LLM Router (Omni)
Smart routing via Arch-Router model. Configured with:
LLM_ROUTER_ROUTES_PATH: JSON file defining routesLLM_ROUTER_ARCH_BASE_URL: Router endpoint- Shortcuts: multimodal routes bypass router if
LLM_ROUTER_ENABLE_MULTIMODAL=true
Database Collections
conversations- Chat sessions with nested messagesusers- User accounts (OIDC-backed)sessions- Session datasharedConversations- Public share linkssettings- User preferences
Environment Setup
Copy .env to .env.local and configure:
OPENAI_BASE_URL=https://router.huggingface.co/v1
OPENAI_API_KEY=hf_***
# MONGODB_URL is optional; omit for in-memory DB persisted to ./dbSee .env for full list of variables including router config, MCP servers, auth, and feature flags.
Code Conventions
- TypeScript strict mode enabled
- ESLint: no
any, no non-null assertions - Prettier: tabs, 100 char width, Tailwind class sorting
- Server vs client separation via SvelteKit conventions (
+page.server.tsvs+page.ts)
Feature Development Checklist
When building new features, consider:
- HuggingChat vs self-hosted: Wrap HuggingChat-specific features with
publicConfig.isHuggingChat - Settings persistence: Add new fields to
src/lib/types/Settings.ts, update API endpoint atsrc/routes/api/v2/user/settings/+server.ts - Rich dropdowns: Use
bits-ui(Select, DropdownMenu) instead of native elements when you need icons/images in options - Scrollbars: Use
scrollbar-customclass for styled scrollbars - Icons: Custom icons in
$lib/components/icons/, use Carbon (~icons/carbon/*) or Lucide (~icons/lucide/*) for standard icons - Provider avatars: Use
PROVIDERS_HUB_ORGSfrom@huggingface/inferencefor HF provider avatar URLs
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

