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 have followed the steps in the installation and configuration steps. This includes setting your API keys, logging in to Docker, pulling the container image, and configuring your LOCAL_NIM_CACHE.
Mounting a local cache directory lets you avoid re-downloading the model on subsequent restarts. Refer to Local Cache for details.
Model-Specific NIM
Model-Free NIM
Run the container using your NGC API Key to authenticate and download the model.
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 <model-name> 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 derived from the container image.
The model name is user-configurable by setting the NIM_SERVED_MODEL_NAME
environment variable. 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: