I'm using Vertex AI in an Angular project with Firebase.
The latest 2.5 Flash model works.
const model = getGenerativeModel(this.vertexAI, { model: "gemini-2.5-flash-preview-05-20" });
But when I try to use 2.5 Pro I get a 404 error
const model = getGenerativeModel(this.vertexAI, { model: "gemini-2.5-pro-preview-06-05" });
The model is publicly available
Am I missing something?
You've got the model name right, but the issue is with the location you are sending the request to.
The gemini-2.5-pro-preview-06-05
model is currently only available in the global
location, not in specific regions like us-central1
. Your error message shows the request is being routed to us-central1
, which is why it's returning a 404 Not Found.
You need to specify the global
location when you initialize the Vertex AI instance.
import { getVertexAI } from "firebase/vertex-ai-preview";
// ... inside your service or component
// Initialize Vertex AI with the 'global' location
const vertexAI = getVertexAI(this.firebaseApp, { location: 'global' });
// Now, get the generative model
const model = getGenerativeModel(vertexAI, { model: "gemini-2.5-pro-preview-06-05" });
// ... the rest of your code will now work
By explicitly setting location: 'global'
, the SDK will construct the correct URL to the global endpoint, and your request will succeed.
This requirement is mentioned in the official Google Cloud documentation for Gemini 2.5 Pro:
Important: Only the global endpoint is supported. For more information, see Global endpoint.
This is confusing, since other Vertex AI models are available in specific regions. I only figured it out when I stumbled upon this reddit thread.