Skip to content

Image input

Send images to vision models as inline content in chat requests.

This page explains how to send images to models that accept image input, and which limits apply. It is intended for developers who build applications that analyze images.

Supported models

Only some models accept images. In Models and pricing, these models list Text, image as their input. The GET /v1/models endpoint reports the same information in input_modalities.

If you send an image to a model that does not accept images, the request fails with HTTP status 400 before it is processed.

Send an image

Add an image_url content part to a user message. The URL must be a Base64 data URI:

IMG="data:image/png;base64,$(base64 -w0 photo.png)"

curl https://api.engy.ai/v1/chat/completions \
  -H "Authorization: Bearer $ENGY_API_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<JSON
{
  "model": "kimi-k3",
  "messages": [{
    "role": "user",
    "content": [
      {"type": "text", "text": "What is in this image?"},
      {"type": "image_url", "image_url": {"url": "$IMG"}}
    ]
  }]
}
JSON

On macOS, use base64 -i photo.png instead of base64 -w0 photo.png.

You can combine text and several images in one message, and across messages, within the limits below. The output is always text.

Use inline images only

The image must be a data URI in the form data:image/<type>;base64,<data>. Engy does not download images from URLs. The following values fail with HTTP status 400:

  • An http or https URL
  • A data URI that does not contain an image
  • A data URI that is not Base64-encoded

To use an image from the web, download it in your application and send it as a data URI.

Limits

LimitValueStatus if exceeded
Total media size per request12 MiB, decoded, across all parts413
Media parts per request100413
Video inputNot supported400

The size limit applies to the decoded bytes. The Base64-encoded payload can be about one third larger.

For each image, Engy reserves credit for 1,024 input tokens before the request starts. You are charged for the tokens that the model actually reports.

Anthropic image blocks

On /v1/messages, send an image content block with a base64 source:

{
  "type": "image",
  "source": {"type": "base64", "media_type": "image/png", "data": "..."}
}

Images with a url source are subject to the same data URI rule and fail with HTTP status 400. Images in assistant messages are ignored.

The /v1/responses endpoint does not support image input.