The short version
- Nothing breaks. Your existing guardrails keep enforcing the same rules, keep their IDs, and the guardrails API and Terraform resources keep working.
- Each guardrail now also appears in Guardrail Policies as up to three separate policies: a budget, a model & provider access policy, and a content moderation policy.
- Changes you make through the guardrails API or Terraform keep flowing into those policies.
- Changes you make in Guardrail Policies don’t flow back into guardrails. Once you edit a policy for a workspace, manage that policy type there from then on.
How guardrails map to policies
Setting names and values are the same for guardrails and policies, so a guardrail body can be split into policy
config objects without renaming anything.
The rules for combining layers are also unchanged: the stricter rule wins, and every budget is checked on its own. See How policies combine.
What’s different with policies
- Each type is assigned on its own. A member can share a team’s model access policy and still have their own budget. With guardrails, giving someone a different budget meant copying the whole guardrail.
- Policies belong to one workspace. A workspace policy can only be assigned to members and API keys in that workspace. Use a workspace-wide policy for a rule that spans workspaces.
- The workspace default is optional. A workspace can have no default of a given type, and you can opt individual members or API keys out of a default.
- Workspace-wide policies can cover many workspaces. One workspace-wide policy can be the default for every workspace or assigned to a chosen list, instead of repeating the same workspace default in each one.
- API keys are named by hash. Policy requests use
api_key_hashesandopted_out_api_key_hashes, thehashreturned by List API keys. Member IDs are the same user IDs you use with guardrails.
Editing a migrated policy
When you change a migrated policy through the Guardrail Policies API or the dashboard, OpenRouter makes a copy of it in that workspace and applies your change to the copy. The copy has a new ID, which thePUT response returns in data.id. Use that ID from then on.
What this means for you:
- The original guardrail is not changed, and neither are other workspaces that use it.
- From then on, changes to that guardrail no longer reach that policy type in that workspace. Other policy types in the workspace are still kept in sync.
- You can’t delete a migrated policy directly. Unassign it, or delete the guardrail with
DELETE /api/v1/guardrails/{id}.
Telling whether a guardrail or a policy is in charge
Guardrail member and API key assignment responses include two fields that show this:managed_byislegacywhen every policy type for that assignment still follows the guardrail, andpoliciesonce at least one type is managed in Guardrail Policies.legacy_policy_typeslists the types that still follow the guardrail, such as["budget", "moderation"].
Migrating API integrations
There’s no deadline to switch, and you can move one workspace and one policy type at a time.- List what OpenRouter already created from your guardrails with
GET /api/v1/guardrails/policies/budget?workspace_id=...(and the/moderationand/model-availabilityroutes). Migrated policies already carry your settings and assignments. - Point your writes at the policy routes for the type you’re moving. See Managing policies with the API for the routes and examples.
- Store the IDs the policy responses return. The first edit of a migrated policy returns a new ID.
- Stop writing that type through the guardrail routes for that workspace.
- Repeat for the other types and workspaces.
Request-shape changes
Example: guardrail to policies
This guardrail:POST /api/v1/guardrails/policies/budget and POST /api/v1/guardrails/policies/model-availability.
Terraform users
The OpenRouter Terraform provider manages guardrails. Those resources keep working the same way, and their changes keep flowing into the matching policies, so your plans stay clean.
To keep Terraform as your source of truth:
- Don’t edit Terraform-managed guardrails in the dashboard or through the Guardrail Policies API. That creates a copy Terraform can’t see, so Terraform shows no change while the copy is what gets enforced.
- Don’t edit a Terraform-managed workspace default guardrail in the dashboard. The dashboard saves that change to a new workspace-wide policy, which Terraform can’t see either.
- Keep using guardrail resources for any workspace you manage with Terraform. The provider doesn’t have Guardrail Policies resources yet.
terraform state rm), then manage them with the Guardrail Policies API or dashboard.