Skip to content

[firebase_ai] Support for Gemini API Key in firebase_ai #17408

Open
@vicajilau

Description

@vicajilau

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs AttentionThis issue needs maintainer attention.plugin: ailabel issues for firebase_ai plugintype: enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions