> This page is for version 2.1.4.
> For other versions, use one of these documentation indexes:
> - 2.1.6 (Latest) (default): https://docs.nvidia.com/nim/large-language-models/2.1.6/llms.txt
> - 2.1.5: https://docs.nvidia.com/nim/large-language-models/2.1.5/llms.txt
> - 2.1.4: https://docs.nvidia.com/nim/large-language-models/2.1.4/llms.txt
> - 2.0.13: https://docs.nvidia.com/nim/large-language-models/2.0.13/llms.txt
> - 2.0.12: https://docs.nvidia.com/nim/large-language-models/2.0.12/llms.txt
> - 2.0.11: https://docs.nvidia.com/nim/large-language-models/2.0.11/llms.txt
> - 2.0.10: https://docs.nvidia.com/nim/large-language-models/2.0.10/llms.txt
> - 2.0.9: https://docs.nvidia.com/nim/large-language-models/2.0.9/llms.txt
> - 2.0.8: https://docs.nvidia.com/nim/large-language-models/2.0.8/llms.txt
> - 2.0.4-pb6: https://docs.nvidia.com/nim/large-language-models/2.0.4-pb6/llms.txt
> - Archive: https://docs.nvidia.com/nim/large-language-models/archive/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nim/large-language-models/llms.txt.

# Get Started with GLM-5.3-Flash

> Run GLM-5.3-Flash with the SGLang Model-Free NIM, choose a checkpoint for your GPUs, and send chat, tool-calling, and image requests on NIM LLM and VLM.

GLM-5.3-Flash is a vision-language Mixture-of-Experts model from Z.ai
with a 1,048,576-token context window. It accepts text and image input, returns
reasoning output, and supports tool calling. On the throughput-optimized GB200
NVFP4 profile, the model's built-in multi-token-prediction (MTP) head serves as
the draft model for speculative decoding, so you do not need a separate draft
model. The other profiles run without speculative decoding.

GLM-5.3-Flash is served by the
[SGLang Model-Free NIM](https://catalog.ngc.nvidia.com/orgs/nim/teams/nvidia/containers/sglang-model-free-nim),
which includes the following for this model:

* Fixes for GLM-5.3-Flash image input and for `tool_choice="required"`.
* The GLM reasoning parser (`glm45`) and tool-call parser (`glm47`), enabled by
  default.
* A throughput-optimized profile for GB200 with the NVFP4 checkpoint, which NIM
  selects automatically.

The container does not bundle the weights. Set `NIM_MODEL_PATH` to the FP8,
NVFP4, or BF16 checkpoint you want, and the container downloads it at startup,
so one image serves all three 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 for NIMs](/nim/large-language-models/2.1.4/reference/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](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html).

#### GPU Drivers

Install the NVIDIA GPU drivers by following the [NVIDIA Driver Installation Guide](https://docs.nvidia.com/datacenter/tesla/driver-installation-guide/choose-an-installation-method.html).

#### 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](https://docs.docker.com/engine/install/).
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:

   ```bash
   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](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#installing-the-nvidia-container-toolkit).
2. Configure Docker to use the NVIDIA runtime by following the [Docker configuration steps](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#configuring-docker).
3. Restart the Docker daemon after configuration:

   ```bash
   sudo systemctl restart docker
   ```

### NIM Container Access

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

* A free [NVIDIA Developer Program](https://developer.nvidia.com/developer-program) membership.
* An NVIDIA AI Enterprise license. To request a free 90-day evaluation license, refer to [Ways to Get Started With NVIDIA AI Enterprise](https://www.nvidia.com/en-us/data-center/products/ai-enterprise/get-started) and [Activate Your NVIDIA AI Enterprise License](https://www.nvidia.com/en-us/data-center/activate-license/).

### 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](https://org.ngc.nvidia.com/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](https://huggingface.co/docs/hub/en/security-tokens)
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:

```sh
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.

```console
+-----------------------------------------------------------------------------------------+
| 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                                                             |
+-----------------------------------------------------------------------------------------+
```

## 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:

   ```bash
   export HF_TOKEN="<token-value>"
   ```

2. Optional: Persist the variable in your shell profile for future terminals.

   If using bash:

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

   If using zsh:

   ```bash
   echo 'export HF_TOKEN="<token-value>"' >> ~/.zshrc
   ```

3. Verify the variable is set:

   ```bash
   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:

   ```bash
   export NGC_API_KEY=<VALUE>
   ```

2. Optional: Persist the variable in your shell profile for future terminals.

   If using bash:

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

   If using zsh:

   ```bash
   echo "export NGC_API_KEY=$NGC_API_KEY" >> ~/.zshrc
   ```

3. Verify the variable is set:

   ```bash
   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:

```bash
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:

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

Run the container with the cache mounted:

```bash
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`:

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

> **Info**
>
> 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.

## Authenticate

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

```bash
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, precision, checkpoint, and
profile ID, you can find the correct path at [GLM-5.3-Flash](/nim/large-language-models/2.1.4/reference/support-matrix#model-free-nim-glm-5-3-flash)
in the Support Matrix.

Each combination is fixed: the precisions available depend on both the GPU type
and the number of GPUs. For example, BF16 needs eight GPUs on B200, H200, and
H200 NVL but four on B300, NVFP4 needs two GPUs on B300, and H100 GPUs need eight
GPUs for FP8 and NVFP4. NIM selects the profile from the GPUs it detects and
the precision of the checkpoint in `NIM_MODEL_PATH`. To override the automatic
selection, refer to
[Model Profiles and Selection](/nim/large-language-models/2.1.4/deployment/model-profiles-and-selection).

## List the Applicable Profiles

To list the profiles available on your system, run `list-model-profiles` with
the same `NIM_MODEL_PATH` that you used in the previous section. Because the
container does not bundle the weights, it needs the checkpoint location to
build its profile list; without `NIM_MODEL_PATH`, the command fails.

```bash
docker run --rm --gpus all \
  -e NGC_API_KEY \
  -e HF_TOKEN \
  -e NIM_MODEL_PATH=hf://nvidia/GLM-5.3-Flash-NVFP4 \
  -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
  -u $(id -u):0 \
  nvcr.io/nim/nvidia/sglang-model-free-nim:2.1.4-variant-glm-5.3-flash list-model-profiles
```

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

On H100 and H200 GPUs, NVFP4 checkpoints run with Marlin weight-only kernels:
the weights stay in 4-bit and the math runs in BF16. This uses less memory than
FP8 but is slower than FP8 on the same GPUs. This container does not need
`NIM_ALLOW_NVFP4_EMULATION=1` for the supported H100 and H200 NVFP4
configurations: their profiles are validated for Marlin and enabled by default.
The `list-model-profiles` output can show warnings that other NVFP4 profiles are
not tagged for emulation. These warnings are expected, and NIM still selects the
validated profile.

The following GPUs are not supported:

* RTX PRO 6000 Blackwell and RTX PRO 4500 Blackwell: SGLang 0.5.20 has no
  sparse-attention (DSA) backend for this GPU architecture.
* A100 and L40S: the sparse-attention kernels need Hopper (SM90) or newer.
* GH200: the Arm64 SGLang kernel package does not include the FlashAttention 3
  kernels that Hopper sparse-attention decoding uses.
* A10G and GB10: the model does not fit in GPU memory on one node.

Every profile runs on a single node. Multi-node deployment is not supported.

### Throughput-Optimized GB200 NVFP4 Profile

On four GB200 GPUs with the NVFP4 checkpoint, NIM selects a throughput-optimized
profile. It uses MTP speculative decoding and a hierarchical KV cache that keeps
100 GB of KV cache per GPU in host memory. The host needs about 400 GB of free
RAM for the four GPUs, and the container needs `--shm-size=64g`. To turn off
speculative decoding, set `NIM_SPECDEC_ENABLE=0`.

## 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 GPU count in [GLM-5.3-Flash](/nim/large-language-models/2.1.4/reference/support-matrix#model-free-nim-glm-5-3-flash). The following example runs the
   throughput-optimized profile on four GB200 GPUs:

   ```bash
   docker run -it --rm \
     --gpus all \
     --shm-size=64g \
     -e NGC_API_KEY \
     -e HF_TOKEN \
     -e NIM_MODEL_PATH=hf://nvidia/GLM-5.3-Flash-NVFP4 \
     -e NIM_SERVED_MODEL_NAME=zai-org/glm-5.3-flash \
     -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
     -u $(id -u):0 \
     -p 8000:8000 \
     nvcr.io/nim/nvidia/sglang-model-free-nim:2.1.4-variant-glm-5.3-flash
   ```

   The example uses `--gpus all`. On a host with more GPUs than the profile uses,
   such as an eight-GPU H200 host running a four-GPU profile, pass only the GPUs
   that you want NIM to use, for example `--gpus '"device=0,1,2,3"'`, and set
   `NIM_MODEL_PATH` to the checkpoint for that GPU type from
   [GLM-5.3-Flash](/nim/large-language-models/2.1.4/reference/support-matrix#model-free-nim-glm-5-3-flash).

   `NIM_SERVED_MODEL_NAME` sets the name that clients send in the `model` field.
   Without it, NIM derives the name from the checkpoint in `NIM_MODEL_PATH`, so
   the name changes with the precision you select. Refer to
   [Environment Variables](/nim/large-language-models/2.1.4/reference/environment-variables) for details.

   The first start downloads about 205 GB (NVFP4), 330 GB (FP8), or 645 GB
   (BF16) of weights. To serve a checkpoint you already downloaded, refer to
   [Model Download](/nim/large-language-models/2.1.4/deployment/model-download).

2. In another terminal, wait until the server is ready. The
   `Application startup complete` log line can appear one to two minutes before
   the server accepts requests, so poll the readiness endpoint until it returns
   HTTP 200:

   ```bash
   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
   ```

   A ready server returns
   `{"object":"health.response","message":"ready","status":"ready"}`.

## Interact with the API

This NIM runs SGLang, not vLLM ([API Reference](/nim/large-language-models/2.1.4/reference/api-reference) describes
the vLLM backend). On this NIM, the following endpoints are available:

* `/v1/chat/completions`
* `/v1/completions`
* `/v1/responses`
* `/v1/messages`
* `/v1/messages/count_tokens`
* `/v1/models`
* `/tokenize`
* `/detokenize`

> **Note**
>
> The following vLLM-only endpoints return HTTP 404 and are not supported:
>
> * `/inference/v1/generate`
> * `/generative_scoring`
> * `/v1/chat/completions/render`
> * `/v1/completions/render`
>
> Response storage is off, so `previous_response_id` and
> `GET /v1/responses/{response_id}` are not supported.

### Send a Chat Completion Request

Send the following request:

```bash
curl -s http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org/glm-5.3-flash",
    "messages": [{"role": "user", "content": "How many prime numbers are there below 30?"}],
    "max_tokens": 8192
  }'
```

The response carries the reasoning in `message.reasoning_content` and the answer
in `message.content`. Reasoning tokens count toward `max_tokens`. If
`finish_reason` is `length` and `content` is empty, the model used the whole
budget on reasoning: increase `max_tokens` or lower the reasoning effort (refer
to [Control Reasoning](#glm-5-3-flash-control-reasoning)).

### Control Reasoning

Reasoning cannot be turned off. The default reasoning effort is `max`. For
shorter reasoning and faster answers, set `reasoning_effort` to `low` or `high`.

Send the following request:

```bash
curl -s http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org/glm-5.3-flash",
    "messages": [{"role": "user", "content": "What is GPU computing?"}],
    "reasoning_effort": "low",
    "max_tokens": 8192
  }'
```

You can also set the effort as `"chat_template_kwargs": {"reasoning_effort": "low"}`.
The model supports `low`, `high`, and `max`. The API also accepts `none`,
`minimal`, `medium`, and `xhigh`, but the model runs them at `max`. Setting
`"chat_template_kwargs": {"enable_thinking": false}` does not turn reasoning off.

`stop` sequences also match text in the reasoning. If a stop sequence appears
while the model is reasoning, the response ends before the answer and `content`
is empty.

When you stream the response, all `delta.reasoning_content` chunks arrive before
the first `delta.content` chunk.

### Enable Tool Calling

Send the following request:

```bash
curl -s http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org/glm-5.3-flash",
    "messages": [{"role": "user", "content": "What is the weather in Paris?"}],
    "tools": [{"type": "function", "function": {
      "name": "get_weather",
      "description": "Get the current weather for a city",
      "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}
    }}],
    "tool_choice": "auto",
    "max_tokens": 8192
  }'
```

`tool_choice` accepts `auto`, `required`, `none`, or a named function, such as
`{"type": "function", "function": {"name": "get_weather"}}`.

### Send an Image

Send the following request:

```bash
curl -s http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org/glm-5.3-flash",
    "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
  }'
```

Video input is not validated on this NIM. Use text and image input.