auth.yamlfor client and administrator authentication- policy YAML for routing, fallback, and dynamic gates
View the installed options
Use the binary’s built-in help to confirm the options available in the version you deployed:The environment-variable prefix is exactly:Environment-variable names are case-sensitive on Linux. Use the capitalization shown in this reference.
Configuration precedence
The router loads configuration in this order:Agent precedence
Most agent settings are available only as command-line flags. The current agent reads these Hivenet Router environment variables directly:Value formats
Durations
Duration flags and environment variables use Go duration syntax:--disk-db-ttl is different. It accepts an integer number of days rather than a duration string.
HTTP and gRPC listen addresses
Router HTTP, gRPC, and metrics values are complete TCP listen addresses. Listen on every interface:libp2p ports
The router’s--p2p-port accepts a port without a colon:
Paths
Relative paths are resolved from the process’s working directory. For a system service or container, prefer explicit paths such as:Tags
Agent tags are comma-separated:Router network settings
HTTP API
The HTTP server exposes:Metrics
The metrics server is separate from the main HTTP API:Remote agents
The router’s libp2p host binds to loopback by default:Agents behind shared NAT
Agents behind one NAT or egress gateway appear to libp2p as connections from one source IP. Set:Router routing and backpressure settings
Built-in policy
When no policy file or directory is configured, Hivenet Router uses:- no static filters
- no dynamic exclusions
- no local fallback steps
- no provider fallback
Policy-file precedence
When both are configured:_default.yaml becomes the global policy.
Hivenet Router logs a warning that it replaced the standalone policy file.
Named policy files in the directory can claim specific models.
Global request queue
--queue-size controls the buffered request channel before processor work begins.
When the channel remains full for the handler’s enqueue window, Hivenet Router returns:
Per-model wait queue
--queue-depth controls how many requests can wait for capacity for each model.
Concurrent forwards
--max-concurrent limits requests actively being forwarded to agents.
It is separate from:
- the global request-channel size
- the per-model wait queue
- each agent’s declared capacity
Request deadline
--request-timeout covers:
- time waiting for processor concurrency
- policy evaluation
- time waiting in a per-model capacity queue
- retries and fallback steps
- agent forwarding
- response or stream handling
Router health and session settings
Keep these relationships:
Session lifetime
The session TTL must be longer than:- authenticate once
- receive a one-hour session
- renew five minutes before expiry
- retry failed renewal after 30 seconds
Router storage settings
The persistent database can contain:
- per-agent request and token history
- SRTT and RTTVAR
- disconnection and failure history
- daily token state when the Badger quota backend is active
Database reset
Do not use
--reset-disk-db as a normal recovery step.It removes persisted agent history and Badger-backed daily quota state from that directory.Universal flush interval
The same interval is currently used for:- universal per-agent history flushes
- Badger-backed quota flushes
Router security and authentication settings
Agent JWT secret
The router requires a shared secret containing at least:--jwt-secret-file wins.
The file’s leading and trailing whitespace is removed, so a final newline is safe.
The value must match every agent exactly.
Changing it changes:
- JWT validation
- the router’s derived gRPC TLS identity
- the public key pinned by agents
Authentication file
- client API authentication
- administrator authentication mode
- static client keys
- model access
- quotas
- static expiration
Router environment-only settings
These settings do not have equivalent router command-line flags.HIVENET_ROUTER_AUTH_MODE
Accepted API modes are:
auth.yaml is present, its:
HIVENET_ROUTER_ADMIN_API_KEYS
Provide one or more raw keys separated by commas:
HIVENET_ROUTER_ALLOW_INSECURE_ADMIN
The router refuses to start with unauthenticated administrator endpoints unless you explicitly set:
HIVENET_ROUTER_MAX_REQUEST_BYTES
The default maximum request body size for /v1/* endpoints is:
413 before routing. Set another byte value to change the limit, or:
Admission environment variables
HIVENET_ROUTER_ADMIT_FRACTION scales a policy’s admit_budget_tokens before the router admits token-weighted occupancy. It defaults to 0.90; invalid values or values outside (0, 1] leave the default unchanged.
HIVENET_ROUTER_ADMIT_PARK_TIMEOUT bounds how long an over-budget request waits for occupancy to free. It uses Go duration syntax, defaults to 250ms, and accepts 0 for immediate rejection. Negative or invalid values leave the default unchanged.
HIVENET_ROUTER_RPM_BURST_SECONDS changes the burst capacity of both flat and per-model RPM buckets. With a value from 1 through 59, burst capacity is floor(effective RPM × seconds / 60), with a minimum of 1. The default 0 preserves the legacy full-minute burst. Invalid values and values outside [0, 60) leave that default unchanged.
See Admission control for policy fields, footprint calculation, and error responses.
HIVENET_ROUTER_QUOTA_BACKEND
Supported values are:
memory:
- keeps RPM and daily token state in process memory
- loses both after a router restart
badger:
- keeps RPM buckets in memory
- periodically persists daily token use
- restores daily token state after restart
Provider credentials
Provider fallback credentials are read when the router starts:Audit path
Router flag reference
The complete current router flag set is:Agent backend settings
Supported engines
Accepted values are:Model discovery
When--model is empty, supported engine adapters try to discover a model from the backend.
Use an explicit model value when:
- the backend exposes several models
- the client-facing alias must remain stable
- backend discovery is unreliable
- the custom engine is selected
Capability
Accepted values are:Capacity
Capacity must be positive. It is an operator-defined concurrency limit, not a value calculated from GPU memory or model size. The router rejects agent authentication when the reported capacity is zero or negative.Backend and router timeouts
The agent’s default backend HTTP timeout is:Stream write timeout
--stream-write-timeout is a rolling per-chunk deadline.
When the router or another receiver stops reading a stream, the agent eventually releases the blocked write rather than holding the libp2p stream indefinitely.
Set:
Agent router and libp2p settings
Router discovery
The agent currently obtains the router’s actual libp2p addresses from the gRPC authentication response. The accepted:Persistent identity
Use a persistent identity path:- request counters
- token counts
- SRTT and RTTVAR
- disconnection history
Agent connection direction
Agents initiate their libp2p connection to the router after successful gRPC authentication. The router forwards inference traffic over that established connection rather than opening a new inbound connection to the agent. The default:Agent metadata settings
Region default
The current code default is literally:Version
Release builds can inject a version at build time. A local build without an injected value reports:--version flag changes registration metadata only. It does not select or install another agent software version.
GPU model
--gpu-model is not detected automatically through NVML.
Set a consistent operator-defined value when routing policies use:
Deployment ID
The deployment ID is included in agent registration and used in tenant request metrics. It may be empty in local or bare-metal deployments that do not have a separate deployment identity.Replica ID
--replica-id supplies a stable identifier for one agent replica. When --deployment-id is also set, the two values form a join key for external schedulers and registration-stream consumers.
hide_llm metadata
An agent with:
/v1/models. Do not use this flag as an access-control or reliable discovery-hiding mechanism. Use API-key model restrictions to control which models a caller can discover and invoke.
Agent telemetry settings
Sampling and push intervals
Sampling and pushing are independent. For example:GPU-device file
The file accepts NVIDIA GPU UUIDs separated by commas or line breaks. When it is empty or contains:Agent flag reference
The complete current agent flag set is:Logging configuration
Both processes usego-log.
Log level
JSON logs
For structured application logs:Distributed tracing
Set an OTLP gRPC endpoint on the router, agents, or both:Environment parsing behavior
Router environment variables are loaded before CLI parsing. For typed router values such as integers and durations, an invalid environment value is generally ignored and the previous default remains active. For example:Startup validation
Router validation
Router startup fails for conditions including:- missing JWT secret
- JWT secret shorter than 32 bytes
- session TTL of five minutes or less
max-tries-per-stepbelow1- negative queue depth
- invalid libp2p announce address
- invalid policy YAML
- invalid per-model policy directory
- unknown authentication mode
- static API-key mode without keys
- administrator API-key mode without administrator keys
- unknown quota backend
- provider fallback without the required provider key
- storage initialization failure
Agent validation
Agent startup or authentication fails for conditions including:- missing JWT secret
- JWT secret shorter than 32 bytes
- unknown engine
- custom engine without a model
- custom engine without a health URL
- unknown capability
- Ollama configured as a reranker
- backend that never becomes ready
- model discovery that never returns a model
- non-positive capacity rejected by the router
- JWT secret that does not match the router
- unreachable router gRPC or libp2p interfaces
Reload or restart
Editing a systemd
EnvironmentFile, Docker .env file, or Kubernetes Secret does not modify the environment of an already running process.
Recreate or restart the process when the changed value comes from its environment.
Send SIGHUP
Bare metal:Router startup example
- exposes gRPC and libp2p for remote agents
- keeps the client API behind a local reverse proxy
- keeps metrics on loopback
- reads secrets and configuration from explicit paths
- uses a policy directory
- persists state outside the working directory
vLLM agent example
--router-p2p. The current agent receives the router’s dialable libp2p address during gRPC authentication.
Custom-engine example
Generate a static client key
Run:- generates 32 random bytes
- encodes a key beginning with
sk-hivenet- - prints the raw key once
- prints its SHA-256 hash
- prints a masked preview
- produces an
auth.yamlentry
auth.yaml.
Next steps
auth.yaml reference
Configure static keys, administrator access, model restrictions, and quotas.
Policy YAML reference
Configure primary routing, fallback chains, provider fallback, and gates.
Detailed architecture
See where each configuration value affects the running system.
Error codes
Diagnose startup, authentication, routing, and backend failures.
Key rotation
Rotate client, administrator, agent, and provider credentials.
Prometheus metrics
Verify runtime behavior after configuration changes.

