Image Processing
A guide to sending images via Base64 or URLs in API requests.
Overview
Supported Image Types
Supported Models
Sending Image Inputs
Example: Sending an Image via URL (Python)
import requests
url = "https://api.fastrouter.ai/api/v1/chat/completions"
headers = {
"Authorization": "Bearer API-KEY",
"Content-Type": "application/json"
}
messages = [
{
"role": "user",
"content": [
{"type": "text", "text": "Describe this image and identify any landmarks."},
{
"type": "image_url",
"image_url": {
"url": "https://upload.wikimedia.org/wikipedia/commons/d/da/Taj-Mahal.jpg"
}
}
]
}
]
payload = {
"model": "openai/gpt-4.1-nano",
"messages": messages
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())Example: Sending a Base64-Encoded Image (Python)
Tips & Best Practices
Last updated
