#Gemini Flash 2.0 not working with images

12 messages · Page 1 of 1 (latest)

astral lagoon
#

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()
astral lagoon
#

@lavish spear do you have any ideas?

lavish spear
#

Hey, sorry for getting back to you late. I'll see if I can reproduce

#

Yeah, this seems janky. Don't necessarily think it's an OpenRouter issue, but we'll see if I can dig into it.

lavish spear
#

Escalated this up to the team since it looks like this is working in Google's AI studio. It might just be something on our end, but it might take a bit to get resolved.

astral lagoon
lavish spear
#

text + image -> text should be using multipart content, with content being an array

astral lagoon
lavish spear
astral lagoon
#

This works for me.