Archiving the heist: Bing Chat's unofficial Python API
Because Microsoft didn't offer a Bing Chat API, this Python library reverse-engineered one—chat and image generation included.
What it does EdgeGPT wraps Microsoft’s undocumented Bing Chat endpoints in an async Python library, exposing both a conversational chatbot and an image generator. You send prompts and receive structured responses—including source citations, follow-up suggestions, and code blocks—without opening a browser. The library handles the messy parts of authentication and response parsing so you can treat Bing Chat like a local API.
The interesting bit
The library treats browser cookies as a consumable resource: it expects files matching bing_cookies_*.json and automatically rotates through them when you near the daily quota of roughly 200 requests. It also encodes the uncertainty of Microsoft’s authentication rules—sometimes an Edge user-agent and a home IP are enough, sometimes you need exported cookies, and datacenter ranges often get challenged.
Key highlights
- Exposes both Bing Chat (
Chatbot,Query) and Bing Image Creator (ImageGen,ImageQuery) through async Python interfaces. - Structured response objects give you text, citations, suggested follow-ups, and extracted code blocks without manual parsing.
- Built-in cookie rotation across multiple
bing_cookies_*.jsonfiles to work around daily quotas. - Region-aware by necessity: the library acknowledges that mainland China requires a VPN and that datacenter IPs may trigger extra authentication.
- Published to PyPI and available as a Docker image, though the repo is now archived.
Caveats
- The project is archived and unmaintained; the README explicitly warns that the author lacks time to fix future breakage.
- Authentication is a moving target: some regions allow anonymous access, others demand Microsoft account cookies, and datacenter IPs often face extra scrutiny.
- Hard daily quotas (around 200 requests) and regional gating make it impractical for heavy or automated production use.
Verdict Worth studying if you are reverse-engineering modern AI interfaces or need a reference for scraping structured chat data. Avoid if you need a maintained API; the repository is archived and Microsoft moves fast enough to break unofficial clients quickly.
Frequently asked
- What is acheong08/EdgeGPT?
- Because Microsoft didn't offer a Bing Chat API, this Python library reverse-engineered one—chat and image generation included.
- Is EdgeGPT open source?
- Yes — acheong08/EdgeGPT is open source, released under the Unlicense license.
- What language is EdgeGPT written in?
- acheong08/EdgeGPT is primarily written in Python.
- How popular is EdgeGPT?
- acheong08/EdgeGPT has 7.9k stars on GitHub.
- Where can I find EdgeGPT?
- acheong08/EdgeGPT is on GitHub at https://github.com/acheong08/EdgeGPT.