I built an app in python to access gemini-2.5-flash-image-preview using
model = GenerativeModel(“gemini-2.5-flash-image-preview”)
but I continually get the message:
```
Error generating image with Gemini: 404 Publisher Model projects/.../locations/us-central1/publishers/google/models/gemini-2.5-flash-image-preview
was not found or your project does not have access to it. Please ensure you are using a valid model version. For more information, see: Model versions and lifecycle | Generative AI on Vertex AI | Google Cloud
```
However, if I use gemini-2.0-flash-exp, I do not get this error.
Do I need to do something to make gemini-2.5-flash-image-preview available to my project?
Hey Doug, the gemini-2.5-flash-image-preview
model is available, but being a Preview model, you need to access it using the global
endpoint rather than a specific region like us-central1
. See my response in this thread: Connecting to Nano Banana - #4 by Andrew_B
I’d love to see what you build!
Hello Andrew, the model always responds with a 400 error?
Does it work if you add response_modalities ?
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Create a surreal scene combining these two images into one cohesive image"
},
{
"fileData": {
"mimeType": "image/png",
"fileUri": "https://sy2zkbdh96.sharedwithexpose.com/uploads/stories/1757339717317/images/1757339810582.png"
}
},
{
"fileData": {
"mimeType": "image/png",
"fileUri": "https://sy2zkbdh96.sharedwithexpose.com/uploads/stories/1757339717317/images/1757339823999.png"
}
}
]
}
],
"generationConfig": {
"responseModalities": ["TEXT", "IMAGE"]
}
}