Skip to navigation

Quickstart

View as MarkdownOpen in Claude

This quickstart runs a NIM LLM and VLM container and sends a first inference request. For installation details, refer to installation.

Prerequisites

Before you start, complete the following prerequisites:

Both PB7 containers require a valid NGC Personal API key at startup whenever they need to download model files, including from Hugging Face. For gated or private Hugging Face models, also provide HF_TOKEN. With a complete model cache or local model store, the NIM can start offline without either credential.

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.

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 to see if the NIM you want to run is listed.

Mounting a local cache directory lets you avoid re-downloading the model on subsequent restarts. Refer to Local Cache for details.

PB7.0 uses the vLLM backend. The image variables in the following commands include the repository and tag. Check the Support Matrix for PB NIMs for supported models and hardware.

Run the container to download the model.

export NIM_LLM_IMAGE=nvcr.io/nim/nvidia/nemotron-3.5-lightning-30b-a3b-pb7:2.1.5-pb7.0
docker run --gpus=all \
-e NGC_API_KEY \
-v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
-p 8000:8000 \
"$NIM_LLM_IMAGE"

Interact with the API

There are three main inference endpoints:

  • Chat Completions: /v1/chat/completions
  • Text Completions: /v1/completions
  • Responses: /v1/responses

All three endpoints support streaming.

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:

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

Use the id returned by /v1/models in requests. For the model-specific example, the ID is nvidia/nemotron-3.5-lightning. A model-free NIM derives its default ID from the model source. In the Hugging Face example above, the ID is openai/gpt-oss-20b.

You can set the environment variable NIM_SERVED_MODEL_NAME to a desired string. This name is used as the model name in API requests. For more information, refer to Environment Variables.

Send a Chat Completion Request

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

curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "nvidia/nemotron-3.5-lightning",
"messages": [
{
"role": "user",
"content": "Hello! How are you?"
}
],
"max_tokens": 100
}'

The expected response:

{
"id":"chatcmpl-9de33afddf166791",
"object":"chat.completion",
"created":1782320669,
"prompt_routed_experts":null,
"model":"nvidia/nemotron-3.5-lightning",
"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?",
"refusal":null,
"annotations":null,
"audio":null,
"function_call":null,
"tool_calls":[
],
"reasoning":null
},
"logprobs":null,
"finish_reason":"stop",
"stop_reason":null,
"token_ids":null,
"routed_experts":null
}
],
"service_tier":null,
"usage":{
"prompt_tokens":41,
"total_tokens":88,
"completion_tokens":47,
"prompt_tokens_details":null
},
"prompt_logprobs":null,
"prompt_token_ids":null,
"prompt_text":null,
"kv_transfer_params":null
}

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:

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

Example response:

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:

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

Example response:

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).

curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model":"nvidia/nemotron-3.5-lightning",
"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:

data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"nvidia/nemotron-3.5-lightning","choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}],"prompt_token_ids":null}
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"nvidia/nemotron-3.5-lightning","choices":[{"index":0,"delta":{"content":"In"},"logprobs":null,"finish_reason":null,"token_ids":null}]}
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"nvidia/nemotron-3.5-lightning","choices":[{"index":0,"delta":{"content":" cir"},"logprobs":null,"finish_reason":null,"token_ids":null}]}
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"nvidia/nemotron-3.5-lightning","choices":[{"index":0,"delta":{"content":"cuits"},"logprobs":null,"finish_reason":null,"token_ids":null}]}
...
data: [DONE]

Next Steps

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