Urgent.News

What's breaking now, across thousands of outlets.

Tech

HeshBot: a small, self-hosted website chatbot (and three ways to power one)

The chat bubble on trevorheshka.com is HeshBot, a chatbot I wrote to replace the Typebot widget I had before. I wanted something small that I fully own: no build step, no framework, no third-party chat platform. The code is open source under the MIT license at github.com/YardPhantom/HeshBot . This post covers how it's put together, the different ways you could power a bot like this, and what a…

HeshBot is a small, self-hosted website chatbot created by Trevor Heshka to replace an earlier Typebot widget. The chatbot is open source under the MIT license and can be found on GitHub. The chatbot has three main components: the widget, the endpoint, and the knowledge source.

The widget, heshbot.js and heshbot.css, are plain JavaScript and CSS files with no dependencies. It is lightweight, loads only when clicked, and works on both desktop and mobile devices. The bot replies use a small markdown renderer that escapes content and adds a whitelist of tags. The conversation is stored in sessionStorage, which is cleared when the tab is closed.

The endpoint, api/chat.php, requires PHP 7.4+ and curl to run on ordinary shared hosting. It calls the Google Gemini API over REST and uses a list of free-tier Flash models in order, with per-IP rate limiting and caps on message history and character counts. The chat.php file is the only reachable file in its directory, with a guarded API key stored outside the public folder.

The bot's knowledge comes from two files, api/system-prompt.md and api/knowledge.md. The knowledge file is generated automatically from the public pages of the site using a Python script. HeshBot is programmed to answer only from the core facts and knowledge file, to say when it does not know an answer, and to never invent prices, dates, or credentials.

There are three ways to power a chatbot like HeshBot:

1. A public API, which sends questions to a hosted model and shows the reply. This approach is fast but leaves questions outside the server and is subject to third-party quotas and pricing.

2. A local LLM, which runs an open model on local hardware instead of a public API. This option has no per-message cost, but it requires sufficient hardware and maintenance.

3. A quick local decision model, which uses a small classifier or set of rules to match questions to known answers and reply instantly without a language model. This approach is less conversational but very cost-effective and not prone to hallucinations.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Remove image backgrounds in the browser with ONNX Runtime Web (no server)

Disclosure: I built this project with a lot of help from an AI assistant (Claude). I tested the result myself on real photos, and the notes below are what I actually ran into.

  • ONNX Runtime Web enables background removal in browser without server
  • IS-Net segmentation model quantized to int8 format reduces file size
  • picfitter.online tool processes images locally, preserving user privacy

How to Get a Wake-Word Model in 2026

Adding a wake word to a product sounds simple: microphone → wake-word model → application action The difficult part begins when the phrase is not one of the pre-trained examples, the language is not…

  • Wake-word models essential for specific command-triggering products.
  • Two methods to obtain custom wake-word model in 2026.
  • Evaluate model performance with recall and false accept rates.

More from Friday 23 October →