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"}}
]
}]
}
JSONOn 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
httporhttpsURL - 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
| Limit | Value | Status if exceeded |
|---|---|---|
| Total media size per request | 12 MiB, decoded, across all parts | 413 |
| Media parts per request | 100 | 413 |
| Video input | kimi-k3 and kimi-k3.1-pro only; see Video input | 400 on other models |
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.
Video input
kimi-k3 and kimi-k3.1-pro also accept video. Add a video_url content part with a Base64 MP4 data URI:
{"type": "video_url", "video_url": {"url": "data:video/mp4;base64,..."}}Video counts toward the same per-request media limits as images. Engy samples frames from the clip, so a video costs input tokens in proportion to its length and resolution; the exact count is reported in usage.prompt_tokens. Very long or corrupt clips are rejected with HTTP status 400 before they are processed. Other models return 400 for video parts.
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.