Skip to main content
Send text to an embedding model through Hivenet Router and receive vector representations for search, retrieval, clustering, classification, and other similarity-based tasks. Hivenet Router routes embedding requests to agents registered with the embedding capability.
The backend must implement an OpenAI-compatible POST /v1/embeddings endpoint. Infinity is the documented embedding backend, but any compatible engine can be used through an agent registered with --capability embedding.

How embedding requests are routed

For each request, Hivenet Router:
  1. authenticates the client when API authentication is enabled
  2. applies the configured request-rate quota
  3. reads and validates the top-level model field
  4. checks that the API key may use that model
  5. filters for agents registered with the embedding capability
  6. applies the routing policy and capacity checks
  7. forwards the original request to POST /v1/embeddings on the selected backend
  8. returns the backend response to the client
The embedding request uses the same routing pipeline as other Hivenet Router workloads. Static filters, dynamic gates, fallback chains, and least-loaded routing can all apply.

Request headers

If X-Request-ID is absent or is not a valid UUID, Hivenet Router generates one and returns it in the response.

Request body

The minimal request contains a model and input:
The model name must:
  • match a model registered by an embedding agent
  • be allowed by the caller’s API key when model restrictions are enabled
  • contain no more than 256 characters
Hivenet Router validates the model field. The selected backend validates the input content, batch size, token limits, and any optional embedding parameters.

Request-body size

Hivenet Router limits /v1/* request bodies to 10485760 bytes, or 10 MiB, by default. This limit includes the complete JSON body, so large embedding batches can reach it before the backend’s own batch or token limits. Requests above the configured limit receive HTTP 413 before routing. Configure the limit with HIVENET_ROUTER_MAX_REQUEST_BYTES, or set it to 0 to disable the built-in check. A proxy or ingress may still enforce a smaller limit. Handle HTTP 413 by reducing the batch or input size. Do not depend on a specific JSON error envelope for this early rejection.

Single input

With API authentication enabled:

Batch input

Send several strings in one request:
A compatible backend returns one embedding for each input. The index field identifies the position of the corresponding input in the original array.
Batch-size and token limits are defined by the selected backend and model. Hivenet Router does not split an oversized batch into smaller requests.

Use the OpenAI Python client

For a batch:
encoding_format="float" asks the backend to return numeric arrays. Other encoding formats work only when the selected backend supports them.

Additional request fields

Hivenet Router forwards the original JSON body to the backend. You can therefore include additional OpenAI-compatible fields such as:
Hivenet Router does not interpret these optional fields. The backend decides whether it supports:
  • output-dimension selection
  • base64 encoding
  • token-array input
  • user identifiers
  • engine-specific extensions
Unsupported fields may be ignored or rejected by the backend.

Response

A successful OpenAI-compatible response resembles:
The vector above is shortened for readability. The exact response fields depend on the backend. Some backends may omit id, created, or usage, or may return additional fields. Hivenet Router returns the successful backend response without reshaping the embedding vectors.

No streaming support

Embedding requests are synchronous. The endpoint does not use server-sent events, and the request does not accept a Hivenet Router streaming mode. The router waits for the selected backend to return the complete embedding response. For large batches, use an appropriate request timeout and keep batch size within the backend’s limits.

Authentication and model access

When API authentication is enabled, send:
An API key can limit access to particular models. A request for a model outside the key’s allowlist returns HTTP 403:
When authentication is disabled, no authorization header is required.

Quotas

Embedding requests participate in request-rate quota enforcement. When a finite request quota is configured, responses may include:
When the request-rate quota is exhausted, Hivenet Router returns HTTP 429.
The current embedding path does not charge input or output tokens against the daily token quota. It records successful embedding requests with zero input and output tokens for quota accounting.Embedding requests are also exempt from the LLM admission gates, including per-request token caps, KV-occupancy budgets, and serverless token rates. These gates model KV-cache-bound generation, which prefill-only embedding work does not perform. Request-rate, body-size, and agent-concurrency limits still protect this path.

Routing policies

Embedding agents can be selected using the same metadata and live signals as other agents. For example:
Capability filtering happens automatically before policy ranking. An embedding request cannot be routed to an agent registered as llm or reranker. You can also use fallback chains when more than one compatible embedding backend serves the same model.

Discover embedding models

List the models available through the router:
Inspect registered embedding agents:
The administration endpoint may require separate credentials depending on the router’s admin-auth configuration.

Error responses

Router errors use this envelope:
Errors produced by the backend use:
Common responses include: See Error codes for the complete reference.

Troubleshooting

The model is not found

List available embedding models:
Check that:
  • the agent uses --capability embedding
  • the requested model matches the registered model exactly
  • the agent is healthy
  • the API key may access the model

The request reaches the wrong backend type

Inspect the agent registration:
The capability must be:
Use distinct model names if the same model identifier would otherwise be registered under different capabilities.

The backend rejects the input

Test the backend directly:
A backend may reject:
  • empty strings
  • unsupported input formats
  • batches that are too large
  • inputs above the model’s token limit
  • unsupported optional fields

The batch response has fewer items than expected

Check the backend response directly. Hivenet Router does not combine, remove, reorder, or deduplicate input strings. It returns the successful backend response as received.

Requests time out

Reduce the batch size or increase the router and agent request timeout where appropriate. The agent’s backend HTTP timeout defaults to two minutes:
Also check:
  • model loading state
  • backend queue pressure
  • agent capacity
  • input length
  • accelerator memory

The request is rate-limited

Check the returned header:
Review the quota assigned to the API key and the per-model quota entry when per-model quotas are enabled.

Next steps

Reranking

Score and reorder documents by relevance to a query.

Models

Discover models, capabilities, engines, and healthy capacity.

Infinity agent

Configure embedding and reranking models through Infinity.