Policy types
There are three kinds of policy:
Each setting works the same way it does in a guardrail. The difference is that each type can be assigned on its own. For example, a team can share one model access policy while each person gets a different budget.
Where policies apply
Policies apply at two levels:- Workspace-wide policies apply to every member and API key in a workspace, and can’t be overridden. A member’s or API key’s own policy within a workspace can add restrictions on top of a workspace-wide policy, but it can’t loosen one. Use these for rules the whole workspace has to follow, like a maximum per-person spending cap or requiring ZDR without exception. The same workspace-wide policy can be assigned to multiple workspaces. Create workspace-wide policies and assign them to workspaces under Account > Guardrails.
- Member and API key policies apply to specific members or API keys inside one workspace. Use them to restrict particular people or keys further, like a smaller budget for a contractor or a shorter model list for a production key. A member’s policy also covers their chatroom usage and the API keys they created. Create and assign member and API key policies within a workspace under Workspace > Guardrails.
An organization API key with no policy of its own follows the member who created it. Its spend counts toward that member’s budget. If the creator leaves the organization, the key falls back to the workspace’s default.
Defaults
For each policy type (budget, model & provider access, content moderation), you can set a default at both levels:- Default workspace-wide policy: applies to every workspace in your account that doesn’t have its own set workspace-wide policy of that type, including workspaces you create later.
- Default member & API key policy within a workspace: applies to every member and API key in that workspace that doesn’t have its own set policy of that type, including people and keys added later.
Replacing or removing a default
You can remove the default from one workspace, member, or API key, at the level where the default is set. Replace it with a different policy or no policy.- Workspace-wide: give a workspace a different workspace-wide policy, or remove the default so that workspace has no workspace-wide policy of that type. Account-wide privacy and provider settings under Settings > Privacy always apply to every workspace.
- Within a workspace: give a member or API key a different policy, or remove the default so they have no member or API key policy of that type. Workspace-wide policies still apply to them.
No default required
You don’t have to set a default at either level. Without one, workspaces, members, and API keys only get a policy of that type if you assign one directly.How policies combine
When more than one level applies to a request, the stricter rule always wins:- Models and providers: only those allowed by every applicable policy are available.
- Zero Data Retention: enforced for a model group if any applicable policy enforces it.
- Data regions: only regions allowed by every policy that sets them. A policy that leaves regions unrestricted doesn’t change the result.
- Sensitive info and content filters: filters from every applicable policy are combined. If the same filter has different actions, block wins over redact.
- Budgets: each budget is checked on its own. A request is blocked when any one of them is used up.
Budget enforcement
Budgets are tracked per person and per API key. They are never a shared pool for everyone assigned to the policy.- A member budget of $50/day gives each assigned member their own $50/day. Spend from all their API keys adds up toward it.
- An API key budget limits that key’s own spend.
- A workspace-wide budget assigned to a workspace limits each member and each API key in that workspace. A $100/month workspace-wide budget means no one in the workspace can spend more than $100/month, even if their own budget is higher.
Example: raising one person’s budget
Your workspace has a workspace-wide policy with a $100/month budget, and a workspace default budget of $50/month. You give Alice her own $300/month budget policy. Alice’s own budget is now $300, but the workspace-wide policy still caps her at $100/month. To let her spend more, raise the workspace-wide policy’s limit or remove the workspace from it. You can check which budgets apply to an API key, and how much is left, withGET /api/v1/key.
Managing policies in the dashboard
Workspace policies live on the workspace’s Guardrails page (for the default workspace, Workspaces > Default > Guardrails). From there you can create budget, model & provider access, and content moderation policies, set a workspace default, and pick policies for each member and API key on the Assignments tab. Workspace-wide policies live under Account > Guardrails, where you choose which workspaces each one covers.Managing policies with the API
Policies are managed with a Management API key. All routes live underhttps://openrouter.ai/api/v1/guardrails/policies:
GET and DELETE on a workspace policy take workspace_id as a query parameter. List routes return { "data": [...], "total_count": N } and accept optional offset and limit for paging.
API keys are named by their hash, like everywhere else in the Management API. Member IDs are the user IDs returned by List organization members (id) or a workspace’s member list (user_id).
Create a budget policy
This creates a $200/month budget in a workspace and assigns it to one member and one API key:"is_workspace_default": true to make it the workspace default for its type. Use opted_out_member_ids and opted_out_api_key_hashes to keep specific members or keys off the new default.
Create a model & provider access policy
Create a workspace-wide policy
This applies a content moderation policy to two workspaces:"is_default": true instead to cover every workspace in the account, and list any workspaces to leave out in opted_out_workspace_ids.
Updating a policy
PUT replaces the policy’s name and settings, so send the full config every time. To change who is assigned, send both member_ids and api_key_hashes with the complete new lists. To leave assignments alone, for example when only changing the limit, leave both out.
Changing one member or API key
When several people or scripts manage assignments at once, sending full lists can overwrite each other’s changes. The assignment routes change one member or API key at a time instead. First read the current state:expected_assignment:
409 Conflict. Read it again and retry. Use the /assignments/api-keys/{key_hash} route the same way for API keys.
Limits
- A single create or update request can name up to 10,000 members and API keys in total. A policy itself can cover any number of them.
- Workspace policies belong to one workspace and can only be assigned to members and API keys in that workspace.
When a request is blocked
Requests blocked by a policy return the same403 errors as guardrails. See When a Request Is Blocked and Budget limits for the response shapes.