Claude Vision
Claude models support powerful visual understanding capabilities. You can send images through either the native format or the OpenAI-compatible format.
Send Image via URL
curl https://crazyrouter.com/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-sonnet-4-20250514",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": [
{
"type": "image",
"source": {
"type": "url",
"url": "https://example.com/photo.jpg"
}
},
{
"type": "text",
"text": "Describe the content of this image"
}
]
}
]
}'
Send Image via Base64
curl https://crazyrouter.com/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-sonnet-4-20250514",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": [
{
"type": "image",
"source": {
"type": "base64",
"media_type": "image/png",
"data": "iVBORw0KGgoAAAANSUhEUg..."
}
},
{
"type": "text",
"text": "What is in this image?"
}
]
}
]
}'
Send images to Claude using the standard OpenAI format:
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://crazyrouter.com/v1"
)
response = client.chat.completions.create(
model="claude-sonnet-4-20250514",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Describe this image"},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/photo.jpg"
}
}
]
}
],
max_tokens=1024
)
print(response.choices[0].message.content)
| Format | MIME Type |
|---|
| JPEG | image/jpeg |
| PNG | image/png |
| GIF | image/gif |
| WebP | image/webp |
Claude’s native format uses type: "image" with a source object, while the OpenAI-compatible format uses type: "image_url" with an image_url object. Crazyrouter handles the format conversion automatically.
Individual images should not exceed 20MB. Higher resolution images consume more tokens.