Get Started with Kimi-K3#

Kimi-K3 is a vision-language model from Moonshot AI. It accepts text and image input. Video input and LoRA are not supported in this release.

Kimi-K3 is served by the vLLM Model-Free NIM, which includes throughput tuning configurations for NVIDIA B200, B300, GB200, and GB300.

The container does not bundle the weights. Set NIM_MODEL_PATH to the MXFP4 or NVFP4 checkpoint you want, and the container downloads it at startup, so one image serves both precisions.

This page covers the deployment settings specific to this model.

Prerequisites#

Before deploying a NIM LLM and VLM container, ensure your environment meets the following requirements:

Hardware Requirements#

The following are the minimum required specifications for supported hardware components:

Requirement

Specification

CPU

AMD64, ARM64

GPU

Refer to the Support Matrix

Software Requirements#

Minimum required versions for supported software components.

Requirement

Specification

Operating System

Ubuntu 22.04 LTS or later recommended

Container Toolkit

1.14.0 or later

CUDA SDK

12.9 or later

GPU Driver

580 or later

Docker

24.0 or later

Operating System#

While other Linux distributions can be compatible with NIM, they have not been officially validated.

We recommend using Ubuntu 22.04 LTS or later for the best experience.

CUDA SDK#

Install CUDA SDK by following the CUDA installation guide for Linux.

GPU Drivers#

Install the NVIDIA GPU drivers by following the NVIDIA Driver Installation Guide.

Docker#

Docker is required to run the containerized NIM services.

  1. Install Docker Engine for your Linux distribution by following the Docker Engine installation guide.

  2. Verify that the Docker daemon is running and that your user can execute docker commands without sudo. Add your user to the docker group if needed:

    sudo groupadd docker
    sudo usermod -aG docker $USER
    
  3. Log out and back in for the group change to take effect.

Container Toolkit#

The NVIDIA Container Toolkit enables Docker containers to access the host GPU.

  1. Install the toolkit by following the NVIDIA Container Toolkit installation guide.

  2. Configure Docker to use the NVIDIA runtime by following the Docker configuration steps.

  3. Restart the Docker daemon after configuration:

    sudo systemctl restart docker
    

NIM Container Access#

To download and deploy NIM containers, you need one of the following:

Generate Access Credentials#

NGC#

An NGC Personal API key is not required to access most NVIDIA NIM containers and models hosted on NGC. An NGC API key is only required to download Production Branch (PB) models. This Get Started documentation uses a feature branch model as an example, so creating an NGC Personal API key is optional.

If you want to create an NGC Personal API key, do the following:

  1. Generate the Personal API Key on the Setup API Keys page.

  2. When creating the Personal API key, select at least NGC Catalog from the Services Included list. You can also include additional services if you want to use the same key for other purposes.

Warning

Legacy API keys are not supported by NIM. Always use a Personal API Key.

Hugging Face#

Create a Hugging Face access token with read permissions (or higher, only if your org or private repos require it). This token allows model-free NIM to fetch models directly from Hugging Face.

Verify NVIDIA Runtime Access#

To ensure that your setup is correct, run the following command:

docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi

This command should produce output similar to one of the following, where you can confirm CUDA driver version, and available GPUs.

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 580.95.05              Driver Version: 580.95.05      CUDA Version: 12.9     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA H100 80GB HBM3          On  |   00000000:1B:00.0 Off |                    0 |
| N/A   36C    P0            112W /  700W |   78489MiB /  81559MiB |      0%      Default |
|                                         |                        |             Disabled |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+

Refer to Kimi-K3 for supported GPUs and node layouts. B300 uses one node with eight GPUs. B200, GB200, and GB300 require multiple nodes and high-speed GPU interconnects; refer to Multi-Node Deployment.

Configuration#

NIM LLM and VLM offers several configuration options using environment variables to control caching, logging, and model profiles.

Export a Hugging Face Access Token#

Export a Hugging Face token to download models from Hugging Face.

  1. Export the variable in your shell (temporary), replacing <token-value> with your actual token:

    export HF_TOKEN="<token-value>"
    
  2. Optional: Persist the variable in your shell profile for future terminals.

    If using bash:

    echo 'export HF_TOKEN="<token-value>"' >> ~/.bashrc
    

    If using zsh:

    echo 'export HF_TOKEN="<token-value>"' >> ~/.zshrc
    
  3. Verify the variable is set:

    echo "$HF_TOKEN"
    

