{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/google/main/json-schema/google-image-generation-request-schema.json",
  "title": "ImageGenerationRequest",
  "x-generated": "2026-10-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-image-generation-api-openapi.yml#/components/schemas/ImageGenerationRequest",
  "type": "object",
  "required": [
    "contents"
  ],
  "properties": {
    "contents": {
      "type": "array",
      "description": "The content of the current conversation with the model",
      "items": {
        "$ref": "#/$defs/Content"
      }
    },
    "generationConfig": {
      "$ref": "#/$defs/ImageGenerationConfig",
      "description": "Configuration options for image generation"
    }
  },
  "$defs": {
    "Content": {
      "type": "object",
      "properties": {
        "role": {
          "type": "string",
          "enum": [
            "user",
            "model"
          ],
          "description": "The role of the content producer (optional for single-turn, required for multi-turn)"
        },
        "parts": {
          "type": "array",
          "description": "Ordered parts that constitute a single message",
          "items": {
            "$ref": "#/$defs/Part"
          }
        }
      },
      "required": [
        "parts"
      ]
    },
    "FileData": {
      "type": "object",
      "description": "Reference to a file uploaded via the File API or a YouTube URL",
      "properties": {
        "mime_type": {
          "type": "string",
          "description": "MIME type of the file (optional for YouTube URLs)"
        },
        "file_uri": {
          "type": "string",
          "description": "URI of the file from File API or YouTube URL"
        }
      },
      "required": [
        "file_uri"
      ]
    },
    "ImageConfig": {
      "type": "object",
      "description": "Configuration for image generation parameters",
      "properties": {
        "aspectRatio": {
          "type": "string",
          "description": "Aspect ratio for generated images",
          "enum": [
            "1:1",
            "3:4",
            "4:3",
            "9:16",
            "16:9"
          ]
        },
        "imageSize": {
          "type": "string",
          "description": "Size of generated images",
          "enum": [
            "1K",
            "2K",
            "4K"
          ]
        }
      }
    },
    "ImageGenerationConfig": {
      "type": "object",
      "description": "Configuration options for image generation",
      "properties": {
        "responseModalities": {
          "type": "array",
          "description": "Modalities to include in the response",
          "items": {
            "type": "string",
            "enum": [
              "TEXT",
              "IMAGE"
            ]
          }
        },
        "imageConfig": {
          "$ref": "#/$defs/ImageConfig",
          "description": "Configuration for image generation"
        }
      }
    },
    "InlineData": {
      "type": "object",
      "required": [
        "mime_type",
        "data"
      ],
      "properties": {
        "mime_type": {
          "type": "string",
          "description": "MIME type of the data",
          "enum": [
            "image/jpeg",
            "image/png",
            "image/webp",
            "video/mp4",
            "video/mpeg",
            "video/mov",
            "video/avi",
            "video/x-flv",
            "video/mpg",
            "video/webm",
            "video/wmv",
            "video/3gpp",
            "audio/wav",
            "audio/mp3",
            "audio/aiff",
            "audio/aac",
            "audio/ogg",
            "audio/flac",
            "application/pdf"
          ]
        },
        "data": {
          "type": "string",
          "format": "byte",
          "description": "Base64 encoded data"
        }
      }
    },
    "Part": {
      "type": "object",
      "description": "A part of the content, can be text, inline data, or file data",
      "oneOf": [
        {
          "type": "object",
          "required": [
            "text"
          ],
          "properties": {
            "text": {
              "type": "string",
              "description": "Text content"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "inline_data"
          ],
          "properties": {
            "inline_data": {
              "$ref": "#/$defs/InlineData"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "file_data"
          ],
          "properties": {
            "file_data": {
              "$ref": "#/$defs/FileData"
            },
            "video_metadata": {
              "$ref": "#/$defs/VideoMetadata",
              "description": "Optional metadata for video processing (clipping, FPS)"
            }
          }
        }
      ]
    },
    "VideoMetadata": {
      "type": "object",
      "description": "Metadata for customizing video processing",
      "properties": {
        "start_offset": {
          "type": "string",
          "description": "Start time offset for video clipping (format like \"1250s\")",
          "pattern": "^\\d+s$"
        },
        "end_offset": {
          "type": "string",
          "description": "End time offset for video clipping (format like \"1570s\")",
          "pattern": "^\\d+s$"
        },
        "fps": {
          "type": "number",
          "format": "float",
          "description": "Custom frame rate sampling (frames per second). Default is 1 FPS. Use <1 for long videos, >1 for rapidly changing visuals",
          "minimum": 0.1
        }
      }
    }
  }
}