Skip to main content
POST
/
v1beta
/
models
/
{model}
:generateContent
gemini-3-pro-image-preview (image edit)
curl --request POST \
  --url https://api.example.com/v1beta/models/{model}:generateContent
Gemini’s official format for the image edit API.
curl --location 'https://gptproto.com/v1beta/models/gemini-3-pro-image-preview:generateContent' \
--header 'Authorization: sk-***********' \
--header 'Content-Type: application/json' \
--data '{
    "contents": [
        {
            "role": "user",
            "parts": [
                {
                    "text": "Create a picture of my cat eating a nano-banana in a fancy restaurant under the Gemini constellation"
                },
                {
                    "inline_data": {
                        "mime_type": "image/jpeg",
                        "data": "base64_encoded_image_data"
                    }
                }
            ]
        }
    ],
    "generationConfig": {
        "responseModalities": [
            "IMAGE"
        ],
        "imageConfig": {
            "aspectRatio": "16:9",
            "imageSize": "1K"
        }
    }
}'
{
  "error": {
    "message": "Invalid signature",
    "type": "401"
  }
}

Path Parameters

Parameters

ParameterTypeRequiredDefaultDescription
contentsarray✅ Yes-An array of content objects representing the generation prompt and input image. The role of the message sender. Typically "user". Optional for single-turn requests.
partsarray✅ Yes-An array of parts that make up the message content, including text prompt and input image. Text prompt for image transformation.
inline_dataobject❌ No-Input image data in base64 format. The MIME type of the image (e.g., "image/jpeg", "image/png").
datastring✅ Yes-Base64-encoded image data.
generationConfigobject❌ No-Configuration for the image generation behavior. Response modalities. For image generation, use ["TEXT", "IMAGE"].
imageConfigobject❌ No-Image-specific configuration. Aspect ratio for the generated image. Examples: "16:9", "1:1", "9:16".