From 5ecaf343bbd2a98ad59309606e021aa07bf8a637 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Tue, 1 Dec 2026 16:47:25 +0000 Subject: [PATCH] ## Python SDK Changes: * `open_router.alpha.decisions.create()`: * `request.provider.tee` **Added** * `open_router.alpha.extractions.create()`: * `request.provider.tee` **Added** * `open_router.embeddings.generate()`: * `request.provider.tee` **Added** * `open_router.embeddings.list_models()`: `response.data[]` **Changed** * `open_router.presets.create_presets_chat_completions()`: * `request.provider.tee` **Added** * `open_router.presets.create_presets_messages()`: * `request.provider.tee` **Added** * `open_router.presets.create_presets_responses()`: * `request.provider.tee` **Added** * `open_router.rerank.rerank()`: * `request.provider.tee` **Added** * `open_router.system_one.create()`: * `request.provider.tee` **Added** --- .speakeasy/gen.lock | 73 ++++--- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 151 +++++++++++++- .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/components/embeddingsmodel.mdx | 34 +++ .../embeddingsmodelslistresponse.mdx | 14 ++ .../embeddingsmodelslistresponselinks.mdx | 12 ++ docs/components/providerpreferences.mdx | 1 + .../listembeddingsmodelsresponse.mdx | 6 +- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 19 ++ src/openrouter/components/embeddingsmodel.py | 196 ++++++++++++++++++ .../embeddingsmodelslistresponse.py | 60 ++++++ .../components/providerpreferences.py | 7 + src/openrouter/embeddings.py | 8 +- .../operations/listembeddingsmodels.py | 10 +- uv.lock | 2 +- 19 files changed, 574 insertions(+), 49 deletions(-) create mode 100644 docs/components/embeddingsmodel.mdx create mode 100644 docs/components/embeddingsmodelslistresponse.mdx create mode 100644 docs/components/embeddingsmodelslistresponselinks.mdx create mode 100644 src/openrouter/components/embeddingsmodel.py create mode 100644 src/openrouter/components/embeddingsmodelslistresponse.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index c4e149a44..2d2f03412 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: 62e79d33460be6f895c8279c5dab694d + docChecksum: 42a7341864f1f9e1b5c719418e673c09 docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.3.221 - configChecksum: 919cb7cf8a9fed18e3c5f3d11ebe8d22 + releaseVersion: 1.3.222 + configChecksum: 346e7c95ab513ac15633e7252ee9b988 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 73dd1646-9619-4ee6-938e-4e5921f05df0 - pristine_commit_hash: 5f1afca572e00380e737415a884488637b794750 - pristine_tree_hash: 7a5fd61338e2832d33b3e4853944ed6a126fe7cd + generation_id: 00cec704-5439-4433-81e9-3ac6505340ce + pristine_commit_hash: 5c4cff4d7439bcdbae98e1266c015e5fb7dd6e8e + pristine_tree_hash: 84c880143b9ec22f749fba37a24ec96078023bcf features: python: acceptHeaders: 3.0.0 @@ -3386,6 +3386,18 @@ trackedFiles: id: 71ed622a2f4d last_write_checksum: sha1:dd0d3e3a74300f11e36f91ba650e17dfe27036fd pristine_git_object: 5b155412cf75006c71e148911d0df802c4861c91 + docs/components/embeddingsmodel.mdx: + id: f9789baaa109 + last_write_checksum: sha1:95ed4b5f9ba1f6d7423a99550984c032e60c8d9b + pristine_git_object: 1488309125cfc0f8c45bcbd10b95f2b93d204909 + docs/components/embeddingsmodelslistresponse.mdx: + id: 1cba1ae05759 + last_write_checksum: sha1:85bac01fe19036801d0e8cc8759ae19b28472634 + pristine_git_object: 40c96d117b657df756cbe4023401f1cd8793c808 + docs/components/embeddingsmodelslistresponselinks.mdx: + id: 2211bacaa9fe + last_write_checksum: sha1:a58024d9e35df662d624ce394493d382d919c2ec + pristine_git_object: 7c0c1b6f26c5dcd1b18004122d4f76ff5bcb510e docs/components/endpoint.mdx: id: bab712ee633d last_write_checksum: sha1:37ef09040eb8a66cf924c237189de7778cfcfcb2 @@ -7776,8 +7788,8 @@ trackedFiles: pristine_git_object: f1955f5489d6b81cf05df12cb0c18d6ca0a16f6f docs/components/providerpreferences.mdx: id: adbdfaa46438 - last_write_checksum: sha1:40fb10dd3699ce5d6c8d6ccb257ae63ce9089277 - pristine_git_object: 8a0379d9d041acb6f0d8e04965d96f440ea90f15 + last_write_checksum: sha1:2303e8cee8a83b27cfda834a742ea5386577608a + pristine_git_object: 8242d6a7e1cc009e85e22ddea32f72e2efadbea0 docs/components/providerpreferencesignore.mdx: id: e0455b31c87b last_write_checksum: sha1:823f56c785a5c80949105fc0f4297a5b0ff2c2b2 @@ -11320,8 +11332,8 @@ trackedFiles: pristine_git_object: dd273ae5c90fb6a7e2ee5b9c1c72855027d4ff72 docs/operations/listembeddingsmodelsresponse.mdx: id: d07053bd83fc - last_write_checksum: sha1:d76daf886246d7c49480d52fa6e7634ed4d8b189 - pristine_git_object: baa3153745661216be4f6cfa1221783f924f7e80 + last_write_checksum: sha1:774e6b8ae3eaf28bc4ee5ff492897a7df9ad7ae2 + pristine_git_object: 3a388f99f4082fd76c24ef4a760443414c225544 docs/operations/listendpointsglobals.mdx: id: 12c08333c32c last_write_checksum: sha1:cf64976fc16ebfd8ec3f9d6215385d11b5dab8d8 @@ -12272,8 +12284,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:b2ec25e7294b8c44e097b64662f0e421a3acd309 - pristine_git_object: 3091edf7069b052f5c0fdabbf77fdb3825e387b6 + last_write_checksum: sha1:9ae391f97e2f8a2db89319d9e8fece71cf2cda18 + pristine_git_object: b8d3d18b773d8e19ffcb9788b4459dff15853ed5 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -12300,8 +12312,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:d068ab3156eac011948cfa37e561750d72092d0a - pristine_git_object: 0d900a872ab3d585d6c0dc0a3dba42540b68e4fd + last_write_checksum: sha1:638b7b5eeb839038f7c07920563fb79963d6a12c + pristine_git_object: e255a0a06c83b2331aad2b0a5ab98a04bb6acf0b src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766 @@ -12348,8 +12360,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:558f464706d541484dc6d70b547652f97cad4e4d - pristine_git_object: 5f2f0c2f15c70ad6111e1ebe4685f19381980eb5 + last_write_checksum: sha1:84a75702011da25b57f6a15c1ed3a79bf1fb8912 + pristine_git_object: 5d32eb5285f4b58e9c8b86254d1e3b65382302b8 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:08125e1d60df82793e11e8aed6e3c9fdb7512ebb @@ -13790,6 +13802,14 @@ trackedFiles: id: 81553b79cc50 last_write_checksum: sha1:f952180280fef71fe3fac4e41ba122af3b931f12 pristine_git_object: ade9cf4cc5e9473f422f8d873b30bb44e0d273b0 + src/openrouter/components/embeddingsmodel.py: + id: 56d48d27ed7c + last_write_checksum: sha1:4031aa1a737e06ef8ae227ef0f7e770dc92f19f5 + pristine_git_object: 1349d4f684c5a5613aee958b4ba68315564a2554 + src/openrouter/components/embeddingsmodelslistresponse.py: + id: 8a70952385cd + last_write_checksum: sha1:d6f04e55b82cbfcdca9eacc565c03f0a216075f8 + pristine_git_object: f81874f0d727380767e94f663fb942f9416b9642 src/openrouter/components/endpointinfo.py: id: ce049670b5ae last_write_checksum: sha1:914f173c73fe1035e56c9acf4ad9e23555bde95a @@ -15392,8 +15412,8 @@ trackedFiles: pristine_git_object: abe660d025957d61f68148006ca2c6efdc6b13a8 src/openrouter/components/providerpreferences.py: id: cdd58c8d664d - last_write_checksum: sha1:01517a1df56864c2b6f3845e9e17c1768c59de65 - pristine_git_object: 3ca57868fa02b7f5e4cd2c0fb0fbf0c6a92a8bee + last_write_checksum: sha1:93f13e4e046bb1ae224c587073c6f45bb4eadd8e + pristine_git_object: e03e30e1bd6dec0159f2e751ad2e9cb619a168df src/openrouter/components/providerresponse.py: id: ad3887be54c5 last_write_checksum: sha1:8a37a635ece4f261e006e9a45a622cd6523b1c5e @@ -16336,8 +16356,8 @@ trackedFiles: pristine_git_object: 86c90d5988c391d0f0d52d29f8f01139eb4d26ae src/openrouter/embeddings.py: id: 0374ace39067 - last_write_checksum: sha1:76c14bf1233a2e4c06582791a89976bbf2f0f579 - pristine_git_object: 2263922e5b202354a7a6979f4b0d6445c5900522 + last_write_checksum: sha1:723bcc5b35691800921b052343e16ecdb86c9eda + pristine_git_object: bafd6d09ab23d03b9dc55d876885b35ea75ffbca src/openrouter/endpoints.py: id: 465bbf2b7939 last_write_checksum: sha1:0632be9f0f9b0bc8a282a5840a759d7a2833c645 @@ -16956,8 +16976,8 @@ trackedFiles: pristine_git_object: 66670139b6cee0fe41d3aeac9ad1be9671f2b501 src/openrouter/operations/listembeddingsmodels.py: id: bf749a1f23d6 - last_write_checksum: sha1:938440c9b9df0c3d8430792f262bffced0207d13 - pristine_git_object: 822451956b9434ae27d4195621be0ba3718eb176 + last_write_checksum: sha1:e7d73cc16cdb10bf4b6ca61eebd7cc7996605a7a + pristine_git_object: aafcb6752fdd8e6133026dc6e602682280392d65 src/openrouter/operations/listendpoints.py: id: 62b7a5f21dec last_write_checksum: sha1:1aa9ca7cc8e0376cc77fe81403e2664ecbd1abb2 @@ -17546,7 +17566,7 @@ examples: limit: 500 responses: "200": - application/json: {"data": [{"architecture": {"input_modalities": ["text"], "modality": "text->text", "output_modalities": ["text"]}, "canonical_slug": "openai/gpt-4", "context_length": 8192, "created": 1692901234, "default_parameters": null, "endpoints": ["/api/v1/chat/completions", "/api/v1/completions", "/api/v1/messages", "/api/v1/responses"], "id": "openai/gpt-4", "links": {"details": "/api/v1/models/openai/gpt-4/endpoints"}, "name": "GPT-4", "per_request_limits": null, "pricing": {"completion": "0.00006", "prompt": "0.00003"}, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "supported_voices": null, "top_provider": {"is_moderated": true}}], "links": {"next": "/api/v1/models?offset=500&limit=500"}, "total_count": 150} + application/json: {"data": [{"architecture": {"input_modalities": ["text"], "modality": "text->embeddings", "output_modalities": ["embeddings"]}, "canonical_slug": "openai/text-embedding-3-small", "context_length": 8192, "created": 1692901234, "default_parameters": null, "endpoints": ["/api/v1/embeddings"], "id": "openai/text-embedding-3-small", "links": {"details": "/api/v1/models/openai/text-embedding-3-small/endpoints"}, "name": "Text Embedding 3 Small", "per_request_limits": null, "pricing": {"completion": "0", "prompt": "0.00000002"}, "supported_parameters": [], "supported_voices": null, "top_provider": {"is_moderated": false}}], "links": {"next": null}, "total_count": 1} "400": application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "500": @@ -22497,9 +22517,4 @@ examples: "500": application/json: {"error": {"code": 400, "message": "custom_id is required on requests[0]."}} examplesVersion: 1.0.2 -releaseNotes: | - ## Python SDK Changes: - * `open_router.images.list_models()`: `response.data[]` **Changed** - * `open_router.images.list_model_endpoints()`: `response.endpoints[]` **Changed** - * `open_router.organization.list_members()`: `response.data[].external_id` **Added** - * `open_router.video_generation.list_videos_models()`: `response.data[]` **Changed** +releaseNotes: "## Python SDK Changes:\n* `open_router.alpha.decisions.create()`: \n * `request.provider.tee` **Added**\n* `open_router.alpha.extractions.create()`: \n * `request.provider.tee` **Added**\n* `open_router.embeddings.generate()`: \n * `request.provider.tee` **Added**\n* `open_router.embeddings.list_models()`: `response.data[]` **Changed**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.provider.tee` **Added**\n* `open_router.presets.create_presets_messages()`: \n * `request.provider.tee` **Added**\n* `open_router.presets.create_presets_responses()`: \n * `request.provider.tee` **Added**\n* `open_router.rerank.rerank()`: \n * `request.provider.tee` **Added**\n* `open_router.system_one.create()`: \n * `request.provider.tee` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index a799675a4..d25ec9739 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.221 + version: 1.3.222 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 87489d3c4..eb2f31b07 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -13009,6 +13009,135 @@ components: - 'throughput' - 'request_count' type: 'object' + EmbeddingsModel: + allOf: + - $ref: '#/components/schemas/Model' + - properties: + input_modalities: + description: 'Typed inputs the model accepts, following the Models API V2 document. The text input carries the context length.' + items: + $ref: '#/components/schemas/ModelInputModalityV2' + minItems: 1 + type: 'array' + output_modalities: + description: 'Typed outputs with the request fields each accepts, following the Models API V2 document. Pricing stays in `pricing`.' + items: + $ref: '#/components/schemas/ModelOutputModalityV2' + minItems: 1 + type: 'array' + type: 'object' + description: 'An embeddings model available on OpenRouter' + example: + architecture: + input_modalities: + - 'text' + instruct_type: null + modality: 'text->embeddings' + output_modalities: + - 'embeddings' + tokenizer: 'GPT' + canonical_slug: 'openai/text-embedding-3-small' + context_length: 8192 + created: 1692901234 + default_parameters: null + description: 'OpenAI text embedding model optimized for performance.' + endpoints: + - '/api/v1/embeddings' + expiration_date: null + id: 'openai/text-embedding-3-small' + input_modalities: + - supported_inputs: + max_context_length: + unit: 'token' + value: 8192 + type: 'text' + knowledge_cutoff: null + links: + details: '/api/v1/models/openai/text-embedding-3-small/endpoints' + name: 'Text Embedding 3 Small' + output_modalities: + - supported_parameters: + encoding_format: + type: 'enum' + values: + - 'float' + - 'base64' + type: 'embeddings' + per_request_limits: null + pricing: + completion: '0' + image: '0' + prompt: '0.00000002' + request: '0' + supported_parameters: [] + supported_voices: null + top_provider: + context_length: 8192 + is_moderated: false + max_completion_tokens: null + EmbeddingsModelsListResponse: + allOf: + - $ref: '#/components/schemas/ModelsListResponse' + - properties: + data: + description: 'List of embeddings models' + items: + $ref: '#/components/schemas/EmbeddingsModel' + type: 'array' + type: 'object' + description: 'List of embeddings models available through the embeddings API' + example: + data: + - architecture: + input_modalities: + - 'text' + instruct_type: null + modality: 'text->embeddings' + output_modalities: + - 'embeddings' + tokenizer: 'GPT' + canonical_slug: 'openai/text-embedding-3-small' + context_length: 8192 + created: 1692901234 + default_parameters: null + description: 'OpenAI text embedding model optimized for performance.' + endpoints: + - '/api/v1/embeddings' + expiration_date: null + id: 'openai/text-embedding-3-small' + input_modalities: + - supported_inputs: + max_context_length: + unit: 'token' + value: 8192 + type: 'text' + knowledge_cutoff: null + links: + details: '/api/v1/models/openai/text-embedding-3-small/endpoints' + name: 'Text Embedding 3 Small' + output_modalities: + - supported_parameters: + encoding_format: + type: 'enum' + values: + - 'float' + - 'base64' + type: 'embeddings' + per_request_limits: null + pricing: + completion: '0' + image: '0' + prompt: '0.00000002' + request: '0' + supported_parameters: [] + supported_voices: null + top_provider: + context_length: 8192 + is_moderated: false + max_completion_tokens: null + links: + next: null + total_count: 1 EndpointInfo: example: model: 'openai/gpt-4o' @@ -32827,6 +32956,12 @@ components: - type: 'null' description: 'The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.' example: 'price' + tee: + description: 'Whether to restrict routing to TEE endpoints, where the request is encrypted to a key held inside the provider enclave. When true, only TEE endpoints will be used.' + example: true + type: + - 'boolean' + - 'null' zdr: description: 'Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.' example: true @@ -47438,10 +47573,24 @@ paths: - '/api/v1/embeddings' expiration_date: null id: 'openai/text-embedding-3-small' + input_modalities: + - supported_inputs: + max_context_length: + unit: 'token' + value: 8192 + type: 'text' knowledge_cutoff: null links: details: '/api/v1/models/openai/text-embedding-3-small/endpoints' name: 'Text Embedding 3 Small' + output_modalities: + - supported_parameters: + encoding_format: + type: 'enum' + values: + - 'float' + - 'base64' + type: 'embeddings' per_request_limits: null pricing: completion: '0' @@ -47455,7 +47604,7 @@ paths: is_moderated: false max_completion_tokens: null schema: - $ref: '#/components/schemas/ModelsListResponse' + $ref: '#/components/schemas/EmbeddingsModelsListResponse' description: 'Returns a list of embeddings models' '400': content: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index bde279006..4b3869121 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.803.2 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:6023b2ffbbb02de7eed5d53a2a69217d5309cbc6fe7c835496d2649e97d68aad - sourceBlobDigest: sha256:c52375a0046e45779007eee6366e39f450a8b059ac7451c0c89e4c467291fe30 + sourceRevisionDigest: sha256:f5e30b08e463001f34df8f5b532c086a2038b761418054ca65f9a6d467a85da7 + sourceBlobDigest: sha256:5bc50c4d526cc0b5d500c62ef21ad2873f40f9e2c455663973c711d45229f9d7 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:6023b2ffbbb02de7eed5d53a2a69217d5309cbc6fe7c835496d2649e97d68aad - sourceBlobDigest: sha256:c52375a0046e45779007eee6366e39f450a8b059ac7451c0c89e4c467291fe30 + sourceRevisionDigest: sha256:f5e30b08e463001f34df8f5b532c086a2038b761418054ca65f9a6d467a85da7 + sourceBlobDigest: sha256:5bc50c4d526cc0b5d500c62ef21ad2873f40f9e2c455663973c711d45229f9d7 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:80a9645aa2e57ec13de000a342f6762abfa528db38ea003baaf4e371ce57225b + codeSamplesRevisionDigest: sha256:312ff18be74643deb1643b09af308af82e4974687b99493e20d091ead1ed2750 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index 58ec26487..59633be23 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4979,4 +4979,14 @@ Based on: ### Generated - [python v1.3.221] . ### Releases -- [PyPI v1.3.221] https://pypi.org/project/openrouter/1.3.221 - . \ No newline at end of file +- [PyPI v1.3.221] https://pypi.org/project/openrouter/1.3.221 - . + +## 2026-12-01 16:44:16 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.222] . +### Releases +- [PyPI v1.3.222] https://pypi.org/project/openrouter/1.3.222 - . \ No newline at end of file diff --git a/docs/components/embeddingsmodel.mdx b/docs/components/embeddingsmodel.mdx new file mode 100644 index 000000000..148830912 --- /dev/null +++ b/docs/components/embeddingsmodel.mdx @@ -0,0 +1,34 @@ +--- +title: "EmbeddingsModel" +--- + +An embeddings model available on OpenRouter + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `alias_target` | [Optional[components.ModelAliasTarget]](../components/modelaliastarget.mdx) | ➖ | Concrete model targeted by this tilde-latest alias, when applicable | \{
"name": "Claude Sonnet 4.5",
"slug": "anthropic/claude-sonnet-4.5"
} | +| `architecture` | [components.ModelArchitecture](../components/modelarchitecture.mdx) | ✔️ | Model architecture information | \{
"input_modalities": [
"text"
],
"instruct_type": "chatml",
"modality": "text-\u003etext",
"output_modalities": [
"text"
],
"tokenizer": "GPT"
} | +| `benchmarks` | [Optional[components.ModelBenchmarks]](../components/modelbenchmarks.mdx) | ➖ | Third-party benchmark rankings for this model. Omitted when no benchmark data is available. | \{
"artificial_analysis": \{
"agentic_index": null,
"coding_index": null,
"cyber_index": 36.4,
"decision_index": 75.7,
"economics_index": 57.2,
"engineering_index": 60.4,
"finance_and_accounting_index": 58.1,
"healthcare_and_medical_index": 56.9,
"intelligence_index": 71.4,
"legal_index": 52.3,
"multilingual_index": 0.82,
"openness_index": 33.3,
"strategy_and_ops_index": 61.7
},
"design_arena": [
\{
"arena": "models",
"category": "website",
"elo": 1385.2,
"rank": 5,
"win_rate": 62.5
}
]
} | +| `canonical_slug` | *str* | ✔️ | Canonical slug for the model | openai/gpt-4 | +| `context_length` | *Nullable[int]* | ✔️ | Maximum context length in tokens | 8192 | +| `created` | *int* | ✔️ | Unix timestamp of when the model was created | 1692901234 | +| `default_parameters` | [Nullable[components.DefaultParameters]](../components/defaultparameters.mdx) | ✔️ | Default parameters for this model | \{
"frequency_penalty": 0,
"presence_penalty": 0,
"repetition_penalty": 1,
"temperature": 0.7,
"top_k": 0,
"top_p": 0.9
} | +| `description` | *Optional[str]* | ➖ | Description of the model | GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. | +| `endpoints` | List[*str*] | ✔️ | Request API paths that serve this model, derived from the same modality and adapter rules the routers use. A model served only through an alpha surface lists only that path. | [
"/api/v1/chat/completions",
"/api/v1/completions",
"/api/v1/messages",
"/api/v1/responses"
] | +| `expiration_date` | *OptionalNullable[str]* | ➖ | The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration. | 2025-06-01 | +| `hugging_face_id` | *OptionalNullable[str]* | ➖ | Hugging Face model identifier, if applicable | microsoft/DialoGPT-medium | +| `id` | *str* | ✔️ | Unique identifier for the model | openai/gpt-4 | +| `knowledge_cutoff` | *OptionalNullable[str]* | ➖ | The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown. | 2024-10-01 | +| `links` | [components.ModelLinks](../components/modellinks.mdx) | ✔️ | Related API endpoints and resources for this model. | \{
"details": "/api/v1/models/openai/gpt-5.4/endpoints"
} | +| `name` | *str* | ✔️ | Display name of the model | GPT-4 | +| `per_request_limits` | [Nullable[components.PerRequestLimits]](../components/perrequestlimits.mdx) | ✔️ | Per-request token limits | \{
"completion_tokens": 1000,
"prompt_tokens": 1000
} | +| `pricing` | [components.PublicPricing](../components/publicpricing.mdx) | ✔️ | Pricing information for the model | \{
"completion": "0.00006",
"image": "0",
"prompt": "0.00003",
"request": "0"
} | +| `reasoning` | [Optional[components.ModelReasoning]](../components/modelreasoning.mdx) | ➖ | Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models. | \{
"default_effort": "medium",
"default_enabled": true,
"mandatory": false,
"supported_efforts": [
"high",
"medium",
"low",
"minimal"
]
} | +| `supported_parameters` | List[[components.Parameter](../components/parameter.mdx)] | ✔️ | List of supported parameters for this model | | +| `supported_voices` | List[*str*] | ✔️ | List of supported voice identifiers for TTS models. Null for non-TTS models. | null | +| `top_provider` | [components.TopProviderInfo](../components/topproviderinfo.mdx) | ✔️ | Information about the top provider for this model | \{
"context_length": 8192,
"is_moderated": true,
"max_completion_tokens": 4096
} | +| `input_modalities` | List[[components.ModelInputModalityV2](../components/modelinputmodalityv2.mdx)] | ➖ | Typed inputs the model accepts, following the Models API V2 document. The text input carries the context length. | | +| `output_modalities` | List[[components.ModelOutputModalityV2](../components/modeloutputmodalityv2.mdx)] | ➖ | Typed outputs with the request fields each accepts, following the Models API V2 document. Pricing stays in `pricing`. | | \ No newline at end of file diff --git a/docs/components/embeddingsmodelslistresponse.mdx b/docs/components/embeddingsmodelslistresponse.mdx new file mode 100644 index 000000000..40c96d117 --- /dev/null +++ b/docs/components/embeddingsmodelslistresponse.mdx @@ -0,0 +1,14 @@ +--- +title: "EmbeddingsModelsListResponse" +--- + +List of embeddings models available through the embeddings API + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `data` | List[[components.EmbeddingsModel](../components/embeddingsmodel.mdx)] | ✔️ | List of embeddings models | | +| `links` | [components.EmbeddingsModelsListResponseLinks](../components/embeddingsmodelslistresponselinks.mdx) | ✔️ | Pagination links | | +| `total_count` | *int* | ✔️ | Total number of models matching the query | 150 | \ No newline at end of file diff --git a/docs/components/embeddingsmodelslistresponselinks.mdx b/docs/components/embeddingsmodelslistresponselinks.mdx new file mode 100644 index 000000000..7c0c1b6f2 --- /dev/null +++ b/docs/components/embeddingsmodelslistresponselinks.mdx @@ -0,0 +1,12 @@ +--- +title: "EmbeddingsModelsListResponseLinks" +--- + +Pagination links + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `next` | *Nullable[str]* | ✔️ | URL for the next page of results, or null if this is the last page | /api/v1/models?offset=500&limit=500 | \ No newline at end of file diff --git a/docs/components/providerpreferences.mdx b/docs/components/providerpreferences.mdx index 8a0379d9d..8242d6a7e 100644 --- a/docs/components/providerpreferences.mdx +++ b/docs/components/providerpreferences.mdx @@ -22,4 +22,5 @@ Provider routing preferences for the request. | `quantizations` | List[[components.Quantization](../components/quantization.mdx)] | ➖ | A list of quantization levels to filter the provider by. | | | `require_parameters` | *OptionalNullable[bool]* | ➖ | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. | | | `sort` | [OptionalNullable[components.ProviderPreferencesSort]](../components/providerpreferencessort.mdx) | ➖ | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price | +| `tee` | *OptionalNullable[bool]* | ➖ | Whether to restrict routing to TEE endpoints, where the request is encrypted to a key held inside the provider enclave. When true, only TEE endpoints will be used. | true | | `zdr` | *OptionalNullable[bool]* | ➖ | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true | \ No newline at end of file diff --git a/docs/operations/listembeddingsmodelsresponse.mdx b/docs/operations/listembeddingsmodelsresponse.mdx index baa315374..3a388f99f 100644 --- a/docs/operations/listembeddingsmodelsresponse.mdx +++ b/docs/operations/listembeddingsmodelsresponse.mdx @@ -4,6 +4,6 @@ title: "ListEmbeddingsModelsResponse" ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `result` | [components.ModelsListResponse](../components/modelslistresponse.mdx) | ✔️ | N/A | \{
"data": [
\{
"architecture": \{
"input_modalities": [
"text"
],
"instruct_type": "chatml",
"modality": "text-\u003etext",
"output_modalities": [
"text"
],
"tokenizer": "GPT"
},
"canonical_slug": "openai/gpt-4",
"context_length": 8192,
"created": 1692901234,
"default_parameters": null,
"description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.",
"expiration_date": null,
"id": "openai/gpt-4",
"knowledge_cutoff": null,
"links": \{
"details": "/api/v1/models/openai/gpt-4/endpoints"
},
"name": "GPT-4",
"per_request_limits": null,
"pricing": \{
"completion": "0.00006",
"image": "0",
"prompt": "0.00003",
"request": "0"
},
"supported_parameters": [
"temperature",
"top_p",
"max_tokens",
"frequency_penalty",
"presence_penalty"
],
"supported_voices": null,
"top_provider": \{
"context_length": 8192,
"is_moderated": true,
"max_completion_tokens": 4096
}
}
],
"links": \{
"next": "/api/v1/models?offset=500\u0026limit=500"
},
"total_count": 150
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `result` | [components.EmbeddingsModelsListResponse](../components/embeddingsmodelslistresponse.mdx) | ✔️ | N/A | \{
"data": [
\{
"architecture": \{
"input_modalities": [
"text"
],
"instruct_type": null,
"modality": "text-\u003eembeddings",
"output_modalities": [
"embeddings"
],
"tokenizer": "GPT"
},
"canonical_slug": "openai/text-embedding-3-small",
"context_length": 8192,
"created": 1692901234,
"default_parameters": null,
"description": "OpenAI text embedding model optimized for performance.",
"endpoints": [
"/api/v1/embeddings"
],
"expiration_date": null,
"id": "openai/text-embedding-3-small",
"input_modalities": [
\{
"supported_inputs": \{
"max_context_length": \{
"unit": "token",
"value": 8192
}
},
"type": "text"
}
],
"knowledge_cutoff": null,
"links": \{
"details": "/api/v1/models/openai/text-embedding-3-small/endpoints"
},
"name": "Text Embedding 3 Small",
"output_modalities": [
\{
"supported_parameters": \{
"encoding_format": \{
"type": "enum",
"values": [
"float",
"base64"
]
}
},
"type": "embeddings"
}
],
"per_request_limits": null,
"pricing": \{
"completion": "0",
"image": "0",
"prompt": "0.00000002",
"request": "0"
},
"supported_parameters": [],
"supported_voices": null,
"top_provider": \{
"context_length": 8192,
"is_moderated": false,
"max_completion_tokens": null
}
}
],
"links": \{
"next": null
},
"total_count": 1
} | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 3091edf70..b8d3d18b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.221" +version = "1.3.222" 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 0d900a872..e255a0a06 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.221" +__version__: str = "1.3.222" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.950.13" -__user_agent__: str = "speakeasy-sdk/python 1.3.221 2.950.13 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.222 2.950.13 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 5f2f0c2f1..5d32eb528 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -1946,6 +1946,13 @@ EdgeNetworkTimeoutResponseErrorDataTypedDict, ) from .embeddings import Embeddings, EmbeddingsTypedDict + from .embeddingsmodel import EmbeddingsModel, EmbeddingsModelTypedDict + from .embeddingsmodelslistresponse import ( + EmbeddingsModelsListResponse, + EmbeddingsModelsListResponseLinks, + EmbeddingsModelsListResponseLinksTypedDict, + EmbeddingsModelsListResponseTypedDict, + ) from .endpointinfo import EndpointInfo, EndpointInfoTypedDict from .endpointsmetadata import EndpointsMetadata, EndpointsMetadataTypedDict from .endpointstatus import EndpointStatus @@ -6724,6 +6731,12 @@ "Embedding", "EmbeddingTypedDict", "Embeddings", + "EmbeddingsModel", + "EmbeddingsModelTypedDict", + "EmbeddingsModelsListResponse", + "EmbeddingsModelsListResponseLinks", + "EmbeddingsModelsListResponseLinksTypedDict", + "EmbeddingsModelsListResponseTypedDict", "EmbeddingsTypedDict", "Endpoint", "EndpointInfo", @@ -10732,6 +10745,12 @@ "EdgeNetworkTimeoutResponseErrorDataTypedDict": ".edgenetworktimeoutresponseerrordata", "Embeddings": ".embeddings", "EmbeddingsTypedDict": ".embeddings", + "EmbeddingsModel": ".embeddingsmodel", + "EmbeddingsModelTypedDict": ".embeddingsmodel", + "EmbeddingsModelsListResponse": ".embeddingsmodelslistresponse", + "EmbeddingsModelsListResponseLinks": ".embeddingsmodelslistresponse", + "EmbeddingsModelsListResponseLinksTypedDict": ".embeddingsmodelslistresponse", + "EmbeddingsModelsListResponseTypedDict": ".embeddingsmodelslistresponse", "EndpointInfo": ".endpointinfo", "EndpointInfoTypedDict": ".endpointinfo", "EndpointsMetadata": ".endpointsmetadata", diff --git a/src/openrouter/components/embeddingsmodel.py b/src/openrouter/components/embeddingsmodel.py new file mode 100644 index 000000000..1349d4f68 --- /dev/null +++ b/src/openrouter/components/embeddingsmodel.py @@ -0,0 +1,196 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .defaultparameters import DefaultParameters, DefaultParametersTypedDict +from .modelaliastarget import ModelAliasTarget, ModelAliasTargetTypedDict +from .modelarchitecture import ModelArchitecture, ModelArchitectureTypedDict +from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict +from .modelinputmodalityv2 import ModelInputModalityV2, ModelInputModalityV2TypedDict +from .modellinks import ModelLinks, ModelLinksTypedDict +from .modeloutputmodalityv2 import ModelOutputModalityV2, ModelOutputModalityV2TypedDict +from .modelreasoning import ModelReasoning, ModelReasoningTypedDict +from .parameter import Parameter +from .perrequestlimits import PerRequestLimits, PerRequestLimitsTypedDict +from .publicpricing import PublicPricing, PublicPricingTypedDict +from .topproviderinfo import TopProviderInfo, TopProviderInfoTypedDict +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict + + +class EmbeddingsModelTypedDict(TypedDict): + r"""An embeddings model available on OpenRouter""" + + architecture: ModelArchitectureTypedDict + r"""Model architecture information""" + canonical_slug: str + r"""Canonical slug for the model""" + context_length: Nullable[int] + r"""Maximum context length in tokens""" + created: int + r"""Unix timestamp of when the model was created""" + default_parameters: Nullable[DefaultParametersTypedDict] + r"""Default parameters for this model""" + endpoints: List[str] + r"""Request API paths that serve this model, derived from the same modality and adapter rules the routers use. A model served only through an alpha surface lists only that path.""" + id: str + r"""Unique identifier for the model""" + links: ModelLinksTypedDict + r"""Related API endpoints and resources for this model.""" + name: str + r"""Display name of the model""" + per_request_limits: Nullable[PerRequestLimitsTypedDict] + r"""Per-request token limits""" + pricing: PublicPricingTypedDict + r"""Pricing information for the model""" + supported_parameters: List[Parameter] + r"""List of supported parameters for this model""" + supported_voices: Nullable[List[str]] + r"""List of supported voice identifiers for TTS models. Null for non-TTS models.""" + top_provider: TopProviderInfoTypedDict + r"""Information about the top provider for this model""" + alias_target: NotRequired[ModelAliasTargetTypedDict] + r"""Concrete model targeted by this tilde-latest alias, when applicable""" + benchmarks: NotRequired[ModelBenchmarksTypedDict] + r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available.""" + description: NotRequired[str] + r"""Description of the model""" + expiration_date: NotRequired[Nullable[str]] + r"""The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration.""" + hugging_face_id: NotRequired[Nullable[str]] + r"""Hugging Face model identifier, if applicable""" + knowledge_cutoff: NotRequired[Nullable[str]] + r"""The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown.""" + reasoning: NotRequired[ModelReasoningTypedDict] + r"""Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models.""" + input_modalities: NotRequired[List[ModelInputModalityV2TypedDict]] + r"""Typed inputs the model accepts, following the Models API V2 document. The text input carries the context length.""" + output_modalities: NotRequired[List[ModelOutputModalityV2TypedDict]] + r"""Typed outputs with the request fields each accepts, following the Models API V2 document. Pricing stays in `pricing`.""" + + +class EmbeddingsModel(BaseModel): + r"""An embeddings model available on OpenRouter""" + + architecture: ModelArchitecture + r"""Model architecture information""" + + canonical_slug: str + r"""Canonical slug for the model""" + + context_length: Nullable[int] + r"""Maximum context length in tokens""" + + created: int + r"""Unix timestamp of when the model was created""" + + default_parameters: Nullable[DefaultParameters] + r"""Default parameters for this model""" + + endpoints: List[str] + r"""Request API paths that serve this model, derived from the same modality and adapter rules the routers use. A model served only through an alpha surface lists only that path.""" + + id: str + r"""Unique identifier for the model""" + + links: ModelLinks + r"""Related API endpoints and resources for this model.""" + + name: str + r"""Display name of the model""" + + per_request_limits: Nullable[PerRequestLimits] + r"""Per-request token limits""" + + pricing: PublicPricing + r"""Pricing information for the model""" + + supported_parameters: List[Parameter] + r"""List of supported parameters for this model""" + + supported_voices: Nullable[List[str]] + r"""List of supported voice identifiers for TTS models. Null for non-TTS models.""" + + top_provider: TopProviderInfo + r"""Information about the top provider for this model""" + + alias_target: Optional[ModelAliasTarget] = None + r"""Concrete model targeted by this tilde-latest alias, when applicable""" + + benchmarks: Optional[ModelBenchmarks] = None + r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available.""" + + description: Optional[str] = None + r"""Description of the model""" + + expiration_date: OptionalNullable[str] = UNSET + r"""The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration.""" + + hugging_face_id: OptionalNullable[str] = UNSET + r"""Hugging Face model identifier, if applicable""" + + knowledge_cutoff: OptionalNullable[str] = UNSET + r"""The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown.""" + + reasoning: Optional[ModelReasoning] = None + r"""Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models.""" + + input_modalities: Optional[List[ModelInputModalityV2]] = None + r"""Typed inputs the model accepts, following the Models API V2 document. The text input carries the context length.""" + + output_modalities: Optional[List[ModelOutputModalityV2]] = None + r"""Typed outputs with the request fields each accepts, following the Models API V2 document. Pricing stays in `pricing`.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "alias_target", + "benchmarks", + "description", + "expiration_date", + "hugging_face_id", + "knowledge_cutoff", + "reasoning", + "input_modalities", + "output_modalities", + ] + ) + nullable_fields = set( + [ + "context_length", + "default_parameters", + "expiration_date", + "hugging_face_id", + "knowledge_cutoff", + "per_request_limits", + "supported_voices", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/src/openrouter/components/embeddingsmodelslistresponse.py b/src/openrouter/components/embeddingsmodelslistresponse.py new file mode 100644 index 000000000..f81874f0d --- /dev/null +++ b/src/openrouter/components/embeddingsmodelslistresponse.py @@ -0,0 +1,60 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .embeddingsmodel import EmbeddingsModel, EmbeddingsModelTypedDict +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List +from typing_extensions import TypedDict + + +class EmbeddingsModelsListResponseLinksTypedDict(TypedDict): + r"""Pagination links""" + + next: Nullable[str] + r"""URL for the next page of results, or null if this is the last page""" + + +class EmbeddingsModelsListResponseLinks(BaseModel): + r"""Pagination links""" + + next: Nullable[str] + r"""URL for the next page of results, or null if this is the last page""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m + + +class EmbeddingsModelsListResponseTypedDict(TypedDict): + r"""List of embeddings models available through the embeddings API""" + + data: List[EmbeddingsModelTypedDict] + r"""List of embeddings models""" + links: EmbeddingsModelsListResponseLinksTypedDict + r"""Pagination links""" + total_count: int + r"""Total number of models matching the query""" + + +class EmbeddingsModelsListResponse(BaseModel): + r"""List of embeddings models available through the embeddings API""" + + data: List[EmbeddingsModel] + r"""List of embeddings models""" + + links: EmbeddingsModelsListResponseLinks + r"""Pagination links""" + + total_count: int + r"""Total number of models matching the query""" diff --git a/src/openrouter/components/providerpreferences.py b/src/openrouter/components/providerpreferences.py index 3ca57868f..e03e30e1b 100644 --- a/src/openrouter/components/providerpreferences.py +++ b/src/openrouter/components/providerpreferences.py @@ -167,6 +167,8 @@ class ProviderPreferencesTypedDict(TypedDict): r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.""" sort: NotRequired[Nullable[ProviderPreferencesSortTypedDict]] r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" + tee: NotRequired[Nullable[bool]] + r"""Whether to restrict routing to TEE endpoints, where the request is encrypted to a key held inside the provider enclave. When true, only TEE endpoints will be used.""" zdr: NotRequired[Nullable[bool]] r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.""" @@ -221,6 +223,9 @@ class ProviderPreferences(BaseModel): sort: OptionalNullable[ProviderPreferencesSort] = UNSET r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" + tee: OptionalNullable[bool] = UNSET + r"""Whether to restrict routing to TEE endpoints, where the request is encrypted to a key held inside the provider enclave. When true, only TEE endpoints will be used.""" + zdr: OptionalNullable[bool] = UNSET r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.""" @@ -241,6 +246,7 @@ def serialize_model(self, handler): "quantizations", "require_parameters", "sort", + "tee", "zdr", ] ) @@ -257,6 +263,7 @@ def serialize_model(self, handler): "quantizations", "require_parameters", "sort", + "tee", "zdr", ] ) diff --git a/src/openrouter/embeddings.py b/src/openrouter/embeddings.py index 2263922e5..bafd6d09a 100644 --- a/src/openrouter/embeddings.py +++ b/src/openrouter/embeddings.py @@ -623,7 +623,9 @@ def next_func() -> Optional[operations.ListEmbeddingsModelsResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return operations.ListEmbeddingsModelsResponse( - result=unmarshal_json_response(components.ModelsListResponse, http_res), + result=unmarshal_json_response( + components.EmbeddingsModelsListResponse, http_res + ), next=next_func, ) if utils.match_response(http_res, "400", "application/json"): @@ -782,7 +784,9 @@ async def empty_result(): response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return operations.ListEmbeddingsModelsResponse( - result=unmarshal_json_response(components.ModelsListResponse, http_res), + result=unmarshal_json_response( + components.EmbeddingsModelsListResponse, http_res + ), next=next_func, ) if utils.match_response(http_res, "400", "application/json"): diff --git a/src/openrouter/operations/listembeddingsmodels.py b/src/openrouter/operations/listembeddingsmodels.py index 822451956..aafcb6752 100644 --- a/src/openrouter/operations/listembeddingsmodels.py +++ b/src/openrouter/operations/listembeddingsmodels.py @@ -1,7 +1,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from openrouter.components import modelslistresponse as components_modelslistresponse +from openrouter.components import ( + embeddingsmodelslistresponse as components_embeddingsmodelslistresponse, +) from openrouter.types import BaseModel, Nullable, OptionalNullable, UNSET_SENTINEL from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata import pydantic @@ -170,7 +172,9 @@ def serialize_model(self, handler): class ListEmbeddingsModelsResponseTypedDict(TypedDict): - result: components_modelslistresponse.ModelsListResponseTypedDict + result: ( + components_embeddingsmodelslistresponse.EmbeddingsModelsListResponseTypedDict + ) class ListEmbeddingsModelsResponse(BaseModel): @@ -179,4 +183,4 @@ class ListEmbeddingsModelsResponse(BaseModel): Callable[[], Awaitable[Optional[ListEmbeddingsModelsResponse]]], ] - result: components_modelslistresponse.ModelsListResponse + result: components_embeddingsmodelslistresponse.EmbeddingsModelsListResponse diff --git a/uv.lock b/uv.lock index 37fafc917..410a2dfc7 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.221" +version = "1.3.222" source = { editable = "." } dependencies = [ { name = "httpcore" },