> This page is for version 2.1.4.
> For other versions, use one of these documentation indexes:
> - 2.1.6 (Latest) (default): https://docs.nvidia.com/nim/large-language-models/2.1.6/llms.txt
> - 2.1.5: https://docs.nvidia.com/nim/large-language-models/2.1.5/llms.txt
> - 2.1.4: https://docs.nvidia.com/nim/large-language-models/2.1.4/llms.txt
> - 2.0.13: https://docs.nvidia.com/nim/large-language-models/2.0.13/llms.txt
> - 2.0.12: https://docs.nvidia.com/nim/large-language-models/2.0.12/llms.txt
> - 2.0.11: https://docs.nvidia.com/nim/large-language-models/2.0.11/llms.txt
> - 2.0.10: https://docs.nvidia.com/nim/large-language-models/2.0.10/llms.txt
> - 2.0.9: https://docs.nvidia.com/nim/large-language-models/2.0.9/llms.txt
> - 2.0.8: https://docs.nvidia.com/nim/large-language-models/2.0.8/llms.txt
> - 2.0.4-pb6: https://docs.nvidia.com/nim/large-language-models/2.0.4-pb6/llms.txt
> - Archive: https://docs.nvidia.com/nim/large-language-models/archive/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nim/large-language-models/llms.txt.

# Image, Audio, and Video Input

> Send image, audio, or video input to NIM LLM and VLM multimodal models through OpenAI-compatible Chat Completions requests.

NIM LLM and VLM can serve multimodal models that accept image, audio,
or video input. Each container image includes either the vLLM or SGLang inference engine.
Supported media types depend on the container image and model. Use OpenAI-compatible Chat
Completions requests with a mixed content array that contains text and media items.

> **Note**
>
> This guide applies to models that support the media type you send. A text-only
> model cannot process image, audio, or video input. For model-specific
> limitations, refer to the model card and the [Support Matrix for NIMs](/nim/large-language-models/2.1.4/reference/support-matrix).

The following table lists supported content parts. The model must support the corresponding media type:

| Media Type | Content Part               | Backend Support                                                   |
| ---------- | -------------------------- | ----------------------------------------------------------------- |
| Image      | `image_url`                | vLLM and SGLang                                                   |
| Audio      | `audio_url`, `input_audio` | vLLM and SGLang                                                   |
| Video      | `video_url`                | vLLM; requires video decoding dependencies in the container image |

To confirm which engine your container runs, check its startup logs or the selected profile description. For more information, refer to [Model Profiles and Selection](/nim/large-language-models/2.1.4/deployment/model-profiles-and-selection).

## Prerequisites

Before you send image, audio, or video input, make sure you have the following:

* A NIM LLM and VLM container image (vLLM or SGLang). Both backends support
  image and audio input, but video input requires a vLLM backend.
* A model that supports image input, audio input, or video input (or some combination).
* A running NIM server and the served model name from `/v1/models`.
* Media URLs that are reachable from the NIM container.
* The Python package for the examples you run: `openai` for the OpenAI Python
  SDK examples or `langchain-openai` for the LangChain examples.

## Send an Image Request

Send image input with a chat message content array that combines the prompt
text with either a remote image URL or inline image bytes.

### Use an External URL

Use an `image_url` item inside the chat message content array.

#### cURL

```bash
curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<served-model-name>",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Describe this image in one sentence."
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "https://assets.ngc.nvidia.com/products/api-catalog/phi-3-5-vision/example1b.jpg"
            }
          }
        ]
      }
    ],
    "max_completion_tokens": 512,
    "temperature": 0.2
  }'
```

#### OpenAI Python SDK

```bash
pip install openai
```

```python
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8000/v1",
    api_key="not-used",
)

response = client.chat.completions.create(
    model="<served-model-name>",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Describe this image in one sentence."},
                {
                    "type": "image_url",
                    "image_url": {"url": "https://assets.ngc.nvidia.com/products/api-catalog/phi-3-5-vision/example1b.jpg"},
                },
            ],
        }
    ],
    max_completion_tokens=512,
    temperature=0.2,
)

print(response.choices[0].message.content)
```

#### LangChain

```bash
pip install langchain-openai
```

```python
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="<served-model-name>",
    base_url="http://localhost:8000/v1",
    api_key="not-used",
    max_completion_tokens=512,
    temperature=0.2,
)

response = llm.invoke(
    [
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Describe this image in one sentence."},
                {
                    "type": "image_url",
                    "image_url": {"url": "https://assets.ngc.nvidia.com/products/api-catalog/phi-3-5-vision/example1b.jpg"},
                },
            ],
        }
    ]
)

print(response.content)
```

### Send Inline Image Data

To avoid downloading an image from a URL at request time, use Python's `base64`
module and `pathlib.Path` to encode the image bytes.

```python
import base64
from pathlib import Path

image_b64 = base64.b64encode(Path("image.jpg").read_bytes()).decode("utf-8")
```

Pass the encoded bytes inline by setting `image_url.url` to a data URL such as
`data:image/jpeg;base64,<base64-data>`. Match the MIME type to the file, such as
`image/png` for a PNG file.

## Send an Audio Request

Send audio input with a chat message content array that combines the prompt
text with either a remote audio URL or inline audio bytes.

### Use an External URL

Audio input uses the `audio_url` content part, an extension to the OpenAI Chat
Completions schema that both the vLLM and SGLang images accept. Use an
`audio_url` item inside the chat message content array.

Both backends also accept the OpenAI `input_audio` content part for inline audio. The following examples use `audio_url`.

#### cURL

```bash
curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<served-model-name>",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Transcribe and summarize this audio."
          },
          {
            "type": "audio_url",
            "audio_url": {
              "url": "https://assets.ngc.nvidia.com/products/api-catalog/gemma3n/speech.wav"
            }
          }
        ]
      }
    ],
    "max_completion_tokens": 512,
    "temperature": 0.2
  }'
```

#### OpenAI Python SDK

```bash
pip install openai
```

```python
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8000/v1",
    api_key="not-used",
)

response = client.chat.completions.create(
    model="<served-model-name>",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Transcribe and summarize this audio."},
                {
                    "type": "audio_url",
                    "audio_url": {"url": "https://assets.ngc.nvidia.com/products/api-catalog/gemma3n/speech.wav"},
                },
            ],
        }
    ],
    max_completion_tokens=512,
    temperature=0.2,
)

print(response.choices[0].message.content)
```

#### LangChain

```bash
pip install langchain-openai
```

```python
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="<served-model-name>",
    base_url="http://localhost:8000/v1",
    api_key="not-used",
    max_completion_tokens=512,
    temperature=0.2,
)

response = llm.invoke(
    [
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Transcribe and summarize this audio."},
                {
                    "type": "audio_url",
                    "audio_url": {"url": "https://assets.ngc.nvidia.com/products/api-catalog/gemma3n/speech.wav"},
                },
            ],
        }
    ]
)

print(response.content)
```

### Send Inline Audio Data

To avoid downloading an audio file from a URL at request time, use Python's
`base64` module and `pathlib.Path` to encode the audio bytes.

```python
import base64
from pathlib import Path

audio_b64 = base64.b64encode(Path("speech.wav").read_bytes()).decode("utf-8")
```

Pass the encoded bytes inline by setting `audio_url.url` to a data URL such as
`data:audio/wav;base64,<base64-data>`. Match the MIME type to the file, such as
`audio/mpeg` for an MP3 file or `audio/flac` for a FLAC file.

## Send a Video Request

> **Info**
>
> Use a vLLM container image for these video examples. The SGLang container images do not include the video decoder required for `video_url` requests.

Send video input with a chat message content array that combines the prompt
text with either a remote video URL or inline video bytes.

### Use an External URL

Video input uses the `video_url` content part, an extension to the OpenAI Chat
Completions schema. Use a `video_url` item inside the chat message content array.

#### cURL

```bash
curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<served-model-name>",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Describe what is happening in this video in one sentence."
          },
          {
            "type": "video_url",
            "video_url": {
              "url": "https://assets.ngc.nvidia.com/products/api-catalog/sam-2/example1/sample1.mp4"
            }
          }
        ]
      }
    ],
    "max_completion_tokens": 512,
    "temperature": 0.2
  }'
```

#### OpenAI Python SDK

```bash
pip install openai
```

```python
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8000/v1",
    api_key="not-used",
)

response = client.chat.completions.create(
    model="<served-model-name>",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Describe what is happening in this video in one sentence.",
                },
                {
                    "type": "video_url",
                    "video_url": {"url": "https://assets.ngc.nvidia.com/products/api-catalog/sam-2/example1/sample1.mp4"},
                },
            ],
        }
    ],
    max_completion_tokens=512,
    temperature=0.2,
)

print(response.choices[0].message.content)
```

#### LangChain

```bash
pip install langchain-openai
```

```python
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="<served-model-name>",
    base_url="http://localhost:8000/v1",
    api_key="not-used",
    max_completion_tokens=512,
    temperature=0.2,
)

response = llm.invoke(
    [
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Describe what is happening in this video in one sentence.",
                },
                {
                    "type": "video_url",
                    "video_url": {"url": "https://assets.ngc.nvidia.com/products/api-catalog/sam-2/example1/sample1.mp4"},
                },
            ],
        }
    ]
)

print(response.content)
```

### Send Inline Video Data

To avoid downloading a video from a URL at request time, use Python's `base64`
module and `pathlib.Path` to encode the video bytes.

```python
import base64
from pathlib import Path

video_b64 = base64.b64encode(Path("video.mp4").read_bytes()).decode("utf-8")
```

Pass the encoded bytes inline by setting `video_url.url` to
`data:video/mp4;base64,<base64-data>`.