Skip to main content
Policies control which requests a workspace accepts, which models and credentials can serve them, and when a fallback can run. Each policy has a target and one or more rules. A rule combines a request match with an action.

How policies apply

  • Every matching restriction must pass
  • Rules within a policy are unordered
  • All matching policies compose
  • Policies are traversed by ID for deterministic evaluation
  • The first matching fallback policy in that order supplies the fallback plan
  • Exact duplicate rules are invalid
  • Editing one policy cannot change another policy
Routing changes take effect after gateways adopt the updated workspace bundle. Budget state refreshes separately. See the budget tutorial for spending and status checks.

Configure a policy

Choose a target

Workspace

Apply the policy to all current and future inference keys and playground sessions in the workspace:

User

Target a human user or service account to apply the policy to all inference keys associated with them, current and future:

Inference keys

Target specific keys. Keys created later are not included:

Choose requests to match

Match all requests:
Or combine model, stream, and capability criteria. Every supplied criterion must match:
Capabilities are tools, reasoning, and structured_output. Matching uses the original request, including when a fallback model handles it.

Choose actions

Add one action to each rule. A policy can contain multiple rules, and matching restrictions from all policies apply.

Allowed models

Limit matching requests and fallbacks to the listed catalog models:

Allowed providers

Limit primary and fallback routes to the listed providers:

Credential access

Allow credentials from the listed scopes. Matching credential rules intersect. airmux chooses the most specific populated allowed scope in workspace, organization, instance order:

Strict parameter support

Reject a route if airmux would otherwise remove an unsupported caller-supplied parameter:
Capability and input-modality checks always run.

Model price limit

Set maximum catalog prices in USD per million tokens. Both input and output prices must meet the limits:
This limits route prices, not the total request cost.

Request limits

Reject a request that explicitly asks for more output tokens than the limit. If it omits the limit, airmux does not invent one:

Budget

Limit matching usage to a USD amount per UTC calendar day or month. Use shared to combine spend across the target or per_key to track each inference key separately:
See the budget tutorial to create a budget and inspect spend.

Deny requests

Reject matching requests with 403 policy_denied and the configured message:

Model fallbacks

Try backup models for rate limits, upstream errors, or timeouts:
A policy may contain one fallback rule with up to four backup models. max_attempts is 2–5 and includes the primary call. timeout_ms is 100–120,000. Invalid requests, policy denials, and authentication failures do not trigger model fallback. An upstream authentication failure may try another credential in the selected scope.

Create a policy

Use either the CLI or the management API. This example creates a workspace-wide output limit. The CLI uses your active organization and workspace context; the API path names both explicitly. Save this as policy.json:
The response wraps the policy in {"data": ...}. The webapp can also create and edit policies with the same target, match, and action options.