From 3ede4b4c218763ab4a0a471b8dfffb409f9dc969 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Thu, 1 Oct 2026 11:54:46 +0000 Subject: [PATCH 1/2] ## Python SDK Changes: * `open_router.generations.get_generation()`: `error.status[400]` **Added** * `open_router.generations.list_generation_content()`: `error.status[400]` **Added** --- .speakeasy/gen.lock | 37 +++++++++++++++++++------------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 26 ++++++++++++++++++++-- .speakeasy/workflow.lock | 10 ++++----- RELEASES.md | 12 ++++++++++- docs/sdks/generations/README.mdx | 2 ++ pyproject.toml | 2 +- src/openrouter/_version.py | 4 ++-- src/openrouter/generations.py | 20 +++++++++++++++++ uv.lock | 2 +- 10 files changed, 89 insertions(+), 28 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 562bddda..0d4c5e86 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: 5b5645754152ff09b11172a49069d153 + docChecksum: db5d16fc32dae841671e0c284a3e74b4 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.3.15 - configChecksum: 64e5d33409cb8b2e41ce76d9f58127b7 + releaseVersion: 1.3.16 + configChecksum: 8c445214e70cd25ef7c941d59d5d5269 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: a8c41ebc-8690-454b-a32d-89a7aadca90e - pristine_commit_hash: 70518b7f2848dfcb8176d3b653cf5c596d096ca1 - pristine_tree_hash: b46c51cbc555cbd171020d2e39bc570b4ef8045f + generation_id: 7e9fbdb9-c775-4bc8-8565-739609edbb94 + pristine_commit_hash: a664b930e07a08cb7d45bc35df0d7e1c96078ae9 + pristine_tree_hash: 2d585312bc84caf58e056ce8ea2c23f807ca82fb features: python: acceptHeaders: 3.0.0 @@ -9860,8 +9860,8 @@ trackedFiles: pristine_git_object: d9aef34c11d538fe9d54a41f27a913181cc4f1f5 docs/sdks/generations/README.mdx: id: a754fecc8514 - last_write_checksum: sha1:a2a58bf659333ca8715d08271ce6510c831609d4 - pristine_git_object: a3866532ac76cdf8a492e1bdb9c2a16d4496f6db + last_write_checksum: sha1:46ab209542cabc2de53c1ec07eebfdaf2601f48a + pristine_git_object: bc1a56cbb41c8f9114c81b547713632272184da6 docs/sdks/guardrails/README.mdx: id: a0cd4218b8fa last_write_checksum: sha1:5d726806705c8c06aa1df8ecbebfa04a0214d8d4 @@ -9948,8 +9948,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:31931f78679d1cd96c0b0cc7b330008d54b06958 - pristine_git_object: c99a3a1da47f41fe0b1639b3ed43c357af380ae1 + last_write_checksum: sha1:a7f8282814d3a962587a530ebfd6cb5f8a994f21 + pristine_git_object: da03951c817d1f9bc2c89224110466660b263ffd scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -9976,8 +9976,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:aac80623f707150bb796ba0790c175ea667a17b3 - pristine_git_object: 6c499389544c3a128b2c99fc922d7c60e995504d + last_write_checksum: sha1:b88ba320acfa6e84395801080f1845a445b8573a + pristine_git_object: 04c07c48d8aafb0e60a892bde66c111fcf0ed5b3 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:30f55a360f41376ab194b9ea725fe4e001a5ae1a @@ -13532,8 +13532,8 @@ trackedFiles: pristine_git_object: 1c30715cccc28393152c3b3152d144e57ca60df1 src/openrouter/generations.py: id: 70e1c21042bc - last_write_checksum: sha1:87220277fc41836ac3bba33ffc229097c23c3384 - pristine_git_object: c520287c94d48268045fb97a4b06dd1c8d56e041 + last_write_checksum: sha1:b4ae45620a9ad38402e72ed42abea516aeb3aa32 + pristine_git_object: 5698c384a36929846530cae98f69ce83a0966217 src/openrouter/guardrails.py: id: 705839f34e66 last_write_checksum: sha1:1551845b6a9776480d99ef0fc1fca61e845f3de2 @@ -14525,6 +14525,8 @@ examples: application/json: {"error": {"code": 524, "message": "Request timed out. Please try again later."}} "529": application/json: {"error": {"code": 529, "message": "Provider returned error"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} listModelsCount: speakeasy-default-list-models-count: responses: @@ -15313,6 +15315,8 @@ examples: application/json: {"error": {"code": 524, "message": "Request timed out. Please try again later."}} "529": application/json: {"error": {"code": 529, "message": "Provider returned error"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} listObservabilityDestinations: speakeasy-default-list-observability-destinations: parameters: @@ -18220,4 +18224,7 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.chat.send()`: \n * `request.tools[].union(ChatDynamicServerTool)` **Added**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.tools[].union(ChatDynamicServerTool)` **Added**\n" +releaseNotes: | + ## Python SDK Changes: + * `open_router.generations.get_generation()`: `error.status[400]` **Added** + * `open_router.generations.list_generation_content()`: `error.status[400]` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 536cb692..6cab0c63 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.15 + version: 1.3.16 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 0c4aea3f..59d2276e 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -39053,7 +39053,8 @@ paths: schema: description: 'The generation ID' example: 'gen-1234567890' - minLength: 1 + maxLength: 128 + pattern: '^gen-[0-9A-Za-z-]+$' type: 'string' responses: '200': @@ -39107,6 +39108,16 @@ paths: schema: $ref: '#/components/schemas/GenerationResponse' description: 'Returns the request metadata for this generation' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' '401': content: application/json: @@ -39205,7 +39216,8 @@ paths: schema: description: 'The generation ID' example: 'gen-1234567890' - minLength: 1 + maxLength: 128 + pattern: '^gen-[0-9A-Za-z-]+$' type: 'string' responses: '200': @@ -39224,6 +39236,16 @@ paths: schema: $ref: '#/components/schemas/GenerationContentResponse' description: 'Returns the stored prompt and completion content, plus the failure error when the generation failed' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' '401': content: application/json: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index dc0d528b..4a47e8cc 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:b6db9aa1a9e75ccb2d2179b17865b0873b0b1617382f13501edcf02a9cc29efa - sourceBlobDigest: sha256:6b70af11a76f6d6600beb51561fae1fd5556f7e2df695fa1e52c2546b2fc9a14 + sourceRevisionDigest: sha256:ce23790edfaffc0a537784d8535152708f0d3c5fc9789e7b173cc6a6525094ce + sourceBlobDigest: sha256:f0cdcda8afd64f749176ada8505daea308dc590d5441fc1a8cd72aa3e37d054a tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:b6db9aa1a9e75ccb2d2179b17865b0873b0b1617382f13501edcf02a9cc29efa - sourceBlobDigest: sha256:6b70af11a76f6d6600beb51561fae1fd5556f7e2df695fa1e52c2546b2fc9a14 + sourceRevisionDigest: sha256:ce23790edfaffc0a537784d8535152708f0d3c5fc9789e7b173cc6a6525094ce + sourceBlobDigest: sha256:f0cdcda8afd64f749176ada8505daea308dc590d5441fc1a8cd72aa3e37d054a codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:d4884296e7d548f2e5fbde6b7c3a57ab8f33f3b70c0e5012721e0fc2d70ffbc1 + codeSamplesRevisionDigest: sha256:7478c6f034a1e48bf1a0829fdf24b40c068e4a192db9d38a424bb962fcc38d38 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 799ebf4e..a8ae21af 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -2919,4 +2919,14 @@ Based on: ### Generated - [python v1.3.15] . ### Releases -- [PyPI v1.3.15] https://pypi.org/project/openrouter/1.3.15 - . \ No newline at end of file +- [PyPI v1.3.15] https://pypi.org/project/openrouter/1.3.15 - . + +## 2026-10-01 11:52:40 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.16] . +### Releases +- [PyPI v1.3.16] https://pypi.org/project/openrouter/1.3.16 - . \ No newline at end of file diff --git a/docs/sdks/generations/README.mdx b/docs/sdks/generations/README.mdx index a3866532..bc1a56cb 100644 --- a/docs/sdks/generations/README.mdx +++ b/docs/sdks/generations/README.mdx @@ -56,6 +56,7 @@ with OpenRouter( | Error Type | Status Code | Content Type | | -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | | errors.UnauthorizedResponseError | 401 | application/json | | errors.PaymentRequiredResponseError | 402 | application/json | | errors.NotFoundResponseError | 404 | application/json | @@ -109,6 +110,7 @@ with OpenRouter( | Error Type | Status Code | Content Type | | -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | | errors.UnauthorizedResponseError | 401 | application/json | | errors.ForbiddenResponseError | 403 | application/json | | errors.NotFoundResponseError | 404 | application/json | diff --git a/pyproject.toml b/pyproject.toml index c99a3a1d..da03951c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.15" +version = "1.3.16" 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 6c499389..04c07c48 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.15" +__version__: str = "1.3.16" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.3.15 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.16 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/generations.py b/src/openrouter/generations.py index c520287c..5698c384 100644 --- a/src/openrouter/generations.py +++ b/src/openrouter/generations.py @@ -110,6 +110,11 @@ def get_generation( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return unmarshal_json_response(components.GenerationResponse, http_res) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) if utils.match_response(http_res, "401", "application/json"): response_data = unmarshal_json_response( errors.UnauthorizedResponseErrorData, http_res @@ -261,6 +266,11 @@ async def get_generation_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return unmarshal_json_response(components.GenerationResponse, http_res) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) if utils.match_response(http_res, "401", "application/json"): response_data = unmarshal_json_response( errors.UnauthorizedResponseErrorData, http_res @@ -414,6 +424,11 @@ def list_generation_content( return unmarshal_json_response( components.GenerationContentResponse, http_res ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) if utils.match_response(http_res, "401", "application/json"): response_data = unmarshal_json_response( errors.UnauthorizedResponseErrorData, http_res @@ -567,6 +582,11 @@ async def list_generation_content_async( return unmarshal_json_response( components.GenerationContentResponse, http_res ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) if utils.match_response(http_res, "401", "application/json"): response_data = unmarshal_json_response( errors.UnauthorizedResponseErrorData, http_res diff --git a/uv.lock b/uv.lock index e2629112..8a7a8f5b 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.15" +version = "1.3.16" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 97ccf4948a85333e35022e739b3c27f7b87f3553 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Thu, 1 Oct 2026 11:54:54 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow