Canonical: https://ai-release.org/guides/kak-vnedrit-nvidia-dgx-spark-v-kompanii-nastroyka-lokal.html · Markdown · JSON · Updated: 2026-12-04
sudo, an NVIDIA NGC account and API key, Docker with the NVIDIA Container Toolkit, curl and jq, a Python 3 virtualenv for the benchmark script, and a spreadsheet.~/dgx-baseline/baseline-<date>.log) proving the GPU, driver, container runtime and free unified memory, captured before anything is changed.http://<dgx-ip>:8000/v1 that your existing tools can call by swapping base_url only.$ per 1M tokens figure and a break-even point against any API price.Most write-ups stop at "it runs". The deliverable that decides whether the unit stays in the office is the third bullet: a measured cost-per-token number from your own hardware, not a vendor slide.
nvidia-smi
docker run --rm --gpus all nvcr.io/nvidia/cuda:<cuda-tag> nvidia-smi
export NGC_API_KEY=<your-ngc-key>
echo "$NGC_API_KEY" | docker login nvcr.io --username '$oauthtoken' --password-stdin
docker run --rm --gpus all -p 8000:8000 -v ~/.cache/nim:/opt/nim/.cache -e NGC_API_KEY <inference-image>:<tag>
curl -s http://localhost:8000/v1/models | jqDetails and verification are in the steps below.

sudo rights on the device.nvcr.io requires an API key, and the username for key auth is the literal string $oauthtoken.curl, jq, and Python 3 (for the benchmark script in Step 3).<cuda-tag> — the CUDA tag listed in the NGC catalog for your DGX OS release; <inference-image>:<tag> — the serving container you pick from NGC; <model-id> — the model identifier the container reports; <dgx-ip> — the unit's LAN address.Checklist before you start:
nvidia-smi runs without sudodocker info lists an nvidia runtimeWhat to do: create a dated inventory of OS, kernel, driver, GPU, memory and disk before you install or pull anything.
mkdir -p ~/dgx-baseline && cd ~/dgx-baseline
{ uname -a; cat /etc/os-release; nvidia-smi; df -h; free -h; } | tee baseline-$(date +%F).log
nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv | tee gpu.csvWhy: DGX Spark uses a unified memory pool shared between CPU and GPU, so "how much VRAM do I have" is not a fixed number — the OS and your containers draw from the same pool. You need the free figure at idle as your budget for model weights plus KV cache, and you need the driver and CUDA versions to pick a matching container tag.
How to check: nvidia-smi prints a table with a GPU name row and a CUDA Version in the header; gpu.csv shows the same values as CSV. Confirm free -h and nvidia-smi report a comparable total. If the numbers disagree wildly, stop and check the documentation for how unified memory is reported on your image.
Example: the log line baseline-2025-06-14.log opens with the kernel string, then the nvidia-smi table, then a Mem: row from free -h. Keep this file; every later measurement is compared against it.
Also record the container runtime state:
docker info --format '{{json .Runtimes}}' | jqExpected: a JSON object containing "nvidia". If it is absent, install the NVIDIA Container Toolkit before continuing.

What to do: authenticate to NGC, start a serving container on port 8000, and expose it on the LAN behind a reverse proxy with an API key.
export NGC_API_KEY=<your-ngc-key>
echo "$NGC_API_KEY" | docker login nvcr.io --username '$oauthtoken' --password-stdin
docker run -d --name local-llm --restart unless-stopped --gpus all \
-p 8000:8000 \
-v ~/.cache/model-cache:/opt/nim/.cache \
-e NGC_API_KEY \
<inference-image>:<tag>
docker logs -f local-llmWhy: an OpenAI-compatible /v1/chat/completions surface means every downstream tool changes one setting instead of its code. That is exactly how you wire automation platforms to a local model — see how to connect n8n to a local LLM for the client side of that swap. The same applies to CLI coding agents reconfigured to point at a different base URL.
How to check:
curl -s http://localhost:8000/v1/models | jq -r '.data[].id'
curl -s http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"<model-id>","messages":[{"role":"user","content":"Reply with the single word: ready"}],"max_tokens":16}' \
| jq -r '.choices[0].message.content'Expected: the model id from the first command, and ready from the second. A JSON body with "object": "list" and an empty data array means the container is up but no model is loaded — read docker logs local-llm.
Memory budgeting matters here: a model whose weights nearly fill the pool will serve short prompts and then fail on long contexts because the KV cache cannot grow. Watch nvidia-smi during the first long request:
watch -n 1 'nvidia-smi --query-gpu=memory.used,memory.total --format=csv'If the used figure climbs to the total, drop to a smaller quantization or reduce the served context length. Consult the model card and the container documentation for the exact flags.

What to do: run a fixed workload three times, record tokens/second, then feed the numbers into the worksheet.
import json, time, urllib.request
URL = "http://localhost:8000/v1/chat/completions"
payload = {"model": "<model-id>",
"messages": [{"role": "user", "content": "Explain TCP retransmission in 200 words."}],
"max_tokens": 256}
for i in range(3):
t0 = time.time()
req = urllib.request.Request(URL, data=json.dumps(payload).encode(),
headers={"Content-Type": "application/json"})
body = json.load(urllib.request.urlopen(req))
elapsed = time.time() - t0
out = body["usage"]["completion_tokens"]
print(f"run {i+1}: {out} tokens in {elapsed:.2f}s -> {out/elapsed:.1f} tok/s")Why: the usage.completion_tokens field is the only trustworthy token count — character counts overflow context windows and distort every downstream number. Three runs expose a cold-start outlier.
How to check: the three lines should be within roughly 10% of each other; if run 1 is far slower, it was the model load and you should rerun.
| Cost line | Formula | Your inputs |
|---|---|---|
| Device capex | price on your quote, incl. tax and shipping | <capex> |
| Amortized per month | capex ÷ useful life in months | <capex> ÷ <months> |
| Power per month | watts ÷ 1000 × hours × $/kWh | <watts> × 730 × <tariff> |
| Tokens per month | tok/s × 2,592,000 × utilization | <tok/s> × 2,592,000 × <0–1> |
| Cost per 1M tokens | monthly cost ÷ (tokens ÷ 1,000,000) | computed |
| Break-even vs API | monthly cost ÷ API price per token | computed |
Example (assumed inputs, replace with your own): 800 tok/s aggregate at 25% utilization gives 800 × 2,592,000 × 0.25 = 518.4M tokens/month. With $150 amortization + $35 power + $50 operations = $235/month, the cost is 235 ÷ 518.4 = $0.45 per 1M tokens. If your API quote is $2.00 per 1M output tokens, local break-even is 235 ÷ 0.000002 ≈ 117.5M tokens/month.
Where this does not work: workloads that are bursty and low-volume. At 5% utilization the same device produces ~130M tokens/month and the per-token cost roughly quadruples — for that profile a hosted API is usually cheaper. If you need a hybrid, the OpenAI models via Google Cloud setup is a practical way to keep a cloud path for overflow while the Spark handles steady-state traffic.
Problem. The GPU is invisible to containers
docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]]sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
docker run --rm --gpus all nvcr.io/nvidia/cuda:<cuda-tag> nvidia-smiProblem. Image pull from NGC is rejected
unauthorized: authentication requireddocker login was done with your email instead of the literal username $oauthtoken, or the API key was regenerated in the NGC portal.echo "$NGC_API_KEY" | docker login nvcr.io --username '$oauthtoken' --password-stdin
docker pull <inference-image>:<tag>Problem. The model dies on long prompts
CUDA out of memory. Tried to allocate <N> MiB in docker logs local-llmdocker restart local-llm
watch -n 1 'nvidia-smi --query-gpu=memory.used,memory.total --format=csv'You now have a baselined DGX Spark, a local OpenAI-compatible endpoint on port 8000, and a cost-per-token figure derived from your own measurements. Next, point one internal tool at the endpoint, re-run the Step 3 benchmark after any driver or container update, and keep the baseline log for comparison.
Does DGX Spark replace a data-center GPU server?
It is a compact office unit, not a rack server. Use it for team-scale inference, prototyping and private data that must not leave the building; keep data-center hardware for multi-tenant, high-concurrency serving. Confirm the supported concurrency for your model against the documentation.
Can I serve several models at once on one unit?
Yes in principle, but every loaded model reserves its weights in the same unified memory pool. Measure free memory at idle in Step 1, subtract the OS overhead, and divide what remains across models. Most teams start with one model and add a second only after the Step 3 numbers are stable.
How do I let the whole team use the endpoint safely?
Keep the container on localhost, put a reverse proxy in front of it with TLS and a per-user API key, and expose only the proxy port. Never publish port 8000 directly to the office network — the container has no authentication by default.
What if our usage is too bursty for local serving?
Run the Step 3 worksheet at your realistic utilization figure. Below roughly 10% utilization the amortized hardware cost dominates; in that case keep the Spark for sensitive or latency-critical requests and route the rest to a hosted API.
Status: practical guide. Some statements come from vendors; verify in your environment.
Time to complete: ~120 minutes from first boot to a model answering requests, plus 1–2 days to collect the numbers your finance team will ask for. Difficulty level: Intermediate
Machine data: Citation Map JSON · JSON-LD · Semantic Embeddings — separate stage.
| Entity | Type | Role |
|---|---|---|
| nvidia dgx spark настройка | тема/инструмент | упоминается в заголовке, TL;DR или разделах гайда |
| dgx spark внедрение | тема/инструмент | упоминается в заголовке, TL;DR или разделах гайда |
| локальные ии для бизнеса | тема/инструмент | упоминается в заголовке, TL;DR или разделах гайда |
| dgx spark стоимость | тема/инструмент | упоминается в заголовке, TL;DR или разделах гайда |
| запуск llm на dgx spark | тема/инструмент | упоминается в заголовке, TL;DR или разделах гайда |
| Docker | платформа/технология | упоминается в заголовке, TL;DR или разделах гайда |
| CUDA | платформа/технология | упоминается в заголовке, TL;DR или разделах гайда |
| Python | платформа/технология | упоминается в заголовке, TL;DR или разделах гайда |
| OpenAI | компания | упоминается в заголовке, TL;DR или разделах гайда |
| NVIDIA | компания | упоминается в заголовке, TL;DR или разделах гайда |
No independent confirmation is provided; source claims and editorial conclusions are separated below.
| Source | Type | Role |
|---|---|---|
| No external links | — | — |
Cite as: AI Release. Как внедрить NVIDIA DGX Spark в компании: настройка, локальные модели и расчёт стоимости. ai-release.org.