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)

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 IDGood For
qwen3-6-27bGeneral image understanding with function calling and a 256K context.
qwen2-5-vl-72bVisual Q&A, documents, charts and diagrams. Pro plan.
gemma-4-26b-a4bMixed text + image tasks; set max_tokens to 1,000+ for image requests (it reasons before answering).
paddleocr-vlDocument parsing / OCR: text, tables, formulas, seals, 109 languages.
deepseek-v4-1-flashDeepSeek's fast, low-cost V4.1 variant.
kimi-k2-7-codeMoonshot AI's Kimi K2.7, tuned for code.
kimi-k3Moonshot AI's flagship Kimi K3.
minimax-m3MiniMax's M3.

Passing the Image

  • Base64 data URL (recommended) — data:image/png;base64,… or data: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_url parts 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.