From d0ddc48499a8085df80a725d0a21a1950e6aab75 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Fri, 21 Aug 2026 00:17:03 +0000 Subject: [PATCH 1/2] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.787.0 --- .speakeasy/gen.lock | 50 ++++++++--------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 6 +- .speakeasy/workflow.lock | 10 ++-- RELEASES.md | 12 +++- docs/components/createguardrailrequest.mdx | 46 +++++++-------- docs/components/guardrail.mdx | 2 +- docs/sdks/guardrails/README.mdx | 56 +++++++++---------- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- .../components/createguardrailrequest.py | 4 +- src/openrouter/components/guardrail.py | 4 +- src/openrouter/guardrails.py | 8 +-- uv.lock | 2 +- 14 files changed, 106 insertions(+), 102 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index b261bffc..8a9384a2 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: 66ead69cb87d4e99eb39c9cd7fb430d8 + docChecksum: 8ed3bce5631ad96347bbc340ae00f480 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.1.69 - configChecksum: 3ebeede390eb7630c0577043ba9fcc8d + releaseVersion: 1.1.70 + configChecksum: 05133456c74de87129259578572364ae repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: c30f667c-3a6f-463e-80a7-b3c79189080a - pristine_commit_hash: ed707642d7c21d53bdd56099f5fb01907acae638 - pristine_tree_hash: b0b009b2f83449213836d1a490902659f5411f39 + generation_id: 9c81eba8-3edd-490b-88fe-c604f9d912d0 + pristine_commit_hash: 2e7ce19453dd4bb87f46f0122a5e5a4dc981c8a6 + pristine_tree_hash: 763f77ddad320d306a8a22a9aa70f22a315c9bef features: python: acceptHeaders: 3.0.0 @@ -1554,8 +1554,8 @@ trackedFiles: pristine_git_object: 67494d04412539e0cb0b406ef4e4cce61b3a6c87 docs/components/createguardrailrequest.mdx: id: c1a768f054c0 - last_write_checksum: sha1:5f0f8c39e8b8e4b495686dbeadc9628fd29251b6 - pristine_git_object: d3465e8fa07d7ea2993d676b2257a6a3feab4938 + last_write_checksum: sha1:334b7c77552a5104a26c009d8a3b5c965fe057c6 + pristine_git_object: 54fcf9ab2a45a2f292bbab40125a3d01a63c92de docs/components/createguardrailresponse.mdx: id: 1477eebdf505 last_write_checksum: sha1:425860f0573dc643cab07623da9d01218e79ba65 @@ -2246,8 +2246,8 @@ trackedFiles: pristine_git_object: 42ef3f3487d6e55ad13f7ae93edd146fd46332bf docs/components/guardrail.mdx: id: 91791d4c83b6 - last_write_checksum: sha1:36c5cd62a4514185f059d18939ac595a4232c4f4 - pristine_git_object: 7f703db34ea13fba2a7af24b511371f2d8691b70 + last_write_checksum: sha1:7aab0a974c329b856b85acb4f1951941e073fe88 + pristine_git_object: c3f81436f616456be94f43d11387872259ea1ceb docs/components/guardrailinterval.mdx: id: ccedea0ab250 last_write_checksum: sha1:08342a9cceb4f7a5dc0b574a429d46af9d9a13f4 @@ -7190,8 +7190,8 @@ trackedFiles: pristine_git_object: 064751ea194bff6b8111575603f804362960b886 docs/sdks/guardrails/README.mdx: id: a0cd4218b8fa - last_write_checksum: sha1:a1382f5db5f769469ee8c236eb60d5a44068bc88 - pristine_git_object: 99ea282ff9a0a1fd1436d984b08b5bc387f9fce0 + last_write_checksum: sha1:cbc0dafe23dfd399991741da734531de2aec3087 + pristine_git_object: 243f22f3d4d52d0d6143ce5fda98b8e6b3d5fd2f docs/sdks/images/README.mdx: id: 534a6c102c4f last_write_checksum: sha1:bb22509015ad414847d101ba719689163a7cd42a @@ -7254,8 +7254,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:426f3411cd419d756ebbab88f015e6e10552b221 - pristine_git_object: 6b21ff40c675a234c89d4bb9f986a46326e8f13b + last_write_checksum: sha1:c62d176755cb2c7889ba3c916373b6da5467d6ab + pristine_git_object: ef0adf665003d73a26729beb01928d60e3312d4c scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -7282,8 +7282,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:1d207c6f701041fcec19305a1e0e492ea64b6638 - pristine_git_object: 65183dd35e706d54c02feec510777db21bbb55c0 + last_write_checksum: sha1:bca2b6914d6368541bcd4305996eb835294ccba8 + pristine_git_object: 10b7f60d3125567d78817aa3431998e8f3df6261 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:1e0004d8d1d5d797e2b54cd1cabeb7f9489d08e9 @@ -8010,8 +8010,8 @@ trackedFiles: pristine_git_object: fcfd9d646f216fdbb715cbbaefa4382d75750b79 src/openrouter/components/createguardrailrequest.py: id: 34d69149fb33 - last_write_checksum: sha1:374cfec194bcb61afee830b30cff563002cff088 - pristine_git_object: 3a11053d14ce02190734af3263ec9661943cc1a0 + last_write_checksum: sha1:6c4fab43def5d26f7fb7fcad3927fea9108c2d03 + pristine_git_object: 6d2ebe8d17de00fab7fbd7b839d47a782144eb00 src/openrouter/components/createguardrailresponse.py: id: b4e1bdf1de5b last_write_checksum: sha1:ae20a5e7425510c240e5697d847b1cae65940bd6 @@ -8330,8 +8330,8 @@ trackedFiles: pristine_git_object: acda534cb0ced2a391479b720434cf0f57f46276 src/openrouter/components/guardrail.py: id: 67ee78dd06e6 - last_write_checksum: sha1:56faacd2e781c742ccb3430e8f01d66f34e5fb3c - pristine_git_object: 6c518ce64d7b32f8a553f7ec2af28a3da0bca532 + last_write_checksum: sha1:01d933cded2e7af8a0805afee42046bfc5798923 + pristine_git_object: 4c294f52613b32af43c6c7390bb27fab87069bf8 src/openrouter/components/guardrailinterval.py: id: 01687fc135ab last_write_checksum: sha1:430f886f371b85777346de663202d62708cd84cf @@ -9882,8 +9882,8 @@ trackedFiles: pristine_git_object: d5990c4254d4b3c5dae3f548bbec02558adadae1 src/openrouter/guardrails.py: id: 705839f34e66 - last_write_checksum: sha1:51cf6938e2307e3834dbeaf45e454fdbec040352 - pristine_git_object: 464675f78cb10d1aa31fdc8eae5eb18c14fca042 + last_write_checksum: sha1:507936bd0a0249a3ade4af1331c325396a4c64ed + pristine_git_object: cacb13cd221291994d86d0ac12b028aa61f1b1a8 src/openrouter/httpclient.py: id: e9311185443d last_write_checksum: sha1:5e55338d6ee9f01ab648cad4380201a8a3da7dd7 @@ -12175,9 +12175,3 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: | - ## Python SDK Changes: - * `open_router.analytics.get_analytics_meta()`: **Added** - * `open_router.analytics.query_analytics()`: **Added** - * `open_router.beta.analytics.get_analytics_meta()`: **Removed** (Breaking ⚠️) - * `open_router.beta.analytics.query_analytics()`: **Removed** (Breaking ⚠️) diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 34dd9dfe..a9ef9d60 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.1.69 + version: 1.1.70 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 904d87a4..2224f71c 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -7255,7 +7255,7 @@ components: reset_interval: $ref: '#/components/schemas/GuardrailInterval' workspace_id: - description: 'The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly.' + description: 'The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace''s traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace''s default guardrail instead.' example: '0df9e665-d932-5740-b2c7-b52af166bc11' format: 'uuid' type: 'string' @@ -10144,7 +10144,7 @@ components: - 'string' - 'null' workspace_id: - description: 'The workspace this guardrail is scoped to, or `null` for an unscoped legacy guardrail predating workspaces. A `null` value does not mean the default workspace, and does not apply the guardrail across every workspace.' + description: '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.' example: '0df9e665-d932-5740-b2c7-b52af166bc11' type: - 'string' @@ -31195,7 +31195,7 @@ paths: results: '$.data' type: 'offsetLimit' post: - description: 'Create a new guardrail for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + description: 'Create a new guardrail for the authenticated user. A newly created guardrail enforces nothing until it is assigned to API keys or organization members; `workspace_id` places the guardrail in a workspace but does not apply it to that workspace''s traffic. To restrict all traffic in a workspace, update the workspace''s default guardrail instead. [Management key](/docs/guides/overview/auth/management-api-keys) required.' operationId: 'createGuardrail' requestBody: content: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 1da3317c..6f631c95 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:e536fc1c3b7c04a2658aaf8c04d463b1551f3a0f4fd7e9cc2fa971fea8d1f355 - sourceBlobDigest: sha256:10c4cd7804672e0d6af7e44b5aaae19596fe24e7432e829ddbad15c0d88ed5cd + sourceRevisionDigest: sha256:5e5a4db069d541e4b682c5b887778b9a3ad48f930306ac76e7aa78e0dab79808 + sourceBlobDigest: sha256:01364ffa74202e8f1e3ba7de276cc8e72f25593b7e498fe0f38052325ae7c561 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:e536fc1c3b7c04a2658aaf8c04d463b1551f3a0f4fd7e9cc2fa971fea8d1f355 - sourceBlobDigest: sha256:10c4cd7804672e0d6af7e44b5aaae19596fe24e7432e829ddbad15c0d88ed5cd + sourceRevisionDigest: sha256:5e5a4db069d541e4b682c5b887778b9a3ad48f930306ac76e7aa78e0dab79808 + sourceBlobDigest: sha256:01364ffa74202e8f1e3ba7de276cc8e72f25593b7e498fe0f38052325ae7c561 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:53fdb413e77445b07c5791391f3a5a3cf21c1d10c43f8eb755f382d3a6d6125c + codeSamplesRevisionDigest: sha256:ee83d11c70c4aeee1b7060bd300018acab0bf4f98099057e14c020f03e18b59d workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 8d56b350..9ef1a35d 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1479,4 +1479,14 @@ Based on: ### Generated - [python v1.1.69] . ### Releases -- [PyPI v1.1.69] https://pypi.org/project/openrouter/1.1.69 - . \ No newline at end of file +- [PyPI v1.1.69] https://pypi.org/project/openrouter/1.1.69 - . + +## 2026-08-21 00:15:33 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.1.70] . +### Releases +- [PyPI v1.1.70] https://pypi.org/project/openrouter/1.1.70 - . \ No newline at end of file diff --git a/docs/components/createguardrailrequest.mdx b/docs/components/createguardrailrequest.mdx index d3465e8f..54fcf9ab 100644 --- a/docs/components/createguardrailrequest.mdx +++ b/docs/components/createguardrailrequest.mdx @@ -4,26 +4,26 @@ title: "CreateGuardrailRequest" ## 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",
"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"
}
] | -| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters to apply to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | A guardrail for limiting API usage | -| `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 | -| `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. Defaults to false. | false | -| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 50 | -| `name` | *str* | :heavy_check_mark: | Name for the new guardrail | My New Guardrail | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file +| 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",
"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"
}
] | +| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters to apply to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | A guardrail for limiting API usage | +| `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 | +| `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. Defaults to false. | false | +| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 50 | +| `name` | *str* | :heavy_check_mark: | Name for the new guardrail | My New Guardrail | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/components/guardrail.mdx b/docs/components/guardrail.mdx index 7f703db3..c3f81436 100644 --- a/docs/components/guardrail.mdx +++ b/docs/components/guardrail.mdx @@ -29,4 +29,4 @@ title: "Guardrail" | `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 is scoped to, or `null` for an unscoped legacy guardrail predating workspaces. 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 +| `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/sdks/guardrails/README.mdx b/docs/sdks/guardrails/README.mdx index 99ea282f..243f22f3 100644 --- a/docs/sdks/guardrails/README.mdx +++ b/docs/sdks/guardrails/README.mdx @@ -77,7 +77,7 @@ with OpenRouter( ## create -Create a new guardrail for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. +Create a new guardrail for the authenticated user. A newly created guardrail enforces nothing until it is assigned to API keys or organization members; `workspace_id` places the guardrail in a workspace but does not apply it to that workspace's traffic. To restrict all traffic in a workspace, update the workspace's default guardrail instead. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -106,33 +106,33 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `name` | *str* | :heavy_check_mark: | Name for the new guardrail | My New Guardrail | -| `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",
"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"
}
] | -| `content_filters` | List[[components.ContentFilterEntry](../../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters to apply to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | A guardrail for limiting API usage | -| `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 | -| `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. Defaults to false. | false | -| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 50 | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. | 0df9e665-d932-5740-b2c7-b52af166bc11 | -| `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 | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `name` | *str* | :heavy_check_mark: | Name for the new guardrail | My New Guardrail | +| `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",
"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"
}
] | +| `content_filters` | List[[components.ContentFilterEntry](../../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters to apply to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | A guardrail for limiting API usage | +| `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 | +| `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. Defaults to false. | false | +| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 50 | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead. | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/pyproject.toml b/pyproject.toml index 6b21ff40..ef0adf66 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.1.69" +version = "1.1.70" 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 65183dd3..10b7f60d 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.69" +__version__: str = "1.1.70" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.1.69 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.1.70 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/createguardrailrequest.py b/src/openrouter/components/createguardrailrequest.py index 3a11053d..6d2ebe8d 100644 --- a/src/openrouter/components/createguardrailrequest.py +++ b/src/openrouter/components/createguardrailrequest.py @@ -64,7 +64,7 @@ class CreateGuardrailRequestTypedDict(TypedDict): reset_interval: NotRequired[Nullable[GuardrailInterval]] r"""Interval at which the limit resets (daily, weekly, monthly)""" workspace_id: NotRequired[str] - r"""The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly.""" + r"""The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead.""" class CreateGuardrailRequest(BaseModel): @@ -136,7 +136,7 @@ class CreateGuardrailRequest(BaseModel): r"""Interval at which the limit resets (daily, weekly, monthly)""" workspace_id: Optional[str] = None - r"""The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly.""" + r"""The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/guardrail.py b/src/openrouter/components/guardrail.py index 6c518ce6..4c294f52 100644 --- a/src/openrouter/components/guardrail.py +++ b/src/openrouter/components/guardrail.py @@ -30,7 +30,7 @@ class GuardrailTypedDict(TypedDict): name: str r"""Name of the guardrail""" workspace_id: Nullable[str] - r"""The workspace this guardrail is scoped to, or `null` for an unscoped legacy guardrail predating workspaces. A `null` value does not mean the default workspace, and does not apply the guardrail across every workspace.""" + 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_models: NotRequired[Nullable[List[str]]] r"""Array of model canonical_slugs (immutable identifiers)""" allowed_providers: NotRequired[Nullable[List[str]]] @@ -87,7 +87,7 @@ class Guardrail(BaseModel): r"""Name of the guardrail""" workspace_id: Nullable[str] - r"""The workspace this guardrail is scoped to, or `null` for an unscoped legacy guardrail predating workspaces. A `null` value does not mean the default workspace, and does not apply the guardrail across every workspace.""" + 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_models: OptionalNullable[List[str]] = UNSET r"""Array of model canonical_slugs (immutable identifiers)""" diff --git a/src/openrouter/guardrails.py b/src/openrouter/guardrails.py index 464675f7..cacb13cd 100644 --- a/src/openrouter/guardrails.py +++ b/src/openrouter/guardrails.py @@ -394,7 +394,7 @@ def create( ) -> components.CreateGuardrailResponse: r"""Create a guardrail - Create a new guardrail for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Create a new guardrail for the authenticated user. A newly created guardrail enforces nothing until it is assigned to API keys or organization members; `workspace_id` places the guardrail in a workspace but does not apply it to that workspace's traffic. To restrict all traffic in a workspace, update the workspace's default guardrail instead. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param name: Name for the new guardrail :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -423,7 +423,7 @@ def create( :param include_byok_in_budgets: Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false. :param limit_usd: Spending limit in USD :param reset_interval: Interval at which the limit resets (daily, weekly, monthly) - :param workspace_id: The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. + :param workspace_id: The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -620,7 +620,7 @@ async def create_async( ) -> components.CreateGuardrailResponse: r"""Create a guardrail - Create a new guardrail for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Create a new guardrail for the authenticated user. A newly created guardrail enforces nothing until it is assigned to API keys or organization members; `workspace_id` places the guardrail in a workspace but does not apply it to that workspace's traffic. To restrict all traffic in a workspace, update the workspace's default guardrail instead. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param name: Name for the new guardrail :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -649,7 +649,7 @@ async def create_async( :param include_byok_in_budgets: Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false. :param limit_usd: Spending limit in USD :param reset_interval: Interval at which the limit resets (daily, weekly, monthly) - :param workspace_id: The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. + :param workspace_id: The workspace to create the guardrail in. When omitted, the guardrail is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds diff --git a/uv.lock b/uv.lock index 0b12d18c..d4ecd9ab 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.1.69" +version = "1.1.70" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 2c9699e2a749439b450897666c0c89a56c9b8efb Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Fri, 21 Aug 2026 00:17:10 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow