Gemini 2.0 image gen not found

Suddenly, I get this error when using my app:

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?

This is how I’m calling the image generation:

const IMAGE_MODEL_NAME = "gemini-2.0-flash-exp-image-generation";
// ...
const model = genAI.getGenerativeModel({ model: IMAGE_MODEL_NAME });

same bro not sure what is happening here, completely disappeared. Google, what happened?

Looks like they are onto something

Just turned on US vpn and it works - so must be a European region issue

is there a solution for this?

How can they do this without warning? I build an entire app using this and now im stuck

This scares me, this might mean its not temporary

It’s flagged as experimental, and not ready for production. The warning is at the left bottom.

BTW i hope they release 2.5 flash image or It will be reinstated in Europe.

It’s too much better than openai in some type of images.

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 !!

My app stop working too. VPN to US works. EU block everything!

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!

Yeah, but the warning message is there

“This experimental model is for feedback and testing only. No production use.”

BTW They haven’t even updated the changes in the changelog, they would be in a hurry.

Sure, I guess now we know what that means - it will be nuked at any given time. So are they planning for another one or something?

Same. “Modified by Moderator”

Just saw this added to the model info

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 the same trouble…

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

Hi Jakov,

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.

Hope this helps!

I got the same today “Modified by Moderator”

I deployed to a server based in the US, it works