diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index bdc72c63..9a8990eb 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: dc7b28650f4b75a64b994dc8d9426192 + docChecksum: a1446b873bd87da38239da96fef30136 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.1.10 - configChecksum: 0fb15d23c07ed7613621e9c5d0e13c7a + releaseVersion: 1.1.11 + configChecksum: 9d5c81b4e0fe110544c084f1cf1dc5b1 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 432a09a5-fa48-4bd0-87d1-85bcfe29a104 - pristine_commit_hash: 61118dc79015705a356aa88189a1d052da5bf0f3 - pristine_tree_hash: 42b6d08626e66fd5679709e8e4edbfaff1368c6e + generation_id: 89695304-a652-4c57-99fb-18d5cfc8d261 + pristine_commit_hash: 90a6fb17bc6a68cd7604ec4b9273c4149a97540a + pristine_tree_hash: 5efbf62418627973246e3d236e6dc09685a28f8f features: python: acceptHeaders: 3.0.0 @@ -618,16 +618,24 @@ trackedFiles: pristine_git_object: ef98b1de499df79940ccacaf5da0be2d635b104e docs/components/autobetarouterplugin.mdx: id: 036f0e51d7c9 - last_write_checksum: sha1:07c3279c2b32711a088fefd3f60699ebc4235cf3 - pristine_git_object: d70f386636c456a081d4c4a147b01b2589e8ad03 + last_write_checksum: sha1:b0a06e90eb11a8f9bd1642fdf2fe5b4d869a61b0 + pristine_git_object: 7ea7dc96f10b916ab31732304345774a14cea3a4 + docs/components/autobetarouterplugincosttier.mdx: + id: b56ac3529805 + last_write_checksum: sha1:f5e869ca0629601f0367ca1e5614bb1d1f58f70f + pristine_git_object: b2e319282c4ebbb4eb7eb01115c54021916e287e docs/components/autobetarouterpluginid.mdx: id: 619eb7d92a83 last_write_checksum: sha1:47b80552a64dbc3dc37421630fddf931ffe5c795 pristine_git_object: 800b8e4a3fd07f10592e3ee8f9c15c7e57398d4c docs/components/autorouterplugin.mdx: id: 4d62f9b36bc2 - last_write_checksum: sha1:74e39d385a2b96ab03d37f959364510eaaae2489 - pristine_git_object: 305de1b54cded7b2bf8290f0595bc35fb24ddc02 + last_write_checksum: sha1:027e227fad90f65f2ea67900e94ab3a0b30bf624 + pristine_git_object: 26f69ea544dd6e91a579e0c7b54e30045ed138f1 + docs/components/autorouterplugincosttier.mdx: + id: 72049c1ccaf4 + last_write_checksum: sha1:88c357901d1b51ef575f21ee957f6aa16bba7b83 + pristine_git_object: 77c913f91b03aefe7f6997bb588080a84960b777 docs/components/autorouterpluginid.mdx: id: ea9862a88ce8 last_write_checksum: sha1:51d6cd6296501209ebc8b721adb3feadeb798f9a @@ -6794,8 +6802,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:d814adb88a8e2c7c5168a931c03704ea9ce69ade - pristine_git_object: c9a345fd0ef4d7fd00fb3e382936627f6cd3241f + last_write_checksum: sha1:68887cf7196f5c439b739b25497108f729e92089 + pristine_git_object: 9ad37b87b230c9153a126f25cb27597e10faac3a scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6822,8 +6830,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:806800cec67125a989b20b50152ebd9de3d0105e - pristine_git_object: fe2edf4a9a3c2f7defcd6068df34488aedbe50de + last_write_checksum: sha1:7881d7cb60e4ba8017a87fdd070b6b4ebd5f81e6 + pristine_git_object: 3d3b3319338c4ded93b69642770503f11927bff5 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6866,8 +6874,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:03132ec935a4e444eab14cb18e268fb77e3b6d08 - pristine_git_object: 1a1bea47e675fbde39b1b72e7b42ef04b2025a54 + last_write_checksum: sha1:c926cc7209a972eafc02ee0697c8c4664131a44d + pristine_git_object: 10eb82a8be06db9cf72d7169b2f82317e29f53a6 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -7122,12 +7130,12 @@ trackedFiles: pristine_git_object: 2ccc3d9be586133e5d5138c77eacefa243987fb5 src/openrouter/components/autobetarouterplugin.py: id: bb4119e5d4dc - last_write_checksum: sha1:4eb9e7bcfe488da3974e5d3f8ef8e05091cfa6f1 - pristine_git_object: 56c32d14e00e66f5415c9ea0d503503f7925d62b + last_write_checksum: sha1:bf7b506b33df81da887af6f0ca009cfcebe1d52a + pristine_git_object: 1388c23edecbd1779145112533aa79503887d9d1 src/openrouter/components/autorouterplugin.py: id: cf49add5d1ae - last_write_checksum: sha1:4d0e56867780d5b238a8c37378fa53db80c42e69 - pristine_git_object: db933a4a1660b5ed5b94167b980e296080f10672 + last_write_checksum: sha1:5dcdc4c9001dc06fc6859e865735ed975ac2f29e + pristine_git_object: 077c2a1ee3d255605f19ff48a71c474d7a354de4 src/openrouter/components/badgatewayresponseerrordata.py: id: f7a33d30d269 last_write_checksum: sha1:d85ab25a06594703cb353767f07f4e1d44e0181c @@ -7326,8 +7334,8 @@ trackedFiles: pristine_git_object: 8bbde153b53887e426989fd5b0486b6dc1122810 src/openrouter/components/chatrequest.py: id: 5e39eaefa9cf - last_write_checksum: sha1:c1a5ce1daa8973042113ff59f08aca13ed4df8fa - pristine_git_object: ef954b6c9ecef144e14c16f5b414640cb9c81f11 + last_write_checksum: sha1:e4acd632bcc5fe672d244e84bf2d849ddb0f6a98 + pristine_git_object: c0e21ad130468e74758749193f0a6210fb6454cd src/openrouter/components/chatresult.py: id: 9062fe2935fe last_write_checksum: sha1:2ff1963c54e7e79500115c8549c8d395f4e336d1 @@ -8074,8 +8082,8 @@ trackedFiles: pristine_git_object: 7e69d1f775baece5f94b03d35bcd884d5e6f519d src/openrouter/components/messagesrequest.py: id: 72b1f339024d - last_write_checksum: sha1:69d731617a67a0d262bb647f6ee35cfc0bdc7827 - pristine_git_object: 083d56730e0686ca08a6e13979d912d30f2682d4 + last_write_checksum: sha1:c07e0a032be800d1e3fdab79f0aca4b4cb5e465e + pristine_git_object: 516c30ac13e88999dbdf6e63afcf00da8d63c337 src/openrouter/components/messagessearchmodelsservertool.py: id: 53d755edb120 last_write_checksum: sha1:389786fc22ba4bb47b0a086b7aa321f2f04fe943 @@ -8702,8 +8710,8 @@ trackedFiles: pristine_git_object: f38c8edcb616d9e7cbd0f724fbb9d9f5aae014f9 src/openrouter/components/responsesrequest.py: id: 8c850080ec5d - last_write_checksum: sha1:55ff8b1195c9d9c7deb522719f37a41fd0b15f10 - pristine_git_object: 0c49df2a87f8403a07d277ed8b64a995c6ea8466 + last_write_checksum: sha1:17b9e65fa563b3a73b7a36ddc8bae1f905b7bfe0 + pristine_git_object: 8c9b4fa1a1a58d4c09bb56af4098e86438e571b2 src/openrouter/components/responsesstreamingresponse.py: id: 142379f3bd90 last_write_checksum: sha1:a48d6f3610f5d15248ef4d25a0d88a0a4a1a9db7 @@ -11329,4 +11337,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.guardrails.list()`: `response.data[]` **Changed**\n* `open_router.guardrails.create()`: \n * `request` **Changed**\n * `response.data` **Changed**\n* `open_router.guardrails.get()`: `response.data` **Changed**\n* `open_router.guardrails.update()`: \n * `request` **Changed**\n * `response.data` **Changed**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.plugins[]` **Changed**\n* `open_router.chat.send()`: \n * `request.plugins[]` **Changed**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.plugins[]` **Changed**\n* `open_router.presets.create_presets_messages()`: \n * `request.plugins[]` **Changed**\n* `open_router.presets.create_presets_responses()`: \n * `request.plugins[]` **Changed**\n* `open_router.responses.send()`: \n * `request.plugins[]` **Changed**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 14aa1928..1e3cd1b1 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.1.10 + version: 1.1.11 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index d88dae20..a8e4c010 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -2871,7 +2871,7 @@ components: allowed_models: - 'anthropic/*' - 'openai/gpt-4o' - cost_quality_tradeoff: 9 + cost_tier: 'low' enabled: true id: 'auto-beta-router' properties: @@ -2885,11 +2885,23 @@ components: type: 'string' type: 'array' cost_quality_tradeoff: - description: 'Balances routing between cost and quality on a 0-10 scale. The auto-beta-router ranks models for the classified task type by community spend share, then filters candidates by their average cost per generation for that task. Higher values favor cheaper models: 10 keeps only models around the cheapest 10th percentile, while 0 permits models up to the 90th percentile for cost. Defaults to 9.' + deprecated: true + description: 'Deprecated: Use cost_tier instead. Balances routing between cost and quality on a 0-10 scale. The auto-beta-router ranks models for the classified task type by community spend share, then filters candidates by their average cost per generation for that task. Higher values favor cheaper models: 10 keeps only models around the cheapest 10th percentile, while 0 permits models up to the 90th percentile for cost. Defaults to 9. Numeric cost_quality_tradeoff remains supported, retains ceiling behavior, and takes precedence over cost_tier when both are provided.' example: 9 maximum: 10 minimum: 0 type: 'integer' + cost_tier: + description: 'Named cost/quality setting. For auto-beta-router, tiers select cost-percentile bands: low = [0, 20), medium = [20, 40), high = [40, 60), xhigh = [60, 80), and max = [80, 100]. Numeric cost_quality_tradeoff takes precedence and retains ceiling behavior.' + enum: + - 'low' + - 'medium' + - 'high' + - 'xhigh' + - 'max' + example: 'low' + type: 'string' + x-speakeasy-unknown-values: allow enabled: description: 'Set to false to disable the auto-beta-router plugin for this request. Defaults to true.' type: 'boolean' @@ -2905,7 +2917,7 @@ components: allowed_models: - 'anthropic/*' - 'openai/gpt-4o' - cost_quality_tradeoff: 7 + cost_tier: 'medium' enabled: true id: 'auto-router' pin_model: false @@ -2920,11 +2932,23 @@ components: type: 'string' type: 'array' cost_quality_tradeoff: - description: 'Controls cost vs. quality routing tradeoff (0–10). 0 = pure quality (best model regardless of cost), 10 = maximize for cost (cheapest model wins). Intermediate values blend quality and cost signals continuously. Defaults to 7.' + deprecated: true + description: 'Deprecated: Use cost_tier instead. Controls cost vs. quality routing tradeoff (0–10). 0 = pure quality (best model regardless of cost), 10 = maximize for cost (cheapest model wins). Intermediate values blend quality and cost signals continuously. Defaults to 7. Numeric cost_quality_tradeoff remains supported and takes precedence over cost_tier when both are provided.' example: 7 maximum: 10 minimum: 0 type: 'integer' + cost_tier: + description: 'Shorthand for cost_quality_tradeoff. Higher tiers spend more on better models: low = 9, medium = 7, high = 5, xhigh = 3, and max = 1. Numeric cost_quality_tradeoff takes precedence when both are provided.' + enum: + - 'low' + - 'medium' + - 'high' + - 'xhigh' + - 'max' + example: 'medium' + type: 'string' + x-speakeasy-unknown-values: allow enabled: description: 'Set to false to disable the auto-router plugin for this request. Defaults to true.' type: 'boolean' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 72c90f4a..ed7b43a3 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:6f41b4fc5146523ef9ffe5907d1de58a3d5bf3a7a52f333ca6bd215079f0b6ab - sourceBlobDigest: sha256:d636342ceccb904cee7648a4bafba3ce7c272b6e05f59a1e0073191f4e7c0a23 + sourceRevisionDigest: sha256:3463c7642dac4e0be5ab491342c923d203bec99aaf8f09d978a8773f66aa858f + sourceBlobDigest: sha256:bcf0c7b7716d4ac425c204f04dd3b60a1631a628c87100bdf8171db17ef44797 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:6f41b4fc5146523ef9ffe5907d1de58a3d5bf3a7a52f333ca6bd215079f0b6ab - sourceBlobDigest: sha256:d636342ceccb904cee7648a4bafba3ce7c272b6e05f59a1e0073191f4e7c0a23 + sourceRevisionDigest: sha256:3463c7642dac4e0be5ab491342c923d203bec99aaf8f09d978a8773f66aa858f + sourceBlobDigest: sha256:bcf0c7b7716d4ac425c204f04dd3b60a1631a628c87100bdf8171db17ef44797 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:120f53668535c593d17783ebb8f66d4c5e44f195df21d8b9aba07767049ad535 + codeSamplesRevisionDigest: sha256:0406a0924db3ccfe1fae98f1ee09cfe42acca15d228dfa66c818e954b61a79bf workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index f8d84370..ad53c69d 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -899,4 +899,14 @@ Based on: ### Generated - [python v1.1.10] . ### Releases -- [PyPI v1.1.10] https://pypi.org/project/openrouter/1.1.10 - . \ No newline at end of file +- [PyPI v1.1.10] https://pypi.org/project/openrouter/1.1.10 - . + +## 2026-07-28 23:05:11 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.1.11] . +### Releases +- [PyPI v1.1.11] https://pypi.org/project/openrouter/1.1.11 - . \ No newline at end of file diff --git a/docs/components/autobetarouterplugin.mdx b/docs/components/autobetarouterplugin.mdx index d70f3866..7ea7dc96 100644 --- a/docs/components/autobetarouterplugin.mdx +++ b/docs/components/autobetarouterplugin.mdx @@ -4,9 +4,10 @@ title: "AutoBetaRouterPlugin" ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | List of model patterns to filter which models the auto-beta-router can route between. Supports wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default supported models list. | [
"anthropic/*",
"openai/gpt-4o",
"google/*"
] | -| `cost_quality_tradeoff` | *Optional[int]* | :heavy_minus_sign: | Balances routing between cost and quality on a 0-10 scale. The auto-beta-router ranks models for the classified task type by community spend share, then filters candidates by their average cost per generation for that task. Higher values favor cheaper models: 10 keeps only models around the cheapest 10th percentile, while 0 permits models up to the 90th percentile for cost. Defaults to 9. | 9 | -| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the auto-beta-router plugin for this request. Defaults to true. | | -| `id` | [components.AutoBetaRouterPluginID](../components/autobetarouterpluginid.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allowed_models` | List[*str*] | :heavy_minus_sign: | List of model patterns to filter which models the auto-beta-router can route between. Supports wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default supported models list. | [
"anthropic/*",
"openai/gpt-4o",
"google/*"
] | +| ~~`cost_quality_tradeoff`~~ | *Optional[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated: Use cost_tier instead. Balances routing between cost and quality on a 0-10 scale. The auto-beta-router ranks models for the classified task type by community spend share, then filters candidates by their average cost per generation for that task. Higher values favor cheaper models: 10 keeps only models around the cheapest 10th percentile, while 0 permits models up to the 90th percentile for cost. Defaults to 9. Numeric cost_quality_tradeoff remains supported, retains ceiling behavior, and takes precedence over cost_tier when both are provided. | 9 | +| `cost_tier` | [Optional[components.AutoBetaRouterPluginCostTier]](../components/autobetarouterplugincosttier.mdx) | :heavy_minus_sign: | Named cost/quality setting. For auto-beta-router, tiers select cost-percentile bands: low = [0, 20), medium = [20, 40), high = [40, 60), xhigh = [60, 80), and max = [80, 100]. Numeric cost_quality_tradeoff takes precedence and retains ceiling behavior. | low | +| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the auto-beta-router plugin for this request. Defaults to true. | | +| `id` | [components.AutoBetaRouterPluginID](../components/autobetarouterpluginid.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/autobetarouterplugincosttier.mdx b/docs/components/autobetarouterplugincosttier.mdx new file mode 100644 index 00000000..b2e31928 --- /dev/null +++ b/docs/components/autobetarouterplugincosttier.mdx @@ -0,0 +1,25 @@ +--- +title: "AutoBetaRouterPluginCostTier" +--- + +Named cost/quality setting. For auto-beta-router, tiers select cost-percentile bands: low = [0, 20), medium = [20, 40), high = [40, 60), xhigh = [60, 80), and max = [80, 100]. Numeric cost_quality_tradeoff takes precedence and retains ceiling behavior. + +## Example Usage + +```python +from openrouter.components import AutoBetaRouterPluginCostTier + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: AutoBetaRouterPluginCostTier = "low" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"low"` +- `"medium"` +- `"high"` +- `"xhigh"` +- `"max"` diff --git a/docs/components/autorouterplugin.mdx b/docs/components/autorouterplugin.mdx index 305de1b5..26f69ea5 100644 --- a/docs/components/autorouterplugin.mdx +++ b/docs/components/autorouterplugin.mdx @@ -4,10 +4,11 @@ title: "AutoRouterPlugin" ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default supported models list. | [
"anthropic/*",
"openai/gpt-4o",
"google/*"
] | -| `cost_quality_tradeoff` | *Optional[int]* | :heavy_minus_sign: | Controls cost vs. quality routing tradeoff (0–10). 0 = pure quality (best model regardless of cost), 10 = maximize for cost (cheapest model wins). Intermediate values blend quality and cost signals continuously. Defaults to 7. | 7 | -| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the auto-router plugin for this request. Defaults to true. | | -| `id` | [components.AutoRouterPluginID](../components/autorouterpluginid.mdx) | :heavy_check_mark: | N/A | | -| `pin_model` | *Optional[bool]* | :heavy_minus_sign: | When true, reuses the model from the most recent assistant message's `model` attribute for subsequent turns. Defaults to false. | false | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allowed_models` | List[*str*] | :heavy_minus_sign: | List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default supported models list. | [
"anthropic/*",
"openai/gpt-4o",
"google/*"
] | +| ~~`cost_quality_tradeoff`~~ | *Optional[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated: Use cost_tier instead. Controls cost vs. quality routing tradeoff (0–10). 0 = pure quality (best model regardless of cost), 10 = maximize for cost (cheapest model wins). Intermediate values blend quality and cost signals continuously. Defaults to 7. Numeric cost_quality_tradeoff remains supported and takes precedence over cost_tier when both are provided. | 7 | +| `cost_tier` | [Optional[components.AutoRouterPluginCostTier]](../components/autorouterplugincosttier.mdx) | :heavy_minus_sign: | Shorthand for cost_quality_tradeoff. Higher tiers spend more on better models: low = 9, medium = 7, high = 5, xhigh = 3, and max = 1. Numeric cost_quality_tradeoff takes precedence when both are provided. | medium | +| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the auto-router plugin for this request. Defaults to true. | | +| `id` | [components.AutoRouterPluginID](../components/autorouterpluginid.mdx) | :heavy_check_mark: | N/A | | +| `pin_model` | *Optional[bool]* | :heavy_minus_sign: | When true, reuses the model from the most recent assistant message's `model` attribute for subsequent turns. Defaults to false. | false | \ No newline at end of file diff --git a/docs/components/autorouterplugincosttier.mdx b/docs/components/autorouterplugincosttier.mdx new file mode 100644 index 00000000..77c913f9 --- /dev/null +++ b/docs/components/autorouterplugincosttier.mdx @@ -0,0 +1,25 @@ +--- +title: "AutoRouterPluginCostTier" +--- + +Shorthand for cost_quality_tradeoff. Higher tiers spend more on better models: low = 9, medium = 7, high = 5, xhigh = 3, and max = 1. Numeric cost_quality_tradeoff takes precedence when both are provided. + +## Example Usage + +```python +from openrouter.components import AutoRouterPluginCostTier + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: AutoRouterPluginCostTier = "low" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"low"` +- `"medium"` +- `"high"` +- `"xhigh"` +- `"max"` diff --git a/pyproject.toml b/pyproject.toml index c9a345fd..9ad37b87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.1.10" +version = "1.1.11" 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 fe2edf4a..3d3b3319 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.1.10" +__version__: str = "1.1.11" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.1.10 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.1.11 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 1a1bea47..10eb82a8 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -301,11 +301,13 @@ from .apprankingsresponse import AppRankingsResponse, AppRankingsResponseTypedDict from .autobetarouterplugin import ( AutoBetaRouterPlugin, + AutoBetaRouterPluginCostTier, AutoBetaRouterPluginID, AutoBetaRouterPluginTypedDict, ) from .autorouterplugin import ( AutoRouterPlugin, + AutoRouterPluginCostTier, AutoRouterPluginID, AutoRouterPluginTypedDict, ) @@ -3112,9 +3114,11 @@ "AudioURL", "AudioURLTypedDict", "AutoBetaRouterPlugin", + "AutoBetaRouterPluginCostTier", "AutoBetaRouterPluginID", "AutoBetaRouterPluginTypedDict", "AutoRouterPlugin", + "AutoRouterPluginCostTier", "AutoRouterPluginID", "AutoRouterPluginTypedDict", "BYOKKey", @@ -5235,9 +5239,11 @@ "AppRankingsResponse": ".apprankingsresponse", "AppRankingsResponseTypedDict": ".apprankingsresponse", "AutoBetaRouterPlugin": ".autobetarouterplugin", + "AutoBetaRouterPluginCostTier": ".autobetarouterplugin", "AutoBetaRouterPluginID": ".autobetarouterplugin", "AutoBetaRouterPluginTypedDict": ".autobetarouterplugin", "AutoRouterPlugin": ".autorouterplugin", + "AutoRouterPluginCostTier": ".autorouterplugin", "AutoRouterPluginID": ".autorouterplugin", "AutoRouterPluginTypedDict": ".autorouterplugin", "BadGatewayResponseErrorData": ".badgatewayresponseerrordata", diff --git a/src/openrouter/components/autobetarouterplugin.py b/src/openrouter/components/autobetarouterplugin.py index 56c32d14..1388c23e 100644 --- a/src/openrouter/components/autobetarouterplugin.py +++ b/src/openrouter/components/autobetarouterplugin.py @@ -1,10 +1,24 @@ """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 +import pydantic from pydantic import model_serializer -from typing import List, Literal, Optional -from typing_extensions import NotRequired, TypedDict +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +AutoBetaRouterPluginCostTier = Union[ + Literal[ + "low", + "medium", + "high", + "xhigh", + "max", + ], + UnrecognizedStr, +] +r"""Named cost/quality setting. For auto-beta-router, tiers select cost-percentile bands: low = [0, 20), medium = [20, 40), high = [40, 60), xhigh = [60, 80), and max = [80, 100]. Numeric cost_quality_tradeoff takes precedence and retains ceiling behavior.""" AutoBetaRouterPluginID = Literal["auto-beta-router",] @@ -15,7 +29,9 @@ class AutoBetaRouterPluginTypedDict(TypedDict): allowed_models: NotRequired[List[str]] r"""List of model patterns to filter which models the auto-beta-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list.""" cost_quality_tradeoff: NotRequired[int] - r"""Balances routing between cost and quality on a 0-10 scale. The auto-beta-router ranks models for the classified task type by community spend share, then filters candidates by their average cost per generation for that task. Higher values favor cheaper models: 10 keeps only models around the cheapest 10th percentile, while 0 permits models up to the 90th percentile for cost. Defaults to 9.""" + r"""Deprecated: Use cost_tier instead. Balances routing between cost and quality on a 0-10 scale. The auto-beta-router ranks models for the classified task type by community spend share, then filters candidates by their average cost per generation for that task. Higher values favor cheaper models: 10 keeps only models around the cheapest 10th percentile, while 0 permits models up to the 90th percentile for cost. Defaults to 9. Numeric cost_quality_tradeoff remains supported, retains ceiling behavior, and takes precedence over cost_tier when both are provided.""" + cost_tier: NotRequired[AutoBetaRouterPluginCostTier] + r"""Named cost/quality setting. For auto-beta-router, tiers select cost-percentile bands: low = [0, 20), medium = [20, 40), high = [40, 60), xhigh = [60, 80), and max = [80, 100]. Numeric cost_quality_tradeoff takes precedence and retains ceiling behavior.""" enabled: NotRequired[bool] r"""Set to false to disable the auto-beta-router plugin for this request. Defaults to true.""" @@ -26,15 +42,25 @@ class AutoBetaRouterPlugin(BaseModel): allowed_models: Optional[List[str]] = None r"""List of model patterns to filter which models the auto-beta-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list.""" - cost_quality_tradeoff: Optional[int] = None - r"""Balances routing between cost and quality on a 0-10 scale. The auto-beta-router ranks models for the classified task type by community spend share, then filters candidates by their average cost per generation for that task. Higher values favor cheaper models: 10 keeps only models around the cheapest 10th percentile, while 0 permits models up to the 90th percentile for cost. Defaults to 9.""" + cost_quality_tradeoff: Annotated[ + Optional[int], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." + ), + ] = None + r"""Deprecated: Use cost_tier instead. Balances routing between cost and quality on a 0-10 scale. The auto-beta-router ranks models for the classified task type by community spend share, then filters candidates by their average cost per generation for that task. Higher values favor cheaper models: 10 keeps only models around the cheapest 10th percentile, while 0 permits models up to the 90th percentile for cost. Defaults to 9. Numeric cost_quality_tradeoff remains supported, retains ceiling behavior, and takes precedence over cost_tier when both are provided.""" + + cost_tier: Optional[AutoBetaRouterPluginCostTier] = None + r"""Named cost/quality setting. For auto-beta-router, tiers select cost-percentile bands: low = [0, 20), medium = [20, 40), high = [40, 60), xhigh = [60, 80), and max = [80, 100]. Numeric cost_quality_tradeoff takes precedence and retains ceiling behavior.""" enabled: Optional[bool] = None r"""Set to false to disable the auto-beta-router plugin for this request. Defaults to true.""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["allowed_models", "cost_quality_tradeoff", "enabled"]) + optional_fields = set( + ["allowed_models", "cost_quality_tradeoff", "cost_tier", "enabled"] + ) serialized = handler(self) m = {} diff --git a/src/openrouter/components/autorouterplugin.py b/src/openrouter/components/autorouterplugin.py index db933a4a..077c2a1e 100644 --- a/src/openrouter/components/autorouterplugin.py +++ b/src/openrouter/components/autorouterplugin.py @@ -1,10 +1,24 @@ """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 +import pydantic from pydantic import model_serializer -from typing import List, Literal, Optional -from typing_extensions import NotRequired, TypedDict +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +AutoRouterPluginCostTier = Union[ + Literal[ + "low", + "medium", + "high", + "xhigh", + "max", + ], + UnrecognizedStr, +] +r"""Shorthand for cost_quality_tradeoff. Higher tiers spend more on better models: low = 9, medium = 7, high = 5, xhigh = 3, and max = 1. Numeric cost_quality_tradeoff takes precedence when both are provided.""" AutoRouterPluginID = Literal["auto-router",] @@ -15,7 +29,9 @@ class AutoRouterPluginTypedDict(TypedDict): allowed_models: NotRequired[List[str]] r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list.""" cost_quality_tradeoff: NotRequired[int] - r"""Controls cost vs. quality routing tradeoff (0–10). 0 = pure quality (best model regardless of cost), 10 = maximize for cost (cheapest model wins). Intermediate values blend quality and cost signals continuously. Defaults to 7.""" + r"""Deprecated: Use cost_tier instead. Controls cost vs. quality routing tradeoff (0–10). 0 = pure quality (best model regardless of cost), 10 = maximize for cost (cheapest model wins). Intermediate values blend quality and cost signals continuously. Defaults to 7. Numeric cost_quality_tradeoff remains supported and takes precedence over cost_tier when both are provided.""" + cost_tier: NotRequired[AutoRouterPluginCostTier] + r"""Shorthand for cost_quality_tradeoff. Higher tiers spend more on better models: low = 9, medium = 7, high = 5, xhigh = 3, and max = 1. Numeric cost_quality_tradeoff takes precedence when both are provided.""" enabled: NotRequired[bool] r"""Set to false to disable the auto-router plugin for this request. Defaults to true.""" pin_model: NotRequired[bool] @@ -28,8 +44,16 @@ class AutoRouterPlugin(BaseModel): allowed_models: Optional[List[str]] = None r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list.""" - cost_quality_tradeoff: Optional[int] = None - r"""Controls cost vs. quality routing tradeoff (0–10). 0 = pure quality (best model regardless of cost), 10 = maximize for cost (cheapest model wins). Intermediate values blend quality and cost signals continuously. Defaults to 7.""" + cost_quality_tradeoff: Annotated[ + Optional[int], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." + ), + ] = None + r"""Deprecated: Use cost_tier instead. Controls cost vs. quality routing tradeoff (0–10). 0 = pure quality (best model regardless of cost), 10 = maximize for cost (cheapest model wins). Intermediate values blend quality and cost signals continuously. Defaults to 7. Numeric cost_quality_tradeoff remains supported and takes precedence over cost_tier when both are provided.""" + + cost_tier: Optional[AutoRouterPluginCostTier] = None + r"""Shorthand for cost_quality_tradeoff. Higher tiers spend more on better models: low = 9, medium = 7, high = 5, xhigh = 3, and max = 1. Numeric cost_quality_tradeoff takes precedence when both are provided.""" enabled: Optional[bool] = None r"""Set to false to disable the auto-router plugin for this request. Defaults to true.""" @@ -40,7 +64,13 @@ class AutoRouterPlugin(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["allowed_models", "cost_quality_tradeoff", "enabled", "pin_model"] + [ + "allowed_models", + "cost_quality_tradeoff", + "cost_tier", + "enabled", + "pin_model", + ] ) serialized = handler(self) m = {} diff --git a/src/openrouter/components/chatrequest.py b/src/openrouter/components/chatrequest.py index ef954b6c..c0e21ad1 100644 --- a/src/openrouter/components/chatrequest.py +++ b/src/openrouter/components/chatrequest.py @@ -82,9 +82,9 @@ FileParserPluginTypedDict, ContextCompressionPluginTypedDict, AutoBetaRouterPluginTypedDict, - AutoRouterPluginTypedDict, WebFetchPluginTypedDict, ParetoRouterPluginTypedDict, + AutoRouterPluginTypedDict, FusionPluginTypedDict, WebSearchPluginTypedDict, ], diff --git a/src/openrouter/components/messagesrequest.py b/src/openrouter/components/messagesrequest.py index 083d5673..516c30ac 100644 --- a/src/openrouter/components/messagesrequest.py +++ b/src/openrouter/components/messagesrequest.py @@ -364,9 +364,9 @@ def serialize_model(self, handler): FileParserPluginTypedDict, ContextCompressionPluginTypedDict, AutoBetaRouterPluginTypedDict, - AutoRouterPluginTypedDict, WebFetchPluginTypedDict, ParetoRouterPluginTypedDict, + AutoRouterPluginTypedDict, FusionPluginTypedDict, WebSearchPluginTypedDict, ], diff --git a/src/openrouter/components/responsesrequest.py b/src/openrouter/components/responsesrequest.py index 0c49df2a..8c9b4fa1 100644 --- a/src/openrouter/components/responsesrequest.py +++ b/src/openrouter/components/responsesrequest.py @@ -130,9 +130,9 @@ FileParserPluginTypedDict, ContextCompressionPluginTypedDict, AutoBetaRouterPluginTypedDict, - AutoRouterPluginTypedDict, WebFetchPluginTypedDict, ParetoRouterPluginTypedDict, + AutoRouterPluginTypedDict, FusionPluginTypedDict, WebSearchPluginTypedDict, ], diff --git a/uv.lock b/uv.lock index 4d0fcca8..1062c7b3 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.1.10" +version = "1.1.11" source = { editable = "." } dependencies = [ { name = "httpcore" },