$ show tech-shrimp/gemini-playground
This repository is a serverless web application that serves as a playground and API proxy for Google's Gemini Multimodal Live API. It provides a client-side interface for real-time text, audio, video, and screen-sharing interactions with the Gemini model. Crucially, it includes a backend proxy layer (deployable on Cloudflare Workers or Deno) that converts the native Gemini WebSocket/REST API into an OpenAI-compatible format, enabling integration with third-party clients like ChatBox or Cursor. The architecture is split between a static frontend (vanilla JS) and a lightweight serverless proxy that handles authentication, protocol translation, and streaming logic.
The LLM identified 3 files worth highlighting for reuse:
Implements a robust adapter that translates Gemini API requests/responses to OpenAI-compatible formats. It handles streaming parsing, token counting, safety settings, and image/audio data transformation. This component is highly reusable for any project needing to bridge Gemini and OpenAI clients.
Manages real-time audio playback with a robust queuing system and Web Audio API worklets for volume metering. It handles buffer scheduling and PCM conversion, demonstrating advanced audio processing patterns suitable for voice assistants or streaming apps.
Encapsulates the WebSocket connection logic for the Gemini API, handling reconnection, tool call responses, and event emission. It provides a clean abstraction over the raw WebSocket protocol, making it easy to integrate multimodal features into the UI.