# Images

> Send images with your text in the OpenAI content-part format.

Source: https://www.lyber.ai/docs/capabilities/images/ · Markdown: https://www.lyber.ai/docs/md/capabilities/images.md

> **Preview:** The API accepts image parts on both models, but neither model has been qualified for image understanding yet. Check answers about images before you rely on them.

Put an `image_url` part in a user message's `content` array, next to a `text` part. The URL can be a base64 `data:` URL or an `https` URL.

Python (`main.py`):

```python
import base64
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://lyber-paid-acceptance-gateway-production.up.railway.app/v1",
    api_key=os.environ["LYBER_API_KEY"],
)

with open("photo.jpg", "rb") as file:
    image = base64.b64encode(file.read()).decode()

response = client.chat.completions.create(
    model="minimax-m3.1-flash-abliterated",
    messages=[{
        "role": "user",
        "content": [
            {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{image}"}},
            {"type": "text", "text": "What is in this image?"},
        ],
    }],
    max_tokens=1024,
)
print(response.choices[0].message.content)
```

curl (`request.sh`):

```bash
IMAGE=$(base64 < photo.jpg | tr -d '\n')

curl https://lyber-paid-acceptance-gateway-production.up.railway.app/v1/chat/completions \
  -H "Authorization: Bearer $LYBER_API_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<EOF
{
  "model": "minimax-m3.1-flash-abliterated",
  "messages": [{
    "role": "user",
    "content": [
      {"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,$IMAGE"}},
      {"type": "text", "text": "What is in this image?"}
    ]
  }],
  "max_tokens": 1024
}
EOF
```

## Limits

| Limit | Value |
| --- | --- |
| Messages and tools, as JSON | 8 MiB, base64 images included (`400 context_length_exceeded`) |
| Whole request body | 16 MiB (`413`) |
| Time to upload the body | 15 seconds (`408 request_timeout`) |
| `detail` | `auto`, `low`, `high` or `original` |

Base64 adds about a third to an image's size, so 8 MiB holds roughly 6 MiB of image files. Resize large photos before sending; a long edge of 2048 pixels is plenty for most questions.

The [Responses API](https://www.lyber.ai/docs/api/responses/) accepts `input_image` parts with an `image_url`; `file_id` references are not supported.
