Image understanding
Analyze images with multimodal language models
Image understanding lets a multimodal model describe, compare, classify or extract information from an image. Results are probabilistic and should not replace accessibility review or expert analysis when accuracy is critical. To turn a document page into text, use OCR instead.
Choose a model
Select an active NaviGator AI Toolkit model whose inputs include Image. This guide uses the locally hosted gemma-4-31b-it.
Analyze an image URL
Before running an example, complete Getting Started, configure the documented environment variables and confirm that your key can use gemma-4-31b-it. Replace the placeholder URL with an image you are authorized to process.
The URL must be reachable by the model's hosting platform. Do not use a public URL for non-public data.
curl "$NAVIGATOR_API_BASE_URL/chat/completions" \
--header "Authorization: Bearer $NAVIGATOR_TOOLKIT_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "gemma-4-31b-it",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "Describe this image concisely."},
{"type": "image_url", "image_url": {"url": "https://example.com/image.png"}}
]
}]
}'A successful request returns a description under choices[0].message.content.
Analyze a local image
These examples read an authorized image.png from the current folder and send it inline as a data URL. The Python and JavaScript examples need the openai package from OpenAI-compatible SDKs.
IMAGE_B64=$(base64 < image.png | tr -d '\n')
curl "$NAVIGATOR_API_BASE_URL/chat/completions" \
--header "Authorization: Bearer $NAVIGATOR_TOOLKIT_API_KEY" \
--header "Content-Type: application/json" \
--data @- <<EOF
{
"model": "gemma-4-31b-it",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "Describe this image concisely."},
{"type": "image_url", "image_url": {"url": "data:image/png;base64,$IMAGE_B64"}}
]
}]
}
EOFThe command works on macOS and Linux.
For a JPEG, change image/png to image/jpeg.
A successful request prints the model's image description.
PNG and JPEG images are the safest choice. Supported formats, file sizes and the number of images per request vary by model and provider.
Prompt patterns
- Describe: “Describe the chart and summarize its main trend.”
- Extract: “Return the visible part numbers as a JSON array.”
- Compare: “List the important differences between these two images.”
- Verify: “Does the image contain the required safety label? Explain where.”
Ask the model to state uncertainty and verify extracted facts before using them in an application.
Responses API
Some cloud models support image input through the Responses API. Local models currently use the Chat Completions workflow described above. See Responses API for documented limitations.
This example sends an image URL to the cloud model gpt-5-mini. Replace the placeholder URL with an image you are authorized to process.
Cloud model:
gpt-5-miniis approved for Open data only and is not available to a default personal key. Use a key from a team with cloud models enabled, or use the local Chat Completions examples above.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["NAVIGATOR_TOOLKIT_API_KEY"],
base_url=os.environ.get(
"NAVIGATOR_API_BASE_URL",
"https://api.navigator.ai.ufl.edu/v1",
),
)
response = client.responses.create(
model="gpt-5-mini",
input=[
{
"role": "user",
"content": [
{"type": "input_text", "text": "What is in this image?"},
{
"type": "input_image",
"image_url": "https://example.com/image.png",
},
],
}
],
)
retrieved = client.responses.retrieve(response.id)
print(retrieved.output_text)
client.responses.delete(response.id)A successful request prints the model's answer and then deletes the stored response.