embedContent with Gemini Embedding 2 Preview does not support WebP images

Summary

The gemini-embedding-2-preview model’s embedContent endpoint only supports PNG and JPEG images. WebP is not supported, despite being a first-class format across the rest of the Gemini API (e.g., generateContent). This creates a significant friction point for multimodal embedding pipelines.

Reproduction

  # PNG — works (200)
  PNG_B64="iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42m
  Nk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="

  curl -s -w "\n%{http_code}" \
    "https://generativelanguage.googleapis.com/v1beta/models/gemini-e
  mbedding-2-preview:embedContent?key=$GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "content": {"parts": [{"inlineData": {"mimeType": "image/png",
  "data": "'"$PNG_B64"'"}}]},
      "taskType": "RETRIEVAL_DOCUMENT",
      "outputDimensionality": 768
    }'
  # → 200 OK
  # WebP — fails (400)
  WEBP_B64=$(base64 -w0 any_valid_image.webp)

  curl -s -w "\n%{http_code}" \
    "https://generativelanguage.googleapis.com/v1beta/models/gemini-e
  mbedding-2-preview:embedContent?key=$GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "content": {"parts": [{"inlineData": {"mimeType": "image/webp",
   "data": "'"$WEBP_B64"'"}}]},
      "taskType": "RETRIEVAL_DOCUMENT",
      "outputDimensionality": 768
    }'
  # → 400 "Request contains an invalid argument."

Why this matters

I understand from the embeddings documentation that only PNG and JPEG are currently supported. I’m posting this as a feature request / discussion because the limitation has a real impact on production workflows:

  1. WebP is the default output format for major CDNs and image processing services. Cloudflare Images, Vercel Image Optimization, and most modern thumbnail pipelines output WebP by default. Requiring PNG/JPEG means adding a conversion step purely for the embedding API.
  2. generateContent already supports WebP. The inconsistency between endpoints means teams building multimodal RAG pipelines that use Gemini for both analysis (generateContent) and retrieval (embedContent) need format-specific branching logic for the same images.
  3. The error message is opaque. The 400 response only says “Request contains an invalid argument” with no indication that the format is the issue. We had to narrow it down to the mime type. A more specific error like “Unsupported image format: image/webp. Supported formats: image/png, image/jpeg” would save developers time.
  4. Vertex AI has the same limitation — and additionally does not support multimodal embedContent at all (only text).

Request

  • Add image/webp support to embedContent for gemini-embedding-2-preview (and future embedding models), consistent with generateContent
  • Improve the error message when an unsupported format is provided
  • Consider adding multimodal support to the Vertex AI embedContent endpoint as well

+1 to this. also experiencing similar limitations