diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 2d2f03412..82329db66 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: 42a7341864f1f9e1b5c719418e673c09 + docChecksum: e595ec329cbb42b8a7ec2bbb83f22d93 docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.3.222 - configChecksum: 346e7c95ab513ac15633e7252ee9b988 + releaseVersion: 1.3.223 + configChecksum: 2b103dd930f97c9a66c11cab9fb857b9 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 00cec704-5439-4433-81e9-3ac6505340ce - pristine_commit_hash: 5c4cff4d7439bcdbae98e1266c015e5fb7dd6e8e - pristine_tree_hash: 84c880143b9ec22f749fba37a24ec96078023bcf + generation_id: 5de0a3b6-15d9-4924-a13d-345a5bde0c4f + pristine_commit_hash: fcedc05c41b319620fe01557d5710498daf438c1 + pristine_tree_hash: 5f93a307a91cfb3c70d2e7baa84efe833ef76226 features: python: acceptHeaders: 3.0.0 @@ -8082,6 +8082,18 @@ trackedFiles: id: b011fb4a30ac last_write_checksum: sha1:c04836cd04951c2d9dbd99636d2e04f21ff2e8e2 pristine_git_object: 01829529ddd14c5f49352ce4ce8faaa3e6b8d351 + docs/components/rerankmodel.mdx: + id: dc873f339895 + last_write_checksum: sha1:39b9022e30e325b96f11a0d0768f781bb4efdcf7 + pristine_git_object: 803ef44ee4d187bf080781957bd3f0c3663092db + docs/components/rerankmodelslistresponse.mdx: + id: 1c2706f3e2e9 + last_write_checksum: sha1:83dae90de9d3a833c57b3e2bdc13d188552eabbc + pristine_git_object: 2d8f00592b7730b0449f9e381aa09d85fc970820 + docs/components/rerankmodelslistresponselinks.mdx: + id: f618cd04da2a + last_write_checksum: sha1:082aef7ef5e2f699078c7e6b56e6cd1ad5b3484f + pristine_git_object: 246923a25210f852ca38a2eb5849dd3287ee42e8 docs/components/responseformat.mdx: id: 9b8deacad550 last_write_checksum: sha1:fab329e55c5d5be71c187de6a2ca592d7c1c3e68 @@ -9226,6 +9238,18 @@ trackedFiles: id: 61aafb246ddf last_write_checksum: sha1:ef9b167ae4fe3626927c3f9f55ab58fcc76dbe8e pristine_git_object: 0902a9624d187709edd1462f64b7d143bdfd7586 + docs/components/transcriptionmodel.mdx: + id: c629fa476f52 + last_write_checksum: sha1:b943a39c7036ca1f067b89e0163d19ff7d0e4993 + pristine_git_object: c9661ee554d538b8347c0f880131f8121ea991b8 + docs/components/transcriptionmodelendpoint.mdx: + id: 668159ae6d23 + last_write_checksum: sha1:6af8f551067c6a2a5e662d151da2d52fe5dcb99e + pristine_git_object: 7058562adaf65718f84805085fb7eca9da5cd84b + docs/components/transcriptionmodelslistresponse.mdx: + id: 54cf46784968 + last_write_checksum: sha1:5c7b09b87fb1606bd58d500a1d9ea24aa268e307 + pristine_git_object: 95f57b852154e7917a340f6adb6aeaf69276acbe docs/components/trigger.mdx: id: a19ce9db8778 last_write_checksum: sha1:b5b28ed637f381b8778df75d590a6845b901adb7 @@ -11194,6 +11218,14 @@ trackedFiles: id: f3248505cd23 last_write_checksum: sha1:abc5b3e1c92a1f967872807cf25f25684df91759 pristine_git_object: ee9aac745f051e48bc602d2ae91b8950beedc21e + docs/operations/gettranscriptionmodelglobals.mdx: + id: b74fd4195159 + last_write_checksum: sha1:c62d505dc878a3cc396c9f0dbfefe18af63fa2ec + pristine_git_object: ea181391051a0daaf1faa3f683c07cd0ba1874e3 + docs/operations/gettranscriptionmodelrequest.mdx: + id: b1c34868e1c4 + last_write_checksum: sha1:530f59032b7126ee34173794142c3dc59684ed01 + pristine_git_object: 8713b46a85f77380e858c6f440e3078a66b48f88 docs/operations/getuseractivityglobals.mdx: id: 9cbf7459a650 last_write_checksum: sha1:83e832721460c1c9ffd65f0dd528001712d14055 @@ -11658,6 +11690,18 @@ trackedFiles: id: 2652e61cd671 last_write_checksum: sha1:f1ea9b33d6f13334132b5884c82034c9629413f6 pristine_git_object: 07e9fc86753b564074075a0781dc3acddf03f9ed + docs/operations/listrerankmodelsglobals.mdx: + id: e667ce591912 + last_write_checksum: sha1:fc694c61d0bb57cab54a8f04cead1eb740eff6ff + pristine_git_object: 9ccaf043d3c0c5603a324623455bd8d80bce7a79 + docs/operations/listrerankmodelsrequest.mdx: + id: 756c25879d8b + last_write_checksum: sha1:326117f45fbb9ad2cf6d1d793d542038773a1179 + pristine_git_object: 4a95ef8764604c40c007db2a3af2fd14d6341adc + docs/operations/listrerankmodelsresponse.mdx: + id: 402ee9867c04 + last_write_checksum: sha1:7fdc28ed3d08a4ec24ec28ce5f0e58e0e6ba2020 + pristine_git_object: 1574186cb927dc7653b169fc79d77227bed3707f docs/operations/listresponse.mdx: id: 0fbda0f81ae8 last_write_checksum: sha1:038d67577055fc228a26c28173b10968f116570a @@ -11710,6 +11754,14 @@ trackedFiles: id: 4f45e0e45460 last_write_checksum: sha1:47cc1f1d883f702ce4bf99aa31f8e1619338a86e pristine_git_object: bb4108aa1d553a538f3a3de3f178518e6452532a + docs/operations/listtranscriptionmodelsglobals.mdx: + id: 0d6c9141d2a1 + last_write_checksum: sha1:b981f74c20bbebb095a13335c9de62b3cc4bd443 + pristine_git_object: 8f2a3a3de024b325d79c21e5e188b08c1f64ddc0 + docs/operations/listtranscriptionmodelsrequest.mdx: + id: 59e2fbc5a4c1 + last_write_checksum: sha1:1f3db18d8b21d422d39e3b84e6dbdfb7d2448477 + pristine_git_object: 5128ddf392087e4cfb939632d6b7df233b992a47 docs/operations/listvaultsecretsglobals.mdx: id: 9f2a43038606 last_write_checksum: sha1:f630a31eacee826e57a967d5b0d98d0e512671a9 @@ -12240,8 +12292,8 @@ trackedFiles: pristine_git_object: fbd074b61683886e7e7049e81e2f03cdfa2ef32a docs/sdks/rerank/README.mdx: id: 68cdfc7f7dca - last_write_checksum: sha1:64d5fd71e3e39c6c24856438e89ef7c9264cf630 - pristine_git_object: 4e10c25ed694e617695e7fc6192b7b25302977d6 + last_write_checksum: sha1:e1874a2df6702012d1649fdb0345b1d8006b826a + pristine_git_object: 1c546218d329b604bbba44f29c105736e8bb0f52 docs/sdks/responses/README.mdx: id: abab319e080e last_write_checksum: sha1:86214a254fdc8dd80bef8cfca43bc0aaa369213a @@ -12252,8 +12304,8 @@ trackedFiles: pristine_git_object: 3f0a3e567b411bd360fd2603d9b9e6b6e40d4787 docs/sdks/stt/README.mdx: id: 190b0dc9a5d1 - last_write_checksum: sha1:a72a850312d8c2f8d6b00c588d35b48af7978f15 - pristine_git_object: 00bfa3bfcde0768983447bb0566eae511074bafd + last_write_checksum: sha1:855bbe02b8316c063023eaa71ff87bdae037f684 + pristine_git_object: 49183f46605dad431ec84f2e89f7183281027b31 docs/sdks/systemone/README.mdx: id: 55c317c71f3d last_write_checksum: sha1:b2c7fa64183a73b951c0c05ca68156bee092c2b4 @@ -12284,8 +12336,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:9ae391f97e2f8a2db89319d9e8fece71cf2cda18 - pristine_git_object: b8d3d18b773d8e19ffcb9788b4459dff15853ed5 + last_write_checksum: sha1:ad85746c51ac6fc90082fe523d6245f82f3e39ba + pristine_git_object: 13cf95391fbd8ae712012d64906099dad19725be scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -12312,8 +12364,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:638b7b5eeb839038f7c07920563fb79963d6a12c - pristine_git_object: e255a0a06c83b2331aad2b0a5ab98a04bb6acf0b + last_write_checksum: sha1:e122ae6d8e49740373b91b6ab04a2ad6c9a4b134 + pristine_git_object: 6bd5fda0bdea5610e132f6c58a9e6c4648bdde33 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766 @@ -12360,8 +12412,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:84a75702011da25b57f6a15c1ed3a79bf1fb8912 - pristine_git_object: 5d32eb5285f4b58e9c8b86254d1e3b65382302b8 + last_write_checksum: sha1:e64a338525b068f90a7dbb5055715a3a38090b8d + pristine_git_object: 619d9b1bc51148bac7c2272fab958f9f79295042 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:08125e1d60df82793e11e8aed6e3c9fdb7512ebb @@ -15554,6 +15606,14 @@ trackedFiles: id: ce0c58ad6b3f last_write_checksum: sha1:a2abdafd0a7fa4e9845a0156f7b7aacf9fc0e045 pristine_git_object: e3740a8f28bfe73603bdae2b32153e8188c059ea + src/openrouter/components/rerankmodel.py: + id: 90d1c777c450 + last_write_checksum: sha1:e9ab43ee3ed692f6f214262b1e8efead68313be2 + pristine_git_object: c366bc285f546fe26acedf8d3d6a81c9e57c3be6 + src/openrouter/components/rerankmodelslistresponse.py: + id: ab497357383b + last_write_checksum: sha1:eca5ef91bf0dc1694610770c3837c3ed42f4dbb7 + pristine_git_object: 6e3abef1101207ed0c01ef4433d06c8867318b8d src/openrouter/components/responsehealingplugin.py: id: 06608e027868 last_write_checksum: sha1:f4ee2caaa09379c52353f8920109f5e3e95f2274 @@ -16034,6 +16094,18 @@ trackedFiles: id: 19375fa88b9a last_write_checksum: sha1:46fd7fd3f26caebda22604006873317f9aab1480 pristine_git_object: d0a4c49a843ad97a82b9c698dbcaaf7a95a413bd + src/openrouter/components/transcriptionmodel.py: + id: 80fbc3857b0b + last_write_checksum: sha1:e3cff2f312cef357e7c50225d07c5e6170f0d2d1 + pristine_git_object: 77f67c488d3cc55007fff0c970a783456e5d5ba9 + src/openrouter/components/transcriptionmodelendpoint.py: + id: 53715f87409e + last_write_checksum: sha1:624412dd2db8d17c51da93e85e3fe005abaf20d5 + pristine_git_object: 03fa68d14f7a29a02970c836f162f4c41758be28 + src/openrouter/components/transcriptionmodelslistresponse.py: + id: d17a4076a5f8 + last_write_checksum: sha1:8b4cc48981f10d58391f38f6bf49f7c615962422 + pristine_git_object: 7a2302d5fa97c19a5d60645d2b30b77c2aab97ce src/openrouter/components/truncation.py: id: 88f4e4be9fc0 last_write_checksum: sha1:69e1f9d19ad27b82d882031c100f8a607344f8af @@ -16536,8 +16608,8 @@ trackedFiles: pristine_git_object: 039fd484b407d7ca13177a892db5939b312ee50d src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:80046e0118dc9cab426959d13e5bc0aa0f835f33 - pristine_git_object: bf81c87ace986ff5e2e5b18a7c8dd7771c09f99b + last_write_checksum: sha1:05800705114143944a7d184dfd0839b55b61fc20 + pristine_git_object: 6d6f4d5c3f081ea99f828325d056c35f4cbc2ba7 src/openrouter/operations/activateprivateendpoint.py: id: 3b39eec5d66f last_write_checksum: sha1:9406e6b3d38c82895fd795f637702ef579cc6d36 @@ -16934,6 +17006,10 @@ trackedFiles: id: f0997d66f38e last_write_checksum: sha1:f3e11b59741e20041a219c423c1392fc69a2a7f1 pristine_git_object: 1e0725f81674559cbf5f017c0dde04e0a36ba727 + src/openrouter/operations/gettranscriptionmodel.py: + id: bad7652337f2 + last_write_checksum: sha1:4fe119a27219981c0a4ee1f3ca462517090e609e + pristine_git_object: 3a3097295b1a5a05b64369b35ebb840db3c93866 src/openrouter/operations/getuseractivity.py: id: 560a0e01c2c3 last_write_checksum: sha1:5de9ab321a939fe40adb6626721fd327890f2850 @@ -17086,6 +17162,10 @@ trackedFiles: id: cf6e2db15118 last_write_checksum: sha1:decee82d2b55738162cc47f02f56c592d53f9ee9 pristine_git_object: 80bcd4b8e5d9e5f92ab4375175d6ee3a826a2e94 + src/openrouter/operations/listrerankmodels.py: + id: d389d3efe8f9 + last_write_checksum: sha1:05eafc7595594cd121497de564c436dffa7d5133 + pristine_git_object: 74728042b2a3fbc24fe25fa7cb5cc1e57a275ce6 src/openrouter/operations/listscimgroupmappings.py: id: 67a3b97ff2bc last_write_checksum: sha1:5acad915dd8fcaa9bc7dd4e087635023ae5a4ebf @@ -17102,6 +17182,10 @@ trackedFiles: id: e8a478b7266e last_write_checksum: sha1:6170d2c5211602d778c9bca2a9f637ef240b13cc pristine_git_object: 2a66b9d148bd036b60b8a6ecf54b56329b1d35b6 + src/openrouter/operations/listtranscriptionmodels.py: + id: c49bbcffb267 + last_write_checksum: sha1:8dc017cc889ecd1419ba11f0b3ee6ccd4891cf7f + pristine_git_object: 4224c999764663de0b03edaac97813f0edd1f55e src/openrouter/operations/listvaultsecrets.py: id: 460dacce49ab last_write_checksum: sha1:c6fcb7a5e7f2f587888a3b087142a2c4c1f23cf9 @@ -17248,8 +17332,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 src/openrouter/rerank.py: id: 8dbc1be8d76f - last_write_checksum: sha1:929024298b8f786961088a00f4c0116e3e9ab95e - pristine_git_object: 9db3cc719bd343ee7be0183d0c87b50c29e5eb31 + last_write_checksum: sha1:90512600b24aba37523a6a3ac9201ca3acfa1a8e + pristine_git_object: b85084dac17fb7423e8b8511171672d374896fc7 src/openrouter/responses.py: id: f2108fb635e1 last_write_checksum: sha1:7691816affedec657f1c8ef4055cfb6ad7a2bf68 @@ -17268,8 +17352,8 @@ trackedFiles: pristine_git_object: 26433165a0b1c25d7bd3115b9b129b18f2dc9387 src/openrouter/stt.py: id: fc0c2f669423 - last_write_checksum: sha1:d411ba27355a5f7bdb3c3970fc89ea2b45d829b4 - pristine_git_object: 62e503c4b2f2a0a97e53245fdb87211e171a94e6 + last_write_checksum: sha1:0b0c6b3a133c67fd9d72abbfb20024561b9c8e40 + pristine_git_object: 9716c23619c1ada6ed03baf4a62033aa04df877f src/openrouter/systemone.py: id: 7e0a0e237bb1 last_write_checksum: sha1:550af693684424feec5e4f8e044f8243b74daeb0 @@ -22516,5 +22600,50 @@ examples: application/json: {"error": {"code": 400, "message": "custom_id is required on requests[0]."}} "500": application/json: {"error": {"code": 400, "message": "custom_id is required on requests[0]."}} + listTranscriptionModels: + speakeasy-default-list-transcription-models: + responses: + "200": + application/json: {"data": []} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + "503": + application/json: {"error": {"code": 503, "message": "Service temporarily unavailable"}} + getTranscriptionModel: + speakeasy-default-get-transcription-model: + parameters: + path: + author: "openai" + slug: "whisper-1" + responses: + "200": + application/json: {"created": 101159, "description": "pro about coincide ick blissfully gosh mmm kiddingly ack marimba", "endpoints": [{"input_modalities": [{"type": "text"}], "output_modalities": [{"supported_parameters": {}, "type": "audio"}], "provider_name": "OpenAI", "provider_slug": "openai"}], "id": "openai/whisper-1", "input_modalities": [], "name": "OpenAI: Whisper", "output_modalities": [{"supported_parameters": {}, "type": "decisions"}]} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + "503": + application/json: {"error": {"code": 503, "message": "Service temporarily unavailable"}} + listRerankModels: + speakeasy-default-list-rerank-models: + parameters: + query: + offset: 0 + 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} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -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" +releaseNotes: | + ## Python SDK Changes: + * `open_router.stt.list_models()`: **Added** + * `open_router.stt.get_model()`: **Added** + * `open_router.rerank.list_models()`: **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index d25ec9739..71bd38e4c 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.222 + version: 1.3.223 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index eb2f31b07..a86e70b6f 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -34094,6 +34094,133 @@ components: - 'throughput' - 'request_count' type: 'object' + RerankModel: + allOf: + - $ref: '#/components/schemas/Model' + - properties: + input_modalities: + description: 'Typed inputs the model accepts, following the Models API V2 document.' + example: + - supported_inputs: + max_context_length: + unit: 'token' + value: 32000 + type: 'text' + - type: 'image' + 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.' + example: + - supported_parameters: + top_n: + min: 1 + type: 'integer' + type: 'rerank' + items: + $ref: '#/components/schemas/ModelOutputModalityV2' + minItems: 1 + type: 'array' + type: 'object' + description: 'Information about an AI model available on OpenRouter' + example: + architecture: + input_modalities: + - 'text' + instruct_type: 'chatml' + modality: 'text->text' + 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-5.4/endpoints' + name: 'GPT-4' + per_request_limits: null + pricing: + completion: '0.00006' + image: '0' + prompt: '0.00003' + request: '0' + reasoning: + default_effort: 'medium' + default_enabled: true + mandatory: false + supported_efforts: + - 'high' + - 'medium' + - 'low' + - 'minimal' + supported_parameters: + - 'temperature' + - 'top_p' + - 'max_tokens' + supported_voices: null + top_provider: + context_length: 8192 + is_moderated: true + max_completion_tokens: 4096 + RerankModelsListResponse: + allOf: + - $ref: '#/components/schemas/ModelsListResponse' + - properties: + data: + description: 'List of available rerank models' + items: + $ref: '#/components/schemas/RerankModel' + type: 'array' + type: 'object' + description: 'List of available rerank models' + example: + data: + - architecture: + input_modalities: + - 'text' + instruct_type: 'chatml' + modality: 'text->text' + 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&limit=500' + total_count: 150 ResponseHealingPlugin: example: enabled: true @@ -38147,6 +38274,85 @@ components: trace_name: type: 'string' type: 'object' + TranscriptionModel: + additionalProperties: false + description: 'A speech-to-text model: its endpoints'' members widened across endpoints, plus each endpoint with its own.' + properties: + created: + description: 'Unix seconds when the model was added' + type: 'integer' + description: + type: 'string' + endpoints: + items: + $ref: '#/components/schemas/TranscriptionModelEndpoint' + minItems: 1 + type: 'array' + id: + example: 'openai/whisper-1' + type: 'string' + input_modalities: + description: 'Typed inputs the model accepts, following the Models API V2 document.' + items: + $ref: '#/components/schemas/ModelInputModalityV2' + minItems: 1 + type: 'array' + name: + example: 'OpenAI: Whisper' + type: 'string' + output_modalities: + description: 'Typed outputs with the /api/v1/audio/transcriptions request fields each accepts, following the Models API V2 document.' + items: + $ref: '#/components/schemas/ModelOutputModalityV2' + minItems: 1 + type: 'array' + required: + - 'id' + - 'name' + - 'description' + - 'created' + - 'input_modalities' + - 'output_modalities' + - 'endpoints' + type: 'object' + TranscriptionModelEndpoint: + additionalProperties: false + description: 'An endpoint that serves a speech-to-text model, with its own members.' + properties: + input_modalities: + description: 'Typed inputs the model accepts, following the Models API V2 document.' + items: + $ref: '#/components/schemas/ModelInputModalityV2' + minItems: 1 + type: 'array' + output_modalities: + description: 'Typed outputs with the /api/v1/audio/transcriptions request fields each accepts, following the Models API V2 document.' + items: + $ref: '#/components/schemas/ModelOutputModalityV2' + minItems: 1 + type: 'array' + provider_name: + example: 'OpenAI' + type: 'string' + provider_slug: + example: 'openai' + type: 'string' + required: + - 'provider_name' + - 'provider_slug' + - 'input_modalities' + - 'output_modalities' + type: 'object' + TranscriptionModelsListResponse: + additionalProperties: false + properties: + data: + items: + $ref: '#/components/schemas/TranscriptionModel' + type: 'array' + required: + - 'data' + type: 'object' Truncation: enum: - 'auto' @@ -43600,6 +43806,218 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /audio/transcriptions/models: + get: + description: 'Lists every speech-to-text model with its typed Models API V2 input and output members, merged across its endpoints, plus each endpoint with its own.' + operationId: 'listTranscriptionModels' + responses: + '200': + content: + application/json: + example: + data: + - created: 1758000000 + description: 'General-purpose speech recognition model.' + endpoints: + - input_modalities: + - type: 'audio' + output_modalities: + - supported_parameters: + response_format: + type: 'enum' + values: + - 'json' + - 'verbose_json' + timestamp_granularities: + items: + type: 'enum' + values: + - 'word' + - 'segment' + type: 'array' + type: 'transcription' + provider_name: 'OpenAI' + provider_slug: 'openai' + id: 'openai/whisper-1' + input_modalities: + - type: 'audio' + name: 'OpenAI: Whisper' + output_modalities: + - supported_parameters: + response_format: + type: 'enum' + values: + - 'json' + - 'verbose_json' + timestamp_granularities: + items: + type: 'enum' + values: + - 'word' + - 'segment' + type: 'array' + type: 'transcription' + schema: + $ref: '#/components/schemas/TranscriptionModelsListResponse' + description: 'List of speech-to-text models' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + '503': + content: + application/json: + example: + error: + code: 503 + message: 'Service temporarily unavailable' + schema: + $ref: '#/components/schemas/ServiceUnavailableResponse' + description: 'Service Unavailable - Service temporarily unavailable' + security: [] + summary: 'List speech-to-text models' + tags: + - 'STT' + x-speakeasy-name-override: 'listModels' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /audio/transcriptions/models/{author}/{slug}: + get: + description: 'Returns a speech-to-text model with each endpoint''s own typed members.' + operationId: 'getTranscriptionModel' + parameters: + - description: 'Model author/organization' + in: 'path' + name: 'author' + required: true + schema: + description: 'Model author/organization' + example: 'openai' + type: 'string' + - description: 'Model slug' + in: 'path' + name: 'slug' + required: true + schema: + description: 'Model slug' + example: 'whisper-1' + type: 'string' + responses: + '200': + content: + application/json: + example: + created: 1758000000 + description: 'General-purpose speech recognition model.' + endpoints: + - input_modalities: + - type: 'audio' + output_modalities: + - supported_parameters: + response_format: + type: 'enum' + values: + - 'json' + - 'verbose_json' + timestamp_granularities: + items: + type: 'enum' + values: + - 'word' + - 'segment' + type: 'array' + type: 'transcription' + provider_name: 'OpenAI' + provider_slug: 'openai' + id: 'openai/whisper-1' + input_modalities: + - type: 'audio' + name: 'OpenAI: Whisper' + output_modalities: + - supported_parameters: + response_format: + type: 'enum' + values: + - 'json' + - 'verbose_json' + timestamp_granularities: + items: + type: 'enum' + values: + - 'word' + - 'segment' + type: 'array' + type: 'transcription' + schema: + $ref: '#/components/schemas/TranscriptionModel' + description: 'A speech-to-text model and its endpoints' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + '503': + content: + application/json: + example: + error: + code: 503 + message: 'Service temporarily unavailable' + schema: + $ref: '#/components/schemas/ServiceUnavailableResponse' + description: 'Service Unavailable - Service temporarily unavailable' + security: [] + summary: 'Get a speech-to-text model' + tags: + - 'STT' + x-speakeasy-name-override: 'getModel' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /auth/keys: post: description: 'Exchange an authorization code from the PKCE flow for a user-controlled API key' @@ -60943,6 +61361,128 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /rerank/models: + get: + description: 'Returns a list of all available rerank models and their properties' + operationId: 'listRerankModels' + parameters: + - description: 'Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned' + in: 'query' + name: 'offset' + required: false + schema: + default: 0 + description: 'Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned' + example: 0 + minimum: 0 + type: + - 'integer' + - 'null' + nullable: false + - description: 'Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned' + in: 'query' + name: 'limit' + required: false + schema: + default: 500 + description: 'Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned' + example: 500 + maximum: 1000 + minimum: 1 + type: 'integer' + responses: + '200': + content: + application/json: + example: + data: + - architecture: + input_modalities: + - 'text' + instruct_type: null + modality: 'text->rerank' + output_modalities: + - 'rerank' + tokenizer: 'Other' + canonical_slug: 'cohere/rerank-v3.5' + context_length: 4096 + created: 1733356800 + default_parameters: null + description: 'Cohere multilingual rerank model.' + endpoints: + - '/api/v1/rerank' + expiration_date: null + id: 'cohere/rerank-v3.5' + input_modalities: + - supported_inputs: + max_context_length: + unit: 'token' + value: 4096 + type: 'text' + knowledge_cutoff: null + links: + details: '/api/v1/models/cohere/rerank-v3.5/endpoints' + name: 'Cohere: Rerank v3.5' + output_modalities: + - supported_parameters: + top_n: + min: 1 + type: 'integer' + type: 'rerank' + per_request_limits: null + pricing: + completion: '0' + image: '0' + prompt: '0' + request: '0.002' + supported_parameters: [] + supported_voices: null + top_provider: + context_length: 4096 + is_moderated: false + max_completion_tokens: null + schema: + $ref: '#/components/schemas/RerankModelsListResponse' + description: 'Returns a list of rerank models' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'List all rerank models' + tags: + - 'Rerank' + x-speakeasy-name-override: 'listModels' + x-speakeasy-pagination: + inputs: + - in: 'parameters' + name: 'offset' + type: 'offset' + - in: 'parameters' + name: 'limit' + type: 'limit' + outputs: + results: '$.data' + type: 'offsetLimit' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /responses: post: description: 'Creates a streaming or non-streaming response using OpenResponses API format' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 4b3869121..1dc85505b 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:f5e30b08e463001f34df8f5b532c086a2038b761418054ca65f9a6d467a85da7 - sourceBlobDigest: sha256:5bc50c4d526cc0b5d500c62ef21ad2873f40f9e2c455663973c711d45229f9d7 + sourceRevisionDigest: sha256:07779c4e389edaf81c38996739348d5ab548fe8bf37ae2aadd734aad7c91acc9 + sourceBlobDigest: sha256:f09bbbf022efa202ad93b975f49977ea295a9c5c6e287d10e304152b5100d262 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:f5e30b08e463001f34df8f5b532c086a2038b761418054ca65f9a6d467a85da7 - sourceBlobDigest: sha256:5bc50c4d526cc0b5d500c62ef21ad2873f40f9e2c455663973c711d45229f9d7 + sourceRevisionDigest: sha256:07779c4e389edaf81c38996739348d5ab548fe8bf37ae2aadd734aad7c91acc9 + sourceBlobDigest: sha256:f09bbbf022efa202ad93b975f49977ea295a9c5c6e287d10e304152b5100d262 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:312ff18be74643deb1643b09af308af82e4974687b99493e20d091ead1ed2750 + codeSamplesRevisionDigest: sha256:8368e10ae44dc2d8b8f7ede5b8a24dd34af7932f04b3c5e320d9a0fa5db6af7b workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index 59633be23..d2bbbd26f 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4989,4 +4989,14 @@ Based on: ### Generated - [python v1.3.222] . ### Releases -- [PyPI v1.3.222] https://pypi.org/project/openrouter/1.3.222 - . \ No newline at end of file +- [PyPI v1.3.222] https://pypi.org/project/openrouter/1.3.222 - . + +## 2026-12-01 17:27:45 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.223] . +### Releases +- [PyPI v1.3.223] https://pypi.org/project/openrouter/1.3.223 - . \ No newline at end of file diff --git a/docs/components/rerankmodel.mdx b/docs/components/rerankmodel.mdx new file mode 100644 index 000000000..803ef44ee --- /dev/null +++ b/docs/components/rerankmodel.mdx @@ -0,0 +1,34 @@ +--- +title: "RerankModel" +--- + +Information about an AI 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. | [
\{
"supported_inputs": \{
"max_context_length": \{
"unit": "token",
"value": 32000
}
},
"type": "text"
},
\{
"type": "image"
}
] | +| `output_modalities` | List[[components.ModelOutputModalityV2](../components/modeloutputmodalityv2.mdx)] | ➖ | Typed outputs with the request fields each accepts, following the Models API V2 document. | [
\{
"supported_parameters": \{
"top_n": \{
"min": 1,
"type": "integer"
}
},
"type": "rerank"
}
] | \ No newline at end of file diff --git a/docs/components/rerankmodelslistresponse.mdx b/docs/components/rerankmodelslistresponse.mdx new file mode 100644 index 000000000..2d8f00592 --- /dev/null +++ b/docs/components/rerankmodelslistresponse.mdx @@ -0,0 +1,14 @@ +--- +title: "RerankModelsListResponse" +--- + +List of available rerank models + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `data` | List[[components.RerankModel](../components/rerankmodel.mdx)] | ✔️ | List of available rerank models | | +| `links` | [components.RerankModelsListResponseLinks](../components/rerankmodelslistresponselinks.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/rerankmodelslistresponselinks.mdx b/docs/components/rerankmodelslistresponselinks.mdx new file mode 100644 index 000000000..246923a25 --- /dev/null +++ b/docs/components/rerankmodelslistresponselinks.mdx @@ -0,0 +1,12 @@ +--- +title: "RerankModelsListResponseLinks" +--- + +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/transcriptionmodel.mdx b/docs/components/transcriptionmodel.mdx new file mode 100644 index 000000000..c9661ee55 --- /dev/null +++ b/docs/components/transcriptionmodel.mdx @@ -0,0 +1,18 @@ +--- +title: "TranscriptionModel" +--- + +A speech-to-text model: its endpoints' members widened across endpoints, plus each endpoint with its own. + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `created` | *int* | ✔️ | Unix seconds when the model was added | | +| `description` | *str* | ✔️ | N/A | | +| `endpoints` | List[[components.TranscriptionModelEndpoint](../components/transcriptionmodelendpoint.mdx)] | ✔️ | N/A | | +| `id` | *str* | ✔️ | N/A | openai/whisper-1 | +| `input_modalities` | List[[components.ModelInputModalityV2](../components/modelinputmodalityv2.mdx)] | ✔️ | Typed inputs the model accepts, following the Models API V2 document. | | +| `name` | *str* | ✔️ | N/A | OpenAI: Whisper | +| `output_modalities` | List[[components.ModelOutputModalityV2](../components/modeloutputmodalityv2.mdx)] | ✔️ | Typed outputs with the /api/v1/audio/transcriptions request fields each accepts, following the Models API V2 document. | | \ No newline at end of file diff --git a/docs/components/transcriptionmodelendpoint.mdx b/docs/components/transcriptionmodelendpoint.mdx new file mode 100644 index 000000000..7058562ad --- /dev/null +++ b/docs/components/transcriptionmodelendpoint.mdx @@ -0,0 +1,15 @@ +--- +title: "TranscriptionModelEndpoint" +--- + +An endpoint that serves a speech-to-text model, with its own members. + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `input_modalities` | List[[components.ModelInputModalityV2](../components/modelinputmodalityv2.mdx)] | ✔️ | Typed inputs the model accepts, following the Models API V2 document. | | +| `output_modalities` | List[[components.ModelOutputModalityV2](../components/modeloutputmodalityv2.mdx)] | ✔️ | Typed outputs with the /api/v1/audio/transcriptions request fields each accepts, following the Models API V2 document. | | +| `provider_name` | *str* | ✔️ | N/A | OpenAI | +| `provider_slug` | *str* | ✔️ | N/A | openai | \ No newline at end of file diff --git a/docs/components/transcriptionmodelslistresponse.mdx b/docs/components/transcriptionmodelslistresponse.mdx new file mode 100644 index 000000000..95f57b852 --- /dev/null +++ b/docs/components/transcriptionmodelslistresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "TranscriptionModelsListResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `data` | List[[components.TranscriptionModel](../components/transcriptionmodel.mdx)] | ✔️ | N/A | \ No newline at end of file diff --git a/docs/operations/gettranscriptionmodelglobals.mdx b/docs/operations/gettranscriptionmodelglobals.mdx new file mode 100644 index 000000000..ea1813910 --- /dev/null +++ b/docs/operations/gettranscriptionmodelglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "GetTranscriptionModelGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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.
| \ No newline at end of file diff --git a/docs/operations/gettranscriptionmodelrequest.mdx b/docs/operations/gettranscriptionmodelrequest.mdx new file mode 100644 index 000000000..8713b46a8 --- /dev/null +++ b/docs/operations/gettranscriptionmodelrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "GetTranscriptionModelRequest" +--- + +## 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.
| | +| `author` | *str* | ✔️ | Model author/organization | openai | +| `slug` | *str* | ✔️ | Model slug | whisper-1 | \ No newline at end of file diff --git a/docs/operations/listrerankmodelsglobals.mdx b/docs/operations/listrerankmodelsglobals.mdx new file mode 100644 index 000000000..9ccaf043d --- /dev/null +++ b/docs/operations/listrerankmodelsglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "ListRerankModelsGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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.
| \ No newline at end of file diff --git a/docs/operations/listrerankmodelsrequest.mdx b/docs/operations/listrerankmodelsrequest.mdx new file mode 100644 index 000000000..4a95ef876 --- /dev/null +++ b/docs/operations/listrerankmodelsrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "ListRerankModelsRequest" +--- + +## 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 | \ No newline at end of file diff --git a/docs/operations/listrerankmodelsresponse.mdx b/docs/operations/listrerankmodelsresponse.mdx new file mode 100644 index 000000000..1574186cb --- /dev/null +++ b/docs/operations/listrerankmodelsresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ListRerankModelsResponse" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `result` | [components.RerankModelsListResponse](../components/rerankmodelslistresponse.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 diff --git a/docs/operations/listtranscriptionmodelsglobals.mdx b/docs/operations/listtranscriptionmodelsglobals.mdx new file mode 100644 index 000000000..8f2a3a3de --- /dev/null +++ b/docs/operations/listtranscriptionmodelsglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "ListTranscriptionModelsGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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.
| \ No newline at end of file diff --git a/docs/operations/listtranscriptionmodelsrequest.mdx b/docs/operations/listtranscriptionmodelsrequest.mdx new file mode 100644 index 000000000..5128ddf39 --- /dev/null +++ b/docs/operations/listtranscriptionmodelsrequest.mdx @@ -0,0 +1,11 @@ +--- +title: "ListTranscriptionModelsRequest" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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.
| \ No newline at end of file diff --git a/docs/sdks/rerank/README.mdx b/docs/sdks/rerank/README.mdx index 4e10c25ed..1c546218d 100644 --- a/docs/sdks/rerank/README.mdx +++ b/docs/sdks/rerank/README.mdx @@ -10,6 +10,7 @@ Rerank endpoints ### Available Operations * [rerank](#rerank) - Submit a rerank request +* [list_models](#list_models) - List all rerank models ## rerank @@ -76,4 +77,54 @@ with OpenRouter( | errors.ServiceUnavailableResponseError | 503 | application/json | | errors.EdgeNetworkTimeoutResponseError | 524 | application/json | | errors.ProviderOverloadedResponseError | 529 | application/json | -| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## list_models + +Returns a list of all available rerank models and their properties + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.rerank.list_models(offset=0, limit=500) + + while res is not None: + # Handle items + + res = res.next() + +``` + +### Parameters + +| Parameter | 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 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[operations.ListRerankModelsResponse](../../operations/listrerankmodelsresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/stt/README.mdx b/docs/sdks/stt/README.mdx index 00bfa3bfc..49183f466 100644 --- a/docs/sdks/stt/README.mdx +++ b/docs/sdks/stt/README.mdx @@ -11,6 +11,8 @@ Speech-to-text endpoints * [create_transcription](#create_transcription) - Create transcription * [create_transcription_multipart](#create_transcription_multipart) - Create transcription +* [list_models](#list_models) - List speech-to-text models +* [get_model](#get_model) - Get a speech-to-text model ## create_transcription @@ -157,4 +159,97 @@ with OpenRouter( | errors.GatewayTimeoutResponseError | 504 | application/json | | errors.EdgeNetworkTimeoutResponseError | 524 | application/json | | errors.ProviderOverloadedResponseError | 529 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## list_models + +Lists every speech-to-text model with its typed Models API V2 input and output members, merged across its endpoints, plus each endpoint with its own. + +### Example Usage + +```python +from openrouter import OpenRouter + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", +) as open_router: + + res = open_router.stt.list_models() + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | + +### Response + +**[components.TranscriptionModelsListResponse](../../components/transcriptionmodelslistresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.ServiceUnavailableResponseError | 503 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## get_model + +Returns a speech-to-text model with each endpoint's own typed members. + +### Example Usage + +```python +from openrouter import OpenRouter + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", +) as open_router: + + res = open_router.stt.get_model(author="openai", slug="whisper-1") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `author` | *str* | ✔️ | Model author/organization | openai | +| `slug` | *str* | ✔️ | Model slug | whisper-1 | +| `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.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.TranscriptionModel](../../components/transcriptionmodel.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.ServiceUnavailableResponseError | 503 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index b8d3d18b7..13cf95391 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.222" +version = "1.3.223" 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 e255a0a06..6bd5fda0b 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.222" +__version__: str = "1.3.223" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.950.13" -__user_agent__: str = "speakeasy-sdk/python 1.3.222 2.950.13 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.223 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 5d32eb528..619d9b1bc 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -4520,6 +4520,13 @@ RequestTimeoutResponseErrorDataTypedDict, ) from .rerank import Rerank, RerankTypedDict + from .rerankmodel import RerankModel, RerankModelTypedDict + from .rerankmodelslistresponse import ( + RerankModelsListResponse, + RerankModelsListResponseLinks, + RerankModelsListResponseLinksTypedDict, + RerankModelsListResponseTypedDict, + ) from .responsehealingplugin import ( ResponseHealingPlugin, ResponseHealingPluginID, @@ -5033,6 +5040,15 @@ ) from .topproviderinfo import TopProviderInfo, TopProviderInfoTypedDict from .traceconfig import TraceConfig, TraceConfigTypedDict + from .transcriptionmodel import TranscriptionModel, TranscriptionModelTypedDict + from .transcriptionmodelendpoint import ( + TranscriptionModelEndpoint, + TranscriptionModelEndpointTypedDict, + ) + from .transcriptionmodelslistresponse import ( + TranscriptionModelsListResponse, + TranscriptionModelsListResponseTypedDict, + ) from .truncation import Truncation from .tts import TTS, TTSTypedDict from .unauthorizedresponseerrordata import ( @@ -8576,6 +8592,12 @@ "RequestTypedDict", "RequestedTokenType", "Rerank", + "RerankModel", + "RerankModelTypedDict", + "RerankModelsListResponse", + "RerankModelsListResponseLinks", + "RerankModelsListResponseLinksTypedDict", + "RerankModelsListResponseTypedDict", "RerankTypedDict", "ResponseFormat", "ResponseFormatTypedDict", @@ -9043,6 +9065,12 @@ "TournamentStatsTypedDict", "TraceConfig", "TraceConfigTypedDict", + "TranscriptionModel", + "TranscriptionModelEndpoint", + "TranscriptionModelEndpointTypedDict", + "TranscriptionModelTypedDict", + "TranscriptionModelsListResponse", + "TranscriptionModelsListResponseTypedDict", "Trigger", "TriggerInputTokens", "TriggerInputTokensTypedDict", @@ -12705,6 +12733,12 @@ "RequestTimeoutResponseErrorDataTypedDict": ".requesttimeoutresponseerrordata", "Rerank": ".rerank", "RerankTypedDict": ".rerank", + "RerankModel": ".rerankmodel", + "RerankModelTypedDict": ".rerankmodel", + "RerankModelsListResponse": ".rerankmodelslistresponse", + "RerankModelsListResponseLinks": ".rerankmodelslistresponse", + "RerankModelsListResponseLinksTypedDict": ".rerankmodelslistresponse", + "RerankModelsListResponseTypedDict": ".rerankmodelslistresponse", "ResponseHealingPlugin": ".responsehealingplugin", "ResponseHealingPluginID": ".responsehealingplugin", "ResponseHealingPluginTypedDict": ".responsehealingplugin", @@ -13096,6 +13130,12 @@ "TopProviderInfoTypedDict": ".topproviderinfo", "TraceConfig": ".traceconfig", "TraceConfigTypedDict": ".traceconfig", + "TranscriptionModel": ".transcriptionmodel", + "TranscriptionModelTypedDict": ".transcriptionmodel", + "TranscriptionModelEndpoint": ".transcriptionmodelendpoint", + "TranscriptionModelEndpointTypedDict": ".transcriptionmodelendpoint", + "TranscriptionModelsListResponse": ".transcriptionmodelslistresponse", + "TranscriptionModelsListResponseTypedDict": ".transcriptionmodelslistresponse", "Truncation": ".truncation", "TTS": ".tts", "TTSTypedDict": ".tts", diff --git a/src/openrouter/components/rerankmodel.py b/src/openrouter/components/rerankmodel.py new file mode 100644 index 000000000..c366bc285 --- /dev/null +++ b/src/openrouter/components/rerankmodel.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 RerankModelTypedDict(TypedDict): + r"""Information about an AI 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.""" + output_modalities: NotRequired[List[ModelOutputModalityV2TypedDict]] + r"""Typed outputs with the request fields each accepts, following the Models API V2 document.""" + + +class RerankModel(BaseModel): + r"""Information about an AI 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.""" + + output_modalities: Optional[List[ModelOutputModalityV2]] = None + r"""Typed outputs with the request fields each accepts, following the Models API V2 document.""" + + @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/rerankmodelslistresponse.py b/src/openrouter/components/rerankmodelslistresponse.py new file mode 100644 index 000000000..6e3abef11 --- /dev/null +++ b/src/openrouter/components/rerankmodelslistresponse.py @@ -0,0 +1,60 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .rerankmodel import RerankModel, RerankModelTypedDict +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List +from typing_extensions import TypedDict + + +class RerankModelsListResponseLinksTypedDict(TypedDict): + r"""Pagination links""" + + next: Nullable[str] + r"""URL for the next page of results, or null if this is the last page""" + + +class RerankModelsListResponseLinks(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 RerankModelsListResponseTypedDict(TypedDict): + r"""List of available rerank models""" + + data: List[RerankModelTypedDict] + r"""List of available rerank models""" + links: RerankModelsListResponseLinksTypedDict + r"""Pagination links""" + total_count: int + r"""Total number of models matching the query""" + + +class RerankModelsListResponse(BaseModel): + r"""List of available rerank models""" + + data: List[RerankModel] + r"""List of available rerank models""" + + links: RerankModelsListResponseLinks + r"""Pagination links""" + + total_count: int + r"""Total number of models matching the query""" diff --git a/src/openrouter/components/transcriptionmodel.py b/src/openrouter/components/transcriptionmodel.py new file mode 100644 index 000000000..77f67c488 --- /dev/null +++ b/src/openrouter/components/transcriptionmodel.py @@ -0,0 +1,48 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .modelinputmodalityv2 import ModelInputModalityV2, ModelInputModalityV2TypedDict +from .modeloutputmodalityv2 import ModelOutputModalityV2, ModelOutputModalityV2TypedDict +from .transcriptionmodelendpoint import ( + TranscriptionModelEndpoint, + TranscriptionModelEndpointTypedDict, +) +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class TranscriptionModelTypedDict(TypedDict): + r"""A speech-to-text model: its endpoints' members widened across endpoints, plus each endpoint with its own.""" + + created: int + r"""Unix seconds when the model was added""" + description: str + endpoints: List[TranscriptionModelEndpointTypedDict] + id: str + input_modalities: List[ModelInputModalityV2TypedDict] + r"""Typed inputs the model accepts, following the Models API V2 document.""" + name: str + output_modalities: List[ModelOutputModalityV2TypedDict] + r"""Typed outputs with the /api/v1/audio/transcriptions request fields each accepts, following the Models API V2 document.""" + + +class TranscriptionModel(BaseModel): + r"""A speech-to-text model: its endpoints' members widened across endpoints, plus each endpoint with its own.""" + + created: int + r"""Unix seconds when the model was added""" + + description: str + + endpoints: List[TranscriptionModelEndpoint] + + id: str + + input_modalities: List[ModelInputModalityV2] + r"""Typed inputs the model accepts, following the Models API V2 document.""" + + name: str + + output_modalities: List[ModelOutputModalityV2] + r"""Typed outputs with the /api/v1/audio/transcriptions request fields each accepts, following the Models API V2 document.""" diff --git a/src/openrouter/components/transcriptionmodelendpoint.py b/src/openrouter/components/transcriptionmodelendpoint.py new file mode 100644 index 000000000..03fa68d14 --- /dev/null +++ b/src/openrouter/components/transcriptionmodelendpoint.py @@ -0,0 +1,33 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .modelinputmodalityv2 import ModelInputModalityV2, ModelInputModalityV2TypedDict +from .modeloutputmodalityv2 import ModelOutputModalityV2, ModelOutputModalityV2TypedDict +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class TranscriptionModelEndpointTypedDict(TypedDict): + r"""An endpoint that serves a speech-to-text model, with its own members.""" + + input_modalities: List[ModelInputModalityV2TypedDict] + r"""Typed inputs the model accepts, following the Models API V2 document.""" + output_modalities: List[ModelOutputModalityV2TypedDict] + r"""Typed outputs with the /api/v1/audio/transcriptions request fields each accepts, following the Models API V2 document.""" + provider_name: str + provider_slug: str + + +class TranscriptionModelEndpoint(BaseModel): + r"""An endpoint that serves a speech-to-text model, with its own members.""" + + input_modalities: List[ModelInputModalityV2] + r"""Typed inputs the model accepts, following the Models API V2 document.""" + + output_modalities: List[ModelOutputModalityV2] + r"""Typed outputs with the /api/v1/audio/transcriptions request fields each accepts, following the Models API V2 document.""" + + provider_name: str + + provider_slug: str diff --git a/src/openrouter/components/transcriptionmodelslistresponse.py b/src/openrouter/components/transcriptionmodelslistresponse.py new file mode 100644 index 000000000..7a2302d5f --- /dev/null +++ b/src/openrouter/components/transcriptionmodelslistresponse.py @@ -0,0 +1,15 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .transcriptionmodel import TranscriptionModel, TranscriptionModelTypedDict +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class TranscriptionModelsListResponseTypedDict(TypedDict): + data: List[TranscriptionModelTypedDict] + + +class TranscriptionModelsListResponse(BaseModel): + data: List[TranscriptionModel] diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index bf81c87ac..6d6f4d5c3 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -759,6 +759,12 @@ GetToolSecurity, GetToolSecurityTypedDict, ) + from .gettranscriptionmodel import ( + GetTranscriptionModelGlobals, + GetTranscriptionModelGlobalsTypedDict, + GetTranscriptionModelRequest, + GetTranscriptionModelRequestTypedDict, + ) from .getuseractivity import ( GetUserActivityGlobals, GetUserActivityGlobalsTypedDict, @@ -1059,6 +1065,14 @@ ListProvidersResponse, ListProvidersResponseTypedDict, ) + from .listrerankmodels import ( + ListRerankModelsGlobals, + ListRerankModelsGlobalsTypedDict, + ListRerankModelsRequest, + ListRerankModelsRequestTypedDict, + ListRerankModelsResponse, + ListRerankModelsResponseTypedDict, + ) from .listscimgroupmappings import ( ListScimGroupMappingsGlobals, ListScimGroupMappingsGlobalsTypedDict, @@ -1090,6 +1104,12 @@ ListToolsSecurity, ListToolsSecurityTypedDict, ) + from .listtranscriptionmodels import ( + ListTranscriptionModelsGlobals, + ListTranscriptionModelsGlobalsTypedDict, + ListTranscriptionModelsRequest, + ListTranscriptionModelsRequestTypedDict, + ) from .listvaultsecrets import ( ListVaultSecretsGlobals, ListVaultSecretsGlobalsTypedDict, @@ -1838,6 +1858,10 @@ "GetToolResponseTypedDict", "GetToolSecurity", "GetToolSecurityTypedDict", + "GetTranscriptionModelGlobals", + "GetTranscriptionModelGlobalsTypedDict", + "GetTranscriptionModelRequest", + "GetTranscriptionModelRequestTypedDict", "GetUserActivityGlobals", "GetUserActivityGlobalsTypedDict", "GetUserActivityRequest", @@ -2065,6 +2089,12 @@ "ListProvidersResponseTypedDict", "ListRequest", "ListRequestTypedDict", + "ListRerankModelsGlobals", + "ListRerankModelsGlobalsTypedDict", + "ListRerankModelsRequest", + "ListRerankModelsRequestTypedDict", + "ListRerankModelsResponse", + "ListRerankModelsResponseTypedDict", "ListResponse", "ListResponseBody", "ListResponseBodyTypedDict", @@ -2091,6 +2121,10 @@ "ListToolsRequestTypedDict", "ListToolsSecurity", "ListToolsSecurityTypedDict", + "ListTranscriptionModelsGlobals", + "ListTranscriptionModelsGlobalsTypedDict", + "ListTranscriptionModelsRequest", + "ListTranscriptionModelsRequestTypedDict", "ListVaultSecretsGlobals", "ListVaultSecretsGlobalsTypedDict", "ListVaultSecretsRequest", @@ -2834,6 +2868,10 @@ "GetToolResponseTypedDict": ".gettool", "GetToolSecurity": ".gettool", "GetToolSecurityTypedDict": ".gettool", + "GetTranscriptionModelGlobals": ".gettranscriptionmodel", + "GetTranscriptionModelGlobalsTypedDict": ".gettranscriptionmodel", + "GetTranscriptionModelRequest": ".gettranscriptionmodel", + "GetTranscriptionModelRequestTypedDict": ".gettranscriptionmodel", "GetUserActivityGlobals": ".getuseractivity", "GetUserActivityGlobalsTypedDict": ".getuseractivity", "GetUserActivityRequest": ".getuseractivity", @@ -3058,6 +3096,12 @@ "ListProvidersRequestTypedDict": ".listproviders", "ListProvidersResponse": ".listproviders", "ListProvidersResponseTypedDict": ".listproviders", + "ListRerankModelsGlobals": ".listrerankmodels", + "ListRerankModelsGlobalsTypedDict": ".listrerankmodels", + "ListRerankModelsRequest": ".listrerankmodels", + "ListRerankModelsRequestTypedDict": ".listrerankmodels", + "ListRerankModelsResponse": ".listrerankmodels", + "ListRerankModelsResponseTypedDict": ".listrerankmodels", "ListScimGroupMappingsGlobals": ".listscimgroupmappings", "ListScimGroupMappingsGlobalsTypedDict": ".listscimgroupmappings", "ListScimGroupMappingsRequest": ".listscimgroupmappings", @@ -3081,6 +3125,10 @@ "ListToolsRequestTypedDict": ".listtools", "ListToolsSecurity": ".listtools", "ListToolsSecurityTypedDict": ".listtools", + "ListTranscriptionModelsGlobals": ".listtranscriptionmodels", + "ListTranscriptionModelsGlobalsTypedDict": ".listtranscriptionmodels", + "ListTranscriptionModelsRequest": ".listtranscriptionmodels", + "ListTranscriptionModelsRequestTypedDict": ".listtranscriptionmodels", "ListVaultSecretsGlobals": ".listvaultsecrets", "ListVaultSecretsGlobalsTypedDict": ".listvaultsecrets", "ListVaultSecretsRequest": ".listvaultsecrets", diff --git a/src/openrouter/operations/gettranscriptionmodel.py b/src/openrouter/operations/gettranscriptionmodel.py new file mode 100644 index 000000000..3a3097295 --- /dev/null +++ b/src/openrouter/operations/gettranscriptionmodel.py @@ -0,0 +1,151 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetTranscriptionModelGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""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: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetTranscriptionModelGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""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: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class GetTranscriptionModelRequestTypedDict(TypedDict): + author: str + r"""Model author/organization""" + slug: str + r"""Model slug""" + http_referer: NotRequired[str] + r"""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: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetTranscriptionModelRequest(BaseModel): + author: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Model author/organization""" + + slug: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Model slug""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""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: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/listrerankmodels.py b/src/openrouter/operations/listrerankmodels.py new file mode 100644 index 000000000..74728042b --- /dev/null +++ b/src/openrouter/operations/listrerankmodels.py @@ -0,0 +1,184 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + rerankmodelslistresponse as components_rerankmodelslistresponse, +) +from openrouter.types import BaseModel, Nullable, OptionalNullable, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata +import pydantic +from pydantic import model_serializer +from typing import Awaitable, Callable, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListRerankModelsGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""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: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ListRerankModelsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""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: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ListRerankModelsRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""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: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + offset: NotRequired[Nullable[int]] + r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned""" + limit: NotRequired[int] + r"""Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned""" + + +class ListRerankModelsRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""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: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + offset: Annotated[ + OptionalNullable[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = 0 + r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned""" + + limit: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = 500 + r"""Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "HTTP-Referer", + "X-OpenRouter-Title", + "X-OpenRouter-Categories", + "offset", + "limit", + ] + ) + nullable_fields = set(["offset"]) + 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 + + +class ListRerankModelsResponseTypedDict(TypedDict): + result: components_rerankmodelslistresponse.RerankModelsListResponseTypedDict + + +class ListRerankModelsResponse(BaseModel): + next: Union[ + Callable[[], Optional[ListRerankModelsResponse]], + Callable[[], Awaitable[Optional[ListRerankModelsResponse]]], + ] + + result: components_rerankmodelslistresponse.RerankModelsListResponse diff --git a/src/openrouter/operations/listtranscriptionmodels.py b/src/openrouter/operations/listtranscriptionmodels.py new file mode 100644 index 000000000..4224c9997 --- /dev/null +++ b/src/openrouter/operations/listtranscriptionmodels.py @@ -0,0 +1,137 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListTranscriptionModelsGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""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: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ListTranscriptionModelsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""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: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ListTranscriptionModelsRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""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: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ListTranscriptionModelsRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""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: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/rerank.py b/src/openrouter/rerank.py index 9db3cc719..b85084dac 100644 --- a/src/openrouter/rerank.py +++ b/src/openrouter/rerank.py @@ -2,12 +2,13 @@ from .basesdk import BaseSDK from enum import Enum +from jsonpath import JSONPath from openrouter import components, errors, operations, utils from openrouter._hooks import HookContext from openrouter.types import OptionalNullable, UNSET from openrouter.utils import get_security_from_env from openrouter.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Iterable, List, Mapping, Optional, Union +from typing import Any, Awaitable, Dict, Iterable, List, Mapping, Optional, Union class RerankAcceptEnum(str, Enum): @@ -463,3 +464,322 @@ async def rerank_async( ) raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def list_models( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + offset: OptionalNullable[int] = 0, + limit: Optional[int] = 500, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[operations.ListRerankModelsResponse]: + r"""List all rerank models + + Returns a list of all available rerank models and their properties + + :param http_referer: 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. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :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 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 + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ListRerankModelsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, + ) + + req = self._build_request( + method="GET", + path="/rerank/models", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListRerankModelsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listRerankModels", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Rerank"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + def next_func() -> Optional[operations.ListRerankModelsResponse]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + offset = request.offset if isinstance(request.offset, int) else 0 + + if not http_res.text: + return None + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return None + limit_ = request.limit if isinstance(request.limit, int) else 500 + if len(results[0]) < limit_: + return None + next_offset = offset + len(results[0]) + + return self.list_models( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.ListRerankModelsResponse( + result=unmarshal_json_response( + components.RerankModelsListResponse, http_res + ), + next=next_func, + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def list_models_async( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + offset: OptionalNullable[int] = 0, + limit: Optional[int] = 500, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[operations.ListRerankModelsResponse]: + r"""List all rerank models + + Returns a list of all available rerank models and their properties + + :param http_referer: 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. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :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 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 + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ListRerankModelsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, + ) + + req = self._build_request_async( + method="GET", + path="/rerank/models", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListRerankModelsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listRerankModels", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Rerank"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + def next_func() -> Awaitable[Optional[operations.ListRerankModelsResponse]]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + async def empty_result(): + return None + + offset = request.offset if isinstance(request.offset, int) else 0 + + if not http_res.text: + return empty_result() + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return empty_result() + limit_ = request.limit if isinstance(request.limit, int) else 500 + if len(results[0]) < limit_: + return empty_result() + next_offset = offset + len(results[0]) + + return self.list_models_async( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.ListRerankModelsResponse( + result=unmarshal_json_response( + components.RerankModelsListResponse, http_res + ), + next=next_func, + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) diff --git a/src/openrouter/stt.py b/src/openrouter/stt.py index 62e503c4b..9716c2361 100644 --- a/src/openrouter/stt.py +++ b/src/openrouter/stt.py @@ -951,3 +951,517 @@ async def create_transcription_multipart_async( ) raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def list_models( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.TranscriptionModelsListResponse: + r"""List speech-to-text models + + Lists every speech-to-text model with its typed Models API V2 input and output members, merged across its endpoints, plus each endpoint with its own. + + :param http_referer: 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. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :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 + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ListTranscriptionModelsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + ) + + req = self._build_request( + method="GET", + path="/audio/transcriptions/models", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=False, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListTranscriptionModelsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listTranscriptionModels", + oauth2_scopes=None, + security_source=None, + tags=["STT"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.TranscriptionModelsListResponse, http_res + ) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "503", "application/json"): + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res + ) + raise errors.ServiceUnavailableResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def list_models_async( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.TranscriptionModelsListResponse: + r"""List speech-to-text models + + Lists every speech-to-text model with its typed Models API V2 input and output members, merged across its endpoints, plus each endpoint with its own. + + :param http_referer: 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. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :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 + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ListTranscriptionModelsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + ) + + req = self._build_request_async( + method="GET", + path="/audio/transcriptions/models", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=False, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListTranscriptionModelsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listTranscriptionModels", + oauth2_scopes=None, + security_source=None, + tags=["STT"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.TranscriptionModelsListResponse, http_res + ) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "503", "application/json"): + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res + ) + raise errors.ServiceUnavailableResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def get_model( + self, + *, + author: str, + slug: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.TranscriptionModel: + r"""Get a speech-to-text model + + Returns a speech-to-text model with each endpoint's own typed members. + + :param author: Model author/organization + :param slug: Model slug + :param http_referer: 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. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :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 + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetTranscriptionModelRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + author=author, + slug=slug, + ) + + req = self._build_request( + method="GET", + path="/audio/transcriptions/models/{author}/{slug}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=False, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetTranscriptionModelGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getTranscriptionModel", + oauth2_scopes=None, + security_source=None, + tags=["STT"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.TranscriptionModel, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "503", "application/json"): + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res + ) + raise errors.ServiceUnavailableResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def get_model_async( + self, + *, + author: str, + slug: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.TranscriptionModel: + r"""Get a speech-to-text model + + Returns a speech-to-text model with each endpoint's own typed members. + + :param author: Model author/organization + :param slug: Model slug + :param http_referer: 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. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :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 + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetTranscriptionModelRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + author=author, + slug=slug, + ) + + req = self._build_request_async( + method="GET", + path="/audio/transcriptions/models/{author}/{slug}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=False, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetTranscriptionModelGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getTranscriptionModel", + oauth2_scopes=None, + security_source=None, + tags=["STT"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.TranscriptionModel, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "503", "application/json"): + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res + ) + raise errors.ServiceUnavailableResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) diff --git a/uv.lock b/uv.lock index 410a2dfc7..292dfa99a 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.222" +version = "1.3.223" source = { editable = "." } dependencies = [ { name = "httpcore" },