Skip to main content
Hivenet Router exposes OpenAI-compatible Chat Completions and Anthropic-compatible Messages endpoints through the same routing pipeline. The router reads the top-level model field, selects a healthy language-model agent, and forwards the original request to the same path on that agent’s backend.
The 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:
  1. authenticates the client when API authentication is enabled
  2. applies request and token quotas when configured
  3. reads and validates the top-level model field
  4. checks that the API key may use that model
  5. applies the model’s request caps, pressure shed, occupancy budget, and serverless per-key admission limits
  6. selects a healthy llm agent through the routing policy
  7. forwards the original body to the same path on the selected backend
  8. returns the backend response to the client
Apart from the fields needed for routing and quota estimation, Hivenet Router does not impose its own generation schema or defaults. Parameters such as sampling controls, tools, structured output, multimodal input, and backend-specific extensions work only when the selected backend supports them.

Allowed passthrough paths

Hivenet Router only forwards an explicit set of inference paths:
Other backend paths are not exposed through the router. This prevents clients from reaching backend administration, scaling, loading, metrics, or other control-plane endpoints through the public inference API.

Request requirements

Every request must contain a non-empty top-level model field:
The model name:
  • 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
Malformed JSON, a missing model, or an overlong model name is rejected before routing.

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:
Set it to 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

When authentication is enabled:

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:
The backend must support the requested modality. Hivenet Router routes and forwards the request but does not add vision or audio support to a text-only engine.

Non-streaming responses

For a non-streaming request, Hivenet Router returns the response produced by the selected backend. A typical OpenAI-compatible response resembles:
The exact fields and values depend on the backend. If the backend omits token usage from a successful non-streaming response, Hivenet Router estimates prompt and completion tokens for accounting and audit records.

Streaming responses

Set:
and use a client that reads server-sent events progressively.
Hivenet Router forwards streaming chunks as they arrive from the backend rather than buffering the full response. A typical stream resembles:
The exact event structure comes from the backend.
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:
The request is routed using its top-level model and forwarded unchanged to /v1/messages on the selected backend.
The backend must natively implement the Anthropic Messages endpoint. If it does not, its error is returned through Hivenet Router. Model names must match both:
  • the name registered by the Hivenet Router agent
  • the name accepted by the backend

Use Claude Code

Point Claude Code at the router:
The router should be exposed through HTTPS before using it outside a trusted network. See Claude Code for the complete setup and compatibility guidance.

Count Anthropic input tokens

Hivenet Router also allows:
The request uses the same top-level model field and is routed to a backend that supports the token-counting endpoint.
A compatible backend returns:
This endpoint counts input tokens without running model inference.

Authentication and model access

When API authentication is enabled, send:
An API key can restrict access to specific models. A request for a model outside the key’s allowlist returns HTTP 403:
When authentication is disabled, requests do not need an authorization header.

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
Before routing, Hivenet Router checks the request-rate quota. Independently of key quotas, LLM generation also passes the model’s admission gates: per-request input and image caps, live pool-pressure shedding, and replica-scaled occupancy limits. These protect the serving pool even when the key has unlimited quotas. When a daily token budget is configured, it also estimates the prompt and checks whether the remaining budget can cover:
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:
Backend-derived errors use:
Common responses include: 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.