Vision
Vision-capable models (e.g. spook-vision, spook-ocr, spook-detect) can "see" an image and answer questions about it. You add the image inside the chat message as multi-part content.
Ways to send the image
There are two ways:
- Public URL — The image is at a publicly reachable address.
- Base64 data URL — Embed the image as
data:image/jpeg;base64,...(for local files).
Example (with base64)
python
import os, base64
from openai import OpenAI
client = OpenAI(api_key=os.environ["QEVRON_API_KEY"], base_url="https://app.qevron.ai/v1")
with open("photo.jpg", "rb") as f:
b64 = base64.b64encode(f.read()).decode()
resp = client.chat.completions.create(
model="spook-vision",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "What do you see in this image?"},
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{b64}"}},
],
}
],
)
print(resp.choices[0].message.content)Example (with URL)
json
{
"model": "spook-vision",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "Describe this image." },
{ "type": "image_url", "image_url": { "url": "https://example.com/photo.jpg" } }
]
}
]
}Models for image tasks
| Model | Task |
|---|---|
spook-vision | Describe / Q&A about an image |
spook-ocr | Extract text from an image (OCR) |
spook-detect | Detect objects in an image |
Tips
Downscale the image
Very large images are slow and may hit the request size limit (413 error). Before sending, downscale the image to a reasonable size (e.g. max 1280 px) and compress as JPEG.
- Don't attach an image for text-only questions; sending an image to a non-vision model (e.g.
verinova) will error. - You can send multiple images in one message (add several
image_urlitems to the content array).
Related: Chat API — Vision.