firebase / firebase/flutterfire
[firebase_ai] Support for Gemini API Key in firebase_ai
- Dominant language
- Dart
- Stars
- 9.3k
- Forks
- 4.1k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 53
Description
### Description:
With the recent migration from `google_generative_ai` to `firebase_ai`, we’ve encountered a significant limitation: **it is no longer possible to set a custom Gemini API key**.
In `google_generative_ai`, developers could allow end users to input their own Gemini API key. This is essential for applications that:
- Are designed to be self-hosted or run without a dedicated backend.
- Let users manage their own token usage and quotas.
- Require flexibility in using personal Google Cloud accounts.
However, `firebase_ai` acts as a proxy between the app and Gemini, abstracting away the API key and centralizing access through Firebase. This makes it impossible for the end user to configure their own key, breaking this usage pattern.
---
### Problem:
- `google_generative_ai` has been officially deprecated.
- `firebase_ai` does not allow setting a custom API key.
- There is currently no official Google-maintained alternative that supports this use case.
---
### Request:
We propose one of the following solutions:
1. **Add optional support for setting a custom Gemini API key** in `firebase_ai`, bypassing the Firebase proxy when detected.
2. **Maintain a minimal legacy version of `google_generative_ai`** to support this use case.
3. **Clearly document this limitation** and suggest viable alternatives for developers who rely on this pattern.
---
### Justification:
This change would allow developers to continue building flexible, decentralized applications without being forced to rely solely on Firebase infrastructure, and without breaking compatibility with existing workflows.
Contributor guide
Assessment
This issue has not been assessed yet.