We at 302 have made 2 optimizations to this endpoint: 1.Supports returning url or raw bs64 data 2.Supports passing in image_url for image editing
{
"contents": [
{
"parts": [
{
"text": "变成Ghibli卡通风格"
},
{
"image_url": "https://file.302ai.cn/gpt/imgs/20250507/d778f9319c534b1c8ffc49c15db14fb1.jpg"
}
]
}
],
"generationConfig": {
"responseModalities": [
"TEXT",
"IMAGE"
]
}
}
curl --location --request POST 'https://api.302.ai/v1/v1beta/models/gemini-2.5-flash-image-preview:generateContent?response_format' \
--header 'x-goog-api-key: sk-jls4AaVBGoe1GwZD64qZA1qyKTN1MPHa4NmvH1cT68z7K1Zz' \
--header 'Content-Type: application/json' \
--data-raw '{
"contents": [
{
"parts": [
{
"text": "变成Ghibli卡通风格"
},
{
"image_url": "https://file.302ai.cn/gpt/imgs/20250507/d778f9319c534b1c8ffc49c15db14fb1.jpg"
}
]
}
],
"generationConfig": {
"responseModalities": [
"TEXT",
"IMAGE"
]
}
}'
{
"completed_at": "",
"created_at": "",
"error": "",
"id": "",
"model": "",
"output": "",
"started_at": "",
"status": ""
}