curl -X POST "https://api.example.com/v1beta/models/gemini-2.5-flash-image:generateContent?key=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{"text": "Add a rainbow to this image"},
{
"inline_data": {
"mime_type": "image/jpeg",
"data": "base64_encoded_image"
}
}
]
}
]
}'
Edit and modify images
curl -X POST "https://api.example.com/v1beta/models/gemini-2.5-flash-image:generateContent?key=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{"text": "Add a rainbow to this image"},
{
"inline_data": {
"mime_type": "image/jpeg",
"data": "base64_encoded_image"
}
}
]
}
]
}'
curl -X POST "https://api.example.com/v1beta/models/gemini-2.5-flash-image:generateContent?key=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{"text": "Add a rainbow to this image"},
{
"inline_data": {
"mime_type": "image/jpeg",
"data": "base64_encoded_image"
}
}
]
}
]
}'