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

# Vision via Chat

> OpenAI-style image input, covering both base64 and remote URL usage

> Last updated: 2026-06-06

# Vision via Chat

```
POST /v1/chat/completions
```

Crazyrouter production has verified OpenAI-style `image_url` input on the usual vision models:

* `gpt-4o`, `gpt-4o-mini`, `gpt-5.5`, `gpt-5.5`, and other OpenAI vision models
* Both `data:image/...;base64,...` data URLs and public `https://` URLs work
* The returned `message.content` is currently a plain string

> Recommended order: for local files, use the [image upload endpoint](/en/upload) first to get a `media.crazyrouter.com` temporary URL, then pass it as `image_url`; or send a base64 data URL directly. Remote public URLs also work, but must satisfy the "Remote URL limits" below.

***

## Using a base64 data URL (most reliable)

```bash theme={null}
curl https://api.crazyrouter.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [
      {
        "role": "user",
        "content": [
          {"type": "text", "text": "What color is this image?"},
          {
            "type": "image_url",
            "image_url": {
              "url": "data:image/png;base64,iVBORw0KGgoAAA..."
            }
          }
        ]
      }
    ],
    "max_tokens": 100
  }'
```

Sample response:

```json theme={null}
{
  "model": "gpt-4o-mini",
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "Red."
      }
    }
  ]
}
```

***

## Using a remote https URL

```bash theme={null}
curl https://api.crazyrouter.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [
      {
        "role": "user",
        "content": [
          {"type": "text", "text": "Describe in 5 words."},
          {
            "type": "image_url",
            "image_url": {
              "url": "https://www.gstatic.com/webp/gallery/1.jpg"
            }
          }
        ]
      }
    ],
    "max_tokens": 40
  }'
```

### Remote URL limits

The URL must be **reachable from the Crazyrouter server**, not merely "openable in a browser". Common failure modes:

| Failure                    | Cause                                                                 | Fix                                             |
| -------------------------- | --------------------------------------------------------------------- | ----------------------------------------------- |
| Domain cannot resolve      | Private/invalid host                                                  | Use a public https URL                          |
| 403 Forbidden              | Some CDNs (wikimedia, private S3) block server UAs or require Referer | Use the [upload endpoint](/en/upload) or base64 |
| Content-Type not `image/*` | URL returns HTML or redirects to a login page                         | Make sure it's a direct image link              |
| File over 20MB             | Single-file size limit                                                | Compress or crop before uploading               |

If you see `Unable to process the image you provided. Please verify the image URL is publicly accessible, or upload it as base64.`, the URL is not reachable from the server — work down the table above.

***

## Recommended practice

* For internal assets, private images, or anything whose reachability is uncertain: call [`POST /v1/files/uploads`](/en/upload) first for a 72-hour `media.crazyrouter.com/...` URL, then pass it to `image_url`
* For small (\< 1MB) or one-off images: send a base64 data URL directly, avoiding an extra upload round-trip
* Multi-image inputs and `detail` parameter: the OpenAI upstream supports them; pass them through following OpenAI's official spec
