diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 2cc28ce6d..0f1e3be3d 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: ab7299f20b99875c8d4dc6b7d1961031 + docChecksum: bebc2e8fea10251aec0323a863417eab docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.3.59 - configChecksum: b5283e3d1f1d768501fa29c241717898 + releaseVersion: 1.3.60 + configChecksum: eb7c86d6839742b98d33d2a96d8b5013 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 60ba15f6-02b1-4b50-87b3-d9cbb799921f - pristine_commit_hash: 7558df97d221f06df6834a6b16d8eefa87151c41 - pristine_tree_hash: 69909a1476c6dba2cdb1362f264793c75ea4e9f3 + generation_id: e6a5b1eb-7359-4fb4-a437-def88295741c + pristine_commit_hash: cb90be710af20c8724a347fff8de3e7e0a1a3608 + pristine_tree_hash: bf3098a3566832138f8cab929b1c28b6c1a88d33 features: python: acceptHeaders: 3.0.0 @@ -9584,8 +9584,8 @@ trackedFiles: pristine_git_object: f0a800135df0c6e4799128a4fbc901c576c8c6ce docs/operations/listmodelsuserrequest.mdx: id: 01537864056e - last_write_checksum: sha1:60310daa2bd8a0adbef484525680460e350172d1 - pristine_git_object: 0ad201f8af94bbf0dee823e9c3eeb841fcd56fc5 + last_write_checksum: sha1:ad5fc5b8d8cfc36bfb28b7fec1011dd6f194d4bf + pristine_git_object: 026e944c7fa18873cecf8644a7f39de467bb2b1f docs/operations/listmodelsuserresponse.mdx: id: 34f7a1648ceb last_write_checksum: sha1:bf1ee4a9b2ad707ff1c39ea8680e72e5d0c27b9a @@ -9594,6 +9594,10 @@ trackedFiles: id: fa5ad15aebfd last_write_checksum: sha1:daa5aafeecb31a35e7cb1bbedc70b722f6a675a5 pristine_git_object: c7dbff35b7c3345c54c268f81a8ad4dac24cc5c3 + docs/operations/listmodelsusersort.mdx: + id: a6cd738b2b05 + last_write_checksum: sha1:fbe3a59ea629b15942d1aeadde96f46a51f29a66 + pristine_git_object: 4bae293ec5d0a8b931bb85c6df53316562c66fee docs/operations/listoauthjwksglobals.mdx: id: 7fe931762b70 last_write_checksum: sha1:5d1a1236488c46dc129a264b6df22e5842921611 @@ -10248,8 +10252,8 @@ trackedFiles: pristine_git_object: b90fc698bfe2b3fc3fa0b06699a33e4e158aef22 docs/sdks/models/README.mdx: id: 58f1ca464e0b - last_write_checksum: sha1:093dd30ebdd18b9763a6956915e0dcae4ae7d5e5 - pristine_git_object: 9131aee97e483384b6721a32936c05901dfeea5d + last_write_checksum: sha1:aab5b254f0a6dc7ab7c6d543b20c889113cc0dc9 + pristine_git_object: fb76b402a8d2da041c3ca7464e09c9ea75c1854e docs/sdks/oauth/README.mdx: id: 42b5079343d2 last_write_checksum: sha1:3cde9bcb927f4723ccdb237d9f7a54a50f96abe7 @@ -10320,8 +10324,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:4d31540309694a56bbfe0f19a53d19f03da53e8b - pristine_git_object: 50f35b30873dfb97a1388b662773da29b4dd10ca + last_write_checksum: sha1:de158115560e39857ddf2f7bd50debf50f14f1f5 + pristine_git_object: 96d4e82b753bc9dcf61521a131fdc9483f8a7e63 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -10348,8 +10352,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:a2461009aed4621da3c5058671d699f186fda10b - pristine_git_object: 74ee8fbdba00a70b1cd00eec1f2d87b48042b8db + last_write_checksum: sha1:466bbdaf1a80e3946d8f91eacf4b29a1866e1c1d + pristine_git_object: 2b7810548e159b9920517756e64e486f2ef318e1 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:30f55a360f41376ab194b9ea725fe4e001a5ae1a @@ -14048,8 +14052,8 @@ trackedFiles: pristine_git_object: 5b741456655ff48919d17ffd552a6410f0587966 src/openrouter/models_.py: id: 4e1ae1fe5b98 - last_write_checksum: sha1:5fabfae94d73d2552537ab5ff4628ade1540d89c - pristine_git_object: e16291f980d3a1e19aeef0f68cf5b4998da16f82 + last_write_checksum: sha1:cf453e9c9ba85da30251698de3c7c8ebcfd344d3 + pristine_git_object: 5b22dc33ede915e5769e5898dd37e4e08312583c src/openrouter/oauth.py: id: 1948ce27255b last_write_checksum: sha1:d6470de6325431db64b08ff4468fb2d8ea781c6f @@ -14060,8 +14064,8 @@ trackedFiles: pristine_git_object: f01a5ab1865b16939c092d854fe8a7145c327058 src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:69f2394d6b0644c50c2f21349f2fd0617622ade0 - pristine_git_object: f4753e5e03a329e4732821e00a353f60ad03e884 + last_write_checksum: sha1:e17ae08243c8381872fb8fd0ded781096749f43e + pristine_git_object: 1370bf741d8ad3debebf00e4983f388362fb31a1 src/openrouter/operations/activateprivateendpoint.py: id: 3b39eec5d66f last_write_checksum: sha1:9406e6b3d38c82895fd795f637702ef579cc6d36 @@ -14500,8 +14504,8 @@ trackedFiles: pristine_git_object: cdde733b97c9b409d550fd58f9d49184d1647f4d src/openrouter/operations/listmodelsuser.py: id: 16eb5946cf60 - last_write_checksum: sha1:8f8571521a92ee945fa3875af7390fecab790a2d - pristine_git_object: 915aa93c1b33fc37b5b38800bd40284de64b8f01 + last_write_checksum: sha1:1f455b856b8c143fd5e96893bdd2f72aacf98da2 + pristine_git_object: 0d87be124c12ceb8cd1f93b7eeca51e9d404a8b9 src/openrouter/operations/listoauthjwks.py: id: 329ac9d6fa76 last_write_checksum: sha1:8d6b08b6637a0ff49f88313a9f1bed03349655f1 @@ -18834,4 +18838,4 @@ examples: examplesVersion: 1.0.2 releaseNotes: | ## Python SDK Changes: - * `open_router.o_auth.create_oauth_token()`: `request.scope` **Changed** + * `open_router.models.list_for_user()`: `request.sort` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 4dd44e81a..16726be1e 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.59 + version: 1.3.60 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index be09952b7..26e00d888 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -47199,6 +47199,28 @@ paths: description: 'Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text".' example: 'text' type: 'string' + - description: 'Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.' + in: 'query' + name: 'sort' + required: false + schema: + description: 'Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.' + enum: + - 'most-popular' + - 'newest' + - 'top-weekly' + - 'pricing-low-to-high' + - 'pricing-high-to-low' + - 'context-high-to-low' + - 'throughput-high-to-low' + - 'latency-low-to-high' + - 'intelligence-high-to-low' + - 'coding-high-to-low' + - 'agentic-high-to-low' + - 'design-arena-elo-high-to-low' + example: 'newest' + type: 'string' + x-speakeasy-unknown-values: allow responses: '200': content: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 2ae3c72af..335408c69 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:fc358e8fd0ba245e16eadeaf71e604d8fdf0c09a17d6bfe0d041843592fb4188 - sourceBlobDigest: sha256:44659309dd26f2f2e23016c8b6f714f17d00755ef3f21013eea925088ba09ed0 + sourceRevisionDigest: sha256:0aacdcc949b2d7675bc27707be861a6976a4f319f12a069e6948227f453053c4 + sourceBlobDigest: sha256:23001c8d777328a9560ba8cd6428170d7229c7eda4f9b64909fbfb3711c18c94 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:fc358e8fd0ba245e16eadeaf71e604d8fdf0c09a17d6bfe0d041843592fb4188 - sourceBlobDigest: sha256:44659309dd26f2f2e23016c8b6f714f17d00755ef3f21013eea925088ba09ed0 + sourceRevisionDigest: sha256:0aacdcc949b2d7675bc27707be861a6976a4f319f12a069e6948227f453053c4 + sourceBlobDigest: sha256:23001c8d777328a9560ba8cd6428170d7229c7eda4f9b64909fbfb3711c18c94 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:595eb9e1e2d337804f295baf347e8dd8a2a0f4e80c2ea0dadd292091358ea1c9 + codeSamplesRevisionDigest: sha256:65be134e3c1e615193ecaadca3d31ece2693ac80067917230150b8dffc36592b workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 4d4923e51..59f25e553 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -3359,4 +3359,14 @@ Based on: ### Generated - [python v1.3.59] . ### Releases -- [PyPI v1.3.59] https://pypi.org/project/openrouter/1.3.59 - . \ No newline at end of file +- [PyPI v1.3.59] https://pypi.org/project/openrouter/1.3.59 - . + +## 2026-10-15 22:24:35 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.60] . +### Releases +- [PyPI v1.3.60] https://pypi.org/project/openrouter/1.3.60 - . \ No newline at end of file diff --git a/docs/operations/listmodelsuserrequest.mdx b/docs/operations/listmodelsuserrequest.mdx index 61a97beb1..726529934 100644 --- a/docs/operations/listmodelsuserrequest.mdx +++ b/docs/operations/listmodelsuserrequest.mdx @@ -4,11 +4,12 @@ title: "ListModelsUserRequest" ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | -| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `offset` | *OptionalNullable[int]* | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | -| `limit` | *Optional[int]* | ➖ | Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned | 500 | -| `output_modalities` | *Optional[str]* | ➖ | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text". | text | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *OptionalNullable[int]* | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | +| `limit` | *Optional[int]* | ➖ | Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned | 500 | +| `output_modalities` | *Optional[str]* | ➖ | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text". | text | +| `sort` | [Optional[operations.ListModelsUserSort]](../operations/listmodelsusersort.mdx) | ➖ | Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. | newest | \ No newline at end of file diff --git a/docs/operations/listmodelsusersort.mdx b/docs/operations/listmodelsusersort.mdx new file mode 100644 index 000000000..4bae293ec --- /dev/null +++ b/docs/operations/listmodelsusersort.mdx @@ -0,0 +1,32 @@ +--- +title: "ListModelsUserSort" +--- + +Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. + +## Example Usage + +```python +from openrouter.operations import ListModelsUserSort + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ListModelsUserSort = "most-popular" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"most-popular"` +- `"newest"` +- `"top-weekly"` +- `"pricing-low-to-high"` +- `"pricing-high-to-low"` +- `"context-high-to-low"` +- `"throughput-high-to-low"` +- `"latency-low-to-high"` +- `"intelligence-high-to-low"` +- `"coding-high-to-low"` +- `"agentic-high-to-low"` +- `"design-arena-elo-high-to-low"` diff --git a/docs/sdks/models/README.mdx b/docs/sdks/models/README.mdx index ad099b012..3a6ab001d 100644 --- a/docs/sdks/models/README.mdx +++ b/docs/sdks/models/README.mdx @@ -219,16 +219,17 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `security` | [operations.ListModelsUserSecurity](../../operations/listmodelsusersecurity.mdx) | ✅ | N/A | | -| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | -| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `offset` | *OptionalNullable[int]* | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | -| `limit` | *Optional[int]* | ➖ | Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned | 500 | -| `output_modalities` | *Optional[str]* | ➖ | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text". | text | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `security` | [operations.ListModelsUserSecurity](../../operations/listmodelsusersecurity.mdx) | ✅ | N/A | | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *OptionalNullable[int]* | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | +| `limit` | *Optional[int]* | ➖ | Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned | 500 | +| `output_modalities` | *Optional[str]* | ➖ | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text". | text | +| `sort` | [Optional[operations.ListModelsUserSort]](../../operations/listmodelsusersort.mdx) | ➖ | Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. | newest | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/pyproject.toml b/pyproject.toml index 50f35b308..96d4e82b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.59" +version = "1.3.60" 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 74ee8fbdb..2b7810548 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.59" +__version__: str = "1.3.60" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.3.59 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.60 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/models_.py b/src/openrouter/models_.py index e16291f98..5b22dc33e 100644 --- a/src/openrouter/models_.py +++ b/src/openrouter/models_.py @@ -1077,6 +1077,7 @@ def list_for_user( offset: OptionalNullable[int] = 0, limit: Optional[int] = 500, output_modalities: Optional[str] = None, + sort: Optional[operations.ListModelsUserSort] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -1097,6 +1098,7 @@ def list_for_user( :param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned :param limit: Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or \"all\" to include all models. Defaults to \"text\". + :param sort: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. :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 @@ -1119,6 +1121,7 @@ def list_for_user( offset=offset, limit=limit, output_modalities=output_modalities, + sort=sort, ) req = self._build_request( @@ -1195,6 +1198,7 @@ def next_func() -> Optional[operations.ListModelsUserResponse]: offset=next_offset, limit=limit, output_modalities=output_modalities, + sort=sort, retries=retries, server_url=server_url, timeout_ms=timeout_ms, @@ -1253,6 +1257,7 @@ async def list_for_user_async( offset: OptionalNullable[int] = 0, limit: Optional[int] = 500, output_modalities: Optional[str] = None, + sort: Optional[operations.ListModelsUserSort] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -1273,6 +1278,7 @@ async def list_for_user_async( :param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned :param limit: Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or \"all\" to include all models. Defaults to \"text\". + :param sort: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. :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 @@ -1295,6 +1301,7 @@ async def list_for_user_async( offset=offset, limit=limit, output_modalities=output_modalities, + sort=sort, ) req = self._build_request_async( @@ -1374,6 +1381,7 @@ async def empty_result(): offset=next_offset, limit=limit, output_modalities=output_modalities, + sort=sort, retries=retries, server_url=server_url, timeout_ms=timeout_ms, diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index f4753e5e0..1370bf741 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -857,6 +857,7 @@ ListModelsUserResponseTypedDict, ListModelsUserSecurity, ListModelsUserSecurityTypedDict, + ListModelsUserSort, ) from .listoauthjwks import ( ListOauthJwksGlobals, @@ -1791,6 +1792,7 @@ "ListModelsUserResponseTypedDict", "ListModelsUserSecurity", "ListModelsUserSecurityTypedDict", + "ListModelsUserSort", "ListOauthJwksGlobals", "ListOauthJwksGlobalsTypedDict", "ListOauthJwksRequest", @@ -2689,6 +2691,7 @@ "ListModelsUserResponseTypedDict": ".listmodelsuser", "ListModelsUserSecurity": ".listmodelsuser", "ListModelsUserSecurityTypedDict": ".listmodelsuser", + "ListModelsUserSort": ".listmodelsuser", "ListOauthJwksGlobals": ".listoauthjwks", "ListOauthJwksGlobalsTypedDict": ".listoauthjwks", "ListOauthJwksRequest": ".listoauthjwks", diff --git a/src/openrouter/operations/listmodelsuser.py b/src/openrouter/operations/listmodelsuser.py index 915aa93c1..0d87be124 100644 --- a/src/openrouter/operations/listmodelsuser.py +++ b/src/openrouter/operations/listmodelsuser.py @@ -2,7 +2,13 @@ from __future__ import annotations from openrouter.components import modelslistresponse as components_modelslistresponse -from openrouter.types import BaseModel, Nullable, OptionalNullable, UNSET_SENTINEL +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET_SENTINEL, + UnrecognizedStr, +) from openrouter.utils import ( FieldMetadata, HeaderMetadata, @@ -11,7 +17,7 @@ ) import pydantic from pydantic import model_serializer -from typing import Awaitable, Callable, Optional, Union +from typing import Awaitable, Callable, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict @@ -97,6 +103,26 @@ class ListModelsUserSecurity(BaseModel): ] +ListModelsUserSort = Union[ + Literal[ + "most-popular", + "newest", + "top-weekly", + "pricing-low-to-high", + "pricing-high-to-low", + "context-high-to-low", + "throughput-high-to-low", + "latency-low-to-high", + "intelligence-high-to-low", + "coding-high-to-low", + "agentic-high-to-low", + "design-arena-elo-high-to-low", + ], + UnrecognizedStr, +] +r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.""" + + class ListModelsUserRequestTypedDict(TypedDict): http_referer: NotRequired[str] r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -117,6 +143,8 @@ class ListModelsUserRequestTypedDict(TypedDict): r"""Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned""" output_modalities: NotRequired[str] r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or \"all\" to include all models. Defaults to \"text\".""" + sort: NotRequired[ListModelsUserSort] + r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.""" class ListModelsUserRequest(BaseModel): @@ -166,6 +194,12 @@ class ListModelsUserRequest(BaseModel): ] = None r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or \"all\" to include all models. Defaults to \"text\".""" + sort: Annotated[ + Optional[ListModelsUserSort], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( @@ -176,6 +210,7 @@ def serialize_model(self, handler): "offset", "limit", "output_modalities", + "sort", ] ) nullable_fields = set(["offset"]) diff --git a/uv.lock b/uv.lock index 60c7c9631..5bd29657b 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.59" +version = "1.3.60" source = { editable = "." } dependencies = [ { name = "httpcore" },