Unfortunately, the Gemini API gemini-2.0-flash-exp-image-generation cannot generate images, and the 2.0 models don’t have voice response capabilities
Hi @Zafaraka_Man,
“gemini-2.0-flash-exp-image-generation” is capable of generating images. Currently it is in experimental stage. Stable version will be released soon. No timeline yet.
Voice response capability will also come soon. You can check capabilities of each model here.
For latest updates you can check release notes.
Thanks.
EDITED CONTENT
- Final edit: Looks like some guardrails were put up to prevent image generation in certain cases. If text mode is not enabled, the model has not oppotunity to respond and throws. If text mode is enabled, then a message usually saying ‘I am unable to create images’ is generated when the guards are violated; however, occassionaly something more informative like ‘I am unbale to generate an image of this because it violates …’ is shown. This allwed me to zero in ont he problem.
this morning gemini-2.0-flash-exp-image-generation was throwing model does not support image mode over 95% of the time.
const chat = model.startChat({
history: userMessages.slice(0, -1), // All messages except the last one
generationConfig: {
temperature: processedRequest.parameters?.temperature || 1.0,
maxOutputTokens: processedRequest.parameters?.max_tokens || 8192,
responseModalities: [“image”], // ← if this is made [“image”,“text”] success becomes more likely but not 100%, and response is sometimes
{text: ‘I am sorry, I am unable to create images.\n’}
responseMimeType: “text/plain”,
}
});
const resultPromise = chat.sendMessage(
lastMessage
);
await resultPromise = chat.sendMessage(
‘"
I perceive that you’re feeling sad. Would you like to share what’s causing this sadness? Perhaps exploring the source of these feelings may bring some clarity.
" analyze for emotions and intent of the speaker … create an image representing the intent’);
throws
[GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp-image-generation:generateContent: [400 Bad Request] Model does not support the requested response modalities: image
Yeah, you’re right, I overlooked that parameter.
Make sure to include responseModalities
: [“Text”, “Image”] in your generation configuration for text and image output with gemini-2.0-flash-exp-image-generation
. Image only is not allowed.
php:
generationConfig = {
// — HERE’S THE KEY CHANGE —
responseModalities: [“Text”, “Image”], // Explicitly specify that we expect Text AND Image
// -----------------------------
temperature: 0.8,
topP: 0.9,
topK: 40
// responseMimeType = application/json, // This parameter is not needed here because the response is always JSON
},