v2.2 Release Update (March 3, 2026)
- 🔌 Dynamic Hardware Control: The AI now natively understands the physical pins of your specific board (e.g. D4 vs GPIO 2).
- 🎛️ Web UI Configurable Pins: You can now define exactly what hardware is connected to what pin (like fans or relays) directly in the WebUI so the AI knows exactly what to control!
- ✨ ESP32 Web UI Overhaul: New built-in "Logs" interface that captures API traces in real-time.
- 🤖 2026 Enterprise Models: Explicit support added for the latest 2026 models like
gpt-5.2,claude-opus-4-6, andgemini-3-flash-previewstraight from the UI.- 📡 cURL API Tracing: The device now automatically synthesizes and logs the formatted
curlcommand it sends to OpenAI, Anthropic, or Gemini for your debugging convenience.- 🧠 Broader AI Personas: The system prompts have been expanded so the AI will not only control hardware but gracefully answer general knowledge questions.
The smartest, smallest AI personal assistant designed to run on incredibly constrained hardware (ESP8266) while seamlessly scaling up to powerful capabilities on the ESP32.
With extensive optimizations, espclaw brings LLMs (OpenAI, Anthropic, OpenRouter) straight to your local network and Telegram, making your microcontroller truly intelligent.
- ESP8266: Ultra-optimized memory footprint. Squeezes an entire AI agent into just ~80KB of RAM using streaming JSON parsers and insecure TLS buffering.
- ESP32: Premium upgrades including a stunning, glassmorphic Web UI and a dynamic Configuration Portal backed by non-volatile storage (NVS).
- Natural Language Tooling: Automatically toggle GPIO pins via natural language commands (e.g.,
[GPIO_ON: 4]). - Telegram Integration: Chat with your board from anywhere in the world.
- Local Web UI (ESP32): Beautiful asynchronous local network chat interface with an onboard real-time Logs dashboard.
- Over-The-Air Setup (ESP32): No need to hardcode WiFi! The ESP32 boots into Access Point mode if it can't connect, allowing you to configure everything from a browser.
espclaw isn't just a chatbot; it physically interacts with the real world! You can control hardware from anywhere on the planet simply by messaging your bot on Telegram (or using the local Web UI).
- ESP32: Open the Config tab in the Web UI. Under the Hardware Pins & Components box, simply tell the AI what you plugged in in plain English! (e.g., "GPIO 4 is connected to the living room fan relay. GPIO 13 is the red LED.")
- ESP8266: Open
src/config.hand edit the#define USER_PINSstring with the same English description. - Open Telegram and message your bot: "Can you turn on the living room fan?" The AI will automatically read your hardware definitions, figure out that the fan is on pin 4, and silently toggle the GPIO high!
The ESP8266 only has ~80KB of data RAM (with roughly ~40KB free after Wi-Fi and system initialization). Running TLS and parsing complex LLM JSON responses usually crushes this chip memory-wise. Here is how espclaw avoids Out-of-Memory (OOM) crashes:
- Insecure TLS Buffer Minimization: We bypass CA Certificate Validation (
client.setInsecure()) and shrink the RX/TX buffers heavily (client.setBufferSizes()). Without this, the cert chain alone would consume all available RAM. - Streaming JSON Filtering: Traditional JSON parsing loads the entire response string into memory before decoding. Instead,
espclawusesArduinoJson 7withDeserializationOption::Filterdirectly on the incoming TCP stream. It instructs the parser to only keep the actualcontentof the LLM reply and immediately discard the rest of the JSON bloat (headers, usage stats, context). - No Heavy Tool Registries: Standard ReAct agents send huge JSON Schemas for tools. We skip this. The
SYSTEM_PROMPTsimply teaches the LLM a syntax ([GPIO_ON: PIN]). The board intercepts these brackets using basic string methods, requiring virtually zero memory. - BearSSL over mbedTLS: Leverages the heavily optimized BearSSL library native to the
espressif8266core.
- Download Visual Studio Code: If you don't have it, download and install VS Code.
- Install PlatformIO Extension: Open VS Code, go to the Extensions tab (Ctrl+Shift+X or Cmd+Shift+X), search for "PlatformIO IDE", and click Install. Wait for the installation to finish and reload the window if prompted.
- Clone the repository (or download and extract the ZIP from the Releases tab):
git clone https://github.com/yourusername/espclaw-esp8266.git
- Open the folder in VS Code:
- Go to
File > Open Folder...and select theespclaw-esp8266directory.
- Go to
- Wait a few moments for PlatformIO to automatically detect the
platformio.inifile and install the required toolchains and libraries for the ESP8266 and ESP32 platforms behind the scenes.
Because the ESP8266 lacks the RAM for a full web server alongside TLS, configuration is handled at compile time.
- Open
src/config.hin VS Code. - Enter your credentials (
WIFI_SSID,WIFI_PASSWORD,TELEGRAM_BOT_TOKEN,OPENAI_API_KEY,LLM_PROVIDER).OPENAI_API_KEYis completely generic and is used for Anthropic or Gemini too.LLM_PROVIDERcan be set to"openai","anthropic", or"gemini".
- Connect your ESP8266 via USB.
- Open the PlatformIO Core CLI (the little terminal icon on the bottom blue status bar of VS Code) and run:
pio run -t upload -e d1_mini
- Connect your ESP32 via USB.
- Open the PlatformIO Core CLI and flash the firmware. You do not need to configure anything in
config.h.pio run -t upload -e esp32dev
- On first boot (or if your WiFi changes), the ESP32 will host an Access Point named ESPClaw-Config (Password:
12345678). - Connect your phone or laptop to this
ESPClaw-ConfigWiFi network, then openhttp://192.168.4.1in your browser. - Fill in your home WiFi and API credentials in the Config Portal and hit Save.
- The ESP32 will reboot, securely transition to your home network, and serve the beautiful Chat UI on its new local IP!
For an in-depth dive into the system architecture, check out the Full Documentation.
Automated binaries are generated for every release. Check the Releases tab to download pre-compiled .bin files for both the ESP8266 and ESP32 platforms!
This project is licensed under the MIT License.
You are free to use, modify, and distribute this software, as long as the original copyright notice and permission notice are included in all copies or substantial portions of the software.