Skip to main content
Model restrictions control which registered models an API key can discover and invoke. Use them to apply least privilege, isolate tenants, separate application workloads, and prevent a credential intended for one model from reaching the rest of the inference fleet. Model names are matched exactly and are case-sensitive.

Restriction methods

Hivenet Router supports two ways to define model access: quota.per_model is both a quota configuration and a model allowlist.
Do not use the agent’s --hide-llm setting as an authorization control. It is registration metadata and does not replace API-key model restrictions.
For predictable behavior, use either an explicit allowlist or quota.per_model on one key.Avoid defining different model sets in both places. A single source of truth is easier to review and less likely to produce inconsistent access expectations.

Full model access

An empty or omitted allowlist grants access to every registered model, provided that quota.per_model is not configured.

Static key

You may also omit models:

Dynamic key

or omit allowed_models.
An unrestricted key can invoke models registered after the key was created.Use an explicit allowlist when newly deployed models should require a separate access decision.

Explicit allowlist

List every model the key may use.

Static key

Dynamic key

The names must match the model IDs reported by Hivenet Router:
This value:
does not match:

Restrict a key to one model

The key can discover and invoke only:
It cannot use a chat or reranking model unless that model is also listed.

Use per-model quotas as the allowlist

When a key uses quota.per_model, every permitted model must appear in that map.
The key can use only:
There is no wildcard or implicit unrestricted fallback. Every entry must contain both fields:
Use 0 when a particular limit should be unlimited.
Do not add a model to a separate models or allowed_models list and omit it from quota.per_model.The per-model map is the authoritative model set for discovery and quota admission.

How discovery is filtered

Model restrictions apply to:

List models

A restricted key sees only its permitted models:
For example:
Other registered models are omitted from the response.

Get one model

When a key requests details for a model it cannot use:
Hivenet Router returns HTTP 404:
The response is deliberately identical to the response for an unknown model. This prevents a restricted tenant from using the detail endpoint to discover model names assigned to another tenant.

Operator discovery is unfiltered

The administration catalog always shows every registered model:
For example:
Use the admin catalog when diagnosing whether a model:
  • is registered
  • is hidden only from a particular key
  • has healthy agents
  • has the expected capability and engine
Client and administration credentials are separate.

Inference access errors

The response depends on which restriction mechanism rejects the request.

Explicit allowlist rejection

A request outside models or allowed_models returns HTTP 403:
For example:

Missing per-model quota entry

When quota.per_model is configured and the requested model is absent from the map, quota admission returns HTTP 429:
This is a strict-enumeration failure rather than a depleted request-rate bucket. The model is also hidden from the client model catalog.

Restrictions apply before routing

Hivenet Router checks model access before selecting an agent. A disallowed request does not:
  • enter the routing queue
  • consume backend capacity
  • try fallback agents
  • reach an external provider
  • expose whether a healthy backend exists
This keeps access control independent of fleet state.

Provider fallback

Provider fallback authorizes the model originally requested by the client. For example:
may be permitted by the key and later fall back to:
The key needs permission for:
It does not need the external provider model in its Hivenet Router allowlist. Quota and audit records remain associated with the original requested model.
Allowing one local model may permit its configured external fallback path.Review provider fallback policies together with model-access rules.

Capability and model restrictions

Model restrictions use model names. They do not independently restrict capabilities or endpoints. For example, a key allowed to use:
can call any compatible endpoint for which an agent registers that exact model name and the required capability. Avoid registering the same public model name under several capabilities. Prefer names that make the workload clear:
This keeps model discovery, access control, quotas, and routing unambiguous.

Multi-tenant isolation

Give each tenant its own key and model set.
Tenant A cannot discover or invoke Tenant B’s Mistral model. Tenant B cannot discover or invoke Tenant A’s Llama models.
Model restrictions isolate API access. They do not create separate router processes, storage databases, logs, or physical infrastructure.Use separate deployments when tenants require stronger operational or infrastructure isolation.

