Vision (image input)
Send images alongside text by using the multimodal content array. Great for debugging a
UI from a screenshot, reading a diagram, or extracting text from an image.
ℹ Note
Multimodal content is forwarded to OpenAI-compatible providers; AIx auto-routes
requests whose content is an array. Use a vision-capable model (e.g. a GPT-4o-class,
Claude, or Gemini model routed via an OpenAI-compatible provider).
Image by URL
from openai import OpenAI
client = OpenAI(base_url="https://api.aix.theaimart.co/v1", api_key="$AIX_KEY")
resp = client.chat.completions.create(
model="google/gemini-2.5-pro",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "What's broken in this UI?"},
{"type": "image_url", "image_url": {"url": "https://example.com/screenshot.png"}},
],
}],
)
print(resp.choices[0].message.content)
Image as base64 (local files)
import base64
b64 = base64.b64encode(open("screenshot.png", "rb").read()).decode()
resp = client.chat.completions.create(
model="google/gemini-2.5-pro",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "Transcribe the text in this image."},
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{b64}"}},
],
}],
)
✦ Tip
You can include multiple image_url parts in one message. Keep images reasonably sized —
they consume input tokens and add latency.