Skip to content
WRAITHERIXDocsENRU

Vision (image input)

Multimodal models accept images inside a user message as image_url content parts. Supply a public https URL or a base64 data URL.

r = client.chat.completions.create(
model="gpt-5.6-luna",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "What is in this image?"},
{"type": "image_url", "image_url": {"url": "https://www.gstatic.com/webp/gallery/1.jpg"}},
],
}],
)
print(r.choices[0].message.content)
import base64
with open("photo.png", "rb") as f:
b64 = base64.b64encode(f.read()).decode()
r = client.chat.completions.create(
model="gpt-5.6-luna",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "Describe this picture."},
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{b64}"}},
],
}],
)
  • Supported formats: PNG, JPEG, WEBP, non-animated GIF.
  • Image URLs must be publicly reachable. Some sites block automated downloads (for example Wikimedia); if you get Error while downloading file, send the image as base64 instead.
  • Images count as input tokens; larger images cost more. Use "detail": "low" inside image_url where supported to reduce cost.
  • Send several images by adding several image_url parts.