Skip to main content
Policies are the highest-level routing control in the AI Router. A policy bundles model routing, guardrail rules, and budget limits into a single named configuration that can be invoked directly from your API calls.
Policies are an Enterprise-only feature. They are available on the AI Router only and cannot be used in combination with Agents.

How policies work

Policies sit at the top of the routing hierarchy:
  • When a policy with a model configured is matched, Routing Rules are bypassed.
  • If the policy has no model configured, the router falls back to Routing Rules and applies the highest-priority matching rule.
  • Any Guardrail Rules that match the request are still evaluated and enforced, regardless of which policy is active.

Visibility

  • Global policies: visible to workspace administrators only.
  • Project policies: visible to all members of the scoped project.

Creating a policy

From the Policies list, click Add New Policy. A panel opens on the right with the following fields.
Create Policy

General

FieldDescription
Policy NameA display name for the policy. Used as the identifier when invoking the policy in code.
DescriptionOptional context for other administrators.
Enable PolicyToggle to activate or deactivate the policy without deleting it.
ProjectScope of the policy. Global (all projects) applies the policy workspace-wide. Selecting a specific project restricts the policy to calls made within that project, and only entities belonging to that project are evaluated.

Providers and traffic weight

Defines which models handle traffic and how requests are distributed across them. Models sets the distribution strategy:
  • Fallback: Requests go to the primary model. If it fails, the next model in the list is tried.
  • Weighted: Traffic is split across models by percentage weights you assign.
  • Round Robin: Requests rotate evenly across all configured models.
Click Add Model to add a model to the policy.

Guardrails

Attach one or more Guardrail Rules to gate requests through the policy. Click Add guardrail to select from the guardrail rules available in the scoped project. Guardrails are condition-triggered: they are only evaluated when a request matches the conditions defined in the guardrail rule.

Budget

The Budget section contains three independently toggleable limits. Each has a configurable period: Hourly, Daily, Weekly, or Monthly.
LimitFieldDescription
Max spendAmount in USDMaximum dollar spend per period.
Token limitMax tokensMaximum number of tokens consumed per period.
Request limitMax requestsMaximum number of API requests per period.
Each limit can be enabled or disabled individually. The next to the period selector clears the current value.

Invoking a policy

Reference a policy in your API call using policy/<policy-name> as the model value. The name must match the Policy Name you set when creating the policy.
import { OpenAI } from 'openai';

const openai = new OpenAI({
  baseURL: 'https://api.orq.ai/v3/router',
  apiKey: process.env.ORQ_API_KEY,
});

const completion = await openai.chat.completions.create({
  messages: [
    { role: 'system', content: 'You are a helpful assistant.' },
    { role: 'user', content: 'What can you help me with today?' },
  ],
  model: 'policy/mypolicy',
});

console.log(completion.choices[0]);
Replace mypolicy with the name of your policy.