ChatGPT replacement in a single html file
Note from the future: Given that having access to multiple models is pretty important and Anthropic (et al.) have issues with CORS with the single HTML file, I would recommend LibreChat, hosted in a HuggingFace space, as per this link. As of this writing, HuggingFace lets you host a space for free on their smallest instance type.
With that being said…
Given that OpenAI exposes the gpt4 api, $20 per month seems like a bit steep for a nice interface. It would be nice to run your own ChatGPT locally with just an API key.
There are some existing options, but all the ones I could find require some complex deployment process (vercel for chat-ui, docker for libre chat, etc).
With that in mind, I created gpt.html
, which is a single html file with < 1000 lines. It runs completely locally in your browser with no complex deployment.
Here’s a screenshot:
As you can see, gpt.html
is pretty fully featured, including the two non trivial ChatGPT features I like the most: tree-like branching chats, and copying code blocks. It also has a few nice little features even ChatGPT doesn’t have: formatting user messages, and left border highlighting of user vs assistant messages, which is helpful for long messages.
The main limitation to the purely local approach is that it makes extensive use of the browser’s local storage to store the chat history. With a limit of ~5 MB depending on the browser, this means the code evicts stale chats when local storage fills up. Personally, this is not a problem for me, as I never use chats > 1 week old, and my back and forths with gpt4 never exceed 5 MB per week, but keep that in mind.
Try it out
🫡