Skip to content

tectijuana/micropython-gemini

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MicroPython Gemini

A simple, serverless Gemini client written in MicroPython.

⚠️ This project is intended for research, educational, and experimental purposes only.

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.


🔧 How It Works

  • 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.

🚀 How To Use

  • Download and copy the gemini.py file to your MicroPython device.
  • This code was tested on ESP32.

🧪 Example Code

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)

⚠️ Disclaimer

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.

About

Serverless Gemini client for MicroPython

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%