> This page is for version 2.1.6 (Latest) (default).
> 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.

# Quickstart

> Run a NIM LLM and VLM container and send your first inference request, from a pulled image to a working API call.

This quickstart runs a NIM LLM and VLM container and sends a first inference request. For installation details, refer to [installation](/nim/large-language-models/get-started/installation).

## Prerequisites

Before you start, complete the following prerequisites:

* Complete the requirements in [prerequisites](/nim/large-language-models/get-started/prerequisites).
* Configure `LOCAL_NIM_CACHE` and any credentials required by your image, tag, or model source by following [configuration](/nim/large-language-models/get-started/configuration).
* Pull the container image by following [installation](/nim/large-language-models/get-started/installation).

For eligible public-catalog NIMs, `NGC_API_KEY` and Docker login are optional. Model-source credentials, such as `HF_TOKEN`, can still be required.

## How to Choose the Right Model Profile

NIM LLM and VLM automatically selects the most optimal model profile based on the detected hardware (for example, number of GPUs or GPU architecture). If you need to manually override this selection, you can specify the `NIM_MODEL_PROFILE` environment variable. For more information, refer to [Model Profiles](/nim/large-language-models/deployment/model-profiles-and-selection).

## Run NIM

To run a NIM LLM and VLM container and download the model, complete the following steps according to your NIM type.

Some NIM LLM and VLM containers need extra profile selection or
startup settings beyond the standard path. Refer to
[Model-Specific Deployment Considerations](/nim/large-language-models/get-started/advanced/model-specific-deployment-considerations)
to see if the NIM you want to run is listed.

