llm agent, and forwards the request to its inference backend.
Prerequisites
Before configuring Pi, you need:- Node.js
22.19.0or later - a reachable Hivenet Router router
- a Hivenet Router client API key
- at least one healthy agent registered with the
llmcapability - an inference backend that supports OpenAI Chat Completions
- a model that can produce reliable structured tool calls
- HTTPS when the router is reached over an untrusted network
Prepare the inference backend
Pi can answer text prompts through any compatible chat model. For coding work, the selected model and inference engine must also support structured tool calls for operations such as:- reading files
- editing and creating files
- running shell commands
- searching the project
- invoking extension-provided tools
Tool-call parsers are model-specific.Do not copy a parser from another model family without checking the inference-engine documentation and testing the complete tool loop.
- the backend’s served-model name
- the Hivenet Router agent registration
- Pi’s
models.json - the client API key’s model restrictions
- any per-model quota entry
Test Hivenet Router directly
Before configuring Pi, test the complete Hivenet Router request path:- the client key is valid
- the key can access the model
- an eligible agent is available
- the backend accepts Chat Completions
- the router and agent can preserve streaming
Install Pi
- npm
- Installer
Configure Hivenet Router as a provider
Pi reads custom providers and models from:https://router.example.comwith the router addresshivenet-router-code-modelwith an exact model ID from/v1/modelscontextWindowwith the usable context sizemaxTokenswith the supported maximum output
Set the API key
Export the raw Hivenet Router client key:- the SHA-256 key hash
- an administrator key
- the agent JWT secret
- a provider fallback key
HIVENET_ROUTER_API_KEY is a client-side environment variable chosen for this guide.It does not need to follow the case-sensitive HIVENET_ROUTER_* convention used by the Hivenet Router process.Read the key from a command
Pi can resolve a credential by running a shell command:- caching
- a timeout
- fallback behavior
- refresh logic
- custom error handling
Understand the provider fields
Provider ID
hivenet-router is Pi’s local provider ID.
It is used by:
Base URL
Use:API type
Use:Bearer authentication
Use:apiKey value in the standard bearer header Hivenet Router accepts. Without this setting, a custom provider can resolve the key without attaching it as Authorization: Bearer.
Model ID
Display name
id.
Context window
Maximum output
- project instructions
- conversation history
- tool definitions
- tool results
- the current prompt
Cost
Add several models
Add every model that should appear in Pi:Configure the default model
Pi’s global settings file is:Review compatibility only when needed
The minimal configuration should be the starting point. Pi also supports compatibility overrides for OpenAI-compatible backends:Developer role
Set:Reasoning effort
Set:reasoning_effort for several reasoning-model integrations, so disabling it unconditionally can remove a feature that the deployment supports.
Output-token field
Set:max_tokens.
Streaming usage
Set:Configure a model-specific override
Compatibility may differ between models served by the same provider. Put the override on one model:Configure reasoning models
Set:- model family
- reasoning parser
- chat template
- vLLM version
- whether the server expects
reasoning_effort - whether it expects
enable_thinking - how reasoning is represented in streamed responses
A model being described as a reasoning model does not prove that its tool calls work reliably while reasoning is enabled.Test reasoning and tool use together.
Reload model configuration
Pi reloads:Verify the provider
List models matching the provider:models.jsonis valid- the provider contains
baseUrlandapi - the API key can be resolved
- the model entry has an
id - the expected Pi configuration directory is in use
Start Pi
Run Pi in the project directory:Begin with a read-only test
Pi does not ask for confirmation before using its tools. For the first integration test, limit the available tools:- structured tool calling
- tool-result handling
- multi-step model behavior
- project access
Test the complete tool loop
After the read-only test succeeds, start Pi normally in a disposable directory:- receives a structured tool call from the model
- invokes the file tool
- returns the tool result to the model
- reads the file
- completes the task without inventing the result
Streaming
Pi’s OpenAI-compatible provider consumes streamed Chat Completions responses. The complete path must preserve server-sent events:- whether the backend streams
- whether the response is
text/event-stream - whether the reverse proxy buffers responses
- whether proxy timeouts are long enough
- whether the agent is current
Request timeout
Hivenet Router’s default request timeout is:- large system instructions
- many tool definitions
- long project context
- slow model startup
- large requested outputs
- backend queueing
Model access and quotas
Pi requests use the same Hivenet Router controls as other clients. The API key may be subject to:- model allowlists
- strict per-model quota enumeration
- request-rate limits
- daily token budgets
- expiration
- routing policies
- provider fallback
- revocation
- rotation
- model access
- quotas
- audit attribution
Restricted-egress environments
Pi performs some startup network operations independently of model inference. Disable install and update telemetry:- model traffic
- extensions
- packages
- external tools
- shell commands
- session sharing
Session sharing
Pi’s:- private source code
- credentials
- customer data
- internal prompts or documents
- security findings
- regulated information
Extensions and packages
Pi can load extensions, skills, prompt templates, and packages. These can change:- available tools
- model behavior
- project instructions
- network access
- command execution
- session handling
Observe Pi traffic
Give Pi its own client key and owner:Troubleshooting
The provider or model does not appear
Check the configuration file:- the file is in the active Pi configuration directory
providers.hivenet-routerexistsbaseUrlends in/v1apiisopenai-completionsauthHeaderistruemodelscontains at least one entry- each model has an
id - the API-key value can be resolved
/model again after editing the file.
Pi reports that no API key is available
Check the variable:$:
Hivenet Router returns 401 Unauthorized
Check that:
- the variable contains the raw client key
- the key has not expired
- the key belongs to client authentication
- the variable reached the Pi process
Requests return a plain 404
Check the base URL.
It should be:
openai-responses.
Hivenet Router returns model_not_found
Compare Pi’s configuration with the live catalog:
- capitalization
- punctuation and slashes
- backend served-model name
- agent registration
- key model access
- agent health
Text works but tools do not
Check that:- the model supports tool calling
- the backend uses a model-appropriate tool parser
- vLLM was started with
--enable-auto-tool-choice - the chat template supports tool and tool-result messages
- the backend returns structured
tool_calls - the model follows the schemas reliably
tools array.
Hivenet Router forwards the response. It does not convert plain model text into a structured tool call.
Tool calls appear as text
The backend parser did not recognize the model’s tool syntax. Review:- model family
- tool-call parser
- chat template
- backend version
- streaming tool-call support
The backend rejects the developer role
Add:
/model again to reload the configuration.
The backend rejects reasoning_effort
Add:
The backend rejects max_completion_tokens
Add:
Streaming usage causes a validation error
Add:Pi compacts too early
Increase the configured:The backend rejects the prompt as too long
Reduce:contextWindowmaxTokens- included project context
- requested output
Output arrives only after completion
Test streaming directly with curl. Then check:- backend SSE behavior
- reverse-proxy buffering
- proxy read and idle timeouts
- Hivenet Router request timeout
- agent logs
Pi modifies files without asking
This is expected behavior. Pi does not have a built-in permission-prompt system. Restart it with restricted tools:Requests return 504 request_timeout
The request exceeded the Hivenet Router deadline.
Check:
- backend readiness
- prompt size
- output size
- engine queue depth
- router-side capacity queueing
- current request timeout
Read the relevant logs
- Router
- Agent
- Backend
Next steps
Open WebUI
Add a browser-based chat interface backed by Hivenet Router.
Use from code
Call Hivenet Router from SDKs, scripts, and custom applications.
Chat completions and messages
Review the supported LLM request paths and streaming behavior.
API keys
Configure model access, quotas, expiration, and rotation.
vLLM agent
Deploy and register an OpenAI-compatible inference backend.
Audit logging
Investigate Pi requests by tenant, model, status, and agent.

