๐ผ๏ธ SwitchBot AI Art Frame
Generate AI artwork with Google's Nano Banana Flash and display it on your SwitchBot AI Art Frame.
Features
- AI Image Generation โ Describe what you want and pick an art style (cyberpunk, watercolor, fantasy, etc.). Powered by Google's Gemini image generation.
- Frame Control โ Browse images on your frame with next/previous controls.
- URL Upload โ Send any publicly-hosted image to your frame.
- Auto-Discovery โ Finds your AI Art Frame automatically from your SwitchBot account.
Quick Start
# Clone
git clone https://github.com/csells/SwitchBotFrame.git
cd SwitchBotFrame
# Configure
cp .env.example .env
# Edit .env with your API keys (see below)
# Install & run
npm install
npm run devOpen http://localhost:5173 in your browser.
Configuration
Copy .env.example to .env and fill in your values:
| Variable | Required | Description |
|---|---|---|
GEMINI_API_KEY |
โ | Google AI API key for image generation. Get one at aistudio.google.com/apikey. |
SWITCHBOT_TOKEN |
โ | SwitchBot API token. See how to get credentials. |
SWITCHBOT_SECRET |
โ | SwitchBot API secret key. Found alongside the token. |
IMGBB_API_KEY |
โ | imgbb API key for hosting generated images. Get one at api.imgbb.com. |
PORT |
โ | API server port (default: 3001). |
โ ๏ธ Privacy notice: Generated images are uploaded to imgbb.com and are publicly accessible. Do not generate anything private or sensitive.
Getting SwitchBot Credentials
- Open the SwitchBot mobile app
- Go to Profile โ Preferences โ App Version
- Tap the version number 10 times to unlock Developer Options
- Go back โ Developer Options
- Copy your Token and Secret Key
Architecture
Browser (Vite :5173) โ API Server (Hono :3001) โ Google AI / SwitchBot APIs
โ โ
React + Tailwind Reads .env credentials
frame.tsxโ React frontend with Tailwind CSSapi.tsโ API handler (image generation + SwitchBot commands)server.tsโ Hono server with static file serving
In development, Vite proxies /api and /generated requests to the Hono backend.
Scripts
| Command | Description |
|---|---|
npm run dev |
Start both Vite and API server with hot reload |
npm run build |
Build the frontend for production |
npm start |
Start the API server (serves built frontend from dist/) |
Deploying
- Build:
npm run build - Deploy to any Node.js host (Fly.io, Railway, Render, etc.)
- Set env vars (
GEMINI_API_KEY,SWITCHBOT_TOKEN,SWITCHBOT_SECRET,IMGBB_API_KEY)
License
MIT
On this page
Languages
TypeScript98.1%HTML1.4%JavaScript0.3%CSS0.1%
Contributors
Created March 6, 2026
Updated March 6, 2026