A simple, serverless Gemini client written in MicroPython.
This project is not affiliated with, endorsed by, or officially supported by Google.
Availability, stability, or correctness of the service is not guaranteed, and the author assumes no responsibility for any usage of this code.
- The microcontroller sends a single prompt via HTTPS to a publicly accessible Gemini endpoint.
- No API key or user-side configuration is required.
- Requests are stateless: a prompt is sent and a response is returned.
- There is no conversation or session support.
- Download and copy the
gemini.pyfile to your MicroPython device. - This code was tested on ESP32.
import network
import gemini
import time
# ======================
# Connect Wi-Fi
# ======================
WIFI_SSID = "WIFI_SSID_HERE"
WIFI_PASSWORD = "WIFI_PASS_HERE"
def wifi_connect():
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
if not wlan.isconnected():
print("Connecting to Wi-Fi...")
wlan.connect(WIFI_SSID, WIFI_PASSWORD)
timeout = 20
while not wlan.isconnected() and timeout > 0:
time.sleep(1)
timeout -= 1
if wlan.isconnected():
print("Connected!")
print("Local IP:", wlan.ifconfig()[0])
else:
raise Exception("Failed to connect Wi-Fi")
wifi_connect()
# ======================
# Main
# ======================
response = gemini.prompt("How are you?")
print("Response from Gemini:", response)This project is provided as-is for experimental and educational purposes only.
It interacts with publicly accessible endpoints whose availability and behavior may change at any time. The author assumes no responsibility for usage, misuse, or any consequences arising from the use of this software. All responsibility lies with the user.