Export an NGC API Key#

Note

An NGC API key is only required to download Production Branch (PB) models. You can skip this section if you did not create an NGC API key.

  1. Export the variable in your shell (temporary), replacing <VALUE> with your actual API key:

    export NGC_API_KEY=<VALUE>
    
  2. Optional: Persist the variable in your shell profile for future terminals.

    If using bash:

    echo "export NGC_API_KEY=$NGC_API_KEY" >> ~/.bashrc
    

    If using zsh:

    echo "export NGC_API_KEY=$NGC_API_KEY" >> ~/.zshrc
    
  3. Verify the variable is set:

    echo "$NGC_API_KEY"
    

Model Cache#

NIM downloads model weights to a cache on the host that you mount into the container. Artifacts persist across restarts, so you do not pull the full model on every run.

Local Cache#

An essential variable to configure on your host system is the cache path directory. This directory is mapped from the host machine to container; assets (for example, model weights) are downloaded to this host directory and persist across container restarts. Configuring a local cache is highly recommended, as it avoids re-downloading large model files upon subsequent container restarts. You can name the environment variable containing the path to the local cache whatever you want.

Create the cache directory and export an environment variable:

export LOCAL_NIM_CACHE=~/.cache/nim
mkdir -p $LOCAL_NIM_CACHE
# Optionally add sticky bit to avoid issues writing to the cache if the container is running as a different user
chmod -R a+rwxt $LOCAL_NIM_CACHE

When you start the NIM container, you must map your host machine’s local cache directory ($LOCAL_NIM_CACHE) to the container’s internal cache path (/opt/nim/.cache) using a Docker volume mount, such as -v "$LOCAL_NIM_CACHE:/opt/nim/.cache". This mapping ensures that the large model weights downloaded by the container are saved to your host machine. Because containers are ephemeral, any data stored only inside the container is lost when it stops. By using a volume mount, subsequent container runs detect the existing model files in your local cache and skip the lengthy download process, allowing the NIM to start up faster.

Cache Directory Permissions#

The NIM container runs as a non-root user with GID 0 (root group). The cache directory on your host must be writable by GID 0:

sudo chgrp -R 0 "$LOCAL_NIM_CACHE"
sudo chmod -R g+rwX "$LOCAL_NIM_CACHE"

Run the container with the cache mounted:

docker run --gpus all \
  -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
  ...

To run as a custom user (for example, your host user), pass -u <uid>:0:

docker run --gpus all -u $(id -u):0 \
  -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
  ...

Important

When using -u <uid>, you must include :0 to set GID 0 (for example, -u $(id -u):0). The container’s writable directories are group-owned by GID 0. Without it, the container will fail with PermissionError when writing to cache, config, or log paths.

Tip

To make this setting permanent across terminal sessions, you can add export LOCAL_NIM_CACHE=~/.cache/nim to your ~/.bashrc or ~/.zshrc profile.

Allow enough persistent storage for the checkpoint and download cache. Each checkpoint is approximately 1.6 TB. Initial download and model loading can take several hours, depending on storage and network performance. Reuse the cache across restarts and allow enough time in startup probes for model loading. Use a separate cache directory for each checkpoint.

Authenticate#

If you created an NGC API key, authenticate with the NVIDIA Container Registry using the following command:

echo "$NGC_API_KEY" | docker login nvcr.io --username '$oauthtoken' --password-stdin

Use $oauthtoken as the username and NGC_API_KEY as the password. The $oauthtoken username is a special name that indicates that you will authenticate with an API key and not a user name and password.

Choose a Checkpoint#

Set NIM_MODEL_PATH to the checkpoint for the precision you want. For every supported combination of GPU, GPU count, and precision, you can find the correct path at Kimi-K3 in the Support Matrix.

NIM selects the profile from the GPUs it detects and the precision of the checkpoint in NIM_MODEL_PATH. Use the node layout listed for your GPU in the Support Matrix. To override the automatic selection, refer to Model Profiles and Selection.

