How to Force Image Generation in Gemini 2.0 Flash Experimental

I am having trouble forcing image generation using Gemini 2.0 Flash Experimental Image Generation. Even when I specify image generation in the prompt, the image is generated less than 50% of the time. Although I can provide an image and ask for edits, the image generation function is rarely triggered when attempting to generate an image from scratch.

To force image generation, I tried specifying only “image” in the “response_modalities” field, but encountered the following error:

google.genai.errors.ClientError: 400 Bad Request. {'message': 'Response not read', 'status': 'Bad Request'}

Additionally, is there any plan to support “system_instructions”?

Based on some testing, it appears that image generation is triggered reliably when using English prompts, whereas in Japanese or other languages, the triggering is less consistent.

Hi @Lami, If you are trying to pass the system instructions to the generative model you can pass those by defining the system_instruction argument. Thank You.

Passing the system_instructions argument will result in an error that the Image Generation model is not supported.

Hi @Lami, May I know which model you are using for image generation. Thank You.

1 Like