Service isolation

Restrict internal services to the workload they need.
A compromised embedding-service key cannot call the chat model merely because both are available through the same router.

Environment separation

Use distinct keys and explicit model lists for development, staging, and production workloads.
This is easiest when the registered model names themselves clearly distinguish environments. Model restrictions cannot distinguish two deployments that register the same model ID. Use separate model names, tags with separate routers, or separate Hivenet Router deployments when that distinction matters.

Share models without sharing quotas

Two keys may use the same model while keeping independent quota state. Give them different owners:
Keys with the same owner share quota buckets. Use one owner only when shared quota accounting is intentional.

Update static restrictions

Edit auth.yaml, then send SIGHUP:
For Docker Compose:
Hivenet Router validates the complete updated file before replacing the active static-key provider. When validation fails, the previous model restrictions remain active. Changing from static to dynamic key mode requires a router restart.

Update dynamic restrictions

Update the key through:
For example:
The update replaces the complete entry. Include every field that should remain present. The new model restrictions take effect after the registry mutation succeeds.

Test a restricted key

Check discovery

Confirm that only intended models appear.

Check an allowed request

Check a denied request

Confirm the expected 403 or 429 based on the key’s restriction type.

Check detail privacy

Confirm that the endpoint returns 404.

Monitor denied access

Audit logs provide the clearest view of explicit model-access failures. With Loki:
Group denied requests by tenant and model:
These queries capture explicit models or allowed_models denials. A model missing from quota.per_model is recorded as rate_limit_exceeded, the same broad code used for RPM exhaustion. Use the request ID and router logs when you need to distinguish those two cases. Inspect successful routed traffic by tenant and model:
Inspect all failed or rejected tenant requests:
The failed-request metric includes other failure types. Use audit logs when you need to distinguish model restrictions from quota, routing, or backend errors.

Security guidance

  • Give every application its own key.
  • Use explicit allowlists for production credentials.
  • Keep model names stable after granting access.
  • Review provider fallback with the original model permission.
  • Use separate owners when quota buckets should be independent.
  • Avoid sharing one model name across capabilities.
  • Test discovery and inference after every restriction change.
  • Use the admin catalog for operator diagnosis.
  • Audit and alert on repeated model_forbidden events.
  • Use separate router deployments when logical filtering is not strong enough.

Troubleshooting

A key sees every model

Check whether its model list is empty or omitted:
or:
An empty allowlist means unrestricted access. Also check whether you edited the correct key and router environment.

A permitted model is missing

Compare the configured name with the operator catalog:
Check capitalization, slashes, punctuation, and model aliases. If quota.per_model is present, confirm that the model has an entry there.

The list endpoint hides a model, but the admin endpoint shows it

The client key is restricted. Review:
  • models
  • allowed_models
  • quota.per_model
This is expected tenant-filtering behavior.

Inference returns 403 model_forbidden

The key uses an explicit allowlist and the requested model is not permitted. Add the exact model name or use an unrestricted list when that is intentional.

Inference returns 429 for an unlisted model

The key uses quota.per_model. Add a complete quota entry for the model:
Both fields are required even when they are unlimited.

A model is allowed but the request still fails

Model authorization succeeded. Check the later routing stages:
  • registered capability
  • agent health
  • available capacity
  • routing-policy filters
  • backend compatibility
  • request validity
Use:

A changed static restriction does not take effect

Send SIGHUP and inspect the router logs:
A validation failure leaves the previous configuration active.

A dynamic restriction disappears after restart

Dynamic key state is memory-only. Repopulate the registry through the administration API after every router restart.

Next steps

Key rotation

Replace client, administrator, agent, and provider credentials safely.

Models

Understand filtered client discovery and the unfiltered operator catalog.

Audit logging

Track owners, keys, models, denials, and request outcomes.