This page provides answers to frequently asked questions (FAQs) about the Gemini API and the Vertex AI in Firebase SDKs. For additional questions, check out the Gemini API FAQ in the Google Cloud documentation.
To use the Vertex AI in Firebase SDKs, your project must have the following two APIs enabled:
- Vertex AI API (
aiplatform.googleapis.com
) - Vertex AI in Firebase API (
firebasevertexai.googleapis.com
)
You can enable these APIs with a few clicks in the Firebase console:
Go to the Build with Gemini page.
Click the Vertex AI in Firebase card to launch a workflow that enables the two APIs. This workflow will also add the Vertex AI in Firebase API to your Firebase API key's allowlist.
Alternatively, you can use the Google Cloud console (more manual option):
Click each API link at the top of this FAQ entry, and then click Enable in each API's page.
Add the Vertex AI in Firebase API to your Firebase API key's allowlist by following the instructions in Add API restrictions in the Google Cloud documentation.
Action | Required IAM permissions | IAM role(s) that include required permissions by default |
---|---|---|
Upgrade billing to pay-as-you-go (Blaze) pricing plan | firebase.billingPlans.update resourcemanager.projects.createBillingAssignment resourcemanager.projects.deleteBillingAssignment
|
Owner |
Enable APIs in project | serviceusage.services.enable |
Editor Owner |
Create Firebase app | firebase.clients.create |
Firebase Admin Editor Owner |
You can use the Vertex AI in Firebase SDKs with any of the Gemini foundation models listed in Learn about the Gemini models.
You cannot use non-foundation Gemini models like PaLM models, tuned models, or Gemma-based models with the Vertex AI in Firebase SDKs.
We frequently add new capabilities to the SDKs, so check back on this FAQ for updates (as well as in release notes, blogs, and social posts).
If you're trying to send a multimodal request with a Cloud Storage for Firebase
URL, you might encounter the following 400 error:
Service agents are being provisioned ... Service agents are needed to read the Cloud Storage file provided.
This error is caused by a project that didn't have the required service agents correctly auto-provisioned when the Vertex AI API was enabled in the project. This is a known issue with some projects, and we're working on a global fix.
Here's the workaround to fix your project and correctly provision these service agents so that you can start including Cloud Storage for Firebase URLs in your multimodal requests. You must be an Owner on the project, and you only need to complete this set of tasks once for your project.
Access and authenticate with the gcloud CLI.
The easiest way to do this is from Cloud Shell. Learn more in the Google Cloud documentation.If prompted, follow the instructions displayed in the terminal to make the gcloud CLI run against your Firebase project.
You'll need your Firebase project ID, which you can find at the top of the Project settings in the Firebase console.
Provision the required service agents in your project by running the following command:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/endpoints -d ''
Wait a few minutes to ensure that the service agents are provisioned, and then retry sending your multimodal request that includes the Cloud Storage for Firebase URL.
If you're still getting this error after waiting several minutes, reach out to Firebase Support.
Give feedback about your experience with Vertex AI in Firebase