A bidirectional bridge connecting Gemini Live API with OpenClaw Gateway.
User Voice → Gemini Live API → Bridge (WebSocket) → OpenClaw Gateway (HTTP) → OpenClaw Agent
- Gemini Live API receives voice input, transcribes it, and calls tools
- Bridge translates between Gemini's protocol and OpenClaw's HTTP API
- OpenClaw executes the requested tasks and returns results
- Gemini speaks the response to the user
- ✅ Real-time voice interaction with OpenClaw
- ✅ Single "execute" tool abstraction (Gemini → OpenClaw)
- ✅ Session continuity via OpenClaw session keys
- ✅ Phase 1: Text-based testing (no audio I/O)
- ✅ Phase 2: Audio capture/playback planned
npm installcp .env.example .env
# Edit .env with your API keys and gateway URLRequired variables:
GEMINI_API_KEY: Your Gemini API keyOPENCLAW_GATEWAY_URL: Your OpenClaw gateway URL (default:http://localhost:18789)OPENCLAW_GATEWAY_TOKEN: Gateway authentication token- Optional:
GEMINI_MODEL,OPENCLAW_SESSION_KEY
Ensure your OpenClaw gateway is running:
openclaw gateway statusIf not running: openclaw gateway start
node src/index.jsYou'll see: "✅ Bridge ready!"
Type your message and press Enter. The bridge will:
- Send it to Gemini Live
- Gemini will call the
executetool - Bridge forwards to OpenClaw
- Result flows back to Gemini → you see the response
Example interaction:
Type your messages and press Enter. Ctrl+C to exit.
📤 You: Search my memory for recent emails about the project
🤖 Gemini: I found 3 mentions of "project" in your recent notes...
gemini-live-bridge/
├── package.json
├── .env.example
├── README.md
└── src/
├── index.js # Entry point, interactive mode
├── gemini-client.js # WebSocket connection to Gemini
├── openclaw-bridge.js # HTTP client for OpenClaw gateway
├── tool-router.js # Routes tool calls → OpenClaw
├── tool-declarations.js # Single "execute" tool schema
└── system-prompt.js # Gemini system instruction
- Uses WebSocket to
wss://generativelanguage.googleapis.com/ws/google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent - Setup message includes model, tools, and system instruction
- Binary protobuf encoding will be needed for production (currently using JSON for testing)
- Endpoint:
{OPENCLAW_GATEWAY_URL}/v1/chat/completions - Auth:
Authorization: Bearer <token> - Session:
x-openclaw-session-keyheader for state continuity - Expects OpenAI-compatible format:
{ model, messages, stream }
Gemini sees only one tool: execute(task: string). All OpenClaw capabilities are accessible through this single function. The bridge forwards the task string to OpenClaw's chat completion endpoint, and OpenClaw's agent decides which tools to use internally.
- Phase 1 (Current): Text-based test harness, no audio I/O
- Phase 2: Add microphone/speaker for real voice (node-speaker, node-microphone)
- Phase 3: Refine for production (protobuf encoding, reconnection logic, error handling)
- Phase 4: Containerization (Docker)
ISC