Skip to content
StatusGet API key

Vision

Models with image input take images as image_url content parts in a user message. Which models: the ones marked “vision” on the models page, for example zai-org/glm-5.3-flash, google/gemma-4-31b-it, moonshotai/kimi-k3 and deepseek/deepseek-v4.1-flash. Text-only models refuse or ignore images.

The URL must be publicly reachable: the provider downloads it.

Terminal window
curl https://api.thetoken.dev/v1/chat/completions \
-H "Authorization: Bearer $TOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "zai-org/glm-5.3-flash",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "Describe this image in one sentence."},
{"type": "image_url", "image_url": {"url": "https://thetoken.dev/brand/og-image.png"}}
]
}]
}'

Send local images as a base64 data: URL:

import base64
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.thetoken.dev/v1", api_key=os.environ["TOKEN_API_KEY"])
with open("receipt.jpg", "rb") as f:
data_url = "data:image/jpeg;base64," + base64.b64encode(f.read()).decode()
response = client.chat.completions.create(
model="google/gemma-4-31b-it",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "What is the total on this receipt?"},
{"type": "image_url", "image_url": {"url": data_url}},
],
}],
)
print(response.choices[0].message.content)
  • Images count as input tokens, billed at the model’s input price; the usage of the response shows the total.
  • On /v1/messages, send images as Anthropic image blocks ({"type": "image", "source": {"type": "base64", "media_type": "image/png", "data": "..."}}).