Sending an Image to a Model

ImageInput

Part of: Multimodal AI: Vision & Images

Your first vision API call almost always fails the same way: you paste a file path and the model says it cannot see anything. The model never opens files. It only reads what is inside the request body. To send a picture you either hand it a public URL or you encode the bytes into text. Get this one detail right and vision "just works." What it is An image input is a picture supplied as part of a prompt, in a format the API can carry. There are two standard ways: - A URL : a link to an image the server can fetch over the internet. - Base64 : the image's raw bytes encoded into a long plain-text string that rides inside the JSON request. Base64 is just a way to write binary data using ordinary text characters, so a picture can travel inside a text-only field. It makes the data about 33 percent larger, but it needs no public hosting. How it works A vision request is a normal chat request whose user message contains a list of content blocks, some text and some image. Each block declares its type: The pieces that matter: 1. content is a list, not a string. Text and image blocks sit side by side. 2. media type must match the real file : image/png, image/jpeg, image/webp. Lie about it and

Challenge: The Attachment Gateway