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.curl --location -g --request POST 'https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp-image-generation:generateContent?key=' \
--header 'Content-Type: application/json' \
--data-raw '{
"contents": [{
"parts": [
{"text": "Hi, can you create a 3d rendered image of a pig with wings and a top hat flying over a happy futuristic scifi city with lots of greenery?"}
]
}],
"generationConfig":{"responseModalities":["TEXT","IMAGE"]}
}'
{}