From f3af72a4d62109671189e1ef337c0eb1f3937450 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Wed, 11 Nov 2026 01:05:38 +0000 Subject: [PATCH 1/2] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.803.2 --- .speakeasy/gen.lock | 47 ++++---- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 32 +++--- .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/components/createguardrailrequest.mdx | 54 ++++----- docs/operations/listguardrailsrequest.mdx | 16 +-- docs/sdks/guardrails/README.mdx | 106 +++++++++--------- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- .../components/createguardrailrequest.py | 4 +- src/openrouter/guardrails.py | 60 +++++----- src/openrouter/operations/listguardrails.py | 4 +- uv.lock | 2 +- 14 files changed, 181 insertions(+), 174 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 5afc20c5d..65c05f814 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: c48cf606-fb42-4a45-9c23-8f0555307828 management: - docChecksum: ad64df57db005388ef0180bca93a668e + docChecksum: 3dc6b9becb1dd17399124bc1dfabd38a docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.3.155 - configChecksum: 12b89731a35d72ec3993c48a1808819e + releaseVersion: 1.3.156 + configChecksum: 1bf0170b4bad4ad5a834268897b1bfa3 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: fb165d8b-fb53-448d-b9db-ba3ddfb6b41f - pristine_commit_hash: a50bc4edb56663b4d33d4cdf881d4e9112e15819 - pristine_tree_hash: 5ff35757e33bc4e72b878aa7ebf5215959e05247 + generation_id: 1ea63ca2-235e-46cf-8fcc-caaf87da85c2 + pristine_commit_hash: 2a98f8aec0376b7bfca0115b2715c08e0e81a7ea + pristine_tree_hash: f9cddff889daf4e40e47bae67d81c07d5f1030c0 features: python: acceptHeaders: 3.0.0 @@ -2772,8 +2772,8 @@ trackedFiles: pristine_git_object: ad32bc42c733d9c38b955e3857469481325d458d docs/components/createguardrailrequest.mdx: id: c1a768f054c0 - last_write_checksum: sha1:c21042a4a5fcf8cc1c0f8dcfda83efa24b2402aa - pristine_git_object: a3858424c3e767de1d51a6361d521290e49d226e + last_write_checksum: sha1:473d3717f62f7f8ec2973cb3412f2362274ff371 + pristine_git_object: 934e197b283d4d82eb80356975cb3e02b115e97b docs/components/createguardrailresponse.mdx: id: 1477eebdf505 last_write_checksum: sha1:e13e8bf981d83c771dfc6d3e4ab81a949487dbd3 @@ -10736,8 +10736,8 @@ trackedFiles: pristine_git_object: 48b141f2096944a1423d0a1a7e64bdb34962c79e docs/operations/listguardrailsrequest.mdx: id: 99334b4d6619 - last_write_checksum: sha1:3018d3d5df1a406b041195179ca97bb543f4b151 - pristine_git_object: c84b9a13dd72c39b29d240e6a43236d3156c4707 + last_write_checksum: sha1:3a1fa5646ac3d28cc74a9f1b74eae2b4adaa7121 + pristine_git_object: c2991b605da74c034e8e328c2bc38e558fa36dd7 docs/operations/listguardrailsresponse.mdx: id: b96388a22ab2 last_write_checksum: sha1:4dec6c5f2c565ec9b07b358dd2c29b06a60fb683 @@ -11504,8 +11504,8 @@ trackedFiles: pristine_git_object: 0fa8a42f96cb4f234775f8bb07f8d985eb041bc3 docs/sdks/guardrails/README.mdx: id: a0cd4218b8fa - last_write_checksum: sha1:d7e1c765f925bb303b9585638075e1ef44d617fa - pristine_git_object: 5549912bda5e7b96a81658a996a60715573f0603 + last_write_checksum: sha1:1e7487cbc4699df83c7a798431b280cc2b5da8b2 + pristine_git_object: 19715d9b3b226b45633808f7bab4507fb358c878 docs/sdks/images/README.mdx: id: 534a6c102c4f last_write_checksum: sha1:079630beece943bdc653184e6d6448df72a62bd5 @@ -11588,8 +11588,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:c46534dc22df5c939427a873c12bf226d7d6d0b8 - pristine_git_object: 4367c4942dd87c77df9868c905e95f3a55f7e326 + last_write_checksum: sha1:350c250d375e528f4b182f8715a6985301914463 + pristine_git_object: df73c3fe6050eb939195dc78558ecd0c37ed8582 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -11616,8 +11616,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:c539afb9331dafccfb71a9221c154ee1b5e7b014 - pristine_git_object: b2b5c94c838e7f3165dca7a520a1082a5d007b73 + last_write_checksum: sha1:f0c49655b2088e98075bdaf212c6553b47434dde + pristine_git_object: 57dc566face63e6cb1f59f2a216a469f0ea08edc src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766 @@ -12836,8 +12836,8 @@ trackedFiles: pristine_git_object: c575c3dbc1aeeb262172f88c60d0e4eddddf5e21 src/openrouter/components/createguardrailrequest.py: id: 34d69149fb33 - last_write_checksum: sha1:d564398773edc7e939a540f8846854af2788b470 - pristine_git_object: 825411407e93d56339d382e4e79c9c36ce0bece2 + last_write_checksum: sha1:70f34d4bc244cd3b4c7c495e1113c7e27cf9768b + pristine_git_object: e93fe85d66f1149dcdf8366d5054157372343d95 src/openrouter/components/createguardrailresponse.py: id: b4e1bdf1de5b last_write_checksum: sha1:ae20a5e7425510c240e5697d847b1cae65940bd6 @@ -15628,8 +15628,8 @@ trackedFiles: pristine_git_object: 9f5800f27db62a5159098c5cea96ed0dc312149d src/openrouter/guardrails.py: id: 705839f34e66 - last_write_checksum: sha1:03183cc20b6c9f41b62b589ed6a6cb370ce50cc9 - pristine_git_object: 7051ec6482027676d268b4a943217d117af98b05 + last_write_checksum: sha1:c9e827a99a58270771866911589c6b31ceee16c3 + pristine_git_object: af664037202c670135045f7a351f0b07ff6c8e88 src/openrouter/httpclient.py: id: e9311185443d last_write_checksum: sha1:5e55338d6ee9f01ab648cad4380201a8a3da7dd7 @@ -16128,8 +16128,8 @@ trackedFiles: pristine_git_object: 49357f1052d225c348c08e831748d5dd23455ea0 src/openrouter/operations/listguardrails.py: id: c99a9e7be93c - last_write_checksum: sha1:6fe758f70a1b8695d4e2d8de6240b465d8b48b4a - pristine_git_object: c7d05cc96dd5b5113e3febe24173a0c2a62c4119 + last_write_checksum: sha1:5f3c90db667e2a1c3159fa442d9e08d56e6bc1ef + pristine_git_object: 556e75c731c7dd7d58c5a6769ffe6e8b0ef3654c src/openrouter/operations/listimagemodelendpoints.py: id: 40fd868ead3f last_write_checksum: sha1:2f4ba55f45f8fe4b5ce56cb6781fa8db455f8927 @@ -21573,6 +21573,3 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: | - ## Python SDK Changes: - * `open_router.alpha.extractions.create()`: `request` **Changed** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 8a649dbe6..16c085d12 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.155 + version: 1.3.156 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 8804f6df7..2c56d9f29 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -10765,7 +10765,7 @@ components: reset_interval: $ref: '#/components/schemas/GuardrailInterval' workspace_id: - description: 'The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace''s traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace''s default guardrail instead.' + description: 'The workspace to create the guardrail in. When omitted, an organization management key creates the guardrail in the default workspace (a 400 if that default has been deleted, so pass `workspace_id` explicitly) and a workspace-scoped key creates it in its own workspace. A workspace-scoped key gets a 403 for any other workspace. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace''s traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace''s default guardrail instead.' example: '0df9e665-d932-5740-b2c7-b52af166bc11' format: 'uuid' type: 'string' @@ -46140,7 +46140,7 @@ paths: - $ref: "#/components/parameters/AppCategories" /guardrails: get: - description: 'List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + description: 'List all guardrails for the authenticated user. A workspace-scoped management key lists only its own workspace, which `workspace_id` defaults to; naming another workspace returns 403. [Management key](/docs/guides/overview/auth/management-api-keys) required.' operationId: 'listGuardrails' parameters: - description: 'Number of records to skip for pagination' @@ -46167,12 +46167,12 @@ paths: maximum: 100 minimum: 1 type: 'integer' - - description: 'Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned.' + - description: 'Filter guardrails by workspace ID. When omitted, an organization management key gets guardrails in the default workspace and a workspace-scoped key gets guardrails in its own workspace. A workspace-scoped key gets 403 for any other workspace.' in: 'query' name: 'workspace_id' required: false schema: - description: 'Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned.' + description: 'Filter guardrails by workspace ID. When omitted, an organization management key gets guardrails in the default workspace and a workspace-scoped key gets guardrails in its own workspace. A workspace-scoped key gets 403 for any other workspace.' example: '0df9e665-d932-5740-b2c7-b52af166bc11' format: 'uuid' type: 'string' @@ -46259,7 +46259,7 @@ paths: results: '$.data' type: 'offsetLimit' post: - description: 'Create a new guardrail for the authenticated user. A newly created guardrail enforces nothing until it is assigned to API keys or organization members; `workspace_id` places the guardrail in a workspace but does not apply it to that workspace''s traffic. To restrict all traffic in a workspace, update the workspace''s default guardrail instead. Set `allowed_data_regions` to enforce [In-Region Routing](/docs/guides/features/in-region-routing#enforcing-in-region-routing-with-guardrails): governed requests must arrive through one of the listed OpenRouter domains and are rejected with a 403 otherwise. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + description: 'Create a new guardrail for the authenticated user. A newly created guardrail enforces nothing until it is assigned to API keys or organization members; `workspace_id` places the guardrail in a workspace but does not apply it to that workspace''s traffic. To restrict all traffic in a workspace, update the workspace''s default guardrail instead. Set `allowed_data_regions` to enforce [In-Region Routing](/docs/guides/features/in-region-routing#enforcing-in-region-routing-with-guardrails): governed requests must arrive through one of the listed OpenRouter domains and are rejected with a 403 otherwise. A workspace-scoped management key creates in its own workspace, which `workspace_id` defaults to; naming another workspace returns 403. [Management key](/docs/guides/overview/auth/management-api-keys) required.' operationId: 'createGuardrail' requestBody: content: @@ -46367,7 +46367,7 @@ paths: - $ref: "#/components/parameters/AppCategories" /guardrails/{id}: delete: - description: 'Delete an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + description: 'Delete an existing guardrail. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required.' operationId: 'deleteGuardrail' parameters: - description: 'The unique identifier of the guardrail to delete' @@ -46433,7 +46433,7 @@ paths: - 'Guardrails' x-speakeasy-name-override: 'delete' get: - description: 'Get a single guardrail by ID. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + description: 'Get a single guardrail by ID. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required.' operationId: 'getGuardrail' parameters: - description: 'The unique identifier of the guardrail to retrieve' @@ -46516,7 +46516,7 @@ paths: - 'Guardrails' x-speakeasy-name-override: 'get' patch: - description: 'Update an existing guardrail, or materialize an unconfigured workspace default guardrail. Collection fields use replace semantics: send the full desired set on every update. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + description: 'Update an existing guardrail, or materialize an unconfigured workspace default guardrail. Collection fields use replace semantics: send the full desired set on every update. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required.' operationId: 'updateGuardrail' parameters: - description: 'The unique identifier of the guardrail to update' @@ -46638,7 +46638,7 @@ paths: - $ref: "#/components/parameters/AppCategories" /guardrails/{id}/assignments/keys: get: - description: 'List all API key assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + description: 'List all API key assignments for a specific guardrail. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required.' operationId: 'listGuardrailKeyAssignments' parameters: - description: 'The unique identifier of the guardrail' @@ -46747,7 +46747,7 @@ paths: results: '$.data' type: 'offsetLimit' post: - description: 'Assign multiple API keys to a specific guardrail. A key may hold at most one guardrail; assigning replaces any existing assignment. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + description: 'Assign multiple API keys to a specific guardrail. A key may hold at most one guardrail; assigning replaces any existing assignment. A workspace-scoped management key reaches only guardrails in its own workspace (any other returns 404), and a batch naming an unknown or out-of-workspace key hash is rejected with 400 before anything changes. [Management key](/docs/guides/overview/auth/management-api-keys) required.' operationId: 'bulkAssignKeysToGuardrail' parameters: - description: 'The unique identifier of the guardrail' @@ -46837,7 +46837,7 @@ paths: - $ref: "#/components/parameters/AppCategories" /guardrails/{id}/assignments/keys/remove: post: - description: 'Unassign multiple API keys from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + description: 'Unassign multiple API keys from a specific guardrail. A workspace-scoped management key reaches only guardrails in its own workspace (any other returns 404), and a batch naming an unknown or out-of-workspace key hash is rejected with 400 before anything changes. [Management key](/docs/guides/overview/auth/management-api-keys) required.' operationId: 'bulkUnassignKeysFromGuardrail' parameters: - description: 'The unique identifier of the guardrail' @@ -46927,7 +46927,7 @@ paths: - $ref: "#/components/parameters/AppCategories" /guardrails/{id}/assignments/members: get: - description: 'List all organization member assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + description: 'List all organization member assignments for a specific guardrail. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required.' operationId: 'listGuardrailMemberAssignments' parameters: - description: 'The unique identifier of the guardrail' @@ -47035,7 +47035,7 @@ paths: results: '$.data' type: 'offsetLimit' post: - description: 'Assign multiple organization members to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + description: 'Assign multiple organization members to a specific guardrail. Requires an organization-scoped management key; workspace-scoped management keys return 403. [Management key](/docs/guides/overview/auth/management-api-keys) required.' operationId: 'bulkAssignMembersToGuardrail' parameters: - description: 'The unique identifier of the guardrail' @@ -47126,7 +47126,7 @@ paths: - $ref: "#/components/parameters/AppCategories" /guardrails/{id}/assignments/members/remove: post: - description: 'Unassign multiple organization members from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + description: 'Unassign multiple organization members from a specific guardrail. Requires an organization-scoped management key; workspace-scoped management keys return 403. [Management key](/docs/guides/overview/auth/management-api-keys) required.' operationId: 'bulkUnassignMembersFromGuardrail' parameters: - description: 'The unique identifier of the guardrail' @@ -47217,7 +47217,7 @@ paths: - $ref: "#/components/parameters/AppCategories" /guardrails/assignments/keys: get: - description: 'List all API key guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + description: 'List all API key guardrail assignments for the authenticated user. A workspace-scoped management key lists only its own workspace, which `workspace_id` defaults to; naming another workspace returns 403. [Management key](/docs/guides/overview/auth/management-api-keys) required.' operationId: 'listKeyAssignments' parameters: - description: 'Number of records to skip for pagination' @@ -47332,7 +47332,7 @@ paths: - $ref: "#/components/parameters/AppCategories" /guardrails/assignments/members: get: - description: 'List all organization member guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + description: 'List all organization member guardrail assignments for the authenticated user. A workspace-scoped management key lists only its own workspace, which `workspace_id` defaults to; naming another workspace returns 403. [Management key](/docs/guides/overview/auth/management-api-keys) required.' operationId: 'listMemberAssignments' parameters: - description: 'Number of records to skip for pagination' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index b2c0a3d4b..b39f17e76 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.803.2 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:fb94baaeefa14fb3a3a76c9a64af47b66f5a397007cc017402da38c7f2266f39 - sourceBlobDigest: sha256:407df421edf7def991e54abf751267bc381d40169785d7e14d1032f060573c51 + sourceRevisionDigest: sha256:9e21e846dafaa2c36ad3733506b3106fc45dba689adee0f95543f36fefdb7b45 + sourceBlobDigest: sha256:2ced0693e6668959ef1098e232fff9689cb44732157a40e73d68f51da4f5a51e tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:fb94baaeefa14fb3a3a76c9a64af47b66f5a397007cc017402da38c7f2266f39 - sourceBlobDigest: sha256:407df421edf7def991e54abf751267bc381d40169785d7e14d1032f060573c51 + sourceRevisionDigest: sha256:9e21e846dafaa2c36ad3733506b3106fc45dba689adee0f95543f36fefdb7b45 + sourceBlobDigest: sha256:2ced0693e6668959ef1098e232fff9689cb44732157a40e73d68f51da4f5a51e codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:34c88e518712fbec70cf76a0352e4dae4404622b6b23529e3550d8dca29d9d3f + codeSamplesRevisionDigest: sha256:902152057d143bc0d494b8d705aa092c47754915042585e61aa4984e21e70472 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index 073bae86b..722494b2e 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4319,4 +4319,14 @@ Based on: ### Generated - [python v1.3.155] . ### Releases -- [PyPI v1.3.155] https://pypi.org/project/openrouter/1.3.155 - . \ No newline at end of file +- [PyPI v1.3.155] https://pypi.org/project/openrouter/1.3.155 - . + +## 2026-11-11 01:02:51 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.156] . +### Releases +- [PyPI v1.3.156] https://pypi.org/project/openrouter/1.3.156 - . \ No newline at end of file diff --git a/docs/components/createguardrailrequest.mdx b/docs/components/createguardrailrequest.mdx index a3858424c..934e197b2 100644 --- a/docs/components/createguardrailrequest.mdx +++ b/docs/components/createguardrailrequest.mdx @@ -4,30 +4,30 @@ title: "CreateGuardrailRequest" ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | -| `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | -| `allowed_data_regions` | List[[components.GuardrailDataRegion](../components/guardraildataregion.mdx)] | ➖ | Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected. | [
"europe"
] | -| `allowed_models` | List[*str*] | ➖ | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | -| `allowed_providers` | List[*str*] | ➖ | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | -| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../components/contentfilterbuiltinentryinput.mdx)] | ➖ | Builtin content filters to apply. Every builtin slug supports "block", "redact", and the detect-only "flag" action. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | -| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | ➖ | Custom regex content filters to apply to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | -| `description` | *OptionalNullable[str]* | ➖ | Description of the guardrail | A guardrail for limiting API usage | -| `enable_free_model_publication` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that publish prompts. | false | -| `enable_free_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that train on request data. | true | -| `enable_paid_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows paid endpoints that train on request data. | true | -| `enforce_first_party_harness_models` | *OptionalNullable[bool]* | ➖ | Whether coding harnesses list only their vendor's own models: Codex lists OpenAI models and Claude Code and Claude Desktop list Anthropic models. Affects only the model list those harnesses request from GET /models; a model the client names directly is still routed. Any true across the workspace default, member, and API key guardrails applies. | false | -| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | ➖ | ⚠️ **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false | -| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_google` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_openai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_other` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_xai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false | -| `ignored_models` | List[*str*] | ➖ | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | -| `ignored_providers` | List[*str*] | ➖ | List of provider IDs to exclude from routing | [
"azure"
] | -| `include_byok_in_budgets` | *Optional[bool]* | ➖ | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false. | false | -| `limit_usd` | *OptionalNullable[float]* | ➖ | Spending limit in USD. Must be provided together with `reset_interval`: a request that sets only one of the two is rejected with a 400. | 50 | -| `name` | *str* | ✔️ | Name for the new guardrail | My New Guardrail | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | ➖ | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `workspace_id` | *Optional[str]* | ➖ | The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | +| `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | +| `allowed_data_regions` | List[[components.GuardrailDataRegion](../components/guardraildataregion.mdx)] | ➖ | Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected. | [
"europe"
] | +| `allowed_models` | List[*str*] | ➖ | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | +| `allowed_providers` | List[*str*] | ➖ | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | +| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../components/contentfilterbuiltinentryinput.mdx)] | ➖ | Builtin content filters to apply. Every builtin slug supports "block", "redact", and the detect-only "flag" action. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | +| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | ➖ | Custom regex content filters to apply to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | +| `description` | *OptionalNullable[str]* | ➖ | Description of the guardrail | A guardrail for limiting API usage | +| `enable_free_model_publication` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that publish prompts. | false | +| `enable_free_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that train on request data. | true | +| `enable_paid_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows paid endpoints that train on request data. | true | +| `enforce_first_party_harness_models` | *OptionalNullable[bool]* | ➖ | Whether coding harnesses list only their vendor's own models: Codex lists OpenAI models and Claude Code and Claude Desktop list Anthropic models. Affects only the model list those harnesses request from GET /models; a model the client names directly is still routed. Any true across the workspace default, member, and API key guardrails applies. | false | +| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | ➖ | ⚠️ **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false | +| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_google` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_other` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_xai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false | +| `ignored_models` | List[*str*] | ➖ | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | +| `ignored_providers` | List[*str*] | ➖ | List of provider IDs to exclude from routing | [
"azure"
] | +| `include_byok_in_budgets` | *Optional[bool]* | ➖ | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false. | false | +| `limit_usd` | *OptionalNullable[float]* | ➖ | Spending limit in USD. Must be provided together with `reset_interval`: a request that sets only one of the two is rejected with a 400. | 50 | +| `name` | *str* | ✔️ | Name for the new guardrail | My New Guardrail | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | ➖ | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `workspace_id` | *Optional[str]* | ➖ | The workspace to create the guardrail in. When omitted, an organization management key creates the guardrail in the default workspace (a 400 if that default has been deleted, so pass `workspace_id` explicitly) and a workspace-scoped key creates it in its own workspace. A workspace-scoped key gets a 403 for any other workspace. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/listguardrailsrequest.mdx b/docs/operations/listguardrailsrequest.mdx index c84b9a13d..c2991b605 100644 --- a/docs/operations/listguardrailsrequest.mdx +++ b/docs/operations/listguardrailsrequest.mdx @@ -4,11 +4,11 @@ title: "ListGuardrailsRequest" ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | -| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `offset` | *OptionalNullable[int]* | ➖ | Number of records to skip for pagination | 0 | -| `limit` | *Optional[int]* | ➖ | Maximum number of records to return (max 100) | 50 | -| `workspace_id` | *Optional[str]* | ➖ | Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *OptionalNullable[int]* | ➖ | Number of records to skip for pagination | 0 | +| `limit` | *Optional[int]* | ➖ | Maximum number of records to return (max 100) | 50 | +| `workspace_id` | *Optional[str]* | ➖ | Filter guardrails by workspace ID. When omitted, an organization management key gets guardrails in the default workspace and a workspace-scoped key gets guardrails in its own workspace. A workspace-scoped key gets 403 for any other workspace. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/sdks/guardrails/README.mdx b/docs/sdks/guardrails/README.mdx index 5549912bd..19715d9b3 100644 --- a/docs/sdks/guardrails/README.mdx +++ b/docs/sdks/guardrails/README.mdx @@ -25,7 +25,7 @@ Guardrails endpoints ## list -List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. +List all guardrails for the authenticated user. A workspace-scoped management key lists only its own workspace, which `workspace_id` defaults to; naming another workspace returns 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -52,15 +52,15 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | -| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `offset` | *OptionalNullable[int]* | ➖ | Number of records to skip for pagination | 0 | -| `limit` | *Optional[int]* | ➖ | Maximum number of records to return (max 100) | 50 | -| `workspace_id` | *Optional[str]* | ➖ | Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned. | 0df9e665-d932-5740-b2c7-b52af166bc11 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *OptionalNullable[int]* | ➖ | Number of records to skip for pagination | 0 | +| `limit` | *Optional[int]* | ➖ | Maximum number of records to return (max 100) | 50 | +| `workspace_id` | *Optional[str]* | ➖ | Filter guardrails by workspace ID. When omitted, an organization management key gets guardrails in the default workspace and a workspace-scoped key gets guardrails in its own workspace. A workspace-scoped key gets 403 for any other workspace. | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | ### Response @@ -78,7 +78,7 @@ with OpenRouter( ## create -Create a new guardrail for the authenticated user. A newly created guardrail enforces nothing until it is assigned to API keys or organization members; `workspace_id` places the guardrail in a workspace but does not apply it to that workspace's traffic. To restrict all traffic in a workspace, update the workspace's default guardrail instead. Set `allowed_data_regions` to enforce [In-Region Routing](/docs/guides/features/in-region-routing#enforcing-in-region-routing-with-guardrails): governed requests must arrive through one of the listed OpenRouter domains and are rejected with a 403 otherwise. [Management key](/docs/guides/overview/auth/management-api-keys) required. +Create a new guardrail for the authenticated user. A newly created guardrail enforces nothing until it is assigned to API keys or organization members; `workspace_id` places the guardrail in a workspace but does not apply it to that workspace's traffic. To restrict all traffic in a workspace, update the workspace's default guardrail instead. Set `allowed_data_regions` to enforce [In-Region Routing](/docs/guides/features/in-region-routing#enforcing-in-region-routing-with-guardrails): governed requests must arrive through one of the listed OpenRouter domains and are rejected with a 403 otherwise. A workspace-scoped management key creates in its own workspace, which `workspace_id` defaults to; naming another workspace returns 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -109,37 +109,37 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `name` | *str* | ✔️ | Name for the new guardrail | My New Guardrail | -| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | -| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | -| `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | -| `allowed_data_regions` | List[[components.GuardrailDataRegion](../../components/guardraildataregion.mdx)] | ➖ | Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected. | [
"europe"
] | -| `allowed_models` | List[*str*] | ➖ | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | -| `allowed_providers` | List[*str*] | ➖ | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | -| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../../components/contentfilterbuiltinentryinput.mdx)] | ➖ | Builtin content filters to apply. Every builtin slug supports "block", "redact", and the detect-only "flag" action. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | -| `content_filters` | List[[components.ContentFilterEntry](../../components/contentfilterentry.mdx)] | ➖ | Custom regex content filters to apply to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | -| `description` | *OptionalNullable[str]* | ➖ | Description of the guardrail | A guardrail for limiting API usage | -| `enable_free_model_publication` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that publish prompts. | false | -| `enable_free_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that train on request data. | true | -| `enable_paid_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows paid endpoints that train on request data. | true | -| `enforce_first_party_harness_models` | *OptionalNullable[bool]* | ➖ | Whether coding harnesses list only their vendor's own models: Codex lists OpenAI models and Claude Code and Claude Desktop list Anthropic models. Affects only the model list those harnesses request from GET /models; a model the client names directly is still routed. Any true across the workspace default, member, and API key guardrails applies. | false | -| `enforce_zdr` | *OptionalNullable[bool]* | ➖ | ⚠️ **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false | -| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_google` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_openai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_other` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_xai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false | -| `ignored_models` | List[*str*] | ➖ | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | -| `ignored_providers` | List[*str*] | ➖ | List of provider IDs to exclude from routing | [
"azure"
] | -| `include_byok_in_budgets` | *Optional[bool]* | ➖ | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false. | false | -| `limit_usd` | *OptionalNullable[float]* | ➖ | Spending limit in USD. Must be provided together with `reset_interval`: a request that sets only one of the two is rejected with a 400. | 50 | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../../components/guardrailinterval.mdx) | ➖ | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `workspace_id` | *Optional[str]* | ➖ | The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead. | 0df9e665-d932-5740-b2c7-b52af166bc11 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `name` | *str* | ✔️ | Name for the new guardrail | My New Guardrail | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | +| `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | +| `allowed_data_regions` | List[[components.GuardrailDataRegion](../../components/guardraildataregion.mdx)] | ➖ | Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected. | [
"europe"
] | +| `allowed_models` | List[*str*] | ➖ | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | +| `allowed_providers` | List[*str*] | ➖ | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | +| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../../components/contentfilterbuiltinentryinput.mdx)] | ➖ | Builtin content filters to apply. Every builtin slug supports "block", "redact", and the detect-only "flag" action. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | +| `content_filters` | List[[components.ContentFilterEntry](../../components/contentfilterentry.mdx)] | ➖ | Custom regex content filters to apply to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | +| `description` | *OptionalNullable[str]* | ➖ | Description of the guardrail | A guardrail for limiting API usage | +| `enable_free_model_publication` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that publish prompts. | false | +| `enable_free_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that train on request data. | true | +| `enable_paid_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows paid endpoints that train on request data. | true | +| `enforce_first_party_harness_models` | *OptionalNullable[bool]* | ➖ | Whether coding harnesses list only their vendor's own models: Codex lists OpenAI models and Claude Code and Claude Desktop list Anthropic models. Affects only the model list those harnesses request from GET /models; a model the client names directly is still routed. Any true across the workspace default, member, and API key guardrails applies. | false | +| `enforce_zdr` | *OptionalNullable[bool]* | ➖ | ⚠️ **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false | +| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_google` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_other` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_xai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false | +| `ignored_models` | List[*str*] | ➖ | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | +| `ignored_providers` | List[*str*] | ➖ | List of provider IDs to exclude from routing | [
"azure"
] | +| `include_byok_in_budgets` | *Optional[bool]* | ➖ | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false. | false | +| `limit_usd` | *OptionalNullable[float]* | ➖ | Spending limit in USD. Must be provided together with `reset_interval`: a request that sets only one of the two is rejected with a 400. | 50 | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../../components/guardrailinterval.mdx) | ➖ | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `workspace_id` | *Optional[str]* | ➖ | The workspace to create the guardrail in. When omitted, an organization management key creates the guardrail in the default workspace (a 400 if that default has been deleted, so pass `workspace_id` explicitly) and a workspace-scoped key creates it in its own workspace. A workspace-scoped key gets a 403 for any other workspace. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead. | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | ### Response @@ -157,7 +157,7 @@ with OpenRouter( ## delete -Delete an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. +Delete an existing guardrail. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -206,7 +206,7 @@ with OpenRouter( ## get -Get a single guardrail by ID. [Management key](/docs/guides/overview/auth/management-api-keys) required. +Get a single guardrail by ID. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -255,7 +255,7 @@ with OpenRouter( ## update -Update an existing guardrail, or materialize an unconfigured workspace default guardrail. Collection fields use replace semantics: send the full desired set on every update. [Management key](/docs/guides/overview/auth/management-api-keys) required. +Update an existing guardrail, or materialize an unconfigured workspace default guardrail. Collection fields use replace semantics: send the full desired set on every update. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -330,7 +330,7 @@ with OpenRouter( ## list_guardrail_key_assignments -List all API key assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. +List all API key assignments for a specific guardrail. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -383,7 +383,7 @@ with OpenRouter( ## bulk_assign_keys -Assign multiple API keys to a specific guardrail. A key may hold at most one guardrail; assigning replaces any existing assignment. [Management key](/docs/guides/overview/auth/management-api-keys) required. +Assign multiple API keys to a specific guardrail. A key may hold at most one guardrail; assigning replaces any existing assignment. A workspace-scoped management key reaches only guardrails in its own workspace (any other returns 404), and a batch naming an unknown or out-of-workspace key hash is rejected with 400 before anything changes. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -436,7 +436,7 @@ with OpenRouter( ## bulk_unassign_keys -Unassign multiple API keys from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. +Unassign multiple API keys from a specific guardrail. A workspace-scoped management key reaches only guardrails in its own workspace (any other returns 404), and a batch naming an unknown or out-of-workspace key hash is rejected with 400 before anything changes. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -489,7 +489,7 @@ with OpenRouter( ## list_guardrail_member_assignments -List all organization member assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. +List all organization member assignments for a specific guardrail. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -542,7 +542,7 @@ with OpenRouter( ## bulk_assign_members -Assign multiple organization members to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. +Assign multiple organization members to a specific guardrail. Requires an organization-scoped management key; workspace-scoped management keys return 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -596,7 +596,7 @@ with OpenRouter( ## bulk_unassign_members -Unassign multiple organization members from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. +Unassign multiple organization members from a specific guardrail. Requires an organization-scoped management key; workspace-scoped management keys return 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -650,7 +650,7 @@ with OpenRouter( ## list_key_assignments -List all API key guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. +List all API key guardrail assignments for the authenticated user. A workspace-scoped management key lists only its own workspace, which `workspace_id` defaults to; naming another workspace returns 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -703,7 +703,7 @@ with OpenRouter( ## list_member_assignments -List all organization member guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. +List all organization member guardrail assignments for the authenticated user. A workspace-scoped management key lists only its own workspace, which `workspace_id` defaults to; naming another workspace returns 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage diff --git a/pyproject.toml b/pyproject.toml index 4367c4942..df73c3fe6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.155" +version = "1.3.156" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index b2b5c94c8..57dc566fa 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.3.155" +__version__: str = "1.3.156" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.950.13" -__user_agent__: str = "speakeasy-sdk/python 1.3.155 2.950.13 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.156 2.950.13 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/createguardrailrequest.py b/src/openrouter/components/createguardrailrequest.py index 825411407..e93fe85d6 100644 --- a/src/openrouter/components/createguardrailrequest.py +++ b/src/openrouter/components/createguardrailrequest.py @@ -73,7 +73,7 @@ class CreateGuardrailRequestTypedDict(TypedDict): reset_interval: NotRequired[Nullable[GuardrailInterval]] r"""Interval at which the limit resets (daily, weekly, monthly)""" workspace_id: NotRequired[str] - r"""The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead.""" + r"""The workspace to create the guardrail in. When omitted, an organization management key creates the guardrail in the default workspace (a 400 if that default has been deleted, so pass `workspace_id` explicitly) and a workspace-scoped key creates it in its own workspace. A workspace-scoped key gets a 403 for any other workspace. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead.""" class CreateGuardrailRequest(BaseModel): @@ -157,7 +157,7 @@ class CreateGuardrailRequest(BaseModel): r"""Interval at which the limit resets (daily, weekly, monthly)""" workspace_id: Optional[str] = None - r"""The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead.""" + r"""The workspace to create the guardrail in. When omitted, an organization management key creates the guardrail in the default workspace (a 400 if that default has been deleted, so pass `workspace_id` explicitly) and a workspace-scoped key creates it in its own workspace. A workspace-scoped key gets a 403 for any other workspace. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/guardrails.py b/src/openrouter/guardrails.py index 7051ec648..af6640372 100644 --- a/src/openrouter/guardrails.py +++ b/src/openrouter/guardrails.py @@ -29,7 +29,7 @@ def list( ) -> Optional[operations.ListGuardrailsResponse]: r"""List guardrails - List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + List all guardrails for the authenticated user. A workspace-scoped management key lists only its own workspace, which `workspace_id` defaults to; naming another workspace returns 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. @@ -40,7 +40,7 @@ def list( :param offset: Number of records to skip for pagination :param limit: Maximum number of records to return (max 100) - :param workspace_id: Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned. + :param workspace_id: Filter guardrails by workspace ID. When omitted, an organization management key gets guardrails in the default workspace and a workspace-scoped key gets guardrails in its own workspace. A workspace-scoped key gets 403 for any other workspace. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -201,7 +201,7 @@ async def list_async( ) -> Optional[operations.ListGuardrailsResponse]: r"""List guardrails - List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + List all guardrails for the authenticated user. A workspace-scoped management key lists only its own workspace, which `workspace_id` defaults to; naming another workspace returns 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. @@ -212,7 +212,7 @@ async def list_async( :param offset: Number of records to skip for pagination :param limit: Maximum number of records to return (max 100) - :param workspace_id: Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned. + :param workspace_id: Filter guardrails by workspace ID. When omitted, an organization management key gets guardrails in the default workspace and a workspace-scoped key gets guardrails in its own workspace. A workspace-scoped key gets 403 for any other workspace. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -410,7 +410,7 @@ def create( ) -> components.CreateGuardrailResponse: r"""Create a guardrail - Create a new guardrail for the authenticated user. A newly created guardrail enforces nothing until it is assigned to API keys or organization members; `workspace_id` places the guardrail in a workspace but does not apply it to that workspace's traffic. To restrict all traffic in a workspace, update the workspace's default guardrail instead. Set `allowed_data_regions` to enforce [In-Region Routing](/docs/guides/features/in-region-routing#enforcing-in-region-routing-with-guardrails): governed requests must arrive through one of the listed OpenRouter domains and are rejected with a 403 otherwise. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Create a new guardrail for the authenticated user. A newly created guardrail enforces nothing until it is assigned to API keys or organization members; `workspace_id` places the guardrail in a workspace but does not apply it to that workspace's traffic. To restrict all traffic in a workspace, update the workspace's default guardrail instead. Set `allowed_data_regions` to enforce [In-Region Routing](/docs/guides/features/in-region-routing#enforcing-in-region-routing-with-guardrails): governed requests must arrive through one of the listed OpenRouter domains and are rejected with a 403 otherwise. A workspace-scoped management key creates in its own workspace, which `workspace_id` defaults to; naming another workspace returns 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param name: Name for the new guardrail :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -443,7 +443,7 @@ def create( :param include_byok_in_budgets: Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false. :param limit_usd: Spending limit in USD. Must be provided together with `reset_interval`: a request that sets only one of the two is rejected with a 400. :param reset_interval: Interval at which the limit resets (daily, weekly, monthly) - :param workspace_id: The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead. + :param workspace_id: The workspace to create the guardrail in. When omitted, an organization management key creates the guardrail in the default workspace (a 400 if that default has been deleted, so pass `workspace_id` explicitly) and a workspace-scoped key creates it in its own workspace. A workspace-scoped key gets a 403 for any other workspace. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -653,7 +653,7 @@ async def create_async( ) -> components.CreateGuardrailResponse: r"""Create a guardrail - Create a new guardrail for the authenticated user. A newly created guardrail enforces nothing until it is assigned to API keys or organization members; `workspace_id` places the guardrail in a workspace but does not apply it to that workspace's traffic. To restrict all traffic in a workspace, update the workspace's default guardrail instead. Set `allowed_data_regions` to enforce [In-Region Routing](/docs/guides/features/in-region-routing#enforcing-in-region-routing-with-guardrails): governed requests must arrive through one of the listed OpenRouter domains and are rejected with a 403 otherwise. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Create a new guardrail for the authenticated user. A newly created guardrail enforces nothing until it is assigned to API keys or organization members; `workspace_id` places the guardrail in a workspace but does not apply it to that workspace's traffic. To restrict all traffic in a workspace, update the workspace's default guardrail instead. Set `allowed_data_regions` to enforce [In-Region Routing](/docs/guides/features/in-region-routing#enforcing-in-region-routing-with-guardrails): governed requests must arrive through one of the listed OpenRouter domains and are rejected with a 403 otherwise. A workspace-scoped management key creates in its own workspace, which `workspace_id` defaults to; naming another workspace returns 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param name: Name for the new guardrail :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -686,7 +686,7 @@ async def create_async( :param include_byok_in_budgets: Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false. :param limit_usd: Spending limit in USD. Must be provided together with `reset_interval`: a request that sets only one of the two is rejected with a 400. :param reset_interval: Interval at which the limit resets (daily, weekly, monthly) - :param workspace_id: The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead. + :param workspace_id: The workspace to create the guardrail in. When omitted, an organization management key creates the guardrail in the default workspace (a 400 if that default has been deleted, so pass `workspace_id` explicitly) and a workspace-scoped key creates it in its own workspace. A workspace-scoped key gets a 403 for any other workspace. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -860,7 +860,7 @@ def delete( ) -> components.DeleteGuardrailResponse: r"""Delete a guardrail - Delete an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Delete an existing guardrail. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail to delete :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -993,7 +993,7 @@ async def delete_async( ) -> components.DeleteGuardrailResponse: r"""Delete a guardrail - Delete an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Delete an existing guardrail. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail to delete :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -1126,7 +1126,7 @@ def get( ) -> components.GetGuardrailResponse: r"""Get a guardrail - Get a single guardrail by ID. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Get a single guardrail by ID. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail to retrieve :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -1259,7 +1259,7 @@ async def get_async( ) -> components.GetGuardrailResponse: r"""Get a guardrail - Get a single guardrail by ID. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Get a single guardrail by ID. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail to retrieve :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -1428,7 +1428,7 @@ def update( ) -> components.UpdateGuardrailResponse: r"""Update a guardrail - Update an existing guardrail, or materialize an unconfigured workspace default guardrail. Collection fields use replace semantics: send the full desired set on every update. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Update an existing guardrail, or materialize an unconfigured workspace default guardrail. Collection fields use replace semantics: send the full desired set on every update. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail to update :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -1681,7 +1681,7 @@ async def update_async( ) -> components.UpdateGuardrailResponse: r"""Update a guardrail - Update an existing guardrail, or materialize an unconfigured workspace default guardrail. Collection fields use replace semantics: send the full desired set on every update. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Update an existing guardrail, or materialize an unconfigured workspace default guardrail. Collection fields use replace semantics: send the full desired set on every update. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail to update :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -1900,7 +1900,7 @@ def list_guardrail_key_assignments( ) -> Optional[operations.ListGuardrailKeyAssignmentsResponse]: r"""List key assignments for a guardrail - List all API key assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + List all API key assignments for a specific guardrail. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -2072,7 +2072,7 @@ async def list_guardrail_key_assignments_async( ) -> Optional[operations.ListGuardrailKeyAssignmentsResponse]: r"""List key assignments for a guardrail - List all API key assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + List all API key assignments for a specific guardrail. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -2248,7 +2248,7 @@ def bulk_assign_keys( ) -> components.BulkAssignKeysResponse: r"""Bulk assign keys to a guardrail - Assign multiple API keys to a specific guardrail. A key may hold at most one guardrail; assigning replaces any existing assignment. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Assign multiple API keys to a specific guardrail. A key may hold at most one guardrail; assigning replaces any existing assignment. A workspace-scoped management key reaches only guardrails in its own workspace (any other returns 404), and a batch naming an unknown or out-of-workspace key hash is rejected with 400 before anything changes. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param key_hashes: Array of API key hashes to assign to the guardrail @@ -2398,7 +2398,7 @@ async def bulk_assign_keys_async( ) -> components.BulkAssignKeysResponse: r"""Bulk assign keys to a guardrail - Assign multiple API keys to a specific guardrail. A key may hold at most one guardrail; assigning replaces any existing assignment. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Assign multiple API keys to a specific guardrail. A key may hold at most one guardrail; assigning replaces any existing assignment. A workspace-scoped management key reaches only guardrails in its own workspace (any other returns 404), and a batch naming an unknown or out-of-workspace key hash is rejected with 400 before anything changes. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param key_hashes: Array of API key hashes to assign to the guardrail @@ -2548,7 +2548,7 @@ def bulk_unassign_keys( ) -> components.BulkUnassignKeysResponse: r"""Bulk unassign keys from a guardrail - Unassign multiple API keys from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Unassign multiple API keys from a specific guardrail. A workspace-scoped management key reaches only guardrails in its own workspace (any other returns 404), and a batch naming an unknown or out-of-workspace key hash is rejected with 400 before anything changes. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param key_hashes: Array of API key hashes to unassign from the guardrail @@ -2700,7 +2700,7 @@ async def bulk_unassign_keys_async( ) -> components.BulkUnassignKeysResponse: r"""Bulk unassign keys from a guardrail - Unassign multiple API keys from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Unassign multiple API keys from a specific guardrail. A workspace-scoped management key reaches only guardrails in its own workspace (any other returns 404), and a batch naming an unknown or out-of-workspace key hash is rejected with 400 before anything changes. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param key_hashes: Array of API key hashes to unassign from the guardrail @@ -2853,7 +2853,7 @@ def list_guardrail_member_assignments( ) -> Optional[operations.ListGuardrailMemberAssignmentsResponse]: r"""List member assignments for a guardrail - List all organization member assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + List all organization member assignments for a specific guardrail. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -3025,7 +3025,7 @@ async def list_guardrail_member_assignments_async( ) -> Optional[operations.ListGuardrailMemberAssignmentsResponse]: r"""List member assignments for a guardrail - List all organization member assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + List all organization member assignments for a specific guardrail. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -3201,7 +3201,7 @@ def bulk_assign_members( ) -> components.BulkAssignMembersResponse: r"""Bulk assign members to a guardrail - Assign multiple organization members to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Assign multiple organization members to a specific guardrail. Requires an organization-scoped management key; workspace-scoped management keys return 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param member_user_ids: Array of member user IDs to assign to the guardrail @@ -3353,7 +3353,7 @@ async def bulk_assign_members_async( ) -> components.BulkAssignMembersResponse: r"""Bulk assign members to a guardrail - Assign multiple organization members to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Assign multiple organization members to a specific guardrail. Requires an organization-scoped management key; workspace-scoped management keys return 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param member_user_ids: Array of member user IDs to assign to the guardrail @@ -3505,7 +3505,7 @@ def bulk_unassign_members( ) -> components.BulkUnassignMembersResponse: r"""Bulk unassign members from a guardrail - Unassign multiple organization members from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Unassign multiple organization members from a specific guardrail. Requires an organization-scoped management key; workspace-scoped management keys return 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param member_user_ids: Array of member user IDs to unassign from the guardrail @@ -3657,7 +3657,7 @@ async def bulk_unassign_members_async( ) -> components.BulkUnassignMembersResponse: r"""Bulk unassign members from a guardrail - Unassign multiple organization members from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Unassign multiple organization members from a specific guardrail. Requires an organization-scoped management key; workspace-scoped management keys return 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param member_user_ids: Array of member user IDs to unassign from the guardrail @@ -3809,7 +3809,7 @@ def list_key_assignments( ) -> Optional[operations.ListKeyAssignmentsResponse]: r"""List all key assignments - List all API key guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + List all API key guardrail assignments for the authenticated user. A workspace-scoped management key lists only its own workspace, which `workspace_id` defaults to; naming another workspace returns 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. @@ -3982,7 +3982,7 @@ async def list_key_assignments_async( ) -> Optional[operations.ListKeyAssignmentsResponse]: r"""List all key assignments - List all API key guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + List all API key guardrail assignments for the authenticated user. A workspace-scoped management key lists only its own workspace, which `workspace_id` defaults to; naming another workspace returns 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. @@ -4158,7 +4158,7 @@ def list_member_assignments( ) -> Optional[operations.ListMemberAssignmentsResponse]: r"""List all member assignments - List all organization member guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + List all organization member guardrail assignments for the authenticated user. A workspace-scoped management key lists only its own workspace, which `workspace_id` defaults to; naming another workspace returns 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. @@ -4331,7 +4331,7 @@ async def list_member_assignments_async( ) -> Optional[operations.ListMemberAssignmentsResponse]: r"""List all member assignments - List all organization member guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + List all organization member guardrail assignments for the authenticated user. A workspace-scoped management key lists only its own workspace, which `workspace_id` defaults to; naming another workspace returns 403. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. diff --git a/src/openrouter/operations/listguardrails.py b/src/openrouter/operations/listguardrails.py index c7d05cc96..556e75c73 100644 --- a/src/openrouter/operations/listguardrails.py +++ b/src/openrouter/operations/listguardrails.py @@ -95,7 +95,7 @@ class ListGuardrailsRequestTypedDict(TypedDict): limit: NotRequired[int] r"""Maximum number of records to return (max 100)""" workspace_id: NotRequired[str] - r"""Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned.""" + r"""Filter guardrails by workspace ID. When omitted, an organization management key gets guardrails in the default workspace and a workspace-scoped key gets guardrails in its own workspace. A workspace-scoped key gets 403 for any other workspace.""" class ListGuardrailsRequest(BaseModel): @@ -143,7 +143,7 @@ class ListGuardrailsRequest(BaseModel): Optional[str], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), ] = None - r"""Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned.""" + r"""Filter guardrails by workspace ID. When omitted, an organization management key gets guardrails in the default workspace and a workspace-scoped key gets guardrails in its own workspace. A workspace-scoped key gets 403 for any other workspace.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/uv.lock b/uv.lock index ef7137431..bed71e74a 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.155" +version = "1.3.156" source = { editable = "." } dependencies = [ { name = "httpcore" }, From fd229c99082b935a5821412d623aa70d1ecc3a24 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Wed, 11 Nov 2026 01:05:45 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow