Skip to main content
POST
/
v1beta
/
models
/
gemini-3-pro-image-preview:generateContent

Authorization

  • Auth Type: Bearer Auth (In: header)
  • Format: Authorization: Bearer <YOUR_API_KEY>
  • Description: Use Bearer <YOUR_API_KEY>. Format: Authorization: Bearer sk-xxxxxx.
  • API Key: where API Key is your AGCloud API KEY

Parameters

Core Parameters

FieldTypeRequiredDescription
contentsarrayContent of the current conversation with the model. For single-turn queries, this contains one instance. For multi-turn queries (e.g., chat), this contains the conversation history and the latest request.
>contents.rolestringThe role of the message sender. Can be user model.
>contents.partsarrayThe content parts of the message, which can contain different types of content (text, inlineData, etc.). See Multimodal
>>contents.parts.textstringThe prompt for generating images. To include images or multiple images
generationConfigobject-Configuration options for content generation.
>generationConfig.imageConfigobject-Configuration for image generation. If set for models that don’t support these configuration options, the system will return an error. See ImageConfiguration
>generationConfig.responseModalitiesarray-The modalities of the response. If set for models that don’t support these configuration options, the system will return an error. Can be TEXT IMAGE.
>generationConfig.temperaturenumber-Controls the randomness of the output. Range in 0.0-1.0.

Multimodal Input

{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "inlineData": {
            "mimeType": "image/jpeg",
            "data": "base64-encoded-image-data"
          }
        },
        {
          "text": "a cat"
        }
      ]
    }
  ]
}
FieldTypeRequiredRange/ExampleDescription
partsarraytext inlineData fileDataThe content parts of the message, which can contain different types of content.
>parts.inlineDataobject--Inline media content. If used, data must be base64-encoded.
>>parts.inlineData.mimeTypestring✅ Yes (if inline_data is used)image/jpeg image/pngThe IANA-standard MIME type of the source data. If the provided MIME type is not supported, the system will return an error.
>>parts.inlineData.datastring✅ Yes (if inline_data is used)-Base64-encoded media data.
>parts.fileDataobject--File media content. If used, fileUri must be provided.
>>parts.fileData.mimeTypestring✅ Yes (if file_data is used)image/jpeg image/pngThe IANA-standard MIME type of the source data. If the provided MIME type is not supported, the system will return an error.
>>parts.fileData.fileUristring✅ Yes (if file_data is used)-The URI of the file to be processed.

Image Configuration

{
  "generationConfig": {
    "imageConfig": {
      "aspectRatio": "1:1",
      "imageSize": "1K"
    }
  }
}
FieldTypeRequiredRange/ExampleDescription
imageConfigobject--Configuration for image generation.
>imageConfig.aspectRatiostring-1:1
2:3
3:2
3:4
4:3
9:16
16:9
21:9
1:4
4:1
1:8
8:1
Configuration for image generation.
>imageConfig.imageSizestring-0.5K
1K
2K
4K
Approximate size of the generated image. If not specified, the model will use the default value of 1K. 0.5K is only supported by Gemini 3.1 Flash Image Preview; 2K and 4K are only supported by Gemini 3.1 Flash Image Preview and Gemini 3 Pro Image Preview.

Model Comparison

FeatureGemini 2.5 Flash ImageGemini 3.1 Flash Image PreviewGemini 3 Pro Image Preview
Use caseSpeed & efficiencySpeed & high-volumeProfessional asset production
Supported sizes1K0.5K, 1K, 2K, 4K1K, 2K, 4K
Max reference images31414
Max object images106
Max portrait images45
Extra aspect ratios1:4, 4:1, 1:8, 8:1
Note:
  • Gemini 3.1 Flash Image Preview: Optimized for speed and high-volume use cases. Supports 0.5K resolution and extra ultra-wide/tall aspect ratios (1:4, 4:1, 1:8, 8:1). Also supports Google Image Search Grounding.
  • Gemini 3 Pro Image Preview: Optimized for professional asset production with advanced reasoning for complex creation tasks.
  • Gemini 2.5 Flash Image: Supports a maximum of 3 reference images and 1K resolution only.
Aspect Ratio & Image Size:
  • By default, the model keeps the output image the same size as the input image; otherwise it produces a 1:1 square. You can control the aspect ratio of the generated image with the aspect_ratio field under image_config in your request, as shown below: