For privacy-conscious users and developers, HuggingChat stands out from proprietary AI chat platforms by providing transparent data boundaries, open-source auditability, and granular infrastructure control. Built on the open-source chat-ui engine, HuggingChat (hosted at huggingface.co/chat) does not sell conversational data or share user interactions with upstream model creators for model training by default.
Whether you are evaluating HuggingChat for daily confidential research or deploying a private interface for your team, configuring data sharing, retention windows, and Hugging Face API tokens ensures your prompts remain protected while unlocking restricted and gated open-weights models.
1. Data Sharing and Privacy Architecture
Understanding how HuggingChat treats conversational inputs requires distinguishing between the public web interface and self-hosted instances.
The Default Privacy Baseline
Hugging Face maintains a "privacy-by-design" stance for HuggingChat:
- No Upstream Model Training: Prompts and responses generated on HuggingChat are not shared with third-party model developers (such as Meta, Mistral AI, or Alibaba) to train future foundation models.
- Server-Side Storage: When logged into an account, conversations are stored in a secure MongoDB database to provide synchronized chat history across sessions.
- No Unsolicited Telemetry: Conversations are not harvested or commercialized for behavioral ad targeting.
Data Sharing Controls
In self-hosted deployments and specific experimental builds of chat-ui, administrators can expose an explicit data sharing opt-in toggle via the environment variable PUBLIC_APP_DATA_SHARING=1. When disabled (or set to 0), user conversations are restricted strictly to session delivery and database persistence, preventing any external data donation.
Web Search Privacy Considerations
HuggingChat features an optional Web Search toggle in the prompt bar. When active, HuggingChat extracts search queries from your prompt and forwards them to integrated web search engines (such as Serper or Exa) to fetch grounding context. If your prompt contains sensitive proprietary code, internal hostnames, or confidential business plans, disable Web Search before submitting to prevent sensitive query tokens from reaching external search indexes.
Public Shared Links
HuggingChat allows users to create public snapshots of conversations via the "Share" feature. Generating a share link creates a publicly accessible URL on Hugging Face's domain. Privacy-conscious teams should establish a strict policy never to generate share links for proprietary workflows. If a link is created unintentionally, deleting the underlying conversation removes the public snapshot.
2. Managing Conversation History Retention
HuggingChat gives users precise control over how long their conversational footprint exists, from stateless guest sessions to hard database deletions.
Guest Mode (Zero-Account Session Isolation)
You can use HuggingChat without signing into a Hugging Face account:
- Guest sessions store chat state transiently in browser session cookies (
hf-chat) rather than binding them to a persistent user profile. - Closing the browser tab or clearing local cookies permanently discards the session context.
- For users seeking maximum operational anonymity without deploying local hardware, Guest Mode prevents identity-to-prompt attribution on Hugging Face's server records.
Deleting Individual Conversations
When logged into a Hugging Face account, your chat history populates the left-hand navigation sidebar:
- Hover over the conversation title in the left panel.
- Click the three horizontal dots (
...) or the trash icon next to the title. - Confirm deletion.
HuggingChat executes a hard delete on the database record: the conversation document is permanently deleted from MongoDB rather than flagged with a soft-delete status.
Complete Account History Purge
To wipe all historical chat records associated with your account:
- Click the Settings gear icon in the lower-left corner of the interface.
- Navigate to the Data Controls or conversation management section.
- Select Delete all conversations and confirm the prompt.
This action immediately drops all conversation records, associated tool-call outputs, and assistant interactions linked to your Hugging Face user ID.
3. Configuring Hugging Face API Tokens and Gated Models
Connecting API tokens to HuggingChat allows developers to access private Hugging Face Hub repositories, unlock gated model weights, and automate advanced tool calling via the Model Context Protocol (MCP).
Accessing Gated Models in the Web Interface
Leading open-weights models (such as Meta's Llama 3 family) are distributed as "gated models" on the Hugging Face Hub, requiring users to accept license terms before accessing weights or inference endpoints:
- Log into your account at Hugging Face.
- Visit the official repository page of the gated model (e.g.,
meta-llama/Meta-Llama-3-70B-Instruct). - Fill out the acknowledgment form and accept the community license terms.
- Return to HuggingChat. Because HuggingChat shares your account session, the gated model will now appear as selectable in the model selector dropdown without requiring manual API token injection in the browser.
User Token Forwarding for MCP Servers
HuggingChat supports the Model Context Protocol (MCP), enabling models to execute external tools and query Hub datasets:
- Open Settings and select MCP Servers.
- Add your custom MCP server endpoint URL.
- When configuring MCP integration in enterprise environments, enable
MCP_FORWARD_HF_USER_TOKEN=true. This allows the application to forward the authenticated user's Hugging Face token securely to authorized MCP tools, allowing interactions with private corporate spaces and gated datasets without exposing global admin credentials.
Deploying a Self-Hosted Chat UI with HF_TOKEN
For complete control over data sovereignty and network isolation, developers can deploy a private instance of chat-ui using their own Hugging Face User Access Token:
Step 1: Create a Scoped Access Token
- Go to Hugging Face Settings > Access Tokens.
- Click Create new token.
- Select Read permissions (or configure a Fine-grained token with access limited to specific inference repositories). Never use write or administrative tokens for chat frontends.
- Copy the token starting with
hf_.
Step 2: Configure Environment Variables
In your local or containerized chat-ui project directory, configure .env.local:
# OpenAI-compatible router endpoint for Hugging Face Inference Providers
OPENAI_BASE_URL=https://router.huggingface.co/v1
# Primary auth token for model inference
OPENAI_API_KEY=hf_your_read_token_here
# When set to true with OpenID authentication, each logged-in user's
# personal HF token is passed for inference, isolating rate limits and permissions
USE_USER_TOKEN=true
# Dedicated private MongoDB connection for conversation retention control
MONGODB_URL=mongodb://localhost:27017
MONGODB_DB_NAME=chat-ui-private
# Explicitly disable public data donation
PUBLIC_APP_DATA_SHARING=0
Step 3: Run the Private Instance
Launch your container or Node service:
docker run -d -p 27017:27017 --name mongo-chatui mongo:latest
npm install
npm run dev
4. Privacy and Configuration Matrix
| Configuration Scenario | Privacy Level | Data Retention | Hugging Face Token Required | Best Use Case |
|---|---|---|---|---|
| Guest Web Session | High (Anonymous) | Session cookies only; dropped on browser close | No | Quick ad-hoc queries, zero account trace |
| Logged-in Web UI | Balanced | Persistent in MongoDB; manual per-chat or bulk purge | No (Inherited via HF account) | Daily workflow with history synchronization |
| Gated Model Access | Balanced | Persistent in MongoDB; subject to model license terms | Accepted on model repo page | Testing restricted models (e.g., Llama 3) |
Self-Hosted chat-ui | Maximum (Air-Gapped capable) | Self-managed database with custom TTL auto-purge | Scoped hf_ Read Token or local server endpoint | Enterprise IP protection, strict HIPAA/GDPR compliance |
5. Recommended Best Practices for Maximum Privacy
- Audit Gated Model Licensing: Accepting terms for gated models establishes a legal agreement with the model creator. Review license boundaries before running internal prompts.
- Enforce Read-Only Tokens: When setting
HF_TOKENorOPENAI_API_KEYfor self-hosted instances, grant only inference read rights to prevent token compromise from exposing account repositories. - Automate Database Expiration: For self-hosted deployments, configure MongoDB TTL indexes on the
conversationscollection to automatically purge chats after 14 or 30 days. - Disable Web Search for Sensitive Prompts: Prevent unintentional leaks of proprietary code fragments and internal queries to third-party search APIs by keeping web search toggled off during confidential sessions.