Quickstart
How to Choose the Right Model Profile
NIM LLM 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
Before running a NIM LLM container, make sure you have
fulfilled all prerequisites and followed the
installation and configuration
steps. This includes pulling the container image, configuring your
LOCAL_NIM_CACHE, and setting any credentials required by your chosen image,
tag, or model source. For eligible public-catalog NIMs, NGC_API_KEY and Docker login are optional for eligible public-catalog NIMs. Model-source credentials, such as HF_TOKEN, may still be required.
Mounting a local cache directory lets you avoid re-downloading the model on subsequent restarts. Refer to Local Cache for details.
The exact image tag varies depending on the container type and backend you intend to deploy. Set ${NIM_LLM_IMAGE} and ${NIM_LLM_MODEL_FREE_IMAGE} to the vLLM or SGLang image and tag for your model and GPU. Check the Support Matrix for NIMs for the image and version to use.
Model-Specific NIM
Model-Free 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.
An NGC API key is only required to download Production Branch (PB) models or
NIMs released prior to NIM LLM 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).
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:
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). For
model-free NIMs, the name is set by the NIM_SERVED_MODEL_NAME environment variable
(or the name is ga-model-free-nim if the environment variable is not set).
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
Once the server is running, you can send a request to the chat completion endpoint:
The expected response:
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:
Example response:
Ready Endpoint
Perform a readiness check to see if the model is fully loaded and ready for inference:
Example response:
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).
The response will be streamed back in chunks, with each chunk containing a data JSON object. The stream terminates with a data: [DONE] message: