From 142277da7c54c105c1df07e2ea883463563a039e Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Mon, 5 Oct 2026 12:09:55 +0000 Subject: [PATCH 1/2] ## Python SDK Changes: * `open_router.batch.create_batches()`: * `request.provider.allow_fallbacks` **Added** --- .speakeasy/gen.lock | 49 +++++++++---------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 7 ++- .speakeasy/workflow.lock | 10 ++-- RELEASES.md | 12 ++++- docs/components/batchproviderpreferences.mdx | 9 ++-- docs/components/batchsubmitbody.mdx | 2 +- docs/sdks/batch/README.mdx | 2 +- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/batch.py | 4 +- .../components/batchproviderpreferences.py | 21 ++++++-- src/openrouter/components/batchsubmitbody.py | 4 +- uv.lock | 2 +- 14 files changed, 78 insertions(+), 52 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index fe48a002..a342e75f 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: 71a40d3e7b0f5a986bebaf119c8585d6 + docChecksum: 75f708312ea880379c9ddaf2d144c955 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.3.22 - configChecksum: 238dc871088e377fa31c2687cfb5afb2 + releaseVersion: 1.3.23 + configChecksum: 1da4f880ffb62a54f395e6a73eb5b6a3 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: c4477706-7b60-41e2-9d6f-5bf3512be933 - pristine_commit_hash: 428319492f51382f83f9daf56731d626fd7916ca - pristine_tree_hash: 3fb99917fb3c65b19b0c5a7176cff17a93c7c892 + generation_id: 6502350d-6a12-47e3-8a78-cdd6240c0b24 + pristine_commit_hash: 6b1dbfb42e3574a1a30750191138244d8455f94f + pristine_tree_hash: 727306d5730a16fb5ccee2713ca3ae98659b8bd8 features: python: acceptHeaders: 3.0.0 @@ -1524,16 +1524,16 @@ trackedFiles: pristine_git_object: e4b28f4d59a00f427977c37c78719bc1cc93808c docs/components/batchproviderpreferences.mdx: id: df0af46e2e5b - last_write_checksum: sha1:1b1a794a78331bbad2e7fe0af1e6f111237c8e7a - pristine_git_object: 541b7dae3623b8cede0dbd1581926a18d9cccece + last_write_checksum: sha1:44be726be8dfe3acc98eb021b93d63224cd16187 + pristine_git_object: f3a21d140c0a54cdf918ac097c83ed0e4075b9ab docs/components/batchproviderpreferencesonly.mdx: id: 329c99c0e347 last_write_checksum: sha1:38504173efff3e8585037c39c3c1a14f6dacb63b pristine_git_object: d25f8767c5f193ee085eca684f5af8c606392c17 docs/components/batchsubmitbody.mdx: id: 2102d576a5e0 - last_write_checksum: sha1:eca8ca82b96b0d144a37ace434320b7e0a284d49 - pristine_git_object: 18a8a279799536c4e9d291265c51c21228720e60 + last_write_checksum: sha1:fa3a1334e13197b14bec1223e1e5a029435831c6 + pristine_git_object: 5f85713cfa1bc27f312cfa9a40edd7c628b743d3 docs/components/batchsubmitbodycompletionwindow.mdx: id: 71af0bee298c last_write_checksum: sha1:8fbf3915f9a5f59a214bd5144758f57d7f9d2485 @@ -9812,8 +9812,8 @@ trackedFiles: pristine_git_object: 0c76b2d59bd6a8956de83eb064c6205fcedae331 docs/sdks/batch/README.mdx: id: e367aa4f4295 - last_write_checksum: sha1:7e385b464cd4f95f6bbe7454e99a412041017ac7 - pristine_git_object: e09a992dba03c02acc70e8df4dbd7e5157bb6eb4 + last_write_checksum: sha1:03ef59395c1bc1a4ffa14dd68ca2a77a72601080 + pristine_git_object: 9fb69f19b90c7db149f1f80f3bac20b4b155f904 docs/sdks/benchmarks/README.mdx: id: 5b483a6770ba last_write_checksum: sha1:885b70fcbd2be60f51a2f58e133fd6452eb21600 @@ -9956,8 +9956,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:a432e127e5cd756ec845119ec104af99b2a806e2 - pristine_git_object: 3b4cd992ae65f59d2dd59144aded9311be0aa88a + last_write_checksum: sha1:ff48b4a9fc49e27dc1643badf968004a67da6c3d + pristine_git_object: 971d2d13b8a9955e3049127c7e2657b97aecc2da scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -9984,8 +9984,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:1d37211f882a611fac524f44f05e86a75e8448f1 - pristine_git_object: ba4305600ee7c677fb0962b892eaa30da4c126d4 + last_write_checksum: sha1:bef127205e8f1604c8b8a275930b921f71e65be5 + pristine_git_object: 59786ba254bd475bc1352c089d0a36cb6b67a181 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:30f55a360f41376ab194b9ea725fe4e001a5ae1a @@ -10004,8 +10004,8 @@ trackedFiles: pristine_git_object: 7a562e21c7e66c9db666ead83748b73adefe4278 src/openrouter/batch.py: id: 148f61e34d5b - last_write_checksum: sha1:f1108729998bfd8e84ac026a36ce1fa78c779bb2 - pristine_git_object: ac75fd407c638445da32288b0d1b3d164a681863 + last_write_checksum: sha1:d88ee31a648fa3027e7d6610d5b789a42ad80aae + pristine_git_object: 51b8ec5e8b4ebd204b5991bf767da38fcfb3ce5b src/openrouter/benchmarks.py: id: 178d2ad8d706 last_write_checksum: sha1:15b8a7ea05a7550032afb15981958aa73b756881 @@ -10672,12 +10672,12 @@ trackedFiles: pristine_git_object: 19b704e42e2a9d76d9b6f394ffa6cec0a8ee17cf src/openrouter/components/batchproviderpreferences.py: id: bf5b14d53dfc - last_write_checksum: sha1:2f0df3d3f568e3597a06065403579a14a235227e - pristine_git_object: 527b6983154fadde14e49b75130a4cdbb7f32d07 + last_write_checksum: sha1:55909ee26d0f0b35da8114da5d75fac640ad61c1 + pristine_git_object: b2bbac635f94d6fe9f4eba2eded41b1990a9d5da src/openrouter/components/batchsubmitbody.py: id: 26e5100bce4e - last_write_checksum: sha1:9d525743ede017b4ec1f8d20d9c592276e1bb79f - pristine_git_object: a84174b50819fdc9acb2780598c0e59c1d548cb1 + last_write_checksum: sha1:80dc631bcd20eacb2a96606b7b66e94026411017 + pristine_git_object: 072a6220d737bd1dd4405ee25316d930607211e7 src/openrouter/components/booleancapability.py: id: 6009fd660c03 last_write_checksum: sha1:2615f4f9eecdf753ece20adc9897553404c71cc1 @@ -18250,7 +18250,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: | - ## Python SDK Changes: - * `open_router.tts.create_speech()`: `request.provider` **Changed** - * `open_router.stt.create_transcription()`: `request.provider` **Changed** +releaseNotes: "## Python SDK Changes:\n* `open_router.batch.create_batches()`: \n * `request.provider.allow_fallbacks` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index f8a63883..1fc6633f 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.22 + version: 1.3.23 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index be140ddb..2bbd8218 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -6138,11 +6138,16 @@ components: type: 'object' BatchProviderPreferences: additionalProperties: false - description: 'Batch provider routing preferences. Only `provider.only` is supported.' + description: 'Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported.' example: only: - 'google-vertex' properties: + allow_fallbacks: + description: "Whether to allow backup providers to serve requests\n- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.\n- false: use only the primary/custom provider, and return the upstream error if it's unavailable.\n" + type: + - 'boolean' + - 'null' only: description: 'List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.' example: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index e4a17bd1..ddfd9059 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:ca24e1566753d8f7a103f4983ae6638c283950b90b0dcc6c151c5747819577c4 - sourceBlobDigest: sha256:e6942a48b2145b89c68feb7ed14991264eea09734a53ff363f6a2848296c9d8c + sourceRevisionDigest: sha256:c3c70c3b6b932203ac3620c7af2ef189dd4ad5f68e8ecfa96d1ae0205eed2577 + sourceBlobDigest: sha256:abda401f4190895ad03681943992315287b174a683984cae44746bfb1fb4c01b tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:ca24e1566753d8f7a103f4983ae6638c283950b90b0dcc6c151c5747819577c4 - sourceBlobDigest: sha256:e6942a48b2145b89c68feb7ed14991264eea09734a53ff363f6a2848296c9d8c + sourceRevisionDigest: sha256:c3c70c3b6b932203ac3620c7af2ef189dd4ad5f68e8ecfa96d1ae0205eed2577 + sourceBlobDigest: sha256:abda401f4190895ad03681943992315287b174a683984cae44746bfb1fb4c01b codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:19fcc3ebdfdb5d287219132c54f7a853732f8c5576e2eea6633af423c75e79b2 + codeSamplesRevisionDigest: sha256:6716b090997cab4e7bab71f18bccdff9954bb6fd397c6309bd37f6c942b08f98 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index eb978237..0dbb3be6 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -2989,4 +2989,14 @@ Based on: ### Generated - [python v1.3.22] . ### Releases -- [PyPI v1.3.22] https://pypi.org/project/openrouter/1.3.22 - . \ No newline at end of file +- [PyPI v1.3.22] https://pypi.org/project/openrouter/1.3.22 - . + +## 2026-10-05 12:07:04 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.23] . +### Releases +- [PyPI v1.3.23] https://pypi.org/project/openrouter/1.3.23 - . \ No newline at end of file diff --git a/docs/components/batchproviderpreferences.mdx b/docs/components/batchproviderpreferences.mdx index 541b7dae..f3a21d14 100644 --- a/docs/components/batchproviderpreferences.mdx +++ b/docs/components/batchproviderpreferences.mdx @@ -2,11 +2,12 @@ title: "BatchProviderPreferences" --- -Batch provider routing preferences. Only `provider.only` is supported. +Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported. ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | -| `only` | List[[components.BatchProviderPreferencesOnly](../components/batchproviderpreferencesonly.mdx)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | [
"openai",
"anthropic"
] | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
| | +| `only` | List[[components.BatchProviderPreferencesOnly](../components/batchproviderpreferencesonly.mdx)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | [
"openai",
"anthropic"
] | \ No newline at end of file diff --git a/docs/components/batchsubmitbody.mdx b/docs/components/batchsubmitbody.mdx index 18a8a279..5f85713c 100644 --- a/docs/components/batchsubmitbody.mdx +++ b/docs/components/batchsubmitbody.mdx @@ -12,5 +12,5 @@ Batch submit request body. | `completion_window` | [Optional[components.BatchSubmitBodyCompletionWindow]](../components/batchsubmitbodycompletionwindow.mdx) | :heavy_minus_sign: | N/A | | | `endpoint` | [components.Endpoint](../components/endpoint.mdx) | :heavy_check_mark: | N/A | | | `model` | *str* | :heavy_check_mark: | N/A | | -| `provider` | [OptionalNullable[components.BatchProviderPreferences]](../components/batchproviderpreferences.mdx) | :heavy_minus_sign: | Batch provider routing preferences. Only `provider.only` is supported. | \{
"only": [
"google-vertex"
]
} | +| `provider` | [OptionalNullable[components.BatchProviderPreferences]](../components/batchproviderpreferences.mdx) | :heavy_minus_sign: | Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported. | \{
"only": [
"google-vertex"
]
} | | `requests` | List[[components.Request](../components/request.mdx)] | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/sdks/batch/README.mdx b/docs/sdks/batch/README.mdx index e09a992d..9fb69f19 100644 --- a/docs/sdks/batch/README.mdx +++ b/docs/sdks/batch/README.mdx @@ -221,7 +221,7 @@ with OpenRouter( | `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.
| | | `completion_window` | [Optional[components.BatchSubmitBodyCompletionWindow]](../../components/batchsubmitbodycompletionwindow.mdx) | :heavy_minus_sign: | N/A | | -| `provider` | [OptionalNullable[components.BatchProviderPreferences]](../../components/batchproviderpreferences.mdx) | :heavy_minus_sign: | Batch provider routing preferences. Only `provider.only` is supported. | \{
"only": [
"google-vertex"
]
} | +| `provider` | [OptionalNullable[components.BatchProviderPreferences]](../../components/batchproviderpreferences.mdx) | :heavy_minus_sign: | Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported. | \{
"only": [
"google-vertex"
]
} | | `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 3b4cd992..971d2d13 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.22" +version = "1.3.23" 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 ba430560..59786ba2 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.22" +__version__: str = "1.3.23" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.3.22 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.23 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/batch.py b/src/openrouter/batch.py index ac75fd40..51b8ec5e 100644 --- a/src/openrouter/batch.py +++ b/src/openrouter/batch.py @@ -398,7 +398,7 @@ def create_batches( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param completion_window: - :param provider: Batch provider routing preferences. Only `provider.only` is supported. + :param provider: Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported. :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 @@ -555,7 +555,7 @@ async def create_batches_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param completion_window: - :param provider: Batch provider routing preferences. Only `provider.only` is supported. + :param provider: Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported. :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/src/openrouter/components/batchproviderpreferences.py b/src/openrouter/components/batchproviderpreferences.py index 527b6983..b2bbac63 100644 --- a/src/openrouter/components/batchproviderpreferences.py +++ b/src/openrouter/components/batchproviderpreferences.py @@ -25,22 +25,35 @@ class BatchProviderPreferencesTypedDict(TypedDict): - r"""Batch provider routing preferences. Only `provider.only` is supported.""" + r"""Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported.""" + allow_fallbacks: NotRequired[Nullable[bool]] + r"""Whether to allow backup providers to serve requests + - true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider. + - false: use only the primary/custom provider, and return the upstream error if it's unavailable. + + """ only: NotRequired[Nullable[List[BatchProviderPreferencesOnlyTypedDict]]] r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" class BatchProviderPreferences(BaseModel): - r"""Batch provider routing preferences. Only `provider.only` is supported.""" + r"""Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported.""" + + allow_fallbacks: OptionalNullable[bool] = UNSET + r"""Whether to allow backup providers to serve requests + - true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider. + - false: use only the primary/custom provider, and return the upstream error if it's unavailable. + + """ only: OptionalNullable[List[BatchProviderPreferencesOnly]] = UNSET r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["only"]) - nullable_fields = set(["only"]) + optional_fields = set(["allow_fallbacks", "only"]) + nullable_fields = set(["allow_fallbacks", "only"]) serialized = handler(self) m = {} diff --git a/src/openrouter/components/batchsubmitbody.py b/src/openrouter/components/batchsubmitbody.py index a84174b5..072a6220 100644 --- a/src/openrouter/components/batchsubmitbody.py +++ b/src/openrouter/components/batchsubmitbody.py @@ -53,7 +53,7 @@ class BatchSubmitBodyTypedDict(TypedDict): requests: List[RequestTypedDict] completion_window: NotRequired[BatchSubmitBodyCompletionWindow] provider: NotRequired[Nullable[BatchProviderPreferencesTypedDict]] - r"""Batch provider routing preferences. Only `provider.only` is supported.""" + r"""Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported.""" class BatchSubmitBody(BaseModel): @@ -68,7 +68,7 @@ class BatchSubmitBody(BaseModel): completion_window: Optional[BatchSubmitBodyCompletionWindow] = "24h" provider: OptionalNullable[BatchProviderPreferences] = UNSET - r"""Batch provider routing preferences. Only `provider.only` is supported.""" + r"""Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/uv.lock b/uv.lock index eb20c0a7..581e7dc0 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.22" +version = "1.3.23" source = { editable = "." } dependencies = [ { name = "httpcore" }, From cd8c264cce5d05c124113af895ac451097a6a844 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Mon, 5 Oct 2026 12:10:04 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow