Requests with images, to multimodel models, are available via the /api/v1/chat/completions API with a multi-part messages parameter. The image_url can either be a URL or a base64-encoded image. Note that multiple images can be sent in separate content array entries. The number of images you can send in a single request varies per provider and per model. Due to how the content is parsed, we recommend sending the text prompt first, then the images. If the images must come first, we recommend putting it in the system prompt.
OpenRouter supports both direct URLs and base64-encoded data for images:
Here’s how to send an image using a URL:
For locally stored images, you can send them using base64 encoding. Here’s how to do it:
Supported image content types are:
image/pngimage/jpegimage/webpimage/gif