Before you start
You need:- a running Hivenet Router router
- an NVIDIA GPU with CUDA support
- network access between the agent host and the router
- access to the model you want to serve
- either Docker or a Python environment supported by vLLM
- the Hivenet Router agent binary or Docker image
- the same JWT secret used by the router
Start vLLM
- Docker
- Bare metal
Start vLLM with host networking:If the model requires authentication or license acceptance, provide the required credentials through your normal secrets-management process.Follow the startup logs:
200.
List the models reported by vLLM:
Hivenet Router forwards each request’s ID to vLLM in the
X-Request-ID header, and vLLM uses it as the request ID in its logs, so the router’s and vLLM’s logs show the same ID. The router generates a new ID for every request, and a retry of the same request gets the ID followed by -2, -3 and so on, so vLLM never receives the same ID twice. When a retry’s response comes back, the client sees the router’s request ID in X-Request-ID and the retry’s ID, for example <id>-2, in X-Upstream-Request-ID.Prepare the Hivenet Router agent
- Docker
- Bare metal
Pull the prebuilt agent image from the GitHub Container Registry:Use Create a directory for the shared secret and persistent agent identity:Place the router’s JWT secret at:Protect it:
:nightly if you want the moving pre-release tag built from the latest commit on main. Immutable :nightly-<shortsha> tags are also published.To build a custom image from source instead, clone the Hivenet Router repository and run:Start the agent
- Docker
- Bare metal
/app/data mount preserves the agent’s peer identity across container replacement and restarts.The agent container receives GPU access so it can collect NVIDIA hardware metrics. Inference still runs in the separate vLLM process or container.Understand the agent settings
You can also add comma-separated routing tags:
Select the model
The agent can discover the model automatically or use an explicit model name.Automatic discovery
When--model is omitted, the agent requests:
Explicit model selection
Use--model when you want to pin the agent to a specific model:
The model name registered by the agent must match the model name clients send to Hivenet Router.
Use a vLLM server that requires an API key
If you start vLLM with--api-key, it rejects every /v1/* request that lacks Authorization: Bearer <key>, including the model discovery request the agent sends before any client traffic exists. Give the agent the same key:
Authorization: Bearer <key> on every request to the backend: readiness and health checks, model discovery, metrics scrapes, and inference. The client’s router API key never reaches vLLM, with or without a backend key: the agent removes the client’s credentials before every request. When both are provided, --backend-api-key-file wins.
The agent never forwards the client’s router credentials to the backend:
Authorization, X-Api-Key, Cookie and Proxy-Authorization are removed first. If the backend requires authentication, set a backend API key.Connect multiple models
Each agent registers as an independent peer and represents one model. If one backend exposes multiple models, start one agent process for each model:--identity-path so every process keeps a distinct peer identity.
Set agent capacity
Set--capacity to the number of concurrent requests the backend can safely accept.
For vLLM, start by matching it to --max-num-seqs:
For streaming responses, Hivenet Router holds the agent capacity slot until the stream fully drains, whether the stream ends normally or the client disconnects.
--capacity therefore limits concurrent generations routed through Hivenet Router, including ongoing streams. Verify vLLM concurrency under sustained streaming load before raising it.Verify the connection
On the router, check agent health:vLLM metrics
The agent scrapes vLLM’s/metrics endpoint every 500 milliseconds by default.
It sends the resulting engine data to the router, which exposes it through the router’s Prometheus endpoint. The agent does not expose a separate Prometheus port.
View all engine metrics on the router:
Use vLLM metrics in routing policies
You can exclude agents whose KV cache is under pressure:Troubleshooting
The agent cannot discover a model
The agent cannot discover a model
Check vLLM health:Check model discovery:The agent waits and retries if vLLM is healthy but no model is available yet.
The wrong model is registered
The wrong model is registered
Automatic discovery selects the first model returned by Restart the agent after changing the setting.
/v1/models.Pin the correct one:The agent does not register
The agent does not register
Check the agent logs:Confirm connectivity:Check that the router and agent use the same JWT secret.
- Docker
- systemd
KV cache utilization remains high
KV cache utilization remains high
Reduce the amount of work Hivenet Router assigns to the agent:Or reduce vLLM’s scheduler limit:You can also use a routing gate to stop selecting the agent above a chosen threshold.
Preemptions keep increasing
Preemptions keep increasing
Rising preemptions indicate that vLLM is evicting in-flight KV-cache data under memory pressure.Reduce:
--capacityon the Hivenet Router agent--max-num-seqson vLLM- model context or batch pressure, where appropriate for your workload
Backend requests time out
Backend requests time out
The agent’s backend HTTP timeout defaults to two minutes.Increase it for longer requests:
The peer ID changes after restart
The peer ID changes after restart
Make sure For bare metal:
--identity-path points to persistent storage.For Docker, confirm the volume is mounted:Metrics are missing
Metrics are missing
Check vLLM’s metrics endpoint:Check the agent logs for scrape errors.Metrics are scraped in the background. A scrape failure does not stop the agent from forwarding requests.
Next steps
Ollama agent
Connect an Ollama backend for local or edge inference.
Routing concepts
Learn how Hivenet Router filters and ranks matching agents.
Engine metrics
Understand the metrics collected from vLLM and other engines.

