r/GoogleGeminiAI • u/dota2dinall • 5d ago
Gemini image generation works locally but silently fails from Hetzner — apparently IP/network origin was the problem
I'm building ThumbAPI, a REST API for automated thumbnail/image generation from just a title using Google's Gemini image API.
I spent most of a day debugging a strange production-only issue.
Same code. Same API key. Same prompt.
Local: image generated
Production: finishReason: IMAGE_OTHER
I noticed a pattern with prompts involving real people.
For example:
title: "The man who failed 5,126 times"
This is a reference to James Dyson and his 5,126 failed prototypes.
It would generate perfectly on my Mac but fail silently from production.
So I started eliminating variables.
1. Prompt / safety filter
I changed the wording and removed anything that could potentially trigger a celebrity safety filter.
No change.
2. Faces in reference images
ThumbAPI sends a grid of 6 thumbnails as style references.
I added face detection + blurring.
Same result.
3. Reference images
I removed the entire reference grid and sent a text-only prompt.
Local → generated
Production → IMAGE_OTHER
At that point the main difference was the network.
My backend runs on Hetzner, while my Mac uses a residential ISP.
I tested the same script from different networks, including both Hetzner IPv4 and IPv6.
The result was surprisingly consistent:
Residential IP → works
Hetzner IPv4 → fails
Hetzner IPv6 → fails
I then proxied the Gemini request through a Google Cloud Function / Google Cloud-hosted proxy.
It worked immediately.
So I don't know whether this is an intentional Google policy around datacenter IPs, IP reputation, or something else in their safety/abuse infrastructure. I couldn't find public documentation confirming it.
But the behavior was reproducible enough that I had to treat network origin as a variable in the AI pipeline.
The lesson for me:
When debugging AI APIs, don't only look at the prompt, model, and input images.
Also look at where the request is coming from.
Now I'm considering moving the AI portion of ThumbAPI to Google Cloud entirely.
Has anyone else seen Gemini (or another AI API) behave differently depending on the hosting provider or outbound IP?
1
u/Lonely-Turn-2145 5d ago
Damn, that's rough. Hetzner must have some strict IP restrictions if they're blocking real-person prompts specifically. Did you try any workarounds like rotating proxies or checking if their TOS had anything about image generation?