Overview
Vision models can analyze images, screenshots, diagrams, and more.
Supported Models
| Model | Context | Use Case |
|---|
meta-llama/llama-3.2-90b-vision-instruct | 131K | High quality |
phala/qwen2.5-vl-72b-instruct | 128K | TEE-protected |
google/gemini-1.5-pro | 2M | Long context |
Basic Usage
response = client.chat.completions.create(
model="phala/qwen2.5-vl-72b-instruct",
messages=[{
"role": "user",
"content": [
{
"type": "text",
"text": "What's in this image?"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/image.jpg"
}
}
]
}]
)
Base64 Images
import base64
def encode_image(image_path):
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode('utf-8')
base64_image = encode_image("photo.jpg")
response = client.chat.completions.create(
model="phala/qwen2.5-vl-72b-instruct",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "Describe this image"},
{
"type": "image_url",
"image_url": {
"url": f"data:image/jpeg;base64,{base64_image}"
}
}
]
}]
)
Multiple Images
response = client.chat.completions.create(
model="phala/qwen2.5-vl-72b-instruct",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "Compare these images"},
{"type": "image_url", "image_url": {"url": "https://example.com/1.jpg"}},
{"type": "image_url", "image_url": {"url": "https://example.com/2.jpg"}}
]
}]
)
Use Cases
- Medical image analysis
- Document OCR
- Chart interpretation
- Product inspection
- Satellite imagery
phala/qwen2.5-vl-72b-instruct processes images in TEE for maximum privacy.