Skip to main content
NVIDIA
Explore
Models
Skills
Blueprints
GPUs
Docs
Help Center
Getting Started
  1. Create and verify your account to unlock full access to NVIDIA NIM APIs.
ResourcesDeveloper ForumsContact Support
FAQs
  • View All Playbooks
    View All Playbooks

    onboarding

    • Set Up Local Network Access
    • Open WebUI with Ollama

    data science

    • Single-cell RNA Sequencing
    • Portfolio Optimization
    • CUDA-X Data Science
    • Build Knowledge Graphs with txt2kg
    • Optimized JAX

    tools

    • DGX Dashboard
    • RAG Application in AI Workbench
    • Set up Tailscale on Your Spark
    • VS Code
    • Connect Three DGX Spark in a Ring Topology
    • Connect Multiple DGX Spark through a Switch

    fine tuning

    • FLUX.1 Dreambooth LoRA Fine-tuning
    • LLaMA Factory
    • Fine-tune with NeMo
    • Fine-tune with Pytorch
    • Unsloth on DGX Spark

    use case

    • Run Hermes Agent with a Local LLM
    • cuTile Kernels
    • CLI Coding Agent
    • Run NemoClaw with a Local LLM
    • 🦞 Set Up Example NemoClaw Agents 🦞
    • Live VLM WebUI
    • Install and Use Isaac Sim and Isaac Lab
    • Vibe Coding in VS Code
    • Build and Deploy a Multi-Agent Chatbot
    • Connect Two Sparks
    • NCCL for Multiple Sparks
    • Build a Video Search and Summarization (VSS) Agent
    • Spark & Reachy Photo Booth
    • Secure AI Agents with OpenShell
    • Run OpenClaw with a Local LLM

    inference

    • Generate Images and Videos with ComfyUI
    • Serve LLMs with vLLM
    • Speculative Decoding
    • Run models with llama.cpp on DGX Spark
    • Nemotron Model Family on DGX Spark
    • Serve LLMs with SGLang
    • TRT LLM for Inference
    • Quantize Models to NVFP4 with NVIDIA Model Optimizer
    • Multi-modal Inference
    • NIM on Spark
    • LM Studio on DGX Spark

    NIM on Spark

    30 MIN

    Deploy a NIM on Spark

    • DGX
    • Spark
    OverviewOverviewInstructionsInstructionsTroubleshootingTroubleshooting

    Step 1
    Verify environment prerequisites

    Check that your system meets the basic requirements for running GPU-enabled containers.

    nvidia-smi
    docker --version
    docker run --rm --gpus all nvcr.io/nvidia/cuda:13.0.1-devel-ubuntu24.04 nvidia-smi
    

    If you see a permission denied error (something like permission denied while trying to connect to the Docker daemon socket), add your user to the docker group so that you don't need to run the command with sudo .

    sudo usermod -aG docker $USER
    newgrp docker
    

    Step 2
    Configure NGC authentication

    Set up access to NVIDIA's container registry using your NGC API key.

    export NGC_API_KEY="<YOUR_NGC_API_KEY>"
    echo "$NGC_API_KEY" | docker login nvcr.io --username '$oauthtoken' --password-stdin
    

    Step 3
    Select and configure NIM container

    Choose a specific LLM NIM from NGC and set up local caching for model assets.

    export CONTAINER_NAME="nim-llm-demo"
    export IMG_NAME="nvcr.io/nim/meta/llama-3.1-8b-instruct-dgx-spark:latest"
    export LOCAL_NIM_CACHE=~/.cache/nim
    export LOCAL_NIM_WORKSPACE=~/.local/share/nim/workspace
    mkdir -p "$LOCAL_NIM_WORKSPACE"
    chmod -R a+w "$LOCAL_NIM_WORKSPACE"
    mkdir -p "$LOCAL_NIM_CACHE"
    chmod -R a+w "$LOCAL_NIM_CACHE"
    

    Step 4
    Launch NIM container

    Start the containerized LLM service with GPU acceleration and proper resource allocation.

    docker run -it --rm --name=$CONTAINER_NAME \
      --gpus all \
      --shm-size=16GB \
      -e NGC_API_KEY=$NGC_API_KEY \
      -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
      -v "$LOCAL_NIM_WORKSPACE:/opt/nim/workspace" \
      -p 8000:8000 \
      $IMG_NAME
    

    The container will download the model on first run and may take several minutes to start. Look for startup messages indicating the service is ready.

    Step 5
    Validate inference endpoint

    Test the deployed service with a basic completion request to verify functionality. Run the following curl command in a new terminal.

    curl -X 'POST' \
        'http://0.0.0.0:8000/v1/chat/completions' \
        -H 'accept: application/json' \
        -H 'Content-Type: application/json' \
        -d '{
          "model": "meta/llama-3.1-8b-instruct",
          "messages": [
            {
              "role":"system",
              "content":"detailed thinking on"
            },
            {
              "role":"user",
              "content":"Can you write me a song?"
            }
          ],
          "top_p": 1,
          "n": 1,
          "max_tokens": 15,
          "frequency_penalty": 1.0,
          "stop": ["hello"]
    
        }'
        
    

    Expected output should be a JSON response containing a completion field with generated text.

    Step 6
    Cleanup and rollback

    Remove the running container and optionally clean up cached model files.

    WARNING

    Removing cached models will require re-downloading on next run.

    docker stop $CONTAINER_NAME
    docker rm $CONTAINER_NAME
    

    To remove cached models and free disk space:

    rm -rf "$LOCAL_NIM_CACHE"
    

    Step 7
    Next steps

    With a working NIM deployment, you can:

    • Integrate the API endpoint into your applications using the OpenAI-compatible interface
    • Experiment with different models available in the NGC catalog
    • Scale the deployment using container orchestration tools
    • Monitor resource usage and optimize container resource allocation

    Test the integration with your preferred HTTP client or SDK to begin building applications.

    Resources

    • DGX Spark Documentation
    • DGX Spark Forum
    • DGX Spark User Performance Guide
    Terms of Use
    Privacy Policy
    Your Privacy Choices
    Contact

    Copyright © 2026 NVIDIA Corporation