Unofficial Python bridge to HuggingChat, built on browser cookies
It wraps HuggingChat’s web UI in a Python class so your bot can chat, search, and swap models without an official API.

What it does
hugging-chat-api is an unofficial Python client for HuggingChat. It automates user login with email and password, persists session cookies, and exposes chat, web search, conversation management, and LLM switching through a ChatBot class and a bundled CLI. In short, it treats the free web UI as a backend service for your Python scripts.
The interesting bit Because HuggingChat lacks a first-party programmatic interface, this library reverse-engineers the session flow—complete with cookie handling, conversation state, and assistant IDs—so you can do in code what the browser does manually. The included CLI even lets you toggle streaming, web search, and model switching with slash commands, which feels more IRC bot than cloud SDK.
Key highlights
- Supports streaming and non-streaming chat responses.
- Can invoke web search and switch between available LLM models by index.
- Allows attaching specific HuggingChat assistants (including image generators) via ID.
- Bundles an interactive CLI with conversation management and slash commands.
- Persists login state locally using saved cookies after email/password authentication.
Caveats
- The maintainer warns that updates are slowing down for personal reasons, with only basic feature upkeep guaranteed.
- Authentication requires real Hugging Face credentials and careful cookie-path formatting; a missing trailing slash causes errors.
- High-frequency polling is explicitly discouraged; the README calls server resources “precious.”
Verdict Worth a look if you need a free, quick Python backend for prototyping chatbots or assistants without API fees. Skip it if you require an officially supported, rate-limit-guaranteed service for production workloads.
Frequently asked
- What is Soulter/hugging-chat-api?
- It wraps HuggingChat’s web UI in a Python class so your bot can chat, search, and swap models without an official API.
- Is hugging-chat-api open source?
- Yes — Soulter/hugging-chat-api is open source, released under the AGPL-3.0 license.
- What language is hugging-chat-api written in?
- Soulter/hugging-chat-api is primarily written in Python.
- How popular is hugging-chat-api?
- Soulter/hugging-chat-api has 940 stars on GitHub.
- Where can I find hugging-chat-api?
- Soulter/hugging-chat-api is on GitHub at https://github.com/Soulter/hugging-chat-api.