AI Gateway

Vision

Send images alongside text to a vision-capable model

View as Markdown

pixtral-large, qwen3-vl, and the gpt-5-6-* models accept image input alongside text. Pass the image as a base64 data URI in an image_url content block. The gateway forwards the image bytes to the model, so remote URLs are not fetched server-side.

Python
import base64
with open("chart.png", "rb") as f:
data_uri = "data:image/png;base64," + base64.b64encode(f.read()).decode()
response = client.chat.completions.create(
model="pixtral-large",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "What does this chart show?"},
{"type": "image_url", "image_url": {"url": data_uri}},
],
}],
)
print(response.choices[0].message.content)

Image generation is not offered. See Errors and limits for the full list of what the gateway doesn’t cover.

Next steps