我们302对这个接口做了2个优化: 1.支持返回url或原始bs64 data 2.支持传入image_url对图片进行编辑
curl --location --request POST 'https://api.302.ai/google/v1/models/gemini-3-pro-image-preview?response_format' \
--header 'Authorization: Bearer ' \
--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"
],
"imageConfig": {
"aspectRatio": "4:3"
}
}
}'{
"candidates": [
{
"content": {
"parts": [
{
"url": "https://file.302.ai/gpt/imgs/20260103/983491b38aa74bf29fa9b82825718568.jpeg"
}
],
"role": "model"
},
"finishReason": "STOP",
"index": 0
}
],
"modelVersion": "gemini-3-pro-image-preview",
"responseId": "VFBZac-tFu6p_uMPycCNyAg",
"usageMetadata": {
"candidatesTokenCount": 1234,
"candidatesTokensDetails": [
{
"modality": "IMAGE",
"tokenCount": 1120
}
],
"promptTokenCount": 34,
"promptTokensDetails": [
{
"modality": "TEXT",
"tokenCount": 34
}
],
"thoughtsTokenCount": 221,
"totalTokenCount": 1489
}
}