model field, selects a healthy language-model agent, and forwards the original request to the same path on that agent’s backend.
OpenAI Chat Completions
POST /v1/chat/completionsAnthropic Messages
POST /v1/messagesAnthropic token counting
POST /v1/messages/count_tokensThe selected backend must support the endpoint used by the client. Hivenet Router does not translate between the OpenAI and Anthropic request formats.
How passthrough works
For each request, Hivenet Router follows the same pipeline:1
Authenticate and apply quotas
Authenticate the client when API authentication is enabled, then apply configured request and token quotas.
2
Resolve and authorize the model
Read and validate the top-level
model field, then confirm that the API key may use it.3
Apply admission control
Check the model’s request caps, pressure shed, occupancy budget, and serverless per-key limits.
4
Select and forward
Select a healthy
llm agent through the routing policy and forward the original body to the same backend path.5
Return the response
Return the backend response to the client.
Allowed passthrough paths
Hivenet Router only forwards an explicit set of inference paths:Request requirements
Every request must contain a non-empty top-levelmodel field:
- must match a model registered by an agent
- must not exceed 256 characters
- must be allowed by the caller’s API key when model restrictions are enabled
Request-body size
Hivenet Router limits/v1/* request bodies to 10485760 bytes, or 10 MiB, by default. Requests above the configured limit are rejected with HTTP 413 before model authorization, quota accounting, queueing, or backend forwarding.
Configure the limit with:
0 to disable the built-in limit. A reverse proxy or ingress can still enforce a smaller limit.
Do not depend on a particular JSON error body for 413 responses. Handle the HTTP status directly, because the rejection occurs before the normal inference-handler error path.
Request headers
If
X-Request-ID contains a valid UUID, Hivenet Router preserves it. If it is missing or invalid, the router creates a new UUID. The value is returned in the response.
Hivenet Router may also return a W3C traceparent header when tracing is enabled.
OpenAI Chat Completions
Send requests to:Basic request
Fields used by Hivenet Router
Hivenet Router forwards the complete request, but it reads a small number of fields for routing and quota enforcement.
All other fields are passed to the backend without Hivenet Router assigning its own default values.
The selected backend decides which request fields, message roles, modalities, tools, and sampling values it accepts.
Multimodal message content
Hivenet Router can parse message content supplied as plain text or as content-part arrays containing text, image URLs, or input audio. For example:Non-streaming responses
For a non-streaming request, Hivenet Router returns the response produced by the selected backend. A typical OpenAI-compatible response resembles:Streaming responses
Set:Hivenet Router can relay a backend’s SSE stream, but it cannot convert a non-streaming backend response into streaming output.
Anthropic Messages
Send Anthropic-compatible requests to:model and forwarded unchanged to /v1/messages on the selected backend.
- the name registered by the Hivenet Router agent
- the name accepted by the backend
Use Claude Code
Point Claude Code at the router:Count Anthropic input tokens
Hivenet Router also allows:model field and is routed to a backend that supports the token-counting endpoint.
Authentication and model access
When API authentication is enabled, send:403:
Request and token quotas
API keys can enforce:- requests per minute
- daily token budgets
- separate quotas for individual models
- on serverless policies, input and output tokens per minute and a per-key occupancy share
max_completion_tokens is used when present. Otherwise Hivenet Router uses max_tokens.
The estimated input tokens are charged at admission. Actual completion tokens from local responses are charged after the backend responds.
Hivenet Router uses one per-model learned estimate for request caps, occupancy, serverless input rates, and daily input admission. It includes message text, the Anthropic top-level
system prompt, and tool-definition JSON. Exact OpenAI or Anthropic backend usage corrects the active reservation and trains the model-specific ratio. Images are bounded separately by images_max and are not used to train the text ratio.POST /v1/messages/count_tokens is exempt from the admission and token-quota checks because it performs no generation. The request-per-minute limiter still protects it from flooding.
Rate-limit headers
When a finite quota is configured, responses may include:
Unlimited quotas do not produce a remaining-value header.
When a request-rate bucket is exhausted, Hivenet Router returns HTTP
429 with X-RateLimit-Remaining-Requests: 0.
A token-budget rejection can still report a nonzero X-RateLimit-Remaining-Tokens value when the remaining budget is positive but too small for the estimated prompt plus requested maximum output. Post-response token rejection reports 0.
Error responses
Router errors use this envelope:
See Error codes for the complete reference.
Next steps
Embeddings
Generate vectors through capability-specific embedding agents.
Models
Discover which models and capabilities are currently available.
API keys
Configure client authentication, model access, and quotas.

