Error: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp-image-generation:generateContent: [404 Not Found] models/gemini-2.0-flash-exp-image-generation is not found for API version v1beta, or is not supported for generateContent. Call ListModels to see the list of available models and their supported methods.
This means that gemini-2.0-flash-exp-image-generation no longer exists.
What happened?
same for me. error 404 from france. was working perfectly until yesterday night. hope there will be an official communication why it is not available to europe any more… and what workaround are offered to use this fine LLM !!
Same here man. We know it was experimental, but you don’t just nuke it out after a month of allowing access like that. At least communicate, or even better, provide a workaround until the next available model!
gemini-2.0-flash-exp-image-generation is not currently supported in a number of countries in Europe, Middle East & Africa
This made it hard for us in Europe to develop now. I suppose an alternative is to get a Github codespace running in US and just connect to it remotely via VS Code or code directly from the browser.
I have tried all avenues and it looks like Gemini Studios API no longer allows you to use gemini-2.0-flash-exp via their API in the countries listed in the previous replies. No amounts of VPN, etc will help you as this wont work when working with edge workers (cloudflare) or any server/client hosted in EU.
Work Around
Vertex AI still luckily allows you to use gemini-2.0-flash-exp via their API. Caveat MAKE SURE you always use us-central-1 and of-course make your customers aware (data location, etc).
Setting it up is extremely painful, as it’s not a drop in replacement, but once you’ve got it up and running you can start using gemini-2.0-flash-exp image generation again.
I am currently using Vercels AI SDK for Vertex . I created a new Service Account and have configured googleCredentials as per the docs above to use that config.
This works - atleast for now- until google re-releases gemini-2.0-flash-exp with Ai Studio.
My Implementation with AI SDK
import { createVertex } from '@ai-sdk/google-vertex/edge'
const vertex = createVertex({
project: <GCP_PROJECT_ID>,
location: 'us-central1',
googleCredentials: {
// You will find everything below from credentials.json from the service account.
// Ref: https://console.cloud.google.com/apis/credentials to create a service account
clientEmail: <SERVICE_ACCOUNT_EMAIL>,
privateKey: <SERVICE_ACCOUNT_PRIVATE_KEY>,
privateKeyId: <SERVICE_ACCOUNT_PRIVATE_KEY_ID>
}
})
const result = await generateText({
model: vertex('gemini-2.0-flash-exp'),
providerOptions: {
google: { responseModalities: ['TEXT', 'IMAGE'] }
},
messages: [
{
role: 'user',
content: 'Generate an image of a flying bear'
}
]
})
const image = result.files
I encountered the same issue before.
I was able to fix it by selecting “us” as the server location when deploying the model.
It seems that certain models like gemini-2.0-flash-exp-image-generation are only available in specific regions, and using the “us” location solved the 404 error for me.