Megabro:连接 Google Gemini 的本地 AI 命令行界面
amanmohdtp/megabro
Megabro 是一个本地 AI 命令行界面,通过 npm 全局安装后运行 megabro 即可在 localhost:3000 启动终端风格 UI,直接调用 Google Gemini API。
AI-powered command interface. Install once. Type megabro. Go.
What is Megabro?
Megabro is a local AI interface that connects to Google Gemini directly from your browser. No cloud dashboard, no account wall, no tracking. Just a clean terminal-style UI running on localhost:3000.
Key Features
- Instant Boot : zero-config startup, launches your browser automatically
- Live Chat : send prompts, get intelligent AI responses in real time
- Retro TV Interface : beautiful CRT-style display with scanlines and glow effects
- Session Stats : live message count and token estimation
- Export : save your full conversation to a
.txtfile with one click - Model Picker : switch between Gemini models on the fly
- Privacy First : your API key stays in
sessionStorageonly, never logged or stored on disk - Lightweight : just Express + one HTML file, minimal footprint
Quick Start
Install globally via npm
npm install -g megabro
Run it
megabro
That is it. A progress bar boots, your browser opens, and you are ready to go.
Get a Free API Key
- Go to aistudio.google.com
- Click Get API Key
- Copy the key (starts with
AIza...) - Paste it into the Megabro boot screen
Your key is stored in sessionStorage only and is never sent anywhere except directly to Google's Gemini API through your own local server.
Screenshot
Tech Stack
| Layer | Technology |
|---|---|
| Server | Node.js + Express |
| Browser Launch | open package |
| Frontend | Vanilla HTML / CSS / JS |
| AI Backend | Google Gemini API |
Project Structure
megabro/
bin/cli.js # CLI entry point with animated boot sequence
index.js # Express server and Gemini API proxy
public/index.html # Single-file frontend (HTML + CSS + JS)
package.json # Package config and dependencies
.github/workflows/ # Automated npm publish pipeline
Configuration
| Environment Variable | Default | Description |
|---|---|---|
PORT |
3000 |
Server port |
PORT=8080 megabro
Available Models
| Model | Description |
|---|---|
gemini-2.0-flash |
Latest fast model (default) |
gemini-1.5-flash |
Fast and efficient |
gemini-1.5-pro |
Most capable |
Switch models from the dropdown in the bottom bar of the interface.
API Endpoints
| Method | Path | Description |
|---|---|---|
POST |
/api/chat |
Send a message to Gemini |
GET |
/api/health |
Health check |
POST /api/chat
{
"message": "Hello!",
"apiKey": "AIza...",
"model": "gemini-2.0-flash",
"history": []
}Troubleshooting
Port already in use?
Set a custom port: PORT=8080 megabro
Browser does not open automatically?
Navigate manually to http://localhost:3000
API key not working?
Make sure your key starts with AIza and is active at aistudio.google.com
Getting rate limited? The free Gemini API has usage limits. Wait a moment and try again, or upgrade your API plan.
Contributing
Contributions are welcome! Please read our Contributing Guide for details on how to get started.
License
来源:GitHub · github.com