> **Tip**
>
> Mounting a local cache directory lets you avoid re-downloading the model on subsequent restarts. Refer to [Local Cache](/nim/large-language-models/get-started/configuration#configure-local-cache) for details.

> **Note**
>
> Choose a vLLM or SGLang image and tag for your model and GPU from the [Support Matrix for NIMs](/nim/large-language-models/reference/support-matrix). The run and inference steps on this page apply to both engines.

#### Model-Specific NIM

Run the container to download the model.

You can omit the `-e NGC_API_KEY=$NGC_API_KEY` line from `docker run` commands
when the selected image and model artifacts support keyless access.

> **Note**
>
> An NGC API key is only required to download Production Branch (PB) models or
> NIMs released prior to NIM LLM and VLM version 2.0.10. PB releases
> are indicated by the `-pb<version>` suffix in the model name (for example,
> `llama-3.1-8b-instruct-pb6`).

```bash
export NIM_LLM_IMAGE=nvcr.io/nim/meta/llama-3.1-8b-instruct:2.1.6

docker run --gpus=all \
  -e NGC_API_KEY=$NGC_API_KEY \
  -e NIM_SERVED_MODEL_NAME="meta/llama-3.1-8b-instruct" \
  -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
  -p 8000:8000 \
  ${NIM_LLM_IMAGE}
```

#### Model-Free NIM

Some model-free NIM deployments require a separate serving recipe with
model-specific runtime settings. Check your model's entry under **Model-Free
NIM** in the [Support Matrix for NIMs](/nim/large-language-models/reference/support-matrix#model-free-nim-support). If it specifies an
NGC collection with a separate recipe, follow
[Run with a Downloaded Serving Recipe](/nim/large-language-models/deployment/model-free-nim#model-free-nim-serving-recipes)
to download and load the recipe with `NIM_CONFIG_FILE`.

For deployments that do not require a separate recipe, run the container with
the model-source credentials required by your selected model. The following
example uses a Hugging Face token to authenticate and download the model.

```bash
export NIM_LLM_MODEL_FREE_IMAGE=nvcr.io/nim/nvidia/vllm-model-free-nim:2.1.6

docker run --gpus=all \
  -e NIM_MODEL_PATH=$NIM_MODEL_PATH \
  -e NIM_SERVED_MODEL_NAME="openai/gpt-oss-20b" \
  -e HF_TOKEN=$HF_TOKEN \
  -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
  -p 8000:8000 \
  ${NIM_LLM_MODEL_FREE_IMAGE}
```

> **Note**
>
> If you want to serve a pre-downloaded local model or a private cloud model instead of downloading one from Hugging Face, refer to [Model Downloads](/nim/large-language-models/deployment/model-download) for your workflow.

## Interact with the API

There are three main inference endpoints:

* **Chat Completions**: `/v1/chat/completions`
* **Text Completions**: `/v1/completions`
* **Responses**: `/v1/responses`

> **Tip**
>
> All three endpoints support [streaming](#streaming).

The examples on this page use text-only Chat Completions requests. For supported media types and model-specific input requirements, refer to [Image, Audio, and Video Input](/nim/large-language-models/advanced-use-cases/multimodal-input).

### Find the Model Name

Replace the `"model"` value in the examples below with the model name served by
your NIM container. To find it, query the models endpoint:

```bash
curl -s http://localhost:8000/v1/models
```

The `id` field in the response is the model name to use in your requests. For model-specific NIMs, this matches the model identifier (for example, `meta/llama-3.1-8b-instruct`). Set the name with `NIM_SERVED_MODEL_NAME` or use the name NIM derives from the model source. Refer to [Model-Free NIM](/nim/large-language-models/deployment/model-free-nim) for examples.

> **Note**
>
> Set `NIM_SERVED_MODEL_NAME` to the model name you want clients to use in API requests. On SGLang, the name must not contain `:`, which separates the base model name from a LoRA adapter name. For details, refer to [Environment Variables](/nim/large-language-models/reference/environment-variables).

### Send a Chat Completion Request

After the server is running, you can send a request to the chat completion endpoint:

```bash
curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "meta/llama-3.1-8b-instruct",
    "messages": [
      {
        "role": "user",
        "content": "Hello! How are you?"
      }
    ],
    "max_tokens": 100
  }'
```

The expected response:

```json
{
  "id":"chatcmpl-9de33afddf166791",
  "object":"chat.completion",
  "created":1782320669,
  "model":"meta/llama-3.1-8b-instruct",
  "choices":[
    {
      "index":0,
      "message":{
        "role":"assistant",
        "content":"I'm just a language model, so I don't have feelings or emotions like humans do. However, I'm functioning properly and ready to assist you with any questions or tasks you may have. How can I help you today?"
      },
      "logprobs":null,
      "finish_reason":"stop"
    }
  ],
  "usage":{
    "prompt_tokens":41,
    "total_tokens":88,
    "completion_tokens":47
  }
}
```

Responses can include additional fields that depend on the inference engine, such as vLLM's `system_fingerprint` or SGLang's `matched_stop`. Clients should accept additional fields without requiring them to be present.

### Verify Health Endpoints

You can verify that the NIM container is running and ready to accept requests by checking its health endpoints. By default, these endpoints are served on port `8000`. If you set `NIM_HEALTH_PORT`, use that port instead.

#### Live Endpoint

Perform a liveness check to see if the server is running:

```bash
curl -v http://localhost:8000/v1/health/live
```

Example response:

```http
GET /v1/health/live HTTP/1.1
Host: localhost:8000
User-Agent: curl/7.81.0
Accept: */*

HTTP/1.1 200 OK
Server: nginx/1.18.0 (Ubuntu)
Content-Type: application/json
Content-Length: 61
Connection: keep-alive
Cache-Control: no-store, no-cache, must-revalidate

{
  "object": "health.response",
  "message": "live",
  "status": "live"
}
```

#### Ready Endpoint

Perform a readiness check to see if the model is fully loaded and ready for inference:

```bash
curl -v http://localhost:8000/v1/health/ready
```

Example response:

```http
GET /v1/health/ready HTTP/1.1
Host: localhost:8000
User-Agent: curl/7.81.0
Accept: */*

HTTP/1.1 200 OK
Server: nginx/1.18.0 (Ubuntu)
Content-Type: application/json
Content-Length: 63
Connection: keep-alive
Cache-Control: no-store, no-cache, must-revalidate

{
  "object": "health.response",
  "message": "ready",
  "status": "ready"
}
```

### Streaming

To receive responses incrementally as they are generated, you can enable streaming by adding `"stream": true` to your request payload. This is supported across the `/v1/chat/completions`, `/v1/completions`, and `/v1/responses` endpoints.

When streaming is enabled, the API returns a sequence of Server-Sent Events (SSE).

```bash
curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model":"meta/llama-3.1-8b-instruct",
    "messages": [
      {
        "role": "user",
        "content": "Write a short poem about a robot."
      }
    ],
    "max_tokens": 100,
    "stream": true
  }'
```

The response is streamed back in chunks, with each chunk containing a `data` JSON object. The stream terminates with a `data: [DONE]` message:

```text
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"meta/llama-3.1-8b-instruct","choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"meta/llama-3.1-8b-instruct","choices":[{"index":0,"delta":{"content":"In"},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"meta/llama-3.1-8b-instruct","choices":[{"index":0,"delta":{"content":" cir"},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"meta/llama-3.1-8b-instruct","choices":[{"index":0,"delta":{"content":"cuits"},"logprobs":null,"finish_reason":null}]}

...

data: [DONE]
```

## Next Steps

After the container is serving requests, explore the following resources:

#### [Environment Variables](/nim/large-language-models/reference/environment-variables)

Set served model names, health port, and other runtime variables.

#### [Model Profiles and Selection](/nim/large-language-models/deployment/model-profiles-and-selection)

Override automatic profile selection or inspect available profiles.

#### [Model Download](/nim/large-language-models/deployment/model-download)

Serve a pre-downloaded local model or a private cloud model.

#### [Advanced Configuration](/nim/large-language-models/reference/advanced-configuration)

Configure TLS, logging, and profile overrides for production.