A private OpenAI-compatible LLM API on an AMD GPU with llama.cpp
- Models & engines
- llama.cpp built with the Vulkan backend, and optionally ROCm/HIP with ROCm 6.x
qwen2.5-7b-instruct Q4_K_M GGUF in the examples
llama-server under systemd, Caddy 2 for HTTPS or a Tailscale IP, Prometheus via --metrics - Key gotcha
- RDNA2 cards not on ROCm's official list (like the RX 6700 XT, gfx1031) need HSA_OVERRIDE_GFX_VERSION=10.3.0
What they built
The author (writing in Vietnamese) notes that most guides assume an NVIDIA card, while many developers in Vietnam use AMD cards such as the RX 6700 XT and RX 7900 XTX, or Ryzen mini PCs with integrated graphics. Their goal was a model running on their own machine, with its own API, no data leaving the machine and no per-token bills.
The post covers the full path: picking a backend, building and benchmarking llama.cpp, exposing an OpenAI-compatible endpoint with llama-server, and running it as a proper service behind a reverse proxy.
Setup
- Ubuntu 24.04
- llama.cpp built with the Vulkan backend, and optionally ROCm/HIP with ROCm 6.x
- qwen2.5-7b-instruct Q4_K_M GGUF in the examples
- llama-server under systemd, Caddy 2 for HTTPS or a Tailscale IP, Prometheus via --metrics
How it works
- Try Vulkan first: it only needs Mesa (RADV) drivers and runs on almost any card, including the 780M iGPU; switch to ROCm only if prompt processing is the bottleneck, such as RAG with long context
- Compare pp512 (prompt processing) and tg128 (generation) in llama-bench; for chat, tg128 matters more and above 30 t/s feels smooth
- llama-server exposes /v1/chat/completions, so code using the OpenAI Python SDK only needs a new base_url; Continue.dev, Open WebUI and internal scripts can use it too
- -c 16384 with --parallel 2 gives each request 8,192 tokens of context
Results & numbers
- The author's advice is that local 7B-14B models suit jobs like summarizing logs, classifying tickets, autocomplete and handling sensitive data, while complex reasoning still belongs to a larger model
Gotchas
- RDNA2 cards not on ROCm's official list (like the RX 6700 XT, gfx1031) need HSA_OVERRIDE_GFX_VERSION=10.3.0
- Without SupplementaryGroups=render video in the systemd unit, the service user can't reach /dev/dri and /dev/kfd and the model silently runs on CPU; it cost the author a whole evening
- If you hit out-of-memory errors, lower -ngl from 99
- Bind to 127.0.0.1 or a Tailscale IP rather than opening the port to the internet
Do it yourself
- Install build-essential, cmake, git, libvulkan-dev, glslc and vulkan-tools, then check the GPU with vulkaninfo --summary
- Clone llama.cpp and build with -DGGML_VULKAN=ON
- Run llama-bench -ngl 99 on two or three quantizations and pick the fastest one with acceptable quality
- Start llama-server on 127.0.0.1:8080 with --api-key and --metrics
- Wrap it in a systemd unit with a dedicated llm user and SupplementaryGroups=render video
- Point your OpenAI SDK client at http://127.0.0.1:8080/v1
cmake -B build-vulkan -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build-vulkan --config Release -j$(nproc)
./build-vulkan/bin/llama-server \
-m ~/models/qwen2.5-7b-instruct-q4_k_m.gguf \
-ngl 99 -c 16384 --parallel 2 \
--host 127.0.0.1 --port 8080 \
--api-key "$LLAMA_API_KEY" --metricsSimilar setups
A CPU-only PDF question-answering API with Ollama, Qwen2.5 1.5B and ChromaDB
A developer who wanted to keep documents inside the private network built a small RAG app on a PC with no active GPU: PDFs are indexed into ChromaDB and a local FastAPI endpoint answers questions with Qwen2.5 1.5B on Ollama.
Serving a local model on Kubernetes on your own laptop with kind and Ollama
Alex Jones wrote a tested guide to running Ollama in a kind cluster on CPU, Intel Arc, NVIDIA and AMD, then using the served model with k8sgpt to explain cluster failures without any data leaving the machine.
A homelab llama-server on Fedora that runs as a systemd service and swaps models on demand
A homelabber's notes on keeping llama.cpp's server running on a Fedora VM with a systemd user unit, a fixed LAN address and a models folder, with Open WebUI as the chat front end.
A Baroque music events calendar fed by a local Qwen agent on a home llama.cpp server
A data scientist serves small models with llama.cpp from a 16 GB RTX 4060 Ti box on his home network, and a LangChain agent on it finds upcoming concerts for his wife's Bavarian Baroque events calendar.