Error 500 on Gemini-3.1-flash-image-preview from API but not in AI Studio

Hi,

I’m testing Nano Banana 2, I was able to generate about 50 images this morning and suddenly I started having error 500 Internal Server:

google.genai.errors.ServerError: 500 INTERNAL. {‘error’: {‘code’: 500, ‘message’: ‘Internal error encountered.’, ‘status’: ‘INTERNAL’}}

At first it was only of some requests and now it is on all requests. I’m using a Tier 1 and looked at my dashboard, it doesn’t seems I hit the thresholds:

I’ve tried in AI Studio and the same key is working fine, so what can I do to unblock my API access?

Also is it possible to update the error message from the API as the doc says that 500 can be a lot of things (for example exceed usage, too much tokens,…) this is not very helpful for us to only get a 500 without any clue of what is going on.

2 Likes

The same is happening to me, it seems google API is returning error 500 every time an image is passed as input over their API, though it seems to work on Google AI Studio

What is weird is that it was working earlier today! Same setup, same API, suddenly stopped working.

Same issue here. 500 internal error everytime i use a reference photo. Fails everytime.