Skip to main content
Menu
Build / Vision
Build

Vision

Send images to a chat model with the vision capability.

4 minute readUpdated 13 November 2026curl · Python · TypeScript

Send an image#

Give the user message's content as a list of parts: text parts and image_url parts. The URL is a data: URL with base64 image data, such as data:image/png;base64,…. The gateway does not fetch remote http or https URLs; they are refused with 400 invalid_request. detail is auto (the default), low or high.

The samples read the model id from PANWARD_VISION_MODEL: set it to a chat model with the vision capability from the model catalog. A model without it refuses the request with 400 unsupported_parameter before any upstream call, so nothing is billed.

cat > body.json <<EOF
{
  "model": "$PANWARD_VISION_MODEL",
  "messages": [{
    "role": "user",
    "content": [
      {"type": "text", "text": "Read the values on this lab report."},
      {"type": "image_url", "image_url": {"url": "data:image/png;base64,$(base64 < report.png | tr -d '\n')", "detail": "high"}}
    ]
  }]
}
EOF

curl https://api.panward.ai/v1/chat/completions \
  -H "Authorization: Bearer $PANWARD_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @body.json

Limits#

The whole request body, images included, may be up to 10 MB; a larger one is refused with 413 request_too_large. Base64 makes an image about a third larger than the file, so scale images down before you send them.

Token cost of images#

Images are counted as input tokens by the serving model's rule and appear in usage.prompt_tokens. Before the request is sent, each image counts as 16,384 tokens toward the model's context window, the project's maximum prompt size and the tokens-per-minute limits, whatever its size.

What is stored#

Images are inference content and are never stored: they exist in the gateway's memory while the request runs. The receipt holds the hash of the request bytes, which include the image, so keep the exact body you sent if you want to verify it.

Models without vision#

An image part sent to a model without the vision capability is refused with 400 unsupported_parameter before any upstream call.

Was this page helpful?Suggest an edit