Gemini Flash 2.0 hangs (no output is given. No error is given. No crash is given. Nothing at all) whenever an image (whether its an image link or base64) is presented to the model. This doesn't happen if only text is given.
Code:
const api = "ADD KEY HERE"
async function chat(messages, config) {
const request = await fetch(
"https://openrouter.ai/api/v1/chat/completions",
{
method: "POST",
headers: {
Authorization: `Bearer ${api}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ messages, ...config })
}
);
const response = await request.json();
if ("error" in response) {
return {
success: false,
errorCode: response.error.status,
errorMessage: response.error.message,
metadata: response.error.metadata
};
}
return { success: true, data: response };
}
async function main() {
console.log(await chat([
{
role: "user",
content: {
type: "image_url",
"image_url": "https://yt3.ggpht.com/Y6jut5A-dhWRlv7W81kGxVFPtZGjZN97IhBP75uLnx2AVV7ZEJUUUxBKHlFw9GcwILxkz1E_cLc=s48-c-k-c0x00ffffff-no-rj"
}
},
{
role: "user",
content: "Whats shown in the image? Describe the image in great detail."
}
], { model: "google/gemini-2.0-flash-001" }))
}
main()