Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions relay/channel/gemini/relay-gemini.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var geminiSupportedMimeTypes = map[string]bool{
"audio/wav": true,
"image/png": true,
"image/jpeg": true,
"image/jpg": true, // support old image/jpeg

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

Google Gemini API supported image MIME types image/jpg image/jpeg

💡 Result:

Google's Gemini API accepts the MIME type image/jpeg (use this for .jpg and .jpeg files). The docs list supported image MIME types as image/png, image/jpeg, image/webp (and in some pages also image/heic / image/heif). Use image/jpeg rather than image/jpg. [1][2]

Sources:

  • Google Gemini API image understanding docs (supported MIME types list). [1]
  • Vertex AI / Gemini image-understanding docs (supported MIME types and examples using mime_type='image/jpeg'). [2]

Remove "image/jpg" — Gemini API does not support this MIME type.

Verification against Google Gemini API documentation shows that the official API only supports image/jpeg, image/png, image/webp, image/heic, and image/heif. The documentation explicitly recommends using image/jpeg rather than image/jpg, and image/jpg is not listed as a supported MIME type.

Adding "image/jpg": true to the whitelist will not provide backwards compatibility since the Gemini API will reject requests with this MIME type. Either remove this entry or update the code to convert image/jpg to image/jpeg before sending to the API.

🤖 Prompt for AI Agents
In relay/channel/gemini/relay-gemini.go around line 35, remove the unsupported
"image/jpg" whitelist entry or normalize incoming images with MIME type
"image/jpg" to "image/jpeg" before sending to Gemini; update the MIME whitelist
to only include Gemini-supported types (image/jpeg, image/png, image/webp,
image/heic, image/heif) and, if you choose normalization, add a small pre-send
step that rewrites any "image/jpg" content-type to "image/jpeg" so requests are
accepted by the Gemini API.

"image/webp": true,
"text/plain": true,
"video/mov": true,
Expand Down