Docs Menu & Search
Documentation
Image Input (Vision)
Send images to vision models in a chat request — OpenAI's content-array format.
Vision models take images in the same /v1/chat/completions request as text. Make the message
content an array of parts: text parts and image_url parts. It’s
the OpenAI format, so OpenAI SDKs work unchanged.
import base64
from openai import OpenAI
client = OpenAI(api_key="nbh_your_key_here", base_url="https://api.nabh.cloud/v1")
with open("receipt.jpg", "rb") as f:
image_b64 = base64.b64encode(f.read()).decode()
response = client.chat.completions.create(
model="qwen3-6-27b",
max_tokens=1000,
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "What is the total on this receipt?"},
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{image_b64}"}},
],
}],
)
print(response.choices[0].message.content)import fs from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({ apiKey: "nbh_your_key_here", baseURL: "https://api.nabh.cloud/v1" });
const imageB64 = fs.readFileSync("receipt.jpg").toString("base64");
const response = await client.chat.completions.create({
model: "qwen3-6-27b",
max_tokens: 1000,
messages: [{
role: "user",
content: [
{ type: "text", text: "What is the total on this receipt?" },
{ type: "image_url", image_url: { url: `data:image/jpeg;base64,${imageB64}` } },
],
}],
});
console.log(response.choices[0].message.content);curl https://api.nabh.cloud/v1/chat/completions \
-H "Authorization: Bearer nbh_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen2-5-vl-72b",
"max_tokens": 500,
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "Describe this chart in two sentences."},
{"type": "image_url", "image_url": {"url": "https://example.com/chart.png"}}
]
}]
}'Models That Accept Images
These are the models whose model page lists Image Input: Supported (filter the catalog by “Image Input” for the live list). Sending an image to a text-only model fails or the image is ignored.
| Model ID | Good For |
|---|---|
qwen3-6-27b | General image understanding with function calling and a 256K context. |
qwen2-5-vl-72b | Visual Q&A, documents, charts and diagrams. Pro plan. |
gemma-4-26b-a4b | Mixed text + image tasks; set max_tokens to 1,000+ for image requests (it reasons before answering). |
paddleocr-vl | Document parsing / OCR: text, tables, formulas, seals, 109 languages. |
deepseek-v4-1-flash | DeepSeek's fast, low-cost V4.1 variant. |
kimi-k2-7-code | Moonshot AI's Kimi K2.7, tuned for code. |
kimi-k3 | Moonshot AI's flagship Kimi K3. |
minimax-m3 | MiniMax's M3. |
Passing the Image
- Base64 data URL (recommended) —
data:image/png;base64,…ordata:image/jpeg;base64,…. The image travels inside your request, so it works for private files and nothing has to be publicly reachable. - Public https URL — the model fetches it while handling your request. It must be reachable without login; if the fetch fails, the request fails.
- Size. Keep each image to a few MB (base64 adds about a third). Large images use more input tokens — downscale to the detail you need.
- Several images — add more
image_urlparts to the same message.
Cost
Images are converted to input tokens by the model, so they’re billed as input tokens at the model’s
input price. The usage.prompt_tokens in the response (and the request log) shows what an image
cost you.