[firebase_ai] Support for Gemini API Key in firebase_ai

Open
#17,408 1 comment 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
dart, firebase
Domain
ai, mobile-dev

Research direction

Start by reviewing the firebase_ai migration from google_generative_ai and how requests currently use Firebase as a proxy. Determine whether custom API keys, a maintained legacy package, or limitation documentation is the appropriate supported direction; done means one approach is selected and its compatibility and usage implications are documented.

Written by the indexing model from the issue text.

Description

Needs Attention plugin: ai type: enhancement
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.

Dominant language
Dart
Stars
9.3k
Forks
4.1k
Avg merge
2d 10h
Merged PRs (30d)
78

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from firebase/flutterfire

All issues in firebase/flutterfire

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.