diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 1b748a3c..a3e7a8b5 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: ddef32b4cd6f5d73939713b2c82a3b29 + docChecksum: d2b87b75740c953a8d17ca0730888708 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.2.22 - configChecksum: b17b6b12ede2e231b529d7155e1fc0d3 + releaseVersion: 1.2.23 + configChecksum: cf04b07f1113c9a5bdb836d9750c6595 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: d70feb9e-7b5f-4223-bd74-6c302290ab81 - pristine_commit_hash: 2e2b161273a0c50a40a16292bc0e77e2cc984059 - pristine_tree_hash: 2b4f8c135349d264802aecf405de53a0945a61f0 + generation_id: 0ce8b7d7-40a6-4545-8c99-e46d21cddf64 + pristine_commit_hash: f8b73026182269af46b0f4ea8eb9bce793b0deb8 + pristine_tree_hash: 713fb275f7f68923b8b4a91d5655c233e3ab64b1 features: python: acceptHeaders: 3.0.0 @@ -4875,8 +4875,8 @@ trackedFiles: pristine_git_object: 8318f521198142d8efdabba734e091545bf1a648 docs/components/providerpreferences.mdx: id: adbdfaa46438 - last_write_checksum: sha1:b02ea5ad41a466836473215d67cd3599df9e6540 - pristine_git_object: f3203a1e3e121102c24cc9a397fa5ad1359a0fcb + last_write_checksum: sha1:97f058dba8ad3b18f25be9342dc43e669a00770f + pristine_git_object: 2ae5e4b4a20883324603d1c2c70f9e6c1b9d19a4 docs/components/providerpreferencesignore.mdx: id: e0455b31c87b last_write_checksum: sha1:823f56c785a5c80949105fc0f4297a5b0ff2c2b2 @@ -8243,8 +8243,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:a262410e1db860a3666bb1a38ed3024cf6df845a - pristine_git_object: b6e61eb75d5b4e7050ca3c9d6ef4037f6078f02f + last_write_checksum: sha1:9e0f472074f415d99a56fa3306425e51f8af90b5 + pristine_git_object: 61bf730ab52f84fd8420a110eba48cd1755bcdf4 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -8271,8 +8271,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:5f2d1738ec120e5dd894bd4e7abd0f4daa948b41 - pristine_git_object: 31edc02f24e953d9278afbf62bbbb239a715b0ad + last_write_checksum: sha1:6847b2055d38d2d2edf8a66e79761da1d616d0d6 + pristine_git_object: c626fe71fb4be5da8602ef0383c70340821d974d src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:30f55a360f41376ab194b9ea725fe4e001a5ae1a @@ -10383,8 +10383,8 @@ trackedFiles: pristine_git_object: abe660d025957d61f68148006ca2c6efdc6b13a8 src/openrouter/components/providerpreferences.py: id: cdd58c8d664d - last_write_checksum: sha1:f8ce833648e42c8bf0bb5e60e42689b5c99a9b1a - pristine_git_object: aa6879d3d84a2740fff5af3c9391b513fc1e1c24 + last_write_checksum: sha1:b65fb68115b0c8ec0f87ea9220ea9c8ebbef4fc3 + pristine_git_object: 6cf5d428899c8722a49aa4ed5918ffe95b793549 src/openrouter/components/providerresponse.py: id: ad3887be54c5 last_write_checksum: sha1:dbd2cdd182deeaf20097ee54c9f2c39596655865 @@ -15130,4 +15130,4 @@ examples: "500": application/json: {"error": {"code": 409, "message": "That question is no longer waiting for an answer."}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.presets.create_presets_responses()`: \n * `request.input.union(Array<>)[]` **Changed** (Breaking ⚠️)\n* `open_router.responses.send()`: \n * `request.input.union(Array<>)[]` **Changed** (Breaking ⚠️)\n* `open_router.beta.responses.send()`: \n * `request.input.union(Array<>)[]` **Changed** (Breaking ⚠️)\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.alpha.decisions.create()`: \n * `request.provider.options` **Added**\n* `open_router.chat.send()`: \n * `request.provider.options` **Added**\n* `open_router.embeddings.generate()`: \n * `request.provider.options` **Added**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.provider.options` **Added**\n* `open_router.presets.create_presets_messages()`: \n * `request.provider.options` **Added**\n* `open_router.presets.create_presets_responses()`: \n * `request.provider.options` **Added**\n* `open_router.rerank.rerank()`: \n * `request.provider.options` **Added**\n* `open_router.responses.send()`: \n * `request.provider.options` **Added**\n* `open_router.beta.responses.send()`: \n * `request.provider.options` **Added**\n* `open_router.system_one.create()`: \n * `request.provider.options` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 1f22d2f1..4cf9fd11 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.2.22 + version: 1.2.23 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 6575bad3..c91388b7 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -23615,6 +23615,8 @@ components: type: - 'array' - 'null' + options: + $ref: '#/components/schemas/ProviderOptions' order: description: 'An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.' example: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index d1dceea3..45d85167 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:790674c532081dfabb7339f3069003cc638178dddc3bee934d5ed0fb388a7d53 - sourceBlobDigest: sha256:b073b26bfee1d9c1478bd018c96279ab06290278274d61255b265940c0d31edb + sourceRevisionDigest: sha256:7bfd9776c2b453f33856c928176266c2fd942f4e3ffe3713b4d961cf98081908 + sourceBlobDigest: sha256:ff57d6a05c40f98ea95dbae53ed8a31c4b7c35471b19fca8099220909e837776 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:790674c532081dfabb7339f3069003cc638178dddc3bee934d5ed0fb388a7d53 - sourceBlobDigest: sha256:b073b26bfee1d9c1478bd018c96279ab06290278274d61255b265940c0d31edb + sourceRevisionDigest: sha256:7bfd9776c2b453f33856c928176266c2fd942f4e3ffe3713b4d961cf98081908 + sourceBlobDigest: sha256:ff57d6a05c40f98ea95dbae53ed8a31c4b7c35471b19fca8099220909e837776 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:4e0ba9267951a6ee26a33ea0dbbf9d6ae805be6321a44fbc2c5b27296dea3fc8 + codeSamplesRevisionDigest: sha256:62f17d989e71d95e6e3ab18552f0dfe8006c837eb98fac27d5cc9b02760ecde9 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 7dbad0a5..af38f9f5 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -2629,4 +2629,14 @@ Based on: ### Generated - [python v1.2.22] . ### Releases -- [PyPI v1.2.22] https://pypi.org/project/openrouter/1.2.22 - . \ No newline at end of file +- [PyPI v1.2.22] https://pypi.org/project/openrouter/1.2.22 - . + +## 2026-09-24 17:39:28 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.2.23] . +### Releases +- [PyPI v1.2.23] https://pypi.org/project/openrouter/1.2.23 - . \ No newline at end of file diff --git a/docs/components/providerpreferences.mdx b/docs/components/providerpreferences.mdx index f3203a1e..2ae5e4b4 100644 --- a/docs/components/providerpreferences.mdx +++ b/docs/components/providerpreferences.mdx @@ -15,6 +15,7 @@ Provider routing preferences for the request. | `ignore` | List[[components.ProviderPreferencesIgnore](../components/providerpreferencesignore.mdx)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | [
"openai",
"anthropic"
] | | `max_price` | [Optional[components.MaxPrice]](../components/maxprice.mdx) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | | | `only` | List[[components.ProviderPreferencesOnly](../components/providerpreferencesonly.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"
] | +| `options` | [Optional[components.ProviderOptions]](../components/provideroptions.mdx) | :heavy_minus_sign: | Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped. | \{
"openai": \{
"max_tokens": 1000
}
} | | `order` | List[[components.ProviderPreferencesOrder](../components/providerpreferencesorder.mdx)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | [
"openai",
"anthropic"
] | | `preferred_max_latency` | [OptionalNullable[components.PreferredMaxLatency]](../components/preferredmaxlatency.mdx) | :heavy_minus_sign: | Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | 5 | | `preferred_min_throughput` | [OptionalNullable[components.PreferredMinThroughput]](../components/preferredminthroughput.mdx) | :heavy_minus_sign: | Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | 100 | diff --git a/pyproject.toml b/pyproject.toml index b6e61eb7..61bf730a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.2.22" +version = "1.2.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 31edc02f..c626fe71 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.2.22" +__version__: str = "1.2.23" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.2.22 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.2.23 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/providerpreferences.py b/src/openrouter/components/providerpreferences.py index aa6879d3..6cf5d428 100644 --- a/src/openrouter/components/providerpreferences.py +++ b/src/openrouter/components/providerpreferences.py @@ -7,6 +7,7 @@ PreferredMinThroughputTypedDict, ) from .providername import ProviderName +from .provideroptions import ProviderOptions, ProviderOptionsTypedDict from .providersort import ProviderSort from .providersortconfig import ProviderSortConfig, ProviderSortConfigTypedDict from .quantization import Quantization @@ -152,6 +153,8 @@ class ProviderPreferencesTypedDict(TypedDict): r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" only: NotRequired[Nullable[List[ProviderPreferencesOnlyTypedDict]]] r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" + options: NotRequired[ProviderOptionsTypedDict] + r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped.""" order: NotRequired[Nullable[List[ProviderPreferencesOrderTypedDict]]] r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" preferred_max_latency: NotRequired[Nullable[PreferredMaxLatencyTypedDict]] @@ -197,6 +200,9 @@ class ProviderPreferences(BaseModel): only: OptionalNullable[List[ProviderPreferencesOnly]] = UNSET r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" + options: Optional[ProviderOptions] = None + r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped.""" + order: OptionalNullable[List[ProviderPreferencesOrder]] = UNSET r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" @@ -228,6 +234,7 @@ def serialize_model(self, handler): "ignore", "max_price", "only", + "options", "order", "preferred_max_latency", "preferred_min_throughput", diff --git a/uv.lock b/uv.lock index 9d6dd8f4..15b23cdc 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.2.22" +version = "1.2.23" source = { editable = "." } dependencies = [ { name = "httpcore" },