Quickstart
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:
- Complete the requirements in prerequisites.
- Configure
LOCAL_NIM_CACHEand any credentials required by your image, tag, or model source by following configuration. - Pull the container image by following 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.
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.
Choose a vLLM or SGLang image and tag for your model and GPU from the Support Matrix for NIMs. The run and inference steps on this page apply to both engines.
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 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).
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.
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.
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). Set the name with NIM_SERVED_MODEL_NAME or use the name NIM derives from the model source. Refer to Model-Free NIM for examples.
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.
Send a Chat Completion Request
After the server is running, you can send a request to the chat completion endpoint:
The expected response:
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:
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 is streamed back in chunks, with each chunk containing a data JSON object. The stream terminates with a data: [DONE] message:
Next Steps
After the container is serving requests, explore the following resources: