# Images as input

> Send images to vision models as URLs or base64 data URLs, in OpenAI or Anthropic format. Routing picks only models that accept images.

Source: https://digitspace.ai/docs/api/images · Last checked: 2026-10-31

Add an image part to a user message. The gateway is text-in, text-out: models can read images, but it doesn't generate images, audio or video.

Python:

```python
reply = client.chat.completions.create(
    model="auto",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "What's in this picture?"},
            {"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}},
        ],
    }],
)
```

TypeScript:

```ts
const reply = await client.chat.completions.create({
  model: "auto",
  messages: [
    {
      role: "user",
      content: [
        { type: "text", text: "What's in this picture?" },
        {
          type: "image_url",
          image_url: { url: "https://example.com/photo.jpg" },
        },
      ],
    },
  ],
});
```

## URL or data URL

- A **URL** must be one the provider can fetch.
- A **data URL**, such as `data:image/png;base64,iVBOR…`, works everywhere and is the safe choice. AWS Bedrock accepts only data URLs, in PNG, JPEG, GIF or WebP.

Both are converted when the request is translated: a data URL becomes Anthropic's base64 source, a URL becomes its URL source, and the reverse on `/v1/messages`.

## Which models are used

A request with an image only goes to offers that support vision. If you name a model that can't read images, you get `400 capability_mismatch`. On the [models page](/models), filter by **Vision**.

## Size and guardrails

The whole request body can be up to 20 MB. Larger requests get `413`. If your organisation's [guardrails](/docs/control/guardrails) limit file types or sizes, an image that breaks the rule is blocked or replaced with the text `[file removed]`, depending on the rule's action.