NIM_SERVED_MODEL_NAME sets the name that clients send in the model field. Set it to moonshotai/kimi-k3 to give clients a stable model name across precisions. Refer to Environment Variables for details.

List the Applicable Profiles#

To list the profiles available on your system, run list-model-profiles with the same NIM_MODEL_PATH that you plan to use for deployment. The following example uses the NVFP4 checkpoint:

docker run --rm --gpus all \
  -e NGC_API_KEY \
  -e HF_TOKEN \
  -e NIM_MODEL_PATH=hf://nvidia/Kimi-K3-NVFP4 \
  -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
  -u $(id -u):0 \
  nvcr.io/nim/nvidia/vllm-model-free-nim:2.1.4-kimi-k3 list-model-profiles

To check which profile a running NIM selected, query /v1/metadata and read profile_id and profile_name.

Use an ID returned by the command if you need to select a profile explicitly. Do not construct a profile ID from a generic name such as vllm-mxfp4-tp8-pp1.

Run NIM#

To run the container and download the model, do the following:

  1. Start the container. Set NIM_MODEL_PATH to the checkpoint listed for your GPU and node layout in Kimi-K3. The following example runs the NVFP4 recipe on one node with eight NVIDIA B300 GPUs:

    docker run -it --rm \
      --gpus all \
      --shm-size=16GB \
      -e NGC_API_KEY \
      -e HF_TOKEN \
      -e NIM_MODEL_PATH=hf://nvidia/Kimi-K3-NVFP4 \
      -e NIM_SERVED_MODEL_NAME=moonshotai/kimi-k3 \
      -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
      -u $(id -u):0 \
      -p 8000:8000 \
      nvcr.io/nim/nvidia/vllm-model-free-nim:2.1.4-kimi-k3
    

    For MXFP4, change NIM_MODEL_PATH to hf://moonshotai/Kimi-K3 and use a separate cache directory. The first start downloads approximately 1.6 TB of weights. Initial download and model loading can take several hours, depending on storage and network performance. Check download progress and cache capacity before restarting the container, preserve the cache, and allow enough time in startup probes for model loading. To serve a checkpoint you already downloaded, refer to Model Download.

  2. In another terminal, wait until the server is ready. Poll the readiness endpoint until it returns HTTP 200:

    until [ "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8000/v1/health/ready)" = "200" ]; do sleep 30; done
    curl -s http://localhost:8000/v1/health/ready
    

    Inspect the startup log while waiting.

Deploy Across Multiple Nodes#

Follow Multi-Node Deployment to install LeaderWorkerSet, configure registry and Hugging Face secrets, and provide shared storage. Use the same container image, checkpoint, and served model name on every node.

Apply the following settings to the Helm chart for your GPU layout:

GPU

multiNode.workers

multiNode.tensorParallelSize

multiNode.pipelineParallelSize

GPUs Requested per Pod

B200

1

8

2

8

GB200

3

8

2

4

GB300

1

8

1

4

The worker count excludes the leader. For example, GB200 needs one leader and three workers, each requesting four GPUs. Set model.modelPath to your chosen checkpoint and model.hfTokenSecret to the secret containing HF_TOKEN. Set the served model name through the chart’s env values:

env:
  - name: NIM_SERVED_MODEL_NAME
    value: moonshotai/kimi-k3

Set model.jsonLogging=false as required by the multi-node deployment guide. Set both GPU resource requests and limits to the per-pod count in the table.

Interact with the API#

This NIM runs vLLM, so the endpoints and request fields in API Reference apply. Confirm that /v1/models lists moonshotai/kimi-k3, and inspect /v1/metadata to confirm the checkpoint and selected profile.

Send a Chat Completion Request#

curl -s http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "moonshotai/kimi-k3",
    "messages": [{"role": "user", "content": "Explain how a rainbow forms."}],
    "max_tokens": 8192
  }'

Send an Image#

curl -s http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "moonshotai/kimi-k3",
    "messages": [{"role": "user", "content": [
      {"type": "text", "text": "Describe this image."},
      {"type": "image_url", "image_url": {"url": "https://assets.ngc.nvidia.com/products/api-catalog/phi-3-5-vision/example1b.jpg"}}
    ]}],
    "max_tokens": 8192
  }'