> ## Documentation Index
> Fetch the complete documentation index at: https://impossibl.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Vision and image input

> Send images alongside text on Chat Completions, the Responses API and Anthropic Messages. Output stays text, and image tokens are billed as input tokens.

The gateway accepts **image input** on Chat Completions, the Responses API, and
Messages. Mix images with text in a user message and the model reasons over both.
Output on these surfaces is still text only — for image output, see
[Image generation](/docs/image-generation).

Two image sources work everywhere:

* **`http(s)` URL** — passed through; the provider fetches it.
* **`data:` URI** — a base64 data URL (`data:image/png;base64,...`); the gateway
  splits it into the raw base64 + media type that providers accept directly.

Image tokens are counted by the provider and billed like any other tokens — no
separate pricing (see [Models & pricing](/docs/models#credits)).

## Chat Completions

Use OpenAI-style `image_url` content parts in a user message:

```bash theme={null}
curl https://api.impossibl.com/v1/chat/completions \
  -H "Authorization: Bearer imp-rt-..." \
  -H 'content-type: application/json' \
  -d '{
    "model": "openai/gpt-4o-mini",
    "messages": [{
      "role": "user",
      "content": [
        { "type": "text", "text": "What is in this image?" },
        { "type": "image_url", "image_url": { "url": "https://example.com/cat.png" } }
      ]
    }]
  }'
```

A `data:` URI works in the same `url` field:

```json theme={null}
{ "type": "image_url", "image_url": { "url": "data:image/png;base64,iVBORw0KGgo..." } }
```

## Responses API

Use `input_image` parts. `image_url` may be a string or a `{ "url": "..." }`
object, paired with `input_text`:

```bash theme={null}
curl https://api.impossibl.com/v1/responses \
  -H "Authorization: Bearer imp-rt-..." \
  -H 'content-type: application/json' \
  -d '{
    "model": "openai/gpt-4o-mini",
    "input": [{
      "role": "user",
      "content": [
        { "type": "input_text", "text": "What is in this image?" },
        { "type": "input_image", "image_url": "https://example.com/cat.png" }
      ]
    }]
  }'
```

## Messages (Anthropic)

Use an `image` content block with a `source`. The gateway accepts both Anthropic
source types — `url` and `base64`. (A bare `claude-...` model id routes to
Anthropic; any `provider/model` id also works here — see
[SDKs & integrations](/docs/integrations#anthropic-sdk).)

```bash theme={null}
curl https://api.impossibl.com/v1/messages \
  -H "x-api-key: imp-rt-..." \
  -H 'content-type: application/json' \
  -d '{
    "model": "claude-haiku-4-5",
    "max_tokens": 256,
    "messages": [{
      "role": "user",
      "content": [
        { "type": "text", "text": "What is in this image?" },
        { "type": "image", "source": { "type": "url", "url": "https://example.com/cat.png" } }
      ]
    }]
  }'
```

A base64 source carries `media_type` + `data`:

```json theme={null}
{ "type": "image", "source": {
  "type": "base64", "media_type": "image/png", "data": "iVBORw0KGgo..."
}}
```

<Note>
  Not every model is multimodal. Pick a vision-capable model (e.g.
  `openai/gpt-4o`, `anthropic/claude-sonnet-4-5`, `google/gemini-2.5-pro`); sending
  an image to a text-only model surfaces the provider's error as
  [`502 upstream_error`](/docs/errors).
</Note>
