BETA
Documentation
Python Vision
Multimodal chat models accept images as an image_url content part on POST /v1/chat/completions — no separate endpoint.
main.py
response = client.chat.completions.create(
model="gpt-5.6-sol",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "What's in this image?"},
{"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}},
],
}
],
)
print(response.choices[0].message.content)For local files, pass a data URL instead of a public one:
{"image_url": {"url": "data:image/jpeg;base64,<...>"}}. Only models with vision support upstream will use the image — check the model's details before relying on it.