Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to protect Gemini API key? #44

Open
dselman opened this issue Jan 2, 2025 · 4 comments
Open

How to protect Gemini API key? #44

dselman opened this issue Jan 2, 2025 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@dselman
Copy link

dselman commented Jan 2, 2025

Description of the bug:

Gemini API key is compiled into the frontend code. What is the best practice for secure management of Gemini API keys?

Actual vs expected behavior:

Some mechanism to prevent disclosure of Gemini API keys to web browser.

Any other information you'd like to share?

Same question, here: pipecat-ai/gemini-multimodal-live-demo#9

@hapticdata
Copy link
Collaborator

You can easily proxy a websocket connection from your own web server. We will have more examples of this soon.
How you accomplish this is based on your own server, if it is a node.js a package such as http-proxy should make it simple. If it is python you can should take a look at the google docs as there is an official SDK implementation.

@hapticdata hapticdata added the question Further information is requested label Jan 2, 2025
@dselman
Copy link
Author

dselman commented Jan 4, 2025

Yes, a node example of this would be a great addition.

@saliksik
Copy link

Any updates on this?

@hapticdata
Copy link
Collaborator

hapticdata commented Jan 24, 2025

We now have an example of using a python server for the websocket communication and protected the API key

https://github.com/GoogleCloudPlatform/generative-ai/tree/main/gemini/sample-apps/e2e-gen-ai-app-starter-pack/app/patterns/multimodal_live_agent

this example integrates in this boilerplate as a frontend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants