Triton AI Docs

Image input

Send an image to a vision-capable model with Python or cURL.

Select a public model that has supports_vision: true. Send the image and your instruction in one user message.

Send an image URL

image_url.py
import os

from openai import OpenAI

client = OpenAI(
    api_key=os.environ["TRITONAI_API_KEY"],
    base_url="https://tritonai-api.ucsd.edu/v1",
)

completion = client.chat.completions.create(
    model="gpt-5.4",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Describe the main objects in this image."},
                {
                    "type": "image_url",
                    "image_url": {"url": "https://example.com/image.jpg"},
                },
            ],
        }
    ],
)

print(completion.choices[0].message.content)

Send a local image

Convert a local image to a data URL before you send it.

local_image.py
import base64
import mimetypes
from pathlib import Path

image_path = Path("diagram.png")
mime_type = mimetypes.guess_type(image_path.name)[0] or "image/png"
encoded = base64.b64encode(image_path.read_bytes()).decode("ascii")
data_url = f"data:{mime_type};base64,{encoded}"

completion = client.chat.completions.create(
    model="gpt-5.4",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Summarize this diagram."},
                {"type": "image_url", "image_url": {"url": data_url}},
            ],
        }
    ],
)

print(completion.choices[0].message.content)

Protect image data

Make sure that your approval permits the image data before you send it. Do not send P4 data.

Provider limits

Image formats, file sizes, and URL rules depend on the selected model route and provider. The Developer API does not publish one shared image limit.

Test image input with the selected model before production use.

On this page