Images
Attach an image to a user message and the model reads it alongside the text. Each API has its own content-part spelling: image_url parts on Chat Completions, input_image on Responses, image blocks on Messages.
Works with
Image parts are accepted on every chat model. The catalog does not yet flag which models have vision; if the underlying model can't process images, the upstream provider's error is relayed back to you. The Claude, GPT, Gemini, and Grok families read images today, and so does mindshub_blaze (Qwen 3.8 27B on Cerebras). The per-model column is on the capability matrix.
mindshub_blaze accepts the same image shapes as every other model, but its provider does not. Cerebras takes images only as base64 PNG or JPEG data URLs and rejects remote URLs and detail. So on this alias the gateway does that work for you: a public http(s) URL is downloaded server-side (up to 6 MiB per image), any other raster type (GIF, WebP, …) is transcoded to PNG, and detail is dropped before the request goes upstream. Your request shape does not change by model. What you can hit: an image URL that can't be fetched, is over the size cap, or isn't a decodable image returns a 400 naming that URL, as does one whose host resolves to a private or internal address or that redirects to one; Cerebras itself caps a request at 10 images (paid tiers) and 10 MiB total.
Request
- Chat Completions
- Responses
- Messages
- Chat Completions
- Responses
- Messages
response = client.chat.completions.create(
model="sonnet",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "What's in this image?"},
{"type": "image_url", "image_url": {"url": "https://example.com/chart.png"}},
],
}],
)
print(response.choices[0].message.content)
response = client.responses.create(
model="sonnet",
input=[{
"role": "user",
"content": [
{"type": "input_text", "text": "What's in this image?"},
{"type": "input_image", "image_url": "https://example.com/chart.png"},
],
}],
)
print(response.output_text)
message = client.messages.create(
model="sonnet",
max_tokens=1024,
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "What's in this image?"},
{"type": "image", "source": {"type": "url", "url": "https://example.com/chart.png"}},
],
}],
)
print(message.content[0].text)
const response = await client.chat.completions.create({
model: "sonnet",
messages: [{
role: "user",
content: [
{ type: "text", text: "What's in this image?" },
{ type: "image_url", image_url: { url: "https://example.com/chart.png" } },
],
}],
});
console.log(response.choices[0].message.content);
const response = await client.responses.create({
model: "sonnet",
input: [{
role: "user",
content: [
{ type: "input_text", text: "What's in this image?" },
{ type: "input_image", image_url: "https://example.com/chart.png", detail: "auto" },
],
}],
});
console.log(response.output_text);
const message = await client.messages.create({
model: "sonnet",
max_tokens: 1024,
messages: [{
role: "user",
content: [
{ type: "text", text: "What's in this image?" },
{ type: "image", source: { type: "url", url: "https://example.com/chart.png" } },
],
}],
});
console.log(message.content[0]);
These samples use sonnet, which reads images and draws the prepaid wallet.
Image sources:
- A
data:URL (data:<media type>;base64,<data>) or a publichttp(s)URL, which the upstream provider fetches. On Messages,base64andurlsources both work. - JPEG, PNG, GIF, and WebP are passed through. Other inline raster formats (
data:URLs) are transcoded to PNG server-side; remote URLs are handed to the provider unchanged. - A malformed data URL or invalid base64 returns
400.
Response
Nothing about the response shape changes: the model's description arrives as ordinary text. Image tokens are metered as input tokens.
Per-model differences
- Anthropic's Files API references (
"source": {"type": "file"}) are unsupported on Messages, and behavior is target-dependent: some providers reject them, others ignore them. Usebase64orurlsources. - An image inside a tool result (a
function_call_outputon Responses, atool_resulton Messages, atoolmessage on Chat Completions) reaches the model as an image where it can take one.glm,gpt-oss-fireworksandmindshub_blazecannot, so they see a short text note in its place instead of failing the request. An image in a user turn is still sent as is. - PDF and other file inputs are not a documented feature yet; a
filepart reaches only the OpenAI-transport models today and is dropped elsewhere.
Errors you can hit
400 for a malformed data URL or invalid base64. A model without vision returns its provider's own error, relayed with the original status. See Errors.