Send images
Ask a model about a photo or a screenshot, by link or with the image in the request.
Models that read images, such as nvidia/nemotron-3-nano-omni, take them in user messages alongside text. Models says which models read images.
Send an image by link
Give the message a list of parts: text, and an image_url with an https link the model can fetch.
curl -s "$AI_URL/chat/completions" \
-H "Authorization: Bearer $AI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nvidia/nemotron-3-nano-omni",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "What does this receipt total?"},
{
"type": "image_url",
"image_url": {"url": "https://example.com/receipt.jpg"}
}
]
}]
}' | jq -r '.choices[0].message.content'Send the image itself
To send an image that is not online, put it in a data: URL:
IMAGE=$(base64 < receipt.jpg | tr -d '\n')
curl -s "$AI_URL/chat/completions" \
-H "Authorization: Bearer $AI_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"model\": \"nvidia/nemotron-3-nano-omni\",
\"messages\": [{
\"role\": \"user\",
\"content\": [
{\"type\": \"text\", \"text\": \"What does this receipt total?\"},
{
\"type\": \"image_url\",
\"image_url\": {\"url\": \"data:image/jpeg;base64,$IMAGE\"}
}
]
}]
}" | jq -r '.choices[0].message.content'Rules for images
- Only user messages can hold images.
- Links must be
https, ordata:image/URLs. - The whole request, images included, can be up to 8 MB.
- Images count toward the model’s input tokens, and so toward your units.
- Sending an image to a model that does not read images is refused with Validation failed, naming the part.
Last updated