Policies
How organization and project policies constrain requests, and how to change them safely.
What a policy is#
A policy is a JSON document in the format panward.policy/1. The organization has one with its defaults, and each project may have its own with overrides. In a project document a value that is null or absent inherits the organization's value, and where both set a limit the lowest applies. Every request and receipt records the policy_version that was applied.
Anyone with policies:read can view the policy in the console; Owners and Admins can change it.
Sealed only and minimum level#
verification.sealed_only lets only Sealed offers serve, and refuses Routed models with policy_blocked. verification.min_level sets the lowest receipt level allowed, weakest first: routed, sealed_attested_channel (no per-response signature), sealed_attested_path or sealed_model_signed. Sealed only without a minimum accepts every Sealed level, the attested channel included. With sealed_model_signed the gateway obtains upstream responses unstreamed and streams them to you afterwards, which raises the time to the first token.
Residency#
residency.allowed_regions lists the regions requests may be served in, a subset of the organization's residency settings, and residency.default_region names the default. processing_regions says where requests may be processed: on a regional hostname the default is that region only, an organization list replaces the default, a project list only narrows it, and it always stays within allowed_regions (Regions and residency).
Model allow-lists and fallbacks#
models.allow is an allow-list of canonical model ids; null allows every model enabled for the scope. A request must pass both the enablement and the allow-list. In a project, models.fallback_models is the ordered fallback list and models.fallbacks sets a chain per model, whose never_routed keeps that chain off the Routed tier. Fallbacks are used only when the model has no capacity and the request sent panward-fallback: allow (Tiers and routing headers).
Limits#
limits.requests_per_minute and limits.tokens_per_minute cap the scope's rates. Keys can carry their own limits as well, and the lowest limit that applies wins (Limits).
Budgets#
spend.monthly_budget_nano_usd is a budget per calendar month (UTC) in integer nano-USD, and spend.hard_stop refuses requests with spend_limit_reached once it is reached. Budget alerts are alert rules, not part of the policy, and the organization's monthly cap is a billing setting (Credits, top-ups and limits).
Input size and identifier counting#
prompt.max_input_tokens refuses requests with more input tokens. Max input tokens is checked before the request is sent, on an estimate of the prompt's tokens made from its words, digits and punctuation. The model counts the prompt only after it answers, and its count can be above or below the estimate, most for very short prompts: a prompt close to the limit, under it or over it, can be refused or served. Each image counts as a fixed 16,384 tokens. prompt.count_identifiers records, on the request's metadata, a count of the personal identifiers detected in its input: a count only, never the matches and never the content. It counts email addresses, phone numbers in international form (a plus sign and 8 to 15 digits, without spaces), payment card numbers of the major card networks that pass the card check digit, and IBANs that pass their check digits. The request log in the console shows the count in the request's details, and request exports carry it as identifier_count; a request served without the switch has none. The request runs either way.
Network#
network.ip_allow lists the CIDR ranges allowed to call with the scope's keys, and network.ip_deny the ranges refused.
Retention#
retention.metadata_days sets how long request metadata and receipts are kept, within your plan's maximum (Retention). There is no content-retention or debug-capture option, because inference content is never stored.
Edit a draft#
Changes are made in a draft, one per scope, under Policies in the console. Saving checks the document: regions within your residency settings, known models, limits within your plan's ceilings and retention within its maximum. If someone else saved the draft since you opened it, your save is refused as a conflict rather than overwriting their change.
Simulate#
Simulate evaluates one hypothetical request (project, region, model, input size and an optional tier) against the draft or the published policy. Nothing is sent to a model, billed or logged, and no content is submitted. It returns the decision, the HTTP status and error type the gateway would return, and each check in evaluation order:
residency: the gateway region is one the policy allows.tier: the tier asked for, or the default, is allowed and has an eligible offer.allow_list: the model is on the allow-list.enablement: the model is enabled for the organization and project.min_level: an offer can reach the minimum level.input_size: the input is within prompt.max_input_tokens.rate_limit: the request and token rates are within the limits.budget: the monthly budget is not used up.network: the caller's address is allowed.
The simulator runs the same policy code as the gateway, so a simulated decision is the decision the gateway makes for the same inputs.
Publish, versions and restore#
Publish policy turns the draft into the next immutable version, with an optional change note of up to 500 characters. The versions are listed newest first, and Restore brings an earlier version back as a draft for you to publish.
Second-admin approval#
When your organization requires a second Admin, publishing creates an approval request instead, and the draft is locked until it is approved or the draft is discarded.
How fast changes apply#
Gateways apply a published version within 10 seconds.
What your application sees#
| Rule | Status and error type |
|---|---|
| Sealed only, minimum level, tier not allowed | 403 policy_blocked |
| Model not on the allow-list | 403 policy_blocked |
| Model not enabled | 403 model_not_enabled |
| Gateway region outside the allowed regions | 403 region_not_allowed |
| Input over prompt.max_input_tokens | 403 policy_blocked |
| Caller address not allowed | 403 ip_not_allowed |
| Request or token rate over a limit | 429 rate_limit_exceeded |
| Budget reached with a hard stop | 402 spend_limit_reached |
A policy refusal has a signed receipt whose policy.applied event has decision: "deny", and it is not billed.
{
"error": {
"type": "policy_blocked",
"message": "This project's policy allows Sealed models only, and 'acme/atlas-2' is offered in the Routed tier.",
"param": "model",
"request_id": "req_01JC7Q6D4H9K2M5P8R1T3V6X7Z",
"doc_url": "https://panward.ai/docs/errors#policy_blocked"
}
}Per request you can tighten, never loosen#
panward-tier: sealed and panward-hold-until-verified: true ask for more than the policy requires for one request. No header can loosen the policy.
Example policies#
Both documents follow the console contract's policy schema.
{
"schema": "panward.policy/1",
"residency": {
"allowed_regions": [
"eu"
],
"default_region": "eu"
},
"verification": {
"sealed_only": true,
"min_level": "sealed_attested_path"
},
"models": {
"allow": [
"z-ai/glm-5.3"
],
"fallbacks": {
"z-ai/glm-5.3": {
"fallback_models": [],
"never_routed": true
}
}
},
"limits": {
"requests_per_minute": 600,
"tokens_per_minute": 400000
},
"spend": {
"monthly_budget_nano_usd": 2000000000000,
"hard_stop": true
},
"prompt": {
"max_input_tokens": 32000,
"count_identifiers": true
},
"network": {
"ip_allow": [
"203.0.113.0/24"
],
"ip_deny": null
},
"retention": {
"metadata_days": 90
}
}{
"schema": "panward.policy/1",
"residency": {
"allowed_regions": null
},
"verification": {
"sealed_only": false,
"min_level": "routed"
},
"limits": {
"requests_per_minute": 60
},
"spend": {
"monthly_budget_nano_usd": 50000000000,
"hard_stop": true
}
}