Skip to main content
The administration API provides operational visibility and runtime controls for a Hivenet Router router. Use these endpoints to inspect agents, models, storage, and routing state; update policies; reset historical agent metrics; and manage API keys when dynamic authentication is enabled.
Protect /admin/* with an admin API key and network controls before using Hivenet Router in production. Without admin authentication, these endpoints expose operational data and, in dynamic mode, control the client key registry.

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:
Provide one or more raw admin keys through the router environment:
Start the router with the auth configuration:
Admin keys are comma-separated. The router hashes them at startup and does not retain the plaintext values. For client commands, store one key in a convenient shell variable:
Then send it as a bearer token:
If admin.mode is none, or no auth configuration is provided, the router refuses to start unless:
That override makes /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 when admin.mode is absent or set to none. For example:
The router refuses to start in dynamic mode when HIVENET_ROUTER_ADMIN_API_KEYS is missing. This prevents the API-key management endpoints from becoming publicly writable.

Public liveness

This endpoint does not use admin authentication.
Response:
It returns HTTP 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

A response resembles:
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

This endpoint combines:
  • agent metadata
  • live connection and capacity state
  • lifetime success and failure counters
  • smoothed latency
  • engine metrics
  • CPU, memory, and GPU state
A shortened response resembles:

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:
  • UNKNOWN before Hivenet Router has initialized latency history
  • KNOWN after enough routing observations are available

Find unhealthy agents

Find agents with high KV-cache use

Compare model latency

Registration stream

This long-lived Server-Sent Events response publishes settled agent registration changes. It is useful for schedulers that need to react faster than polling the routing table.
Each event is one 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

These endpoints use the same response shapes as:
The difference is filtering. The public endpoints return only models visible to the calling client API key. The admin endpoints always return the complete registered catalog. List every registered model:
Read one model and its agent list:
See Models for the full response reference.

Storage statistics

A response resembles:
When another storage backend is used, the endpoint may return:
with HTTP 200.

Reset lifetime metrics

This endpoint clears persisted per-agent lifetime metrics so dashboards begin from a clean baseline.
Response:
This operation is destructive. It cannot restore the cleared historical counters.
It resets:
  • 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
It does not reset:
  • 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
A common use is immediately after deploying a routing or backend change, so new success and latency measurements are not mixed with older history.

Global policy

Read the active policy

The response is the active policy serialized as JSON.

Replace the active policy

Send the policy as YAML:
Response:
The request body is limited to 1 MiB (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.
Policies written through the administration API are ephemeral. A router restart reloads the policy supplied through --policy-file, or the built-in default when no file is configured.
For a persistent change:
  1. update the policy file on disk
  2. send SIGHUP to 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

The response is an object keyed by policy name:
An empty configuration returns:

Read one named policy

An unknown policy name returns HTTP 404.

Create or replace a named policy

Response:
The body must contain at least one model under:
A model can belong to only one named policy document. Hivenet Router returns HTTP 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

Response:
Deletion is idempotent. The endpoint returns HTTP 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:
Dynamic key state is held in memory. After a router restart, an external control service must repopulate the registry. When dynamic mode is not active, these endpoints return HTTP 501:

Registry versions

Mutating requests carry an opaque version string. Use values whose lexical order matches their chronological order, such as:
or RFC 3339 timestamps:
The registry rejects versions that sort lower than its current version. Equal and higher values are accepted. Use a new monotonically increasing version for each intended change.

Hash a client API key

The dynamic API accepts a SHA-256 hexadecimal hash, never the raw bearer key.
The hash must contain exactly 64 hexadecimal characters.

Add or update a key

The URL parameter is the source of truth for the entry ID.
Response:
A stale version returns HTTP 409:
A key hash cannot belong to two different IDs. Delete the existing entry before assigning its hash to another ID.

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_share must be 0 or in (0, 1].
  • input_tokens_per_minute and output_tokens_per_minute cannot be negative.
  • For every reachable mode: serverless model, a nonzero input_tokens_per_minute must be at least that policy’s max_input_tokens.
A violation returns HTTP 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 as auth.yaml. A per-model example:
Do not mix:
with:
on the same key. Every per-model entry must contain both quota fields. Use 0 to mean unlimited.

Delete a key

Response:
The 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

Use this endpoint to bootstrap or reconcile the entire in-memory registry.
Response:
Each entry requires its own 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 (16777216 bytes)
Use a current or newer registry version. A lexically lower version is rejected.

Read the registry version

Response:

List registry entries

A response resembles:
The response includes enabled and disabled registry entries. key_hash is always an empty string. Hivenet Router never returns stored hashes through the API.

Read one key

Response:
An unknown ID returns HTTP 404:

Administration request-body limits

Administration write endpoints use fixed route-specific limits. They are separate from HIVENET_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 HTTP 401 with a bearer challenge:
Response:
Most endpoint-specific validation errors use a simpler response:
Common statuses include:

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.