custom engine.
Use this integration when your backend is not covered by one of Hivenet Router’s built-in engine types but exposes a compatible chat-completions endpoint.
Backend requirements
The backend must expose:
The health endpoint can use any path. Pass its complete URL to
--health-url.
For example:
This page covers language-model agents using the default
llm capability. Use the dedicated Infinity integration for the documented embedding and reranking workflow.Before you start
You need:- a running Hivenet Router router
- an OpenAI-compatible inference backend
- a health endpoint that returns HTTP
200 - network access between the agent and router
- the Hivenet Router agent binary or Docker image
- the same JWT secret used by the router
- a model name that clients and the backend can use
Start your backend
The command depends on the inference server you are using. A generic example might look like:200.
Test chat completions directly:
Choose the model name
The custom engine does not call/v1/models.
You must provide the model name explicitly:
- register the agent
- list the model through
GET /v1/models - match incoming requests to the agent
- label routing and observability data
model field. For the cleanest setup, use the same model name:
- in the agent’s
--modelvalue - in client requests
- in the backend’s public API
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 identity:Place the router’s JWT secret at:Protect it:
Start the agent
- Docker
- Bare metal
--gpus all when the backend is CPU-only or the agent does not need NVIDIA hardware metrics.The /data mount preserves the agent’s peer identity across container replacement and restarts.200. If the backend is still starting, the agent continues polling rather than exiting permanently.
Understand the custom settings
You can also add routing tags:
How requests are forwarded
For a non-streaming request, the agent sends:- invalid parameters
- context-length limits
- backend unavailability
- rate limits
- general backend failures
Streaming responses
The custom engine supports streaming chat completions when the backend returns an SSE response compatible with the OpenAI API. Send:Set agent capacity
--capacity controls how many concurrent requests Hivenet Router may assign to the agent.
It does not configure the backend’s own scheduler, worker count, queue, or batch size.
Choose a value based on:
- backend concurrency
- model size
- available CPU, RAM, or VRAM
- context length
- acceptable response time
- whether other workloads share the machine
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 the custom backend under sustained streaming load.Verify the connection
On the router, check operational health:Route to custom agents
Match the custom engine in a routing policy:- model
- engine
- region
- organization
- machine
- tags
- GPU model
Available metrics
The custom integration does not scrape engine-specific metrics from the backend. The following information is still available:Routing and request metrics
- routed and failed request counts
- active requests and declared capacity
- success and failure history
- smoothed round-trip time
- policy and fallback decisions
- tenant and model labels where configured
Hardware metrics
When available on the agent host:- CPU use
- system memory use
- GPU utilization
- VRAM use
- GPU temperature
- GPU power
Troubleshooting
The agent reports that --model is required
The custom engine cannot discover models.
Start the agent with:
The agent reports that --health-url is required
Provide the complete health endpoint:
--backend-url.
The backend never becomes ready
Test the exact URL passed to--health-url:
200. Redirects, authentication challenges, and other status codes are treated as unhealthy.
Direct requests work, but routed requests fail
Test the exact OpenAI-compatible path:- the backend uses another path
- the backend expects a proprietary request schema
- the model name differs
- the backend requires credentials that are not present in the client request
- the backend does not support the requested field or streaming mode
The model is visible but requests do not route
Check the model value in all three places:The agent does not register
Check the logs:- Docker
- systemd
- the router and agent use the same JWT secret
- the backend health endpoint returns HTTP
200 - the router’s libp2p interface is reachable
- the router advertises a libp2p address the agent can reach
Streaming is buffered or incomplete
Test the backend directly withcurl -N.
Confirm that it returns a streaming content type and flushes chunks as they are generated.
Hivenet Router can relay an SSE stream, but it cannot correct buffering introduced by the backend or an intermediate proxy.
Requests time out
The backend HTTP timeout defaults to two minutes. Increase it for longer requests:The peer ID changes after restart
Make sure--identity-path points to persistent storage.
For Docker:
Next steps
Chat completions
Review the supported request, response, and streaming behavior.
Routing concepts
Learn how custom agents participate in routing and fallback.
Hardware metrics
Understand the system and GPU signals collected from agent hosts.

