Prerequisites: Node.js
- Install dependencies:
npm install - Set the
GEMINI_API_KEYin.envto your Gemini API key - Run the app:
npm run dev
When deploying to a remote server (e.g. Linux cloud server), there are two important requirements to be aware of:
The app uses browser APIs (navigator.mediaDevices) for camera and microphone access. These APIs are only available in Secure Contexts:
https://connectionslocalhost/127.0.0.1
If you access the app via plain http://<server-ip>, the camera and microphone will not work. Choose one of the following solutions:
- In Chrome, navigate to
chrome://flags/#unsafely-treat-insecure-origin-as-secure - Enter your server address, e.g.
http://123.45.67.89:5005 - Set to Enabled and restart Chrome
⚠️ This only applies to your own browser. Each user needs to configure this manually.
Install Caddy on your server. It automatically provisions and renews TLS certificates:
your-domain.com {
reverse_proxy localhost:5005
}
Requires a domain name pointing to your server IP.
# Generate a self-signed certificate
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /etc/ssl/private/self-signed.key \
-out /etc/ssl/certs/self-signed.crtThen configure Nginx to reverse proxy to port 5005 with SSL. Users will see a browser security warning on first visit and need to click "Proceed" to continue.
The Gemini Live API WebSocket connection is made directly from the user's browser to Google's servers. Google restricts access based on the user's IP location.
If you see the error:
Session closed. Code: 1007 Reason: User location is not supported for the API use.
This means the user's network is in an unsupported region. To resolve this:
- Use a VPN/proxy on the client side so that the browser's outbound IP is in a supported region (e.g. US, Japan, etc.)
- Note: this restriction applies to the browser's network, not the server's. Even if your server is in a supported region, the user still needs a supported network because the WebSocket connects directly from the browser.