Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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**
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ generation:
documentation: mintlify
preApplyUnionDiscriminators: true
python:
version: 1.3.15
version: 1.3.16
additionalDependencies:
dev: {}
main: {}
Expand Down
26 changes: 24 additions & 2 deletions .speakeasy/out.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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':
Expand All @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ 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
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
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2919,4 +2919,14 @@ Based on:
### Generated
- [python v1.3.15] .
### Releases
- [PyPI v1.3.15] https://pypi.org/project/openrouter/1.3.15 - .
- [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 - .
2 changes: 2 additions & 0 deletions docs/sdks/generations/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/openrouter/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
20 changes: 20 additions & 0 deletions src/openrouter/generations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading