Bridge by Wekoya / Docs / Chat

Images, audio, video, PDFs

Updated

Attach an image alongside the text and a model that can read it is chosen for you. Nothing you attach is written to our database.

client.chat.completions.create(
    model="auto",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "What is the total on this receipt?"},
            {"type": "image_url", "image_url": {
                "url": "https://example.com/receipt.jpg"
            }},
        ],
    }],
)

Gemini models also read audio, video and PDFs, in OpenAI's message shapes: ask about a voice note, a contract, a lesson recording or a YouTube video. Send files inline as base64, up to 20 MB in all per request; video can also be a public YouTube link. Audio is billed at the model's audio rate, which on some models is above its text rate. A model that cannot read what you sent is refused with nothing charged, and the error names models that can.

import base64

pdf = base64.b64encode(open("invoice.pdf", "rb").read()).decode()
audio = base64.b64encode(open("voice-note.mp3", "rb").read()).decode()

client.chat.completions.create(
    model="gemini-3.5-flash-lite",
    messages=[{"role": "user", "content": [
        {"type": "text", "text": "Does the voice note agree with the invoice total?"},
        {"type": "file", "file": {"file_data": f"data:application/pdf;base64,{pdf}", "filename": "invoice.pdf"}},
        {"type": "input_audio", "input_audio": {"data": audio, "format": "mp3"}},
        # Video: a data URL, or a public YouTube link.
        {"type": "video_url", "video_url": {"url": "https://www.youtube.com/watch?v=…"}},
    ]}],
)