diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 37cc787e..2cc28ce6 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: 2820c1ebeee9014a28ca30bf098f8aee + docChecksum: ab7299f20b99875c8d4dc6b7d1961031 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.3.58 - configChecksum: 402618c19e749c96b24b99f3da7e25d5 + releaseVersion: 1.3.59 + configChecksum: b5283e3d1f1d768501fa29c241717898 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 247f2336-3669-41d1-a973-651801266f68 - pristine_commit_hash: 7fc1c4d6c4813a5d232f4c7309e34a207afe6106 - pristine_tree_hash: 4d8a3da59058ebca12b8b2d618a296012352b4f2 + generation_id: 60ba15f6-02b1-4b50-87b3-d9cbb799921f + pristine_commit_hash: 7558df97d221f06df6834a6b16d8eefa87151c41 + pristine_tree_hash: 69909a1476c6dba2cdb1362f264793c75ea4e9f3 features: python: acceptHeaders: 3.0.0 @@ -7384,16 +7384,16 @@ trackedFiles: pristine_git_object: 834297f4c2167ee22b57bd3cfb126b37662cd1ae docs/components/tokenexchangerequest.mdx: id: c1564eb38361 - last_write_checksum: sha1:c4e87426647f3cd5568160bc18a5adac444ecf65 - pristine_git_object: a086ed56570a2ace2826884497fc3fe0d2fe2337 + last_write_checksum: sha1:ed65ff086f95ebbeb1f16a001378b50762f38d47 + pristine_git_object: c48d025215d5de8fd2b08529c36c9ed67c4daedd docs/components/tokenexchangerequestscope.mdx: id: 786235cab16a - last_write_checksum: sha1:a436470eca241bc1e8127b80110e0a89cc8ff1d7 - pristine_git_object: 32b57f584bd0540db2465e8ef74e00528518b3e0 + last_write_checksum: sha1:d6048f57a1ee0a2ffa074a8319ffef50447c2d85 + pristine_git_object: 615bc1fff1fda47a8bcbca13b6f227818e4b47ad docs/components/tokenexchangeresponse.mdx: id: 5b7eb37933eb - last_write_checksum: sha1:a0fb15d00227686dfe83a567178d71d3a7c7c710 - pristine_git_object: c3a8de52d28aeafb3daf7e9f12b19782b3aa582e + last_write_checksum: sha1:1c7a24b994310dac9c378ea83696f0769691a914 + pristine_git_object: a3c7e992b6b90b2e1a8b38c732a94e0365d6de4f docs/components/tokentype.mdx: id: 0c9b63e6ad84 last_write_checksum: sha1:015804b1c1b1e656b35d22e1a348649dd5d11cda @@ -10252,8 +10252,8 @@ trackedFiles: pristine_git_object: 9131aee97e483384b6721a32936c05901dfeea5d docs/sdks/oauth/README.mdx: id: 42b5079343d2 - last_write_checksum: sha1:57c8bf432795162dae43b5ec3d37004ff0df0dd5 - pristine_git_object: ac1d96c8536a9f18194690db64cefa9858de2998 + last_write_checksum: sha1:3cde9bcb927f4723ccdb237d9f7a54a50f96abe7 + pristine_git_object: 044ea9eb6f4710cc2be85a5ce09b8fe6b86629a5 docs/sdks/observability/README.mdx: id: 75811527e651 last_write_checksum: sha1:5c1c1b6816a3e5af3b84a32a8e9605619e8469c9 @@ -10320,8 +10320,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:a86a096de48d48d3e59c20f6f49ef7bd9008c900 - pristine_git_object: a1e0ff5e66179c29d1e07e0d2fbce8d160d63747 + last_write_checksum: sha1:4d31540309694a56bbfe0f19a53d19f03da53e8b + pristine_git_object: 50f35b30873dfb97a1388b662773da29b4dd10ca scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -10348,8 +10348,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:640adf20b6b1131f18d77eead235ede40e5aadba - pristine_git_object: 01dfa8836269c963c723ea7abb2d21b8e5bae4bf + last_write_checksum: sha1:a2461009aed4621da3c5058671d699f186fda10b + pristine_git_object: 74ee8fbdba00a70b1cd00eec1f2d87b48042b8db src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:30f55a360f41376ab194b9ea725fe4e001a5ae1a @@ -13544,12 +13544,12 @@ trackedFiles: pristine_git_object: ffae73647f1060eeb9f46a4d331de6b9760dc5d9 src/openrouter/components/tokenexchangerequest.py: id: 2359476f8b4b - last_write_checksum: sha1:945320dc39299eb722890d3ac2d8352e033c561a - pristine_git_object: 10c0f8aa34133562638d4421a70b007a5dbe6f13 + last_write_checksum: sha1:90071f47bf240283f5e58701a2cf8e50fc96f94e + pristine_git_object: 58aa51d1dc1ce340128584142f70638048fc03e5 src/openrouter/components/tokenexchangeresponse.py: id: c7c8ecb676b8 - last_write_checksum: sha1:bd1d4f0bbb4c320e630e28f92504f040c927eabf - pristine_git_object: ce7b2081d390b2e9c986f61c9d1be50ab6e5794f + last_write_checksum: sha1:0728962d87b24eb6eaa82e12c43adedafd69cea4 + pristine_git_object: 0416596bae5f67d52cf9f09e2a262b37bc40738c src/openrouter/components/toolcallstatus.py: id: 32339139c3f3 last_write_checksum: sha1:a75631cdb460f190aa10d5557519519d1ef5fbe3 @@ -14052,8 +14052,8 @@ trackedFiles: pristine_git_object: e16291f980d3a1e19aeef0f68cf5b4998da16f82 src/openrouter/oauth.py: id: 1948ce27255b - last_write_checksum: sha1:3a64f1522bcd0680e4371e8eb2ec88122987bf61 - pristine_git_object: 6f3d587f5a6c2635328cb27a4d869b81cfbc2213 + last_write_checksum: sha1:d6470de6325431db64b08ff4468fb2d8ea781c6f + pristine_git_object: 0df1c3e42dd5af1a7071a6be34253477695edb4b src/openrouter/observability.py: id: 6a17f32d3f33 last_write_checksum: sha1:aed374189ac7e95d66485d8114e130ecd74af99e @@ -18834,6 +18834,4 @@ examples: examplesVersion: 1.0.2 releaseNotes: | ## Python SDK Changes: - * `open_router.vault.delete_intern_vault_secret()`: `error.status[409]` **Added** - * `open_router.vault.delete_vault_secret()`: `error.status[409]` **Added** - * `open_router.vault.store_vault_secret()`: `error.status[409]` **Added** + * `open_router.o_auth.create_oauth_token()`: `request.scope` **Changed** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 0fd5c747..4dd44e81 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.58 + version: 1.3.59 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index cc6f4202..be09952b 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -31367,11 +31367,13 @@ components: example: 'urn:ietf:params:oauth:token-type:access_token' type: 'string' scope: - description: 'Optional; only `inference` is available.' + description: 'Optional; when present must match the policy''s key: `management` for a management key, `inference` otherwise.' enum: - 'inference' + - 'management' example: 'inference' type: 'string' + x-speakeasy-unknown-values: allow subject_token: description: 'The JWT issued by your identity provider.' example: '' @@ -31414,6 +31416,7 @@ components: example: 'urn:ietf:params:oauth:token-type:access_token' type: 'string' scope: + description: 'The one capability the token grants, fixed by the kind of key the policy acts as: `inference` or `management`.' example: 'inference' type: 'string' token_type: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 3f96887f..2ae3c72a 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:6a8e2a83988a144c76a37022b284c3231f2c21214f5eedf21acc119f3811331f - sourceBlobDigest: sha256:9e11fb751bf0341d329ac70e5b91bf099fe7a5081c596c5769be8427d748efe0 + sourceRevisionDigest: sha256:fc358e8fd0ba245e16eadeaf71e604d8fdf0c09a17d6bfe0d041843592fb4188 + sourceBlobDigest: sha256:44659309dd26f2f2e23016c8b6f714f17d00755ef3f21013eea925088ba09ed0 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:6a8e2a83988a144c76a37022b284c3231f2c21214f5eedf21acc119f3811331f - sourceBlobDigest: sha256:9e11fb751bf0341d329ac70e5b91bf099fe7a5081c596c5769be8427d748efe0 + sourceRevisionDigest: sha256:fc358e8fd0ba245e16eadeaf71e604d8fdf0c09a17d6bfe0d041843592fb4188 + sourceBlobDigest: sha256:44659309dd26f2f2e23016c8b6f714f17d00755ef3f21013eea925088ba09ed0 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:2ab616a7ffef4556033bee8f360e5279bad1a8b8733cd81659320213ffcf3379 + codeSamplesRevisionDigest: sha256:595eb9e1e2d337804f295baf347e8dd8a2a0f4e80c2ea0dadd292091358ea1c9 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 2a294de0..4d4923e5 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -3349,4 +3349,14 @@ Based on: ### Generated - [python v1.3.58] . ### Releases -- [PyPI v1.3.58] https://pypi.org/project/openrouter/1.3.58 - . \ No newline at end of file +- [PyPI v1.3.58] https://pypi.org/project/openrouter/1.3.58 - . + +## 2026-10-15 21:29:19 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.59] . +### Releases +- [PyPI v1.3.59] https://pypi.org/project/openrouter/1.3.59 - . \ No newline at end of file diff --git a/docs/components/tokenexchangerequest.mdx b/docs/components/tokenexchangerequest.mdx index 59182ed6..c8649133 100644 --- a/docs/components/tokenexchangerequest.mdx +++ b/docs/components/tokenexchangerequest.mdx @@ -12,6 +12,6 @@ RFC 8693 token exchange request body (application/x-www-form-urlencoded). | `federation_policy_id` | *str* | ✅ | The federation policy to evaluate, from Settings → Workload identity. Binds the exchange to one organization. | 4b2f7d1e-8c3a-4e5f-9a6b-1c2d3e4f5a6b | | `grant_type` | [components.GrantType](../components/granttype.mdx) | ✅ | Must be `urn:ietf:params:oauth:grant-type:token-exchange`. | urn:ietf:params:oauth:grant-type:token-exchange | | `requested_token_type` | [Optional[components.RequestedTokenType]](../components/requestedtokentype.mdx) | ➖ | Optional; when present must be `urn:ietf:params:oauth:token-type:access_token`. | urn:ietf:params:oauth:token-type:access_token | -| `scope` | [Optional[components.TokenExchangeRequestScope]](../components/tokenexchangerequestscope.mdx) | ➖ | Optional; only `inference` is available. | inference | +| `scope` | [Optional[components.TokenExchangeRequestScope]](../components/tokenexchangerequestscope.mdx) | ➖ | Optional; when present must match the policy's key: `management` for a management key, `inference` otherwise. | inference | | `subject_token` | *str* | ✅ | The JWT issued by your identity provider. | \ | | `subject_token_type` | [components.SubjectTokenType](../components/subjecttokentype.mdx) | ✅ | Must be `urn:ietf:params:oauth:token-type:jwt`. | urn:ietf:params:oauth:token-type:jwt | \ No newline at end of file diff --git a/docs/components/tokenexchangerequestscope.mdx b/docs/components/tokenexchangerequestscope.mdx index 32b57f58..615bc1ff 100644 --- a/docs/components/tokenexchangerequestscope.mdx +++ b/docs/components/tokenexchangerequestscope.mdx @@ -2,16 +2,21 @@ title: "TokenExchangeRequestScope" --- -Optional; only `inference` is available. +Optional; when present must match the policy's key: `management` for a management key, `inference` otherwise. ## Example Usage ```python from openrouter.components import TokenExchangeRequestScope + +# Open enum: unrecognized values are captured as UnrecognizedStr value: TokenExchangeRequestScope = "inference" ``` ## Values +This is an open enum. Unrecognized values will not fail type checks. + - `"inference"` +- `"management"` diff --git a/docs/components/tokenexchangeresponse.mdx b/docs/components/tokenexchangeresponse.mdx index 9078e209..9b5cfc5b 100644 --- a/docs/components/tokenexchangeresponse.mdx +++ b/docs/components/tokenexchangeresponse.mdx @@ -7,10 +7,10 @@ RFC 8693 token exchange response. ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | -| `access_token` | *str* | ✅ | A short-lived JWT to send as `Authorization: Bearer` to the inference API. | \ | -| `expires_in` | *int* | ✅ | Seconds until the access token expires: at most 15 minutes, and never later than the subject token expires. | 900 | -| `issued_token_type` | [components.IssuedTokenType](../components/issuedtokentype.mdx) | ✅ | N/A | urn:ietf:params:oauth:token-type:access_token | -| `scope` | *str* | ✅ | N/A | inference | -| `token_type` | [components.TokenType](../components/tokentype.mdx) | ✅ | N/A | Bearer | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `access_token` | *str* | ✅ | A short-lived JWT to send as `Authorization: Bearer` to the inference API. | \ | +| `expires_in` | *int* | ✅ | Seconds until the access token expires: at most 15 minutes, and never later than the subject token expires. | 900 | +| `issued_token_type` | [components.IssuedTokenType](../components/issuedtokentype.mdx) | ✅ | N/A | urn:ietf:params:oauth:token-type:access_token | +| `scope` | *str* | ✅ | The one capability the token grants, fixed by the kind of key the policy acts as: `inference` or `management`. | inference | +| `token_type` | [components.TokenType](../components/tokentype.mdx) | ✅ | N/A | Bearer | \ No newline at end of file diff --git a/docs/sdks/oauth/README.mdx b/docs/sdks/oauth/README.mdx index 50b9f022..84053f5a 100644 --- a/docs/sdks/oauth/README.mdx +++ b/docs/sdks/oauth/README.mdx @@ -203,7 +203,7 @@ with OpenRouter( | `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `requested_token_type` | [Optional[components.RequestedTokenType]](../../components/requestedtokentype.mdx) | ➖ | Optional; when present must be `urn:ietf:params:oauth:token-type:access_token`. | urn:ietf:params:oauth:token-type:access_token | -| `scope` | [Optional[components.TokenExchangeRequestScope]](../../components/tokenexchangerequestscope.mdx) | ➖ | Optional; only `inference` is available. | inference | +| `scope` | [Optional[components.TokenExchangeRequestScope]](../../components/tokenexchangerequestscope.mdx) | ➖ | Optional; when present must match the policy's key: `management` for a management key, `inference` otherwise. | inference | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/pyproject.toml b/pyproject.toml index a1e0ff5e..50f35b30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.58" +version = "1.3.59" 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 01dfa883..74ee8fbd 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.3.58" +__version__: str = "1.3.59" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.3.58 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.59 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/tokenexchangerequest.py b/src/openrouter/components/tokenexchangerequest.py index 10c0f8aa..58aa51d1 100644 --- a/src/openrouter/components/tokenexchangerequest.py +++ b/src/openrouter/components/tokenexchangerequest.py @@ -1,10 +1,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr from openrouter.utils import FieldMetadata from pydantic import model_serializer -from typing import Literal, Optional +from typing import Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict @@ -16,8 +16,14 @@ r"""Optional; when present must be `urn:ietf:params:oauth:token-type:access_token`.""" -TokenExchangeRequestScope = Literal["inference",] -r"""Optional; only `inference` is available.""" +TokenExchangeRequestScope = Union[ + Literal[ + "inference", + "management", + ], + UnrecognizedStr, +] +r"""Optional; when present must match the policy's key: `management` for a management key, `inference` otherwise.""" SubjectTokenType = Literal["urn:ietf:params:oauth:token-type:jwt",] @@ -38,7 +44,7 @@ class TokenExchangeRequestTypedDict(TypedDict): requested_token_type: NotRequired[RequestedTokenType] r"""Optional; when present must be `urn:ietf:params:oauth:token-type:access_token`.""" scope: NotRequired[TokenExchangeRequestScope] - r"""Optional; only `inference` is available.""" + r"""Optional; when present must match the policy's key: `management` for a management key, `inference` otherwise.""" class TokenExchangeRequest(BaseModel): @@ -64,7 +70,7 @@ class TokenExchangeRequest(BaseModel): scope: Annotated[Optional[TokenExchangeRequestScope], FieldMetadata(form=True)] = ( None ) - r"""Optional; only `inference` is available.""" + r"""Optional; when present must match the policy's key: `management` for a management key, `inference` otherwise.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/tokenexchangeresponse.py b/src/openrouter/components/tokenexchangeresponse.py index ce7b2081..0416596b 100644 --- a/src/openrouter/components/tokenexchangeresponse.py +++ b/src/openrouter/components/tokenexchangeresponse.py @@ -21,6 +21,7 @@ class TokenExchangeResponseTypedDict(TypedDict): r"""Seconds until the access token expires: at most 15 minutes, and never later than the subject token expires.""" issued_token_type: IssuedTokenType scope: str + r"""The one capability the token grants, fixed by the kind of key the policy acts as: `inference` or `management`.""" token_type: TokenType @@ -36,5 +37,6 @@ class TokenExchangeResponse(BaseModel): issued_token_type: IssuedTokenType scope: str + r"""The one capability the token grants, fixed by the kind of key the policy acts as: `inference` or `management`.""" token_type: TokenType diff --git a/src/openrouter/oauth.py b/src/openrouter/oauth.py index 6f3d587f..0df1c3e4 100644 --- a/src/openrouter/oauth.py +++ b/src/openrouter/oauth.py @@ -914,7 +914,7 @@ def create_oauth_token( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param requested_token_type: Optional; when present must be `urn:ietf:params:oauth:token-type:access_token`. - :param scope: Optional; only `inference` is available. + :param scope: Optional; when present must match the policy's key: `management` for a management key, `inference` otherwise. :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 @@ -1061,7 +1061,7 @@ async def create_oauth_token_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param requested_token_type: Optional; when present must be `urn:ietf:params:oauth:token-type:access_token`. - :param scope: Optional; only `inference` is available. + :param scope: Optional; when present must match the policy's key: `management` for a management key, `inference` otherwise. :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 7a1cdc7d..60c7c963 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.58" +version = "1.3.59" source = { editable = "." } dependencies = [ { name = "httpcore" },