Endpoint overview
The dynamic key endpoints return HTTP
501 unless the router is using dynamic API authentication.
Configure admin authentication
Admin authentication is separate from client authentication for/v1/*.
Enable it in auth.yaml:
admin.mode is none, or no auth configuration is provided, the router refuses to start unless:
/admin/* publicly accessible to any client that can reach the router. Use it only in an isolated development environment.
Dynamic mode
When the client API uses dynamic authentication, Hivenet Router automatically requires admin API-key authentication, even whenadmin.mode is absent or set to none.
For example:
HIVENET_ROUTER_ADMIN_API_KEYS is missing. This prevents the API-key management endpoints from becoming publicly writable.
Public liveness
200 while the router process is running. It does not report whether agents or inference backends are available.
Use it for load balancers, process monitoring, and liveness probes.
Router health
The top-level
status does not mean every registered agent is healthy. Compare healthy_agents with total_agents when partial fleet health matters.Routing table
- agent metadata
- live connection and capacity state
- lifetime success and failure counters
- smoothed latency
- engine metrics
- CPU, memory, and GPU state
Response sections
engine is omitted until the agent reports at least one supported engine metric. It is normally available for vLLM, SGLang, and metrics-enabled llama.cpp agents.
hardware is omitted until the first hardware snapshot arrives. CPU-only agents return an empty or omitted GPU array.
latency_state is:
UNKNOWNbefore Hivenet Router has initialized latency historyKNOWNafter enough routing observations are available
Find unhealthy agents
Find agents with high KV-cache use
Compare model latency
Registration stream
data: frame containing JSON:
The
(deployment_id, replica_id) pair is the external scheduler join key. The server sends an SSE comment every 25 seconds to keep idle connections alive.
This endpoint is a change feed, not a complete snapshot. Each subscriber has a bounded buffer, and a slow subscriber can miss events rather than block agent registration. Read
/admin/routing-table when connecting and whenever you need to resynchronize authoritative state.Operator model catalog
See Models for the full response reference.
Storage statistics
When another storage backend is used, the endpoint may return:
200.
Reset lifetime metrics
This operation is destructive. It cannot restore the cleared historical counters.
- successful and failed request totals
- input and output token totals
- rejected-request totals
- disconnection and failure counters
- SRTT and RTTVAR history
- the matching in-memory state
- the matching Prometheus series
- tenant or billing quota counters
- API-key registry entries
- agent metadata
- liveness gauges
- capacity utilization
- routing-level counters that already reset when the router restarts
Global policy
Read the active policy
Replace the active policy
1048576 bytes).
Hivenet Router parses and validates the YAML before replacing the active policy. Invalid YAML, unsupported fields, or invalid provider-fallback configuration return HTTP 400.
For a persistent change:
- update the policy file on disk
- send
SIGHUPto the router
Named model policies
Named policies apply to the model IDs listed inside each policy document. The name in the URL identifies the policy document, not the model.List named policies
Read one named policy
404.
Create or replace a named policy
409 when another named policy already claims one of the models.
Like the global policy update, this change is ephemeral and the body is limited to 1 MiB (1048576 bytes).
Delete a named policy
200 even when the named policy did not exist.
Models previously assigned to the document return to the global policy.
See Policy YAML reference for the complete policy format.
Dynamic API-key management
The following endpoints work only when the client API uses dynamic authentication:501:
Registry versions
Mutating requests carry an opaque version string. Use values whose lexical order matches their chronological order, such as:Hash a client API key
The dynamic API accepts a SHA-256 hexadecimal hash, never the raw bearer key.Add or update a key
A stale version returns HTTP
409:
Admission validation on key writes
PUT /admin/api-keys/{id} and POST /admin/api-keys/replace enforce the same admission invariants as static configuration:
max_occupancy_sharemust be0or in(0, 1].input_tokens_per_minuteandoutput_tokens_per_minutecannot be negative.- For every reachable
mode: serverlessmodel, a nonzeroinput_tokens_per_minutemust be at least that policy’smax_input_tokens.
400 and leaves the registry unchanged. Policy reloads run the reverse check against both static and dynamic keys; a policy that would invalidate an existing key is rejected and the previous policy remains active.
The API stores the values supplied by the caller. It does not load router_limits.yaml or invoke auth.DeriveKeyDefaults automatically.
Use per-model quotas
The dynamic API accepts the same quota shapes asauth.yaml.
A per-model example:
0 to mean unlimited.
Delete a key
version query parameter is required.
Deletion is idempotent. It returns HTTP 200 when the ID does not exist, provided the version is accepted.
Replace the registry
id.
The operation:
- validates every entry before applying changes
- rejects duplicate IDs
- rejects duplicate key hashes
- replaces the registry atomically
- accepts request bodies up to 16 MiB (
16777216bytes)
Read the registry version
List registry entries
key_hash is always an empty string. Hivenet Router never returns stored hashes through the API.
Read one key
404:
Administration request-body limits
Administration write endpoints use fixed route-specific limits. They are separate fromHIVENET_ROUTER_MAX_REQUEST_BYTES, which applies to /v1/* inference requests.
When a body exceeds its route limit, the current handler returns HTTP
400 with a simple {"error":"..."} response rather than the structured /v1/* error envelope.
Error responses
Missing or invalid admin credentials return HTTP401 with a bearer challenge:
Operational guidance
- Keep
/admin/*on a private management network where possible. - Use HTTPS through a reverse proxy or load balancer.
- Use different values for client and admin API keys.
- Rotate admin keys through the router environment and restart the process.
- Do not log raw client or admin keys.
- Treat policy updates and metrics resets as privileged operator actions.
- Reconcile the dynamic API-key registry after every router restart.
Next steps
Routing concepts
Understand how global and named policies select agents.
API keys
Configure static and dynamic client authentication, access, and quotas.
Prometheus metrics
Query router, agent, tenant, policy, and hardware metrics.

