/api/tags endpoint, registers one available model with the router, and forwards chat-completion requests to Ollama’s OpenAI-compatible API.
Ollama does not provide the engine metrics collected from vLLM, SGLang, or metrics-enabled llama.cpp servers. Hivenet Router still records routing, request, latency, health, and available hardware metrics for the agent.
Before you start
You need:- a running Hivenet Router router
- Ollama on the agent host
- at least one model pulled in Ollama
- network access between the agent and router
- the Hivenet Router agent binary or Docker image
- the same JWT secret used by the router
Start Ollama
- Linux
- Docker
Install Ollama:Start the server:The agent runs on the same host, so Ollama does not need to listen on a public interface. Bind it to
OLLAMA_KEEP_ALIVE=-1 keeps loaded models in memory instead of unloading them after an idle period.To store models in another directory, set OLLAMA_MODELS before starting the server:0.0.0.0 only when another machine must connect directly and your network controls restrict access appropriately.Pull a model
- Linux
- Docker
Prepare the Hivenet Router agent
- Docker
- Bare metal
From the Hivenet Router repository, build the agent image if you have not already done so:Create a directory for the shared secret and persistent agent identity:Place the router’s JWT secret at:Protect it:
Start the agent
The examples pin the agent tollama3.1:8b. This avoids ambiguity when more than one model is available in Ollama.
- Docker
- Bare metal
/data mount preserves the agent’s peer identity across container replacement and restarts.Understand the agent settings
You can provide more routing metadata:
Model discovery and naming
If you omit--model, the agent requests:
The :latest suffix
Ollama adds :latest when a model has no explicit tag. Hivenet Router removes that implicit suffix during discovery.
Explicit tags remain unchanged.
When using
--model, provide the model name expected by Ollama:
Run several Ollama models
Run one agent for each model you want Hivenet Router to expose. For the first model:--identity-path so every process keeps a distinct peer identity.
The agents can share the same Ollama backend URL.
Set agent capacity
--capacity controls how many concurrent requests Hivenet Router may assign to the agent.
It does not change Ollama’s own parallelism or memory settings.
A conservative starting point is:
These values are starting points, not fixed limits. The right setting depends on:
- model size
- available RAM or VRAM
- context length
- Ollama’s parallelism configuration
- acceptable response time
- whether several models share the same hardware
For streaming responses, Hivenet Router releases the agent capacity slot when response headers arrive, while backend generation can continue. Treat
--capacity as a routing-admission setting rather than a hard limit on ongoing streams, and verify Ollama concurrency under sustained streaming load.Verify the connection
On the router, check agent health:Available observability
The Ollama integration does not scrape an engine-specific Prometheus endpoint. Hivenet Router can still expose:- agent health
- routed request counts
- failed request counts
- active request and capacity state
- smoothed round-trip time
- success and failure history
- CPU and memory metrics
- NVIDIA GPU utilization, memory, temperature, and power when NVML is available
Troubleshooting
No model is found
List the pulled models:- Linux
- Docker
The wrong model is registered
When--model is omitted, the agent registers the first model returned by /api/tags.
Restart the agent with an explicit model:
A model appears without :latest
This is expected.
Hivenet Router converts:
:8b or :7b are preserved.
Ollama is unreachable
Check the server:--backend-url matches the address where Ollama is listening.
The first response is slow
Ollama may need to load the model into memory before serving the first request. Check loaded models:- Linux
- Docker
The agent does not register
Check the agent logs:- Docker
- systemd
- the router and agent use the same JWT secret
- the router’s libp2p interface is reachable
- the router advertises a libp2p address the agent can reach
- Ollama contains the selected model
The agent gets a new peer ID after restart
Make sure--identity-path points to persistent storage.
For Docker:
GPU metrics are missing
Check that NVIDIA tools work on the host:Requests time out
The agent’s backend HTTP timeout defaults to two minutes. Increase it for long-running requests:Next steps
SGLang agent
Connect an SGLang backend and collect engine metrics.
Routing concepts
Learn how metadata, capacity, and policies affect agent selection.
Hardware metrics
Understand the CPU, memory, and GPU signals reported by agents.

