If you already run a local LLM and want colleagues or an application to reach it through one API, you can use Ollama with Hivenet Router. Ollama runs the model on your hardware. A Router agent beside Ollama registers one model tag and forwards chat requests to it. This gives the team a stable address even when you move the model to another machine. You’ll check the tag on the host, find the corresponding ID from a client machine, and use that ID to get your first answer. Those checks tell you where to look if a model works locally but disappears from the client’s model list.
This walkthrough uses a running Router with client authentication enabled, an Ollama server with a local chat model, Bash, and curl 7.76 or later. The example model is llama3.1:8b. If you still need to install Ollama or pull a model onto a GPU host, start with the self-hosted Ollama setup guide.
Hivenet Router is open-source inference routing software. It gives applications a single API endpoint for the models their key can access. The difference between the three addresses matters when a first request fails. An application that points to Router’s gRPC authentication port will never reach the chat API.
127.0.0.1:11434 on the agent’s machine.8080 by default).Run this command on the Ollama host. Port 11434 belongs to the local Ollama server. The agent will call that same address, so Ollama can keep listening on loopback.
Look for llama3.1:8b in the name field of a models entry. If you use a different chat model, copy its name, including the tag, into the agent command below. If the model is missing, pull it on this Ollama server and repeat the check. For example, ollama pull llama3.1:8b downloads the tag used here. Choose a model your host has enough memory to run. An entry here tells you Ollama has the model. Router discovery comes after agent registration. See Ollama’s model list response.
Run the agent beside Ollama. The example assumes the v0.1.7 agent binary is at ./bin/hivenet-agent. Replace the example Router address and region with your own. The agent needs a readable copy of the Router’s shared JWT secret and a writable, persistent directory for its identity file. The v0.1.7 Ollama agent guide covers preparing those paths and running the agent in Docker.
Leave the agent running in this shell. For a pinned chat model, the agent checks that Ollama is reachable and sends the selected model a warm-up request with max_tokens: 1. It registers after that request succeeds. A large model can take time to load even after its tag appears locally.
Without --model, the agent registers the first model returned by Ollama. Pinning the tag makes the choice explicit when someone pulls another model onto the same host. To expose a second model from the same Ollama server, run a second agent with its own model tag and identity file.
Yes. The Ollama deployment docs show separate server and agent containers on Linux with host networking. They can share the host’s loopback address without running in the same container. If you use bridge networking, 127.0.0.1 inside the agent container points back to that container. Check the backend URL from the agent’s network before troubleshooting Router.
Give the agent read access to the shared secret and a separate writable, persistent location for its identity file. Replacing the container with the same identity file preserves its peer ID. On a CPU-only host, omit the GPU option from the documented Docker commands.
Open a second Bash shell on the client machine. Enter your Router’s HTTPS base URL and an inference API key that can access the model. The previous command used a shared secret to register the agent. The client uses its own key to make requests.
Read the data array in the JSON output. Find the entry whose id string is llama3.1:8b. Check that agents.engines includes ollama and agents.healthy is at least 1. Copy the returned id for the chat request. With --model, the agent uses the name you supplied. If you omit the flag, automatic discovery strips a trailing :latest and preserves other tags, including :8b. See the Router model catalog fields.
In the same client shell, send a short prompt to POST /v1/chat/completions. Use the model ID from the Router catalog in the JSON body. Setting stream to false makes the first reply easier to inspect as a single JSON response.
Read the assistant’s answer in choices[0].message.content. A successful response confirms that this key can get a chat completion through Router for the requested model. If several backends serve the same ID, the reply alone does not identify which one answered. For testing, use a model ID served only by your Ollama agent and a policy without fallback. On a shared deployment, add -i to the curl command to include response headers in the output. An operator can then match the response’s X-Request-ID header to request_id and read the agent_id field in Router’s request audit record. The record omits prompt and response bodies, so you can investigate which backend answered without copying sensitive information from a conversation. The chat completions reference describes the response.
Suppose a second machine serves the same model and tag. Start an agent beside that Ollama instance and give it its own persistent identity. The application can keep its Router URL and model ID. Router filters out unhealthy agents and applies the configured routing policy. For example, a least-loaded policy ranks eligible agents by current load. If the new machine serves a different model ID, select that ID in the request body instead. See the routing policy selection order.
If this client must use local infrastructure, check its YAML routing policy before adding another host. A configured external fallback can send a request to a cloud provider after local routing options are exhausted. To control which models a user can call and how much they can send, configure model access and request or token quotas on the inference key. See Router API key settings.
Router collects routing metrics in one place across its connected agents. Before sending more traffic, compare request counts, failures, and per-agent latency. The Ollama agent can report CPU and memory data, plus GPU utilization when NVIDIA’s NVML is available. Ollama does not expose engine queue depth through this integration. To bound concurrent work, set max_inflight in the model policy. The admission control reference defines it per healthy replica. For example, a setting of 2 gives a two-replica pool a ceiling of four requests in flight. If one replica becomes unhealthy, the ceiling drops to two. A per-key quota separately controls how much a client can send over time. The Router monitoring guide explains where to look when a request slows down.
--model value with the local tag list. If the flag was omitted, restart the agent with an explicit tag and check the catalog again.401 unauthorized points to the key. A 403 model_forbidden means the key cannot call that model. For 503 no_agents_available, check for a healthy matching agent. For 503 no_capacity, matching agents are already busy.400 context_length_exceeded means the backend rejected the context length. Retry with a shorter message history. A 429 token_limit_exceeded points to the client’s token budget. Changing the model’s context settings will not fix that quota.Once the request returns an answer, you can use the same Router endpoint for a browser-based chat interface. Follow the Open WebUI connection guide to configure the client and check which models its users can select.
Pick one AI, compute, or storage workload and see the difference for yourself. Spin it up in minutes, or let our team map your fastest path to production.