Hi everyone,
Nice to meet you all. I’m posting today to discuss a confusing issue I’ve recently run into and haven’t been able to figure out yet.
Previously well-tested prompts can suddenly stop working on a random day. The API call still succeeds, but the server simply returns the original image I uploaded, without applying the prompt at all.
I’m relatively new to the Gemini API and am currently using the Node.js SDK (@google/genai) to generate images. My goal is to upload an image and then use the Gemini SDK to automatically generate a new image based on prompts, so we can avoid manual Photoshop work.
After evaluating different options, I found that gemini-2.5-flash-image fits our requirements well and is reasonably priced, so we chose this model. After several days of iterative prompt tuning, we were able to generate quite satisfactory results with a high success rate. Everything looked great and we were ready to ship.
However, one day things suddenly changed. The previously working prompts almost completely stopped taking effect, and the behavior became:
-
The API call succeeds, tokens are consumed normally, and an image is returned.
-
In more than 90% of cases, the returned image is exactly the original uploaded image. Only in a few cases does it generate a meaningful image according to the prompt.
-
There are no error messages or warnings at any stage.
I’m trying to understand what could cause prompts that worked perfectly for several days to suddenly fail like this. Since there are no errors or logs, I’m not sure where to even start debugging.
Even if I manage to “fix” the prompt again, I don’t know whether the same issue will reappear later.
I also tried asking Google’s AI for suggestions and adjusted the request parameters accordingly — including seed, temperature, topK, and topP — but it didn’t really help. The issue persists. Below is the updated code:
import { GoogleGenAI } from "@google/genai";
const GEMINI_GEN_AI = new GoogleGenAI({ apiKey: GEMINI_API_KEY }); // GEMINI_API_KEY read from env
const parts = await buildPartsParam(prompt, promptImages);
const response = await GEMINI_GEN_AI.models.generateContent({
model: 'gemini-2.5-flash-image',
contents: [{ parts }],
config: {
responseModalities: ["TEXT", "IMAGE"],
imageConfig: { aspectRatio },
seed: Math.floor(Math.random() * 1000000000),
temperature: 1.0,
topK: 100,
topP: 1.0,
},
});
Has anyone encountered a similar issue with Gemini image generation models?
If so, how did you diagnose or resolve it?
Thanks in advance for any insights.
This document was translated by AI. The original Chinese text is included below.
使用 gemini-2.5-flash-image 时会经常返回原始图片,而不是根据提示词生成
各位朋友,大家好,很高兴认识大家,今天发帖主要是想和大家交流下我目前遇到的一个让我很困惑且不知道如何处理的问题:
之前已经调试好的提示词在某一天会突然失效,API 调用成了,但服务端会返回我上传的原始图片,完全没有按提示词进行操作。
我是一个使用 gemini api 的新手。目前在尝试使用 gemini api 的 node.js sdk: “@google/genai” 生成一些图片。
我期望能用 gemini sdk 来实现如下需求:上传一张图片后调用 gemini sdk 来实现自动图片生成,省去人工 PS 图片的工作。
通过总体权衡,我发现 gemini-2.5-flash-image 可以满足我们的需求,而且价格也合适,所以就选中了这个模型。而且经过几天的反复修改提示词,已经可以生成比较满意的图片了,成功率也很高。一切很完美,准备上线了。
但突然某一天,我发现我们调试好的提示词完全不起作用了,会出现如下结果:
-
API 调用成了,也正常扣除了 token,并返回了图片
-
90% 以上的情况下返回的图片是我上传的原始图片,仅有个别情况下会按提示词生成有价值的图片
-
整个过程没有任何报错信息
我想知道是什么原因可能会导致之前几天工作得很好的提示词突然失效了呢?整个过程既没有错误提示,也没有 log 信息,我不知道从何查起这个问题。
即使我调整了提示词好了,也不知道是否还会出现类似的问题。
我试着问了下 google 的 AI,并按 AI 的提示修改了下请求参数:seed、temperature、topK、topP,但没什么效果,问题依旧,修改后的结果如下(见上方代码)。
不知道朋友们有没有遇到同类的问题?大家遇到后都是怎么解决的呢?
