diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 7a8c7157..c07f6bc8 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: 6347bd6ad6ee679ead12c88b6d9412a3 + docChecksum: 8d1ddcb1ec40d884db93bc0db665e440 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.1.117 - configChecksum: c142c0cf39fae8ab675c3e1cf39b3127 + releaseVersion: 1.1.118 + configChecksum: c034902d1804d4170bfff0b2e1c583c4 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 3a52b6a9-d466-42bd-bd76-a8ecef45b80b - pristine_commit_hash: ff88e61e0f61836ced5c04e832f14351e8eabc70 - pristine_tree_hash: c99193b692faf367347038de098f1fe96d857196 + generation_id: 7739462e-9ce4-4dfa-b3ff-ccc39ba1b359 + pristine_commit_hash: 87f34637ee9a2df6045dcfaa21af3a6d5c3ce128 + pristine_tree_hash: c28da05c4b6f752b736de8664bd83fe1327d1ac6 features: python: acceptHeaders: 3.0.0 @@ -1614,12 +1614,12 @@ trackedFiles: pristine_git_object: 67494d04412539e0cb0b406ef4e4cce61b3a6c87 docs/components/createguardrailrequest.mdx: id: c1a768f054c0 - last_write_checksum: sha1:3f07584a8215d1423c5cca92ec6df0bd1edb0213 - pristine_git_object: 93057e720a156eb57589ec6f5e635efa7a55a6bd + last_write_checksum: sha1:d32d712d132971b34f6d81d28ff45d22d919f4ac + pristine_git_object: 3930d118781a8fbb7efdc3e347f99773828097ca docs/components/createguardrailresponse.mdx: id: 1477eebdf505 - last_write_checksum: sha1:425860f0573dc643cab07623da9d01218e79ba65 - pristine_git_object: 677f9a9f2183fa8c520143736a05c37b2c66195e + last_write_checksum: sha1:76bb1fcafda689e9823bb21541c84e7d0bdb991d + pristine_git_object: 63cc820d2e3f4ddaa6d42dfef4c80006f7810cb2 docs/components/createobservabilitydestinationrequest.mdx: id: 8d942a601a6e last_write_checksum: sha1:0021248490c5090429fcd8fe25d4f0fdfcf06ac6 @@ -2278,8 +2278,8 @@ trackedFiles: pristine_git_object: 5730056ada30b50ff129f1da9e021fe69310d5b7 docs/components/getguardrailresponse.mdx: id: a5ffd4aa91ea - last_write_checksum: sha1:f03e56c3ab73b24d53c5ea85a010e0c54f83b233 - pristine_git_object: 21e603e46b10fd25c932b65a82a82f37ce27ce28 + last_write_checksum: sha1:1b5cf22952bbe43de45da9ce526eff0229c6abd6 + pristine_git_object: c17bc0e827b50a77e3d2a447a32cd8d51d84d0ed docs/components/getobservabilitydestinationresponse.mdx: id: fc89b94d297e last_write_checksum: sha1:59e4dd8c6b1ec13fde7bfbee9df6c54c2912dd40 @@ -2306,8 +2306,12 @@ trackedFiles: pristine_git_object: 42ef3f3487d6e55ad13f7ae93edd146fd46332bf docs/components/guardrail.mdx: id: 91791d4c83b6 - last_write_checksum: sha1:7aab0a974c329b856b85acb4f1951941e073fe88 - pristine_git_object: c3f81436f616456be94f43d11387872259ea1ceb + last_write_checksum: sha1:6f8af0e14ef12e99132304a903cc2e68adff68a0 + pristine_git_object: 884c23302a2aa375a053e84bd702aa3b9e76595d + docs/components/guardraildataregion.mdx: + id: d3be2a48aa20 + last_write_checksum: sha1:81f1c0b515e1c1c13432cae9910ce77cb9991507 + pristine_git_object: a01bb2c84c7a64d0f09bc2ad0390dd8bcf73d903 docs/components/guardrailinterval.mdx: id: ccedea0ab250 last_write_checksum: sha1:08342a9cceb4f7a5dc0b574a429d46af9d9a13f4 @@ -5638,12 +5642,12 @@ trackedFiles: pristine_git_object: 335feb18256a83af9c732525307d1432a718f3a1 docs/components/updateguardrailrequest.mdx: id: 450912b18db6 - last_write_checksum: sha1:1de87bad986af28ad7f59f8b821798c2e18f0e5d - pristine_git_object: c4e5ea94ff784b4932f20c5e185a302cc8318651 + last_write_checksum: sha1:f0e2aaf8ecb96d8b53a02768ec260472490963cd + pristine_git_object: e42e435d516b5fb62183b7e0a65e20bdbcf25f1b docs/components/updateguardrailresponse.mdx: id: e00dc0a0c6e0 - last_write_checksum: sha1:84196e49043895cbb391d40163fd2a60572eb766 - pristine_git_object: 9afd1bfd1a9140422831bb7a13567382bbd8dada + last_write_checksum: sha1:1be70185072640936151f861913c2b89a09d4bab + pristine_git_object: 510bac097152bc64d1eccad4f2a498db9bd8a86c docs/components/updateobservabilitydestinationrequest.mdx: id: b54091567003 last_write_checksum: sha1:5e1ca1d49b7a6a202ab0c8b8aa0b4f1a78a6246d @@ -7406,8 +7410,8 @@ trackedFiles: pristine_git_object: 064751ea194bff6b8111575603f804362960b886 docs/sdks/guardrails/README.mdx: id: a0cd4218b8fa - last_write_checksum: sha1:cfb0cf3094d5db1baa290f8d1e9aedfa5f96743c - pristine_git_object: 448b81faf70c44ac312c1183731ac31aadec6cb6 + last_write_checksum: sha1:38528ebab7b27c8a9573213e6a35986c40c09770 + pristine_git_object: d0e5b6f5dc99709bb57448b98401d8f1fee98d04 docs/sdks/images/README.mdx: id: 534a6c102c4f last_write_checksum: sha1:bc62f91590ac816c58ad954f4a888a46aee71bb9 @@ -7470,8 +7474,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:88eb79aeaf2e388babc8e9ef2d78be4699f94b7a - pristine_git_object: 468c99cf3ed4c3d4f66aa5873daf8628835373b5 + last_write_checksum: sha1:6a93cfc0b9d57daad29477ac565b9c8bd5099095 + pristine_git_object: 2f994cca195bb80c8deb3ba9cb82c17f96688013 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -7498,8 +7502,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:bde1522891c6783143d2a874d1b4e0db642dfcca - pristine_git_object: 7e31b70a8b76efd9b6ce6ee29f9f9d5bfd17edff + last_write_checksum: sha1:12e4c32845fc1bd5033e126961ba5276b4f4961e + pristine_git_object: be165943041ea357cd2c73da716dc984f2050f6f src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:1e0004d8d1d5d797e2b54cd1cabeb7f9489d08e9 @@ -7538,8 +7542,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:ee70d625d7027ee29923ba65bb5fe1e4718fd7de - pristine_git_object: ed8b0e61148dac5a11debbf97c028fd8dd145fec + last_write_checksum: sha1:9407e2d53ca342ebec61ba62a021df466d857e9f + pristine_git_object: 387c9d06176293810c2b3368f291c5d917f4c96a src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -8254,8 +8258,8 @@ trackedFiles: pristine_git_object: fcfd9d646f216fdbb715cbbaefa4382d75750b79 src/openrouter/components/createguardrailrequest.py: id: 34d69149fb33 - last_write_checksum: sha1:230942143ddb6e5d09577d3743a867e39ead5c2d - pristine_git_object: 82b36522057b40056fca7c50922b204c4f5902b5 + last_write_checksum: sha1:af6fca661fed3b42e547333b14750448c46b43cf + pristine_git_object: d3cb25c2acff7aa00ad2cd966e5aaeb62d6e531c src/openrouter/components/createguardrailresponse.py: id: b4e1bdf1de5b last_write_checksum: sha1:ae20a5e7425510c240e5697d847b1cae65940bd6 @@ -8574,8 +8578,12 @@ trackedFiles: pristine_git_object: acda534cb0ced2a391479b720434cf0f57f46276 src/openrouter/components/guardrail.py: id: 67ee78dd06e6 - last_write_checksum: sha1:01d933cded2e7af8a0805afee42046bfc5798923 - pristine_git_object: 4c294f52613b32af43c6c7390bb27fab87069bf8 + last_write_checksum: sha1:a06d7d1d1aa75b2e1c27cfa10cc5347a88821e76 + pristine_git_object: c58c4908937be5ceb0414666315782ebb862e331 + src/openrouter/components/guardraildataregion.py: + id: 16c31f1446b2 + last_write_checksum: sha1:52b5622a7c93a30219108f033ab0e3fbb3a396f7 + pristine_git_object: 61b77732d122723a7d244d2f8a693443ee6b09af src/openrouter/components/guardrailinterval.py: id: 01687fc135ab last_write_checksum: sha1:430f886f371b85777346de663202d62708cd84cf @@ -9874,8 +9882,8 @@ trackedFiles: pristine_git_object: a3664695c9722c531f7694851da76e51c2efe4fb src/openrouter/components/updateguardrailrequest.py: id: 6a557cd822a0 - last_write_checksum: sha1:9d5c60239abb562417b8735bc2aa2148ad05fe1d - pristine_git_object: 1b419680b12daf50741c20c8bf48d773137c57c0 + last_write_checksum: sha1:0e5978b49b7a37f48931dd778caf1fc46657b881 + pristine_git_object: 21afa8a30b9688294c7c210ed45e23ea17109241 src/openrouter/components/updateguardrailresponse.py: id: 7b068d26ce31 last_write_checksum: sha1:2b63cbb90747f07f775d9a22e80f74c67221fea8 @@ -10142,8 +10150,8 @@ trackedFiles: pristine_git_object: d5990c4254d4b3c5dae3f548bbec02558adadae1 src/openrouter/guardrails.py: id: 705839f34e66 - last_write_checksum: sha1:c8f6d746c67c2faf5d509d512a6ac68514c7032b - pristine_git_object: 28a73c3fc2693ba8334e0a1449912548548864c9 + last_write_checksum: sha1:375746bca04b2636732a777a26da1e59bccbbd2a + pristine_git_object: c6397aa3dd46a1ce6b447b0cd0d2228a9c005c08 src/openrouter/httpclient.py: id: e9311185443d last_write_checksum: sha1:5e55338d6ee9f01ab648cad4380201a8a3da7dd7 @@ -12577,6 +12585,4 @@ examples: "503": application/json: {"error": {"code": 503, "message": "Service temporarily unavailable"}} examplesVersion: 1.0.2 -releaseNotes: | - ## Python SDK Changes: - * `open_router.api_keys.create()`: `request` **Changed** (Breaking ⚠️) +releaseNotes: "## Python SDK Changes:\n* `open_router.guardrails.list()`: `response.data[].allowed_data_regions` **Added**\n* `open_router.guardrails.create()`: \n * `request.allowed_data_regions` **Added**\n * `response.data.allowed_data_regions` **Added**\n* `open_router.guardrails.get()`: `response.data.allowed_data_regions` **Added**\n* `open_router.guardrails.update()`: \n * `request.allowed_data_regions` **Added**\n * `response.data.allowed_data_regions` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index ed82824d..43145786 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.1.117 + version: 1.1.118 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 3b8ef995..2aaa8d33 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -7386,6 +7386,16 @@ components: name: 'My New Guardrail' reset_interval: 'monthly' properties: + allowed_data_regions: + description: '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.' + example: + - 'europe' + items: + $ref: '#/components/schemas/GuardrailDataRegion' + minItems: 1 + type: + - 'array' + - 'null' allowed_models: description: 'Array of model identifiers (slug or canonical_slug accepted)' example: @@ -10241,6 +10251,7 @@ components: type: 'object' Guardrail: example: + allowed_data_regions: null allowed_models: null allowed_providers: - 'openai' @@ -10272,6 +10283,15 @@ components: updated_at: '2025-08-24T15:45:00Z' workspace_id: '0df9e665-d932-5740-b2c7-b52af166bc11' properties: + allowed_data_regions: + description: '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.' + example: + - 'europe' + items: + $ref: '#/components/schemas/GuardrailDataRegion' + type: + - 'array' + - 'null' allowed_models: description: 'Array of model canonical_slugs (immutable identifiers)' example: @@ -10440,6 +10460,15 @@ components: - 'created_at' - 'workspace_id' type: 'object' + GuardrailDataRegion: + description: 'An OpenRouter data region: `global` (https://openrouter.ai), `europe` (https://eu.openrouter.ai), or `us` (https://us.openrouter.ai)' + enum: + - 'global' + - 'europe' + - 'us' + example: 'europe' + type: 'string' + x-speakeasy-unknown-values: allow GuardrailInterval: description: 'Interval at which the limit resets (daily, weekly, monthly)' enum: @@ -25913,6 +25942,16 @@ components: name: 'Updated Guardrail Name' reset_interval: 'weekly' properties: + allowed_data_regions: + description: '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.' + example: + - 'europe' + items: + $ref: '#/components/schemas/GuardrailDataRegion' + minItems: 1 + type: + - 'array' + - 'null' allowed_models: description: 'Array of model identifiers (slug or canonical_slug accepted)' example: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index fa5253fa..f3135b94 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.787.0 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:cff2f8843cab07843b51385e80ec0bedbee73ab8f51fbde0e093c469a3d3b878 - sourceBlobDigest: sha256:aaaf189600f77a1e84c459dfaefa6240d3633c8733c89fcf061d8380d3a2ae1e + sourceRevisionDigest: sha256:7653bb5ddb5a2631fbafe215ee7a9cff39561fd3d4aac78269142fe5e9480f59 + sourceBlobDigest: sha256:aa2090dae19b80edae917cc47934cfa0551033bb2e0e7f3900bebc99bf220cef tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:cff2f8843cab07843b51385e80ec0bedbee73ab8f51fbde0e093c469a3d3b878 - sourceBlobDigest: sha256:aaaf189600f77a1e84c459dfaefa6240d3633c8733c89fcf061d8380d3a2ae1e + sourceRevisionDigest: sha256:7653bb5ddb5a2631fbafe215ee7a9cff39561fd3d4aac78269142fe5e9480f59 + sourceBlobDigest: sha256:aa2090dae19b80edae917cc47934cfa0551033bb2e0e7f3900bebc99bf220cef codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:f3a3ad0383259e5ab498a11676d33a1bbbaca2e5f401918fff7e37c5d9c2dbad + codeSamplesRevisionDigest: sha256:4b44a31a05c14148f404504d497c148f0655682a8c6cd97a71d3ca6879fccbc0 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 373db0b5..b08eb8ec 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1959,4 +1959,14 @@ Based on: ### Generated - [python v1.1.117] . ### Releases -- [PyPI v1.1.117] https://pypi.org/project/openrouter/1.1.117 - . \ No newline at end of file +- [PyPI v1.1.117] https://pypi.org/project/openrouter/1.1.117 - . + +## 2026-09-02 23:29:07 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.1.118] . +### Releases +- [PyPI v1.1.118] https://pypi.org/project/openrouter/1.1.118 - . \ No newline at end of file diff --git a/docs/components/createguardrailrequest.mdx b/docs/components/createguardrailrequest.mdx index 93057e72..3930d118 100644 --- a/docs/components/createguardrailrequest.mdx +++ b/docs/components/createguardrailrequest.mdx @@ -6,6 +6,7 @@ title: "CreateGuardrailRequest" | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allowed_data_regions` | List[[components.GuardrailDataRegion](../components/guardraildataregion.mdx)] | :heavy_minus_sign: | 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*] | :heavy_minus_sign: | 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*] | :heavy_minus_sign: | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | | `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../components/contentfilterbuiltinentryinput.mdx)] | :heavy_minus_sign: | Builtin content filters to apply. Every builtin slug supports "block", "redact", and the detect-only "flag" action. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | diff --git a/docs/components/createguardrailresponse.mdx b/docs/components/createguardrailresponse.mdx index 677f9a9f..63cc820d 100644 --- a/docs/components/createguardrailresponse.mdx +++ b/docs/components/createguardrailresponse.mdx @@ -4,6 +4,6 @@ title: "CreateGuardrailResponse" ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [components.Guardrail](../components/guardrail.mdx) | :heavy_check_mark: | N/A | \{
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"google"
],
"content_filter_builtins": [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
],
"content_filters": null,
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enable_free_model_publication": false,
"enable_free_model_training": true,
"enable_paid_model_training": true,
"enforce_zdr": null,
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"enforce_zdr_xai": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"include_byok_in_budgets": false,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [components.Guardrail](../components/guardrail.mdx) | :heavy_check_mark: | N/A | \{
"allowed_data_regions": null,
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"google"
],
"content_filter_builtins": [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
],
"content_filters": null,
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enable_free_model_publication": false,
"enable_free_model_training": true,
"enable_paid_model_training": true,
"enforce_zdr": null,
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"enforce_zdr_xai": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"include_byok_in_budgets": false,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
} | \ No newline at end of file diff --git a/docs/components/getguardrailresponse.mdx b/docs/components/getguardrailresponse.mdx index 21e603e4..c17bc0e8 100644 --- a/docs/components/getguardrailresponse.mdx +++ b/docs/components/getguardrailresponse.mdx @@ -4,6 +4,6 @@ title: "GetGuardrailResponse" ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [components.Guardrail](../components/guardrail.mdx) | :heavy_check_mark: | N/A | \{
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"google"
],
"content_filter_builtins": [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
],
"content_filters": null,
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enable_free_model_publication": false,
"enable_free_model_training": true,
"enable_paid_model_training": true,
"enforce_zdr": null,
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"enforce_zdr_xai": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"include_byok_in_budgets": false,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [components.Guardrail](../components/guardrail.mdx) | :heavy_check_mark: | N/A | \{
"allowed_data_regions": null,
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"google"
],
"content_filter_builtins": [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
],
"content_filters": null,
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enable_free_model_publication": false,
"enable_free_model_training": true,
"enable_paid_model_training": true,
"enforce_zdr": null,
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"enforce_zdr_xai": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"include_byok_in_budgets": false,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
} | \ No newline at end of file diff --git a/docs/components/guardrail.mdx b/docs/components/guardrail.mdx index c3f81436..884c2330 100644 --- a/docs/components/guardrail.mdx +++ b/docs/components/guardrail.mdx @@ -4,29 +4,30 @@ title: "Guardrail" ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model canonical_slugs (immutable identifiers) | [
"openai/gpt-5.2-20251211",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | -| `allowed_providers` | List[*str*] | :heavy_minus_sign: | List of allowed provider IDs | [
"openai",
"anthropic",
"google"
] | -| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntry](../components/contentfilterbuiltinentry.mdx)] | :heavy_minus_sign: | Builtin content filters applied to requests. Includes PII detectors and the regex-based prompt injection detector. | [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
] | -| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters applied to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | -| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the guardrail was created | 2025-08-24T10:30:00Z | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | Guardrail for production environment | -| `enable_free_model_publication` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows free endpoints that publish prompts. | false | -| `enable_free_model_training` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows free endpoints that train on request data. | true | -| `enable_paid_model_training` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows paid endpoints that train on request data. | true | -| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** 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]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false | -| `id` | *str* | :heavy_check_mark: | Unique identifier for the guardrail | 550e8400-e29b-41d4-a716-446655440000 | -| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model canonical_slugs to exclude from routing | [
"openai/gpt-4o-mini-2024-07-18"
] | -| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | -| `include_byok_in_budgets` | *bool* | :heavy_check_mark: | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. | false | -| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 100 | -| `name` | *str* | :heavy_check_mark: | Name of the guardrail | Production Guardrail | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `updated_at` | *OptionalNullable[str]* | :heavy_minus_sign: | ISO 8601 timestamp of when the guardrail was last updated | 2025-08-24T15:45:00Z | -| `workspace_id` | *Nullable[str]* | :heavy_check_mark: | The workspace this guardrail belongs to, or `null` for an unscoped legacy guardrail predating workspaces. Workspace membership organizes the guardrail; it does not apply the guardrail to the workspace's traffic. A `null` value does not mean the default workspace, and does not apply the guardrail across every workspace. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `allowed_data_regions` | List[[components.GuardrailDataRegion](../components/guardraildataregion.mdx)] | :heavy_minus_sign: | 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. | [
"europe"
] | +| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model canonical_slugs (immutable identifiers) | [
"openai/gpt-5.2-20251211",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | +| `allowed_providers` | List[*str*] | :heavy_minus_sign: | List of allowed provider IDs | [
"openai",
"anthropic",
"google"
] | +| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntry](../components/contentfilterbuiltinentry.mdx)] | :heavy_minus_sign: | Builtin content filters applied to requests. Includes PII detectors and the regex-based prompt injection detector. | [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
] | +| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters applied to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | +| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the guardrail was created | 2025-08-24T10:30:00Z | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | Guardrail for production environment | +| `enable_free_model_publication` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows free endpoints that publish prompts. | false | +| `enable_free_model_training` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows free endpoints that train on request data. | true | +| `enable_paid_model_training` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows paid endpoints that train on request data. | true | +| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** 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]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false | +| `id` | *str* | :heavy_check_mark: | Unique identifier for the guardrail | 550e8400-e29b-41d4-a716-446655440000 | +| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model canonical_slugs to exclude from routing | [
"openai/gpt-4o-mini-2024-07-18"
] | +| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | +| `include_byok_in_budgets` | *bool* | :heavy_check_mark: | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. | false | +| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 100 | +| `name` | *str* | :heavy_check_mark: | Name of the guardrail | Production Guardrail | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `updated_at` | *OptionalNullable[str]* | :heavy_minus_sign: | ISO 8601 timestamp of when the guardrail was last updated | 2025-08-24T15:45:00Z | +| `workspace_id` | *Nullable[str]* | :heavy_check_mark: | The workspace this guardrail belongs to, or `null` for an unscoped legacy guardrail predating workspaces. Workspace membership organizes the guardrail; it does not apply the guardrail to the workspace's traffic. A `null` value does not mean the default workspace, and does not apply the guardrail across every workspace. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/components/guardraildataregion.mdx b/docs/components/guardraildataregion.mdx new file mode 100644 index 00000000..a01bb2c8 --- /dev/null +++ b/docs/components/guardraildataregion.mdx @@ -0,0 +1,23 @@ +--- +title: "GuardrailDataRegion" +--- + +An OpenRouter data region: `global` (https://openrouter.ai), `europe` (https://eu.openrouter.ai), or `us` (https://us.openrouter.ai) + +## Example Usage + +```python +from openrouter.components import GuardrailDataRegion + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: GuardrailDataRegion = "global" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"global"` +- `"europe"` +- `"us"` diff --git a/docs/components/updateguardrailrequest.mdx b/docs/components/updateguardrailrequest.mdx index c4e5ea94..e42e435d 100644 --- a/docs/components/updateguardrailrequest.mdx +++ b/docs/components/updateguardrailrequest.mdx @@ -4,25 +4,26 @@ title: "UpdateGuardrailRequest" ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2"
] | -| `allowed_providers` | List[*str*] | :heavy_minus_sign: | New list of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | -| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../components/contentfilterbuiltinentryinput.mdx)] | :heavy_minus_sign: | Builtin content filters to apply. Set to null to remove. 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)] | :heavy_minus_sign: | Custom regex content filters to apply. Set to null to remove. | null | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | New description for the guardrail | Updated description | -| `enable_free_model_publication` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows free endpoints that publish prompts. | false | -| `enable_free_model_training` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows free endpoints that train on request data. | true | -| `enable_paid_model_training` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows paid endpoints that train on request data. | true | -| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** 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. | true | -| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | 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. | true | -| `enforce_zdr_xai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | true | -| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | -| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | -| `include_byok_in_budgets` | *Optional[bool]* | :heavy_minus_sign: | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Omit to leave unchanged. | true | -| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | New spending limit in USD | 75 | -| `name` | *Optional[str]* | :heavy_minus_sign: | New name for the guardrail | Updated Guardrail Name | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allowed_data_regions` | List[[components.GuardrailDataRegion](../components/guardraildataregion.mdx)] | :heavy_minus_sign: | 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*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2"
] | +| `allowed_providers` | List[*str*] | :heavy_minus_sign: | New list of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | +| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../components/contentfilterbuiltinentryinput.mdx)] | :heavy_minus_sign: | Builtin content filters to apply. Set to null to remove. 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)] | :heavy_minus_sign: | Custom regex content filters to apply. Set to null to remove. | null | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | New description for the guardrail | Updated description | +| `enable_free_model_publication` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows free endpoints that publish prompts. | false | +| `enable_free_model_training` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows free endpoints that train on request data. | true | +| `enable_paid_model_training` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows paid endpoints that train on request data. | true | +| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** 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. | true | +| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | 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. | true | +| `enforce_zdr_xai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | true | +| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | +| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | +| `include_byok_in_budgets` | *Optional[bool]* | :heavy_minus_sign: | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Omit to leave unchanged. | true | +| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | New spending limit in USD | 75 | +| `name` | *Optional[str]* | :heavy_minus_sign: | New name for the guardrail | Updated Guardrail Name | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | \ No newline at end of file diff --git a/docs/components/updateguardrailresponse.mdx b/docs/components/updateguardrailresponse.mdx index 9afd1bfd..510bac09 100644 --- a/docs/components/updateguardrailresponse.mdx +++ b/docs/components/updateguardrailresponse.mdx @@ -4,6 +4,6 @@ title: "UpdateGuardrailResponse" ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [components.Guardrail](../components/guardrail.mdx) | :heavy_check_mark: | N/A | \{
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"google"
],
"content_filter_builtins": [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
],
"content_filters": null,
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enable_free_model_publication": false,
"enable_free_model_training": true,
"enable_paid_model_training": true,
"enforce_zdr": null,
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"enforce_zdr_xai": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"include_byok_in_budgets": false,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [components.Guardrail](../components/guardrail.mdx) | :heavy_check_mark: | N/A | \{
"allowed_data_regions": null,
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"google"
],
"content_filter_builtins": [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
],
"content_filters": null,
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enable_free_model_publication": false,
"enable_free_model_training": true,
"enable_paid_model_training": true,
"enforce_zdr": null,
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"enforce_zdr_xai": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"include_byok_in_budgets": false,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "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 448b81fa..d0e5b6f5 100644 --- a/docs/sdks/guardrails/README.mdx +++ b/docs/sdks/guardrails/README.mdx @@ -112,6 +112,7 @@ with OpenRouter( | `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `allowed_data_regions` | List[[components.GuardrailDataRegion](../../components/guardraildataregion.mdx)] | :heavy_minus_sign: | 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*] | :heavy_minus_sign: | 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*] | :heavy_minus_sign: | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | | `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../../components/contentfilterbuiltinentryinput.mdx)] | :heavy_minus_sign: | Builtin content filters to apply. Every builtin slug supports "block", "redact", and the detect-only "flag" action. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | @@ -271,33 +272,34 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail to update | 550e8400-e29b-41d4-a716-446655440000 | -| `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2"
] | -| `allowed_providers` | List[*str*] | :heavy_minus_sign: | New list of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | -| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../../components/contentfilterbuiltinentryinput.mdx)] | :heavy_minus_sign: | Builtin content filters to apply. Set to null to remove. 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)] | :heavy_minus_sign: | Custom regex content filters to apply. Set to null to remove. | null | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | New description for the guardrail | Updated description | -| `enable_free_model_publication` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows free endpoints that publish prompts. | false | -| `enable_free_model_training` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows free endpoints that train on request data. | true | -| `enable_paid_model_training` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows paid endpoints that train on request data. | true | -| `enforce_zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** 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. | true | -| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | 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. | true | -| `enforce_zdr_xai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | true | -| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | -| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | -| `include_byok_in_budgets` | *Optional[bool]* | :heavy_minus_sign: | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Omit to leave unchanged. | true | -| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | New spending limit in USD | 75 | -| `name` | *Optional[str]* | :heavy_minus_sign: | New name for the guardrail | Updated Guardrail Name | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail to update | 550e8400-e29b-41d4-a716-446655440000 | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `allowed_data_regions` | List[[components.GuardrailDataRegion](../../components/guardraildataregion.mdx)] | :heavy_minus_sign: | 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*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2"
] | +| `allowed_providers` | List[*str*] | :heavy_minus_sign: | New list of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | +| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../../components/contentfilterbuiltinentryinput.mdx)] | :heavy_minus_sign: | Builtin content filters to apply. Set to null to remove. 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)] | :heavy_minus_sign: | Custom regex content filters to apply. Set to null to remove. | null | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | New description for the guardrail | Updated description | +| `enable_free_model_publication` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows free endpoints that publish prompts. | false | +| `enable_free_model_training` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows free endpoints that train on request data. | true | +| `enable_paid_model_training` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether this guardrail allows paid endpoints that train on request data. | true | +| `enforce_zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** 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. | true | +| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | 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. | true | +| `enforce_zdr_xai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | true | +| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | +| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | +| `include_byok_in_budgets` | *Optional[bool]* | :heavy_minus_sign: | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Omit to leave unchanged. | true | +| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | New spending limit in USD | 75 | +| `name` | *Optional[str]* | :heavy_minus_sign: | New name for the guardrail | Updated Guardrail Name | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/pyproject.toml b/pyproject.toml index 468c99cf..2f994cca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.1.117" +version = "1.1.118" 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 7e31b70a..be165943 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.1.117" +__version__: str = "1.1.118" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.1.117 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.1.118 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index ed8b0e61..387c9d06 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -1273,6 +1273,7 @@ GetWorkspaceResponseTypedDict, ) from .guardrail import Guardrail, GuardrailTypedDict + from .guardraildataregion import GuardrailDataRegion from .guardrailinterval import GuardrailInterval from .imageconfig import ImageConfig, ImageConfigTypedDict from .imageendpoint import ImageEndpoint, ImageEndpointTypedDict @@ -4099,6 +4100,7 @@ "GetWorkspaceResponse", "GetWorkspaceResponseTypedDict", "Guardrail", + "GuardrailDataRegion", "GuardrailInterval", "GuardrailTypedDict", "ImageConfig", @@ -6429,6 +6431,7 @@ "GetWorkspaceResponseTypedDict": ".getworkspaceresponse", "Guardrail": ".guardrail", "GuardrailTypedDict": ".guardrail", + "GuardrailDataRegion": ".guardraildataregion", "GuardrailInterval": ".guardrailinterval", "ImageConfig": ".imageconfig", "ImageConfigTypedDict": ".imageconfig", diff --git a/src/openrouter/components/createguardrailrequest.py b/src/openrouter/components/createguardrailrequest.py index 82b36522..d3cb25c2 100644 --- a/src/openrouter/components/createguardrailrequest.py +++ b/src/openrouter/components/createguardrailrequest.py @@ -6,6 +6,7 @@ ContentFilterBuiltinEntryInputTypedDict, ) from .contentfilterentry import ContentFilterEntry, ContentFilterEntryTypedDict +from .guardraildataregion import GuardrailDataRegion from .guardrailinterval import GuardrailInterval from openrouter.types import ( BaseModel, @@ -23,6 +24,8 @@ class CreateGuardrailRequestTypedDict(TypedDict): name: str r"""Name for the new guardrail""" + allowed_data_regions: NotRequired[Nullable[List[GuardrailDataRegion]]] + r"""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.""" allowed_models: NotRequired[Nullable[List[str]]] r"""Array of model identifiers (slug or canonical_slug accepted)""" allowed_providers: NotRequired[Nullable[List[str]]] @@ -71,6 +74,9 @@ class CreateGuardrailRequest(BaseModel): name: str r"""Name for the new guardrail""" + allowed_data_regions: OptionalNullable[List[GuardrailDataRegion]] = UNSET + r"""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.""" + allowed_models: OptionalNullable[List[str]] = UNSET r"""Array of model identifiers (slug or canonical_slug accepted)""" @@ -142,6 +148,7 @@ class CreateGuardrailRequest(BaseModel): def serialize_model(self, handler): optional_fields = set( [ + "allowed_data_regions", "allowed_models", "allowed_providers", "content_filter_builtins", @@ -166,6 +173,7 @@ def serialize_model(self, handler): ) nullable_fields = set( [ + "allowed_data_regions", "allowed_models", "allowed_providers", "content_filter_builtins", diff --git a/src/openrouter/components/guardrail.py b/src/openrouter/components/guardrail.py index 4c294f52..c58c4908 100644 --- a/src/openrouter/components/guardrail.py +++ b/src/openrouter/components/guardrail.py @@ -6,6 +6,7 @@ ContentFilterBuiltinEntryTypedDict, ) from .contentfilterentry import ContentFilterEntry, ContentFilterEntryTypedDict +from .guardraildataregion import GuardrailDataRegion from .guardrailinterval import GuardrailInterval from openrouter.types import ( BaseModel, @@ -31,6 +32,8 @@ class GuardrailTypedDict(TypedDict): r"""Name of the guardrail""" workspace_id: Nullable[str] r"""The workspace this guardrail belongs to, or `null` for an unscoped legacy guardrail predating workspaces. Workspace membership organizes the guardrail; it does not apply the guardrail to the workspace's traffic. A `null` value does not mean the default workspace, and does not apply the guardrail across every workspace.""" + allowed_data_regions: NotRequired[Nullable[List[GuardrailDataRegion]]] + r"""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.""" allowed_models: NotRequired[Nullable[List[str]]] r"""Array of model canonical_slugs (immutable identifiers)""" allowed_providers: NotRequired[Nullable[List[str]]] @@ -89,6 +92,9 @@ class Guardrail(BaseModel): workspace_id: Nullable[str] r"""The workspace this guardrail belongs to, or `null` for an unscoped legacy guardrail predating workspaces. Workspace membership organizes the guardrail; it does not apply the guardrail to the workspace's traffic. A `null` value does not mean the default workspace, and does not apply the guardrail across every workspace.""" + allowed_data_regions: OptionalNullable[List[GuardrailDataRegion]] = UNSET + r"""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.""" + allowed_models: OptionalNullable[List[str]] = UNSET r"""Array of model canonical_slugs (immutable identifiers)""" @@ -155,6 +161,7 @@ class Guardrail(BaseModel): def serialize_model(self, handler): optional_fields = set( [ + "allowed_data_regions", "allowed_models", "allowed_providers", "content_filter_builtins", @@ -178,6 +185,7 @@ def serialize_model(self, handler): ) nullable_fields = set( [ + "allowed_data_regions", "allowed_models", "allowed_providers", "content_filter_builtins", diff --git a/src/openrouter/components/guardraildataregion.py b/src/openrouter/components/guardraildataregion.py new file mode 100644 index 00000000..61b77732 --- /dev/null +++ b/src/openrouter/components/guardraildataregion.py @@ -0,0 +1,16 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import UnrecognizedStr +from typing import Literal, Union + + +GuardrailDataRegion = Union[ + Literal[ + "global", + "europe", + "us", + ], + UnrecognizedStr, +] +r"""An OpenRouter data region: `global` (https://openrouter.ai), `europe` (https://eu.openrouter.ai), or `us` (https://us.openrouter.ai)""" diff --git a/src/openrouter/components/updateguardrailrequest.py b/src/openrouter/components/updateguardrailrequest.py index 1b419680..21afa8a3 100644 --- a/src/openrouter/components/updateguardrailrequest.py +++ b/src/openrouter/components/updateguardrailrequest.py @@ -6,6 +6,7 @@ ContentFilterBuiltinEntryInputTypedDict, ) from .contentfilterentry import ContentFilterEntry, ContentFilterEntryTypedDict +from .guardraildataregion import GuardrailDataRegion from .guardrailinterval import GuardrailInterval from openrouter.types import ( BaseModel, @@ -21,6 +22,8 @@ class UpdateGuardrailRequestTypedDict(TypedDict): + allowed_data_regions: NotRequired[Nullable[List[GuardrailDataRegion]]] + r"""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.""" allowed_models: NotRequired[Nullable[List[str]]] r"""Array of model identifiers (slug or canonical_slug accepted)""" allowed_providers: NotRequired[Nullable[List[str]]] @@ -66,6 +69,9 @@ class UpdateGuardrailRequestTypedDict(TypedDict): class UpdateGuardrailRequest(BaseModel): + allowed_data_regions: OptionalNullable[List[GuardrailDataRegion]] = UNSET + r"""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.""" + allowed_models: OptionalNullable[List[str]] = UNSET r"""Array of model identifiers (slug or canonical_slug accepted)""" @@ -137,6 +143,7 @@ class UpdateGuardrailRequest(BaseModel): def serialize_model(self, handler): optional_fields = set( [ + "allowed_data_regions", "allowed_models", "allowed_providers", "content_filter_builtins", @@ -161,6 +168,7 @@ def serialize_model(self, handler): ) nullable_fields = set( [ + "allowed_data_regions", "allowed_models", "allowed_providers", "content_filter_builtins", diff --git a/src/openrouter/guardrails.py b/src/openrouter/guardrails.py index 28a73c3f..c6397aa3 100644 --- a/src/openrouter/guardrails.py +++ b/src/openrouter/guardrails.py @@ -357,6 +357,9 @@ def create( http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + allowed_data_regions: OptionalNullable[ + Iterable[components.GuardrailDataRegion] + ] = UNSET, allowed_models: OptionalNullable[Iterable[str]] = UNSET, allowed_providers: OptionalNullable[Iterable[str]] = UNSET, content_filter_builtins: OptionalNullable[ @@ -404,6 +407,7 @@ def create( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + :param allowed_data_regions: 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. :param allowed_models: Array of model identifiers (slug or canonical_slug accepted) :param allowed_providers: List of allowed provider IDs :param content_filter_builtins: Builtin content filters to apply. Every builtin slug supports \"block\", \"redact\", and the detect-only \"flag\" action. @@ -444,6 +448,10 @@ def create( x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, create_guardrail_request=components.CreateGuardrailRequest( + allowed_data_regions=utils.unmarshal( + allowed_data_regions, + OptionalNullable[List[components.GuardrailDataRegion]], + ), allowed_models=utils.unmarshal( allowed_models, OptionalNullable[List[str]] ), @@ -583,6 +591,9 @@ async def create_async( http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + allowed_data_regions: OptionalNullable[ + Iterable[components.GuardrailDataRegion] + ] = UNSET, allowed_models: OptionalNullable[Iterable[str]] = UNSET, allowed_providers: OptionalNullable[Iterable[str]] = UNSET, content_filter_builtins: OptionalNullable[ @@ -630,6 +641,7 @@ async def create_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + :param allowed_data_regions: 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. :param allowed_models: Array of model identifiers (slug or canonical_slug accepted) :param allowed_providers: List of allowed provider IDs :param content_filter_builtins: Builtin content filters to apply. Every builtin slug supports \"block\", \"redact\", and the detect-only \"flag\" action. @@ -670,6 +682,10 @@ async def create_async( x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, create_guardrail_request=components.CreateGuardrailRequest( + allowed_data_regions=utils.unmarshal( + allowed_data_regions, + OptionalNullable[List[components.GuardrailDataRegion]], + ), allowed_models=utils.unmarshal( allowed_models, OptionalNullable[List[str]] ), @@ -1321,6 +1337,9 @@ def update( http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + allowed_data_regions: OptionalNullable[ + Iterable[components.GuardrailDataRegion] + ] = UNSET, allowed_models: OptionalNullable[Iterable[str]] = UNSET, allowed_providers: OptionalNullable[Iterable[str]] = UNSET, content_filter_builtins: OptionalNullable[ @@ -1368,6 +1387,7 @@ def update( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + :param allowed_data_regions: 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. :param allowed_models: Array of model identifiers (slug or canonical_slug accepted) :param allowed_providers: New list of allowed provider IDs :param content_filter_builtins: Builtin content filters to apply. Set to null to remove. Every builtin slug supports \"block\", \"redact\", and the detect-only \"flag\" action. @@ -1409,6 +1429,10 @@ def update( x_open_router_categories=x_open_router_categories, id=id, update_guardrail_request=components.UpdateGuardrailRequest( + allowed_data_regions=utils.unmarshal( + allowed_data_regions, + OptionalNullable[List[components.GuardrailDataRegion]], + ), allowed_models=utils.unmarshal( allowed_models, OptionalNullable[List[str]] ), @@ -1547,6 +1571,9 @@ async def update_async( http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + allowed_data_regions: OptionalNullable[ + Iterable[components.GuardrailDataRegion] + ] = UNSET, allowed_models: OptionalNullable[Iterable[str]] = UNSET, allowed_providers: OptionalNullable[Iterable[str]] = UNSET, content_filter_builtins: OptionalNullable[ @@ -1594,6 +1621,7 @@ async def update_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + :param allowed_data_regions: 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. :param allowed_models: Array of model identifiers (slug or canonical_slug accepted) :param allowed_providers: New list of allowed provider IDs :param content_filter_builtins: Builtin content filters to apply. Set to null to remove. Every builtin slug supports \"block\", \"redact\", and the detect-only \"flag\" action. @@ -1635,6 +1663,10 @@ async def update_async( x_open_router_categories=x_open_router_categories, id=id, update_guardrail_request=components.UpdateGuardrailRequest( + allowed_data_regions=utils.unmarshal( + allowed_data_regions, + OptionalNullable[List[components.GuardrailDataRegion]], + ), allowed_models=utils.unmarshal( allowed_models, OptionalNullable[List[str]] ), diff --git a/uv.lock b/uv.lock index 094a654b..e792c40f 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.1.117" +version = "1.1.118" source = { editable = "." } dependencies = [ { name = "httpcore" },