API reference
Image understanding (vision)
Vision uses multimodal Chat Completions messages. Include text and images together for visual questions, OCR and scene descriptions, without a separate endpoint.
Supported models
| Model | Positioning |
|---|---|
gpt-5.6-sol | General-purpose flagship for combined text and image reasoning |
claude-sonnet-5 | Balances speed and intelligence for production workflows |
claude-sonnet-4-6 | Balanced and efficient for frequent vision tasks |
All models above support vision input. Refer to the capability labels in the Model Catalog (Models in the console).
Input methods
In messages, use content as an array of content parts. Use text parts for text and image_url parts for images. Images can be supplied in two ways:
- Image URL: Provide a publicly accessible image address when the image is already online.
- Base64 encoding: Encode a local image as a data URL in the form
data:image/jpeg;base64,..., suitable for local files or private-network images.
Code examples
Python (image URL)
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.yomiapi.com/v1"
)
response = client.chat.completions.create(
model="claude-sonnet-5",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "What is in this image?"},
{"type": "image_url", "image_url": {"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"}}
]
}],
max_tokens=300
)
print(response.choices[0].message.content)
Python (local image as Base64)
import base64
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.yomiapi.com/v1"
)
with open("photo.jpg", "rb") as f:
b64 = base64.b64encode(f.read()).decode()
response = client.chat.completions.create(
model="claude-sonnet-5",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "Recognize the text in the image and return plain text"},
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{b64}"}}
]
}]
)
print(response.choices[0].message.content)
cURL
curl https://api.yomiapi.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "Describe the contents of this image"},
{"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}}
]
}]
}'
Recommendations
- Image quality: Clear images with a distinct subject are easier to recognize. Use high-resolution originals for OCR when possible.
- Multiple images: A message can contain multiple
image_urlparts to compare or relate images. - Ask specifically: State precise requirements, such as "Extract the table as Markdown" or "Output only the phone number in the image", for more controllable results than a broad request to describe the image.
Images count toward input tokens; larger images consume more. Compress images before batch processing and test a small sample to check quality and usage.
