diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index b56149c7..cd1e4a2d 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: b2ef6dae450677f07521afea7e283080 + docChecksum: 22a237d7f82bd54b7962d414a7957cab docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.6 - configChecksum: cee05e5b61926388f1b13343d3324556 + releaseVersion: 0.11.7 + configChecksum: c93a3c0cf8d2ef872726ed600df77d93 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 1b9e2976-5e47-49bf-808c-135c466df479 - pristine_commit_hash: 893fb9bbf7f62d287ba9846d1bb62c5d9b977ab2 - pristine_tree_hash: 1541b6273a8dd9ad55e99f64a898845c555a84b6 + generation_id: 83866999-be04-4ad2-861f-5cffd5108efe + pristine_commit_hash: db0868c88c2da5c28ffb08cad3a18c4693828be5 + pristine_tree_hash: 68d039d8cfa62fa2c70a096a924d2cd1823467f2 features: python: acceptHeaders: 3.0.0 @@ -4056,10 +4056,6 @@ trackedFiles: id: 9b8deacad550 last_write_checksum: sha1:2ca93510828412e375f9903be2c92bcefbacd177 pristine_git_object: 29709effcd49176f32b4b99f9a37ed1309231549 - docs/components/responseformatenum.mdx: - id: 60f6138df415 - last_write_checksum: sha1:b3d58b45db884f8b051be834701ee3166bfb13cc - pristine_git_object: 0b7c4b07a2162050d564e6947d060d1b22241817 docs/components/responsehealingplugin.mdx: id: 5bf9b8008e95 last_write_checksum: sha1:1aa7dc7146a93a215d275571233ee63902a6e155 @@ -4242,12 +4238,16 @@ trackedFiles: pristine_git_object: 5d617cac37f7b364f4dd0640246e97c34351d824 docs/components/speechrequest.mdx: id: 06e81b0433f6 - last_write_checksum: sha1:0c8b9aae49356145aa960740cd88e620b511ec6c - pristine_git_object: e984d1fcbbc242679fbd51f142bd9de711833a50 + last_write_checksum: sha1:f56d694567b45d6656c3bf4e84a19283d526014c + pristine_git_object: b16289c3fc9ba1db2880a5e3e6de9b747e2acdb8 docs/components/speechrequestprovider.mdx: id: 4f78ed0394c4 last_write_checksum: sha1:99d94c6b01dbd3e875c213584f97c7dca545a6a9 pristine_git_object: 3a95d19f4a88dbd0c96cec7cf53d9264927a3c0d + docs/components/speechrequestresponseformat.mdx: + id: bd09f77a4a90 + last_write_checksum: sha1:1b87242f33c6d22a08dd085d0ef41335ec2e9b0c + pristine_git_object: 9af8a5aa6a7c26f353f552d369b87debb045b7cd docs/components/speed.mdx: id: 4fd1f2823924 last_write_checksum: sha1:c6815d115b55b9409052f9d1d1d16bb1d7197763 @@ -4366,20 +4366,36 @@ trackedFiles: pristine_git_object: 70a2660b7c0bc35aed96124e1faa3852b3117054 docs/components/sttrequest.mdx: id: 6a5e33cf6dbe - last_write_checksum: sha1:6fefcb5b5dd513388709f62acee929cde6bfb8ee - pristine_git_object: 198ca47de64cf983930c58cc618d3ef8c15d74a8 + last_write_checksum: sha1:63f215311d23a63a59b65d2bc8d642005379730e + pristine_git_object: e81d9df15323bda23bdc67ac0703ca24e5a84175 docs/components/sttrequestprovider.mdx: id: d8b1bac8e745 last_write_checksum: sha1:e15551eddbe4c1f7c4515fa556d4873075512eea pristine_git_object: 5eebff082dc885ed94ec0e6ceed8446c2ca104ae + docs/components/sttrequestresponseformat.mdx: + id: ab58b1666609 + last_write_checksum: sha1:f0cbf9b5b35d8ef8c049a3b84c47f6c43778a00a + pristine_git_object: d016021a79783dfa11b1110edc231f49f45df4d0 docs/components/sttresponse.mdx: id: a421f69065a0 - last_write_checksum: sha1:3bf5f6d14c6e2586808ee5a0db3cd911af03ff7c - pristine_git_object: 9a61014568868a1f08581e5b7580feddaf379f8c + last_write_checksum: sha1:438935b5dcb2fb9cf44c74fff733133937286bff + pristine_git_object: 5868e50f86df62aae9952c94f98ebb33570efff1 + docs/components/sttsegment.mdx: + id: 7264ea9cdd57 + last_write_checksum: sha1:8a4996d6a483fdeee0899f6656ed6e5d69a4e159 + pristine_git_object: d0bcd9afe39262dd4297adb6fc618e984e1c209f + docs/components/stttimestampgranularity.mdx: + id: 2a365c57c3a1 + last_write_checksum: sha1:5932b36c214d97201f0cce0d0787203fed2baf4e + pristine_git_object: 3505a518e362a11e06a3c098eb31de2718ee1c04 docs/components/sttusage.mdx: id: 11bce3b257f6 last_write_checksum: sha1:a777bc390f180c1163612213633f2150a9566313 pristine_git_object: f0b56839c067ce29024888f689d379ed83f86ff4 + docs/components/sttword.mdx: + id: 665227ec6052 + last_write_checksum: sha1:e39fb80f3b8d02747142ab15631e4788810c366f + pristine_git_object: 994522a52060add3b501680d2be27546ded1dfe2 docs/components/subagentnestedtool.mdx: id: 12547a9efd5f last_write_checksum: sha1:9141ce608f42d2c53e89f0e8e108252227a7366f @@ -5180,6 +5196,10 @@ trackedFiles: id: 537b5f749941 last_write_checksum: sha1:49c12ecbb5dfd1da81be814c3e70baa9c249d432 pristine_git_object: 08e418f7bcf3cf8142171de78bedd0243bda6854 + docs/operations/contextbucket.mdx: + id: 2ab0b419379e + last_write_checksum: sha1:f3bcb4a33fc0d7d868762b459a838d1fdca99d28 + pristine_git_object: d24616128ffb2e8a3f1fc639235d8210dbeea107 docs/operations/costdetails.mdx: id: a5015273e58c last_write_checksum: sha1:90a330bfa37e208bcee6615af2ee7535c4416a26 @@ -5210,8 +5230,8 @@ trackedFiles: pristine_git_object: b5031668ec1156a4157609e4812b7a3937b802a2 docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx: id: 0550cc56c73a - last_write_checksum: sha1:c377fd998af4c7cb2bae44e1a41c3bce02367a18 - pristine_git_object: 70f754bbc14e7fe9754309837b419705c622dfb6 + last_write_checksum: sha1:c15b1a62c475511e194d9a5b7b2ed240e369a4d1 + pristine_git_object: 3054ebe9dc2b1c40dbac7a5b387a57a89c468bdc docs/operations/createaudiotranscriptionsrequest.mdx: id: 68a813383936 last_write_checksum: sha1:a3ad7e4691917927539d6c614788da7f4d6b4892 @@ -5708,14 +5728,18 @@ trackedFiles: id: 970105a3a642 last_write_checksum: sha1:001bb931da274741dca567c87c4149c11c5e67d1 pristine_git_object: c7cf40110dc4a82e2d4abdd06e98d9a28637a016 + docs/operations/getrankingsdailycategory.mdx: + id: 37dbd531ea7d + last_write_checksum: sha1:3c4ffc04da2558c3357a8759ba9984ea15b58db4 + pristine_git_object: a81ff4b55f28b6a1456eee9665809305a68e7ee1 docs/operations/getrankingsdailyglobals.mdx: id: 0f9fa155d24e last_write_checksum: sha1:b3f58d600e4791419b37f4a8ec65869d59424f41 pristine_git_object: 4bc1a2bf9e75dc1eaca4e1531a49dfbbea0dfb72 docs/operations/getrankingsdailyrequest.mdx: id: a83322d91eea - last_write_checksum: sha1:ee987639475df96010b6a2732ecf9c7b4cfd2472 - pristine_git_object: 1788b942b41cb5afa8bebb28c0387c2cc0381d50 + last_write_checksum: sha1:fd05c4e755a6ba4f6b41bb37856169ad1b14d927 + pristine_git_object: 04784a9f4a05fa7d473b532d4e881a6d45a64a10 docs/operations/gettaskclassificationsglobals.mdx: id: 14d0010b40f8 last_write_checksum: sha1:6c967e8855540035a6f70fa895ceea0c9caf1cdd @@ -5772,6 +5796,10 @@ trackedFiles: id: fa09ca81a05c last_write_checksum: sha1:6126fc355e98574f157b9b485ac850a0ec6f2a5e pristine_git_object: 2394952123e253a775bb81426d6ee2d49911e97b + docs/operations/languagetype.mdx: + id: fe52912b0ea7 + last_write_checksum: sha1:85897c7620d5c3725f610a496f4ceb485b9f5063 + pristine_git_object: 0d94d66d51eee4f9fc8d18fb42a32c91fb9c89ec docs/operations/listbyokkeysglobals.mdx: id: b77dfe46caab last_write_checksum: sha1:203cef2704a0493a98ae74994baf54dd7789b998 @@ -6076,6 +6104,10 @@ trackedFiles: id: 43ac1599200a last_write_checksum: sha1:cfb8efa24bc87017aff709963270c9b414bc3483 pristine_git_object: a1b3a3e10a8fc5042c341319692cb2a643cdd9fe + docs/operations/modality.mdx: + id: b6e20b489278 + last_write_checksum: sha1:7914d5e12a4b5a623f277722ae09e1e27d7d6a08 + pristine_git_object: 63f8e9856e57d9736628dcd45b24b6c5646f4a35 docs/operations/object.mdx: id: 6fa1fcf5620b last_write_checksum: sha1:3727111f1223b76f5a9f21c89fba6c59ea31d428 @@ -6096,6 +6128,10 @@ trackedFiles: id: 5465d93e546d last_write_checksum: sha1:5f10a8fd8a9a7b55fc023e33bc9250f4d801af35 pristine_git_object: 91c6769e0026aa486c3fb4a6672c3691b2a997aa + docs/operations/period.mdx: + id: 038d66aa4fc1 + last_write_checksum: sha1:f65e16f5901c128767ab047aaeb811430c2bce3e + pristine_git_object: a1fdee3160b2294a66e05f59cfd17382364c129c docs/operations/prompttokensdetails.mdx: id: 346b38e82e1c last_write_checksum: sha1:ece0f5c30ccaef159981265b3ac57381289e86b3 @@ -6138,8 +6174,8 @@ trackedFiles: pristine_git_object: 051bb4d1cdb3bdbcd87b29419a4a408f10bb1555 docs/operations/responseformat.mdx: id: 363fb8a0ddd6 - last_write_checksum: sha1:69ffb401451c435882706846f68465b58324f02f - pristine_git_object: 83b1634e4f243f00c539d436c9defb32eee0f466 + last_write_checksum: sha1:ce7d9ba61f903de7446102d09d412e5813d77f1b + pristine_git_object: b7f772318bb3da788acb989aba6067371db53634 docs/operations/result.mdx: id: b68db2e6b7af last_write_checksum: sha1:3ca42544567f285e78aa012de25ac52b5d082314 @@ -6176,6 +6212,10 @@ trackedFiles: id: 03a218211f06 last_write_checksum: sha1:3cdcfbfcdb71dcc17a0c3b4cd5704eac3718fa0f pristine_git_object: dc194bad92caf2afd0759830559be89a8bafe5a4 + docs/operations/timestampgranularities.mdx: + id: 6694d3af2ace + last_write_checksum: sha1:bc7319f009e4133e65cf476c1763b11fb6622ff9 + pristine_git_object: c783ad06042f710374b4702b3b63030a32e52180 docs/operations/typeimageurl.mdx: id: 66578c3ea6a5 last_write_checksum: sha1:e3275995c5351075e0c4082a161891cf710b8fdc @@ -6322,8 +6362,8 @@ trackedFiles: pristine_git_object: 414ae2830c58add7ad904cc9ffc5b46ed65058df docs/sdks/datasets/README.mdx: id: 15e5ab0183de - last_write_checksum: sha1:91e92cf17fa0a3a1729a8777bad701e69aeed404 - pristine_git_object: 9cdcae1f6c83a4b1918d00c221f619978967f490 + last_write_checksum: sha1:f716eecbda6e252e092fd559e4c68778b551d5c8 + pristine_git_object: ef43241cee60a329848e01772031d3f97e0f0d30 docs/sdks/embeddings/README.mdx: id: cd71581df291 last_write_checksum: sha1:627e1efaacb2a29cb97e9d184ead987d95008bed @@ -6382,12 +6422,12 @@ trackedFiles: pristine_git_object: 03281f8cf709ebb9a81700ade4cf9bc0db665eb6 docs/sdks/stt/README.mdx: id: 190b0dc9a5d1 - last_write_checksum: sha1:b07ff598e0d3cf542021bff66790ce97ceef6686 - pristine_git_object: 4ca736501a4c14a79710585ab460ea224f95918d + last_write_checksum: sha1:a8e68ac2b0bb8640e01d962177b42ab47b24898b + pristine_git_object: 003f85994a515547fe80dcc316ccc19d81c5322d docs/sdks/tts/README.mdx: id: cd1132543884 - last_write_checksum: sha1:8930237642313a1db6fdce5f7ea2b0680dc7c5ac - pristine_git_object: ece7fa92f85b1d8f702ecf2855f7267120d4efac + last_write_checksum: sha1:d28728db90dbab11f336d772b27544bb41ecceee + pristine_git_object: dca713aa3629e162924844de964be74e9b4ed081 docs/sdks/videogeneration/README.mdx: id: 9a8fa04c3872 last_write_checksum: sha1:7d3c54cf2daa98e25df18bc27cc4ca30b2b1f03f @@ -6402,8 +6442,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:3e14cbf5ff3840151bd6c7af58d44d62d4595384 - pristine_git_object: 501f0c59631a591f0359664dd63643e9f2f27553 + last_write_checksum: sha1:2ebe96d8a4d112652eb43405442cdd305b5527f2 + pristine_git_object: 0ab0806b589bf64862fa7b0d06cbf2febee38379 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6430,8 +6470,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:227debe496eb6e581977ca65e0029cc6c638b46d - pristine_git_object: e8f04f546a8475289bce1c52654f0a09402a2dec + last_write_checksum: sha1:7811cd9984f7915aab91893aa048ae2fed9e51ec + pristine_git_object: 56b8833781310b3e7c300631cc0e0a66f97efc4f src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6470,8 +6510,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:fd8a64c71c4edc63a92eec32343fef06f743dd1b - pristine_git_object: 6e6304237012f2f5eaa9d96e5fde8ee13bc7096d + last_write_checksum: sha1:67dca4a903421d2bf39474047c5953b2c4432d70 + pristine_git_object: 6fd499892576c4bff0ee51dc59e77b99ff239f7f src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -8274,8 +8314,8 @@ trackedFiles: pristine_git_object: 418953ba7366a6015934bf8795178d79adb03b89 src/openrouter/components/speechrequest.py: id: 2a9400167112 - last_write_checksum: sha1:110111aca3452c99b2c8ae365956737d935ae5ba - pristine_git_object: cb7e1b2a4626b9424b4c4c564a084d1ad2f15b3d + last_write_checksum: sha1:c91c94e2cf165ea7fd12b8001094c537c8858c9c + pristine_git_object: f903339eaa5c31fa00f7aad4150d61dea0737dad src/openrouter/components/stopservertoolswhencondition.py: id: 2deeda4209ac last_write_checksum: sha1:581e0ee62776d42bf598b9f68b998faabfecd3ce @@ -8342,16 +8382,28 @@ trackedFiles: pristine_git_object: 76c4b466e22e57b34098b587e95cb358089dd87c src/openrouter/components/sttrequest.py: id: 5fb1d469e16e - last_write_checksum: sha1:04621e286373ed7b188a3c171f83c93cb89c67f1 - pristine_git_object: d5497b98e6de245a4839b80079bf673be05d70ae + last_write_checksum: sha1:2944becda4acc11da95aff5cfb967544b8b15d0a + pristine_git_object: ce7ba259743cba658a3e23c2ea212d0fcaf34ebf src/openrouter/components/sttresponse.py: id: 2dc8eb8daaca - last_write_checksum: sha1:31cb20245662006e6459e662152c80e97778d77f - pristine_git_object: 19ff065a62373dfe9e0c97842d4ee173a175f5b6 + last_write_checksum: sha1:36aff8c075a27f036d34f3970031a26aad99f804 + pristine_git_object: 61daeb24ef51df79db5fa62329f8d15d81d729d9 + src/openrouter/components/sttsegment.py: + id: f3439539736c + last_write_checksum: sha1:be08482dc37814ed812250622b4ecb346b31787a + pristine_git_object: 471a0806203bea27421e0681e4b48cda9ce23220 + src/openrouter/components/stttimestampgranularity.py: + id: d6f8b068026d + last_write_checksum: sha1:9d1aff48024b9ab1446a05784f9aeb33aebdcee4 + pristine_git_object: 30edd2ffd22cad78e4950c8751b8de3314909250 src/openrouter/components/sttusage.py: id: abe8329af787 last_write_checksum: sha1:4b7b79be71c2d1e392aef738a37d2d75f0bb29c4 pristine_git_object: 1feb5db4da1422d55744c5a4bb10eabda6c50c4f + src/openrouter/components/sttword.py: + id: b46ff7c5fa20 + last_write_checksum: sha1:69fc17c2b943ace9486b782f7250579ba8d454b0 + pristine_git_object: 020dd01249eb982b0e94f0c19748badf5287a31a src/openrouter/components/subagentnestedtool.py: id: 911a465973a0 last_write_checksum: sha1:beb2209144b032e109c4afe33f440728423d7594 @@ -8614,8 +8666,8 @@ trackedFiles: pristine_git_object: 791cdeba11d6c5e9e9381760fd8cd8ca86233b22 src/openrouter/datasets.py: id: 2378f80d1d6a - last_write_checksum: sha1:a2941625198705ff1585bb7e8ae7ba5c110d43e9 - pristine_git_object: 04200589b12afe8bf67a158b99c7b9c11e4dab5c + last_write_checksum: sha1:bcbf0eef58b4f26fc01ddd28c568fc361ccf8919 + pristine_git_object: 3d9437c8ce1bdc83d3703c4374cf10b1bcae5d71 src/openrouter/embeddings.py: id: 0374ace39067 last_write_checksum: sha1:bdfaf3f9ffa1e337c0cc62b5a956a53c7863f24d @@ -8750,8 +8802,8 @@ trackedFiles: pristine_git_object: a1dea9b45650cc42a6f60447c032fa46b102839a src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:86fa5bd8f963caf8257ef28d618202fdb56e0b8f - pristine_git_object: 737838dfcd39c8a590ca5058aeffb8fe85311665 + last_write_checksum: sha1:46a3dfac25ac1c3d774e37ec8df54f9ba9851e46 + pristine_git_object: ab9fa9e4793e73671cc752005123a482b51b506f src/openrouter/operations/bulkaddworkspacemembers.py: id: e0ed56117619 last_write_checksum: sha1:5c44eb0d40fdece3ac084615f6c6082be4cf1d5a @@ -8786,8 +8838,8 @@ trackedFiles: pristine_git_object: 4e8414f223370bff1e4f060919f36f70da6ec40c src/openrouter/operations/createaudiotranscriptions_multipart.py: id: da07d463225a - last_write_checksum: sha1:340621e278cff6ac1537e4d7e3b2c116a4193ee8 - pristine_git_object: 2697d1e94c6a76e751575bc6f6f626f3e3149f3d + last_write_checksum: sha1:a267131b5e9d8803f51431bbbc96a29484e97f0b + pristine_git_object: ff5459ee49af5fabed9c5e9a68979b923a7c4e9b src/openrouter/operations/createauthkeyscode.py: id: 4253a437de22 last_write_checksum: sha1:874492b64266fcdc5a7f3cd988d71326b7796a5c @@ -8942,8 +8994,8 @@ trackedFiles: pristine_git_object: cbcc9abe2ab38d7e7bd3cbc79acfda4da6b630e0 src/openrouter/operations/getrankingsdaily.py: id: 61dd0325de08 - last_write_checksum: sha1:a5953f86dfb31e77024412d02cc56b7a485fdb76 - pristine_git_object: efa494faf3208ec621c97b156196a27b1c61b018 + last_write_checksum: sha1:352d2aeaebf68140c78343f31cc8ba344dc3d9ae + pristine_git_object: fb9267c75f1e40b75ad22f313c3c1028f026f657 src/openrouter/operations/gettaskclassifications.py: id: ba6156d68acf last_write_checksum: sha1:c569572d21aa766ac542d5c535208e8b1caae503 @@ -9134,12 +9186,12 @@ trackedFiles: pristine_git_object: 26433165a0b1c25d7bd3115b9b129b18f2dc9387 src/openrouter/stt.py: id: fc0c2f669423 - last_write_checksum: sha1:d9821e49378f4ceba290fcfd17f7c9b68311fecc - pristine_git_object: b5895f3b688cde2b19bcef498e4992761bbdd58d + last_write_checksum: sha1:22247925e3c44234947eadbd409603292d4f9efe + pristine_git_object: 4bcc6d0314a17f48bc9735e2720e5b0b5f4bca22 src/openrouter/tts.py: id: 5055d4b95f1d - last_write_checksum: sha1:727a19a0df768153cbe2d8351394a2e254f680ea - pristine_git_object: 68ae54d07c464e69738c16bebf77d06d0d7f2141 + last_write_checksum: sha1:1561bf5c436e6912dfde6bfec7516aa85e24db9c + pristine_git_object: 5ccc4b9bad1c3db1c901d7df2d7f8d7e2d12df57 src/openrouter/types/__init__.py: id: 5eab536205b7 last_write_checksum: sha1:f9ad14217f832e74f594285960125add50324be9 @@ -10706,3 +10758,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 +releaseNotes: "## Python SDK Changes:\n* `open_router.stt.create_transcription()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.stt.create_transcription_multipart()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.datasets.get_rankings_daily()`: `request` **Changed**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 0cfd9cb7..9d74094e 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.6 + version: 0.11.7 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 58e804a5..3fb0f9e7 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -20687,11 +20687,28 @@ components: options: $ref: '#/components/schemas/ProviderOptions' type: object + response_format: + description: >- + Output format. "json" (default) returns { text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. + enum: + - json + - verbose_json + example: json + type: string + x-speakeasy-unknown-values: allow temperature: description: Sampling temperature for transcription example: 0 format: double type: number + timestamp_granularities: + description: >- + Timestamp detail levels to include when response_format is "verbose_json". "segment" returns segment-level timestamps; "word" additionally returns word-level timestamps in the words array. Ignored unless response_format is "verbose_json". + example: + - segment + items: + $ref: '#/components/schemas/STTTimestampGranularity' + type: array required: - model - input_audio @@ -20707,6 +20724,24 @@ components: seconds: 9.2 total_tokens: 113 properties: + duration: + description: Duration of the input audio in seconds, present when response_format is verbose_json + example: 9.2 + format: double + type: number + language: + description: Detected or forced language, present when response_format is verbose_json + example: english + type: string + segments: + description: Timestamped transcript segments, present when response_format is verbose_json + items: + $ref: '#/components/schemas/STTSegment' + type: array + task: + description: The task performed, present when response_format is verbose_json + example: transcribe + type: string text: description: The transcribed text example: >- @@ -20714,9 +20749,88 @@ components: type: string usage: $ref: '#/components/schemas/STTUsage' + words: + description: Timestamped words, present when the provider returns word-level timestamps + items: + $ref: '#/components/schemas/STTWord' + type: array required: - text type: object + STTSegment: + description: A timestamped transcript segment, returned when response_format is verbose_json + example: + avg_logprob: -0.28 + compression_ratio: 1.13 + end: 3.2 + id: 0 + no_speech_prob: 0.01 + seek: 0 + start: 0 + temperature: 0 + text: Hello there. + tokens: + - 50364 + - 2425 + - 456 + properties: + avg_logprob: + description: Average log probability of the segment + format: double + type: number + compression_ratio: + description: Compression ratio of the segment + format: double + type: number + end: + description: Segment end time in seconds + example: 3.2 + format: double + type: number + id: + description: Segment index within the transcript + example: 0 + type: integer + no_speech_prob: + description: Probability the segment contains no speech + format: double + type: number + seek: + description: Seek offset of the segment + example: 0 + type: integer + start: + description: Segment start time in seconds + example: 0 + format: double + type: number + temperature: + description: Temperature used for the segment + format: double + type: number + text: + description: Transcribed text of the segment + example: Hello there. + type: string + tokens: + description: Token IDs of the segment + items: + type: integer + type: array + required: + - id + - start + - end + - text + type: object + STTTimestampGranularity: + description: A timestamp detail level for verbose_json transcription responses. + enum: + - word + - segment + example: word + type: string + x-speakeasy-unknown-values: allow STTUsage: description: Aggregated usage statistics for the request example: @@ -20749,6 +20863,32 @@ components: example: 113 type: integer type: object + STTWord: + description: A timestamped word, returned when the provider includes word-level timestamps + example: + end: 0.4 + start: 0 + word: Hello + properties: + end: + description: Word end time in seconds + example: 0.4 + format: double + type: number + start: + description: Word start time in seconds + example: 0 + format: double + type: number + word: + description: The transcribed word + example: Hello + type: string + required: + - word + - start + - end + type: object SubagentNestedTool: additionalProperties: nullable: true @@ -23747,13 +23887,26 @@ paths: description: The model to use for transcription. type: string response_format: - description: The response format. Only "json" is supported. + description: >- + The response format. "json" (default) returns { text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). enum: - json + - verbose_json type: string + x-speakeasy-unknown-values: allow temperature: description: The sampling temperature. type: number + timestamp_granularities[]: + description: >- + Timestamp detail levels to include when response_format is "verbose_json". "word" additionally returns word-level timestamps in the words array. + items: + enum: + - word + - segment + type: string + x-speakeasy-unknown-values: allow + type: array required: - file - model @@ -25507,6 +25660,13 @@ paths: reserved permaslug `other` and is always returned last within its date, so callers can compute `top-50 traffic / total daily traffic` without a second request. + Optional filters slice the dataset. `period` (`day`/`week`/`month`) sets the time + grain. `modality` and `context_bucket` narrow the exact dataset by output/input + modality (or tool-calling activity) and request context length. `category` and + `language_type` instead read a sampled, upsampled dataset whose `total_tokens` are + weekly-grain estimates — they cannot be combined with each other or with the exact + filters, and reject `period=day` with a 400. + Authenticate with any valid OpenRouter API key (same key used for inference). Rate-limited to 30 requests/minute per key and 500 requests/day per account. @@ -25541,6 +25701,93 @@ paths: example: '2026-05-11' pattern: ^\d{4}-\d{2}-\d{2}$ type: string + - description: >- + Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries. + in: query + name: period + required: false + schema: + description: >- + Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries. + enum: + - day + - week + - month + example: day + type: string + x-speakeasy-unknown-values: allow + - description: >- + Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`. + in: query + name: modality + required: false + schema: + description: >- + Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`. + enum: + - text + - image + - image_output + - audio + - tool_calling + example: text + type: string + x-speakeasy-unknown-values: allow + - description: >- + Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`. + in: query + name: context_bucket + required: false + schema: + description: >- + Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`. + enum: + - 1K + - 10K + - 100K + - 1M + - 10M + example: 100K + type: string + x-speakeasy-unknown-values: allow + - description: >- + Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`. + in: query + name: category + required: false + schema: + description: >- + Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`. + enum: + - programming + - roleplay + - marketing + - marketing/seo + - technology + - science + - translation + - legal + - finance + - health + - trivia + - academia + example: programming + type: string + x-speakeasy-unknown-values: allow + - description: >- + Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`. + in: query + name: language_type + required: false + schema: + description: >- + Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`. + enum: + - natural + - programming + example: natural + type: string + x-speakeasy-unknown-values: allow responses: '200': content: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 8b363367..3c63cc84 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.787.0 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:ae3b03ac140c2789ef39eddcb297b78e78540441ed22c9f4854e3fa75a6f391b - sourceBlobDigest: sha256:b6b2fd9a8e068d5e601bb5cae1e24b882a449f5f5147e5970e9dcbb0e47527cf + sourceRevisionDigest: sha256:c76873ed773f59ce59af18cd48af7b5e704346cfea03fa8d2fa7fef96fdfb465 + sourceBlobDigest: sha256:e21ec1784f2b7eb1fe3fab59deb0148cc48ecd0f4835ef56502b7e808aab231c tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:ae3b03ac140c2789ef39eddcb297b78e78540441ed22c9f4854e3fa75a6f391b - sourceBlobDigest: sha256:b6b2fd9a8e068d5e601bb5cae1e24b882a449f5f5147e5970e9dcbb0e47527cf + sourceRevisionDigest: sha256:c76873ed773f59ce59af18cd48af7b5e704346cfea03fa8d2fa7fef96fdfb465 + sourceBlobDigest: sha256:e21ec1784f2b7eb1fe3fab59deb0148cc48ecd0f4835ef56502b7e808aab231c codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:f296de4382641a2b6396f017c634185759e79bf0de91ab45e1b843bd5c609353 + codeSamplesRevisionDigest: sha256:ca16452a0a4478ea5a47dc4f2c60de4b9be28eab5156d58c8bf691ceabb6d742 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 60ce0fef..5764233d 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -168,4 +168,14 @@ Based on: ### Generated - [python v0.11.6] . ### Releases -- [PyPI v0.11.6] https://pypi.org/project/openrouter/0.11.6 - . \ No newline at end of file +- [PyPI v0.11.6] https://pypi.org/project/openrouter/0.11.6 - . + +## 2026-07-07 21:46:35 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.7] . +### Releases +- [PyPI v0.11.7] https://pypi.org/project/openrouter/0.11.7 - . \ No newline at end of file diff --git a/docs/components/speechrequest.mdx b/docs/components/speechrequest.mdx index e984d1fc..b16289c3 100644 --- a/docs/components/speechrequest.mdx +++ b/docs/components/speechrequest.mdx @@ -12,6 +12,6 @@ Text-to-speech request input | `input` | *str* | :heavy_check_mark: | Text to synthesize | Hello world | | `model` | *str* | :heavy_check_mark: | TTS model identifier | elevenlabs/eleven-turbo-v2 | | `provider` | [Optional[components.SpeechRequestProvider]](../components/speechrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | -| `response_format` | [Optional[components.ResponseFormatEnum]](../components/responseformatenum.mdx) | :heavy_minus_sign: | Audio output format | pcm | +| `response_format` | [Optional[components.SpeechRequestResponseFormat]](../components/speechrequestresponseformat.mdx) | :heavy_minus_sign: | Audio output format | pcm | | `speed` | *Optional[float]* | :heavy_minus_sign: | Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers. | 1 | | `voice` | *str* | :heavy_check_mark: | Voice identifier (provider-specific). | alloy | \ No newline at end of file diff --git a/docs/components/responseformatenum.mdx b/docs/components/speechrequestresponseformat.mdx similarity index 61% rename from docs/components/responseformatenum.mdx rename to docs/components/speechrequestresponseformat.mdx index 0b7c4b07..9af8a5aa 100644 --- a/docs/components/responseformatenum.mdx +++ b/docs/components/speechrequestresponseformat.mdx @@ -1,5 +1,5 @@ --- -title: "ResponseFormatEnum" +title: "SpeechRequestResponseFormat" --- Audio output format @@ -7,10 +7,10 @@ Audio output format ## Example Usage ```python -from openrouter.components import ResponseFormatEnum +from openrouter.components import SpeechRequestResponseFormat # Open enum: unrecognized values are captured as UnrecognizedStr -value: ResponseFormatEnum = "mp3" +value: SpeechRequestResponseFormat = "mp3" ``` diff --git a/docs/components/sttrequest.mdx b/docs/components/sttrequest.mdx index 198ca47d..e81d9df1 100644 --- a/docs/components/sttrequest.mdx +++ b/docs/components/sttrequest.mdx @@ -7,10 +7,12 @@ Speech-to-text request input. Accepts a JSON body with input_audio containing ba ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `input_audio` | [components.STTInputAudio](../components/sttinputaudio.mdx) | :heavy_check_mark: | Base64-encoded audio to transcribe | \{
"data": "UklGRiQA...",
"format": "wav"
} | -| `language` | *Optional[str]* | :heavy_minus_sign: | ISO-639-1 language code (e.g., "en", "ja"). Auto-detected if omitted. | en | -| `model` | *str* | :heavy_check_mark: | STT model identifier | openai/whisper-large-v3 | -| `provider` | [Optional[components.STTRequestProvider]](../components/sttrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | -| `temperature` | *Optional[float]* | :heavy_minus_sign: | Sampling temperature for transcription | 0 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `input_audio` | [components.STTInputAudio](../components/sttinputaudio.mdx) | :heavy_check_mark: | Base64-encoded audio to transcribe | \{
"data": "UklGRiQA...",
"format": "wav"
} | +| `language` | *Optional[str]* | :heavy_minus_sign: | ISO-639-1 language code (e.g., "en", "ja"). Auto-detected if omitted. | en | +| `model` | *str* | :heavy_check_mark: | STT model identifier | openai/whisper-large-v3 | +| `provider` | [Optional[components.STTRequestProvider]](../components/sttrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | +| `response_format` | [Optional[components.STTRequestResponseFormat]](../components/sttrequestresponseformat.mdx) | :heavy_minus_sign: | Output format. "json" (default) returns \{ text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. | json | +| `temperature` | *Optional[float]* | :heavy_minus_sign: | Sampling temperature for transcription | 0 | +| `timestamp_granularities` | List[[components.STTTimestampGranularity](../components/stttimestampgranularity.mdx)] | :heavy_minus_sign: | Timestamp detail levels to include when response_format is "verbose_json". "segment" returns segment-level timestamps; "word" additionally returns word-level timestamps in the words array. Ignored unless response_format is "verbose_json". | [
"segment"
] | \ No newline at end of file diff --git a/docs/components/sttrequestresponseformat.mdx b/docs/components/sttrequestresponseformat.mdx new file mode 100644 index 00000000..d016021a --- /dev/null +++ b/docs/components/sttrequestresponseformat.mdx @@ -0,0 +1,22 @@ +--- +title: "STTRequestResponseFormat" +--- + +Output format. "json" (default) returns \{ text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. + +## Example Usage + +```python +from openrouter.components import STTRequestResponseFormat + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: STTRequestResponseFormat = "json" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"json"` +- `"verbose_json"` diff --git a/docs/components/sttresponse.mdx b/docs/components/sttresponse.mdx index 9a610145..5868e50f 100644 --- a/docs/components/sttresponse.mdx +++ b/docs/components/sttresponse.mdx @@ -9,5 +9,10 @@ STT response containing transcribed text and optional usage statistics | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| `duration` | *Optional[float]* | :heavy_minus_sign: | Duration of the input audio in seconds, present when response_format is verbose_json | 9.2 | +| `language` | *Optional[str]* | :heavy_minus_sign: | Detected or forced language, present when response_format is verbose_json | english | +| `segments` | List[[components.STTSegment](../components/sttsegment.mdx)] | :heavy_minus_sign: | Timestamped transcript segments, present when response_format is verbose_json | | +| `task` | *Optional[str]* | :heavy_minus_sign: | The task performed, present when response_format is verbose_json | transcribe | | `text` | *str* | :heavy_check_mark: | The transcribed text | Hello, this is a test of OpenAI speech-to-text transcription. The weather is sunny today and the temperature is around 72 degrees. | -| `usage` | [Optional[components.STTUsage]](../components/sttusage.mdx) | :heavy_minus_sign: | Aggregated usage statistics for the request | \{
"cost": 0.000508,
"input_tokens": 83,
"output_tokens": 30,
"seconds": 9.2,
"total_tokens": 113
} | \ No newline at end of file +| `usage` | [Optional[components.STTUsage]](../components/sttusage.mdx) | :heavy_minus_sign: | Aggregated usage statistics for the request | \{
"cost": 0.000508,
"input_tokens": 83,
"output_tokens": 30,
"seconds": 9.2,
"total_tokens": 113
} | +| `words` | List[[components.STTWord](../components/sttword.mdx)] | :heavy_minus_sign: | Timestamped words, present when the provider returns word-level timestamps | | \ No newline at end of file diff --git a/docs/components/sttsegment.mdx b/docs/components/sttsegment.mdx new file mode 100644 index 00000000..d0bcd9af --- /dev/null +++ b/docs/components/sttsegment.mdx @@ -0,0 +1,21 @@ +--- +title: "STTSegment" +--- + +A timestamped transcript segment, returned when response_format is verbose_json + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `avg_logprob` | *Optional[float]* | :heavy_minus_sign: | Average log probability of the segment | | +| `compression_ratio` | *Optional[float]* | :heavy_minus_sign: | Compression ratio of the segment | | +| `end` | *float* | :heavy_check_mark: | Segment end time in seconds | 3.2 | +| `id` | *int* | :heavy_check_mark: | Segment index within the transcript | 0 | +| `no_speech_prob` | *Optional[float]* | :heavy_minus_sign: | Probability the segment contains no speech | | +| `seek` | *Optional[int]* | :heavy_minus_sign: | Seek offset of the segment | 0 | +| `start` | *float* | :heavy_check_mark: | Segment start time in seconds | 0 | +| `temperature` | *Optional[float]* | :heavy_minus_sign: | Temperature used for the segment | | +| `text` | *str* | :heavy_check_mark: | Transcribed text of the segment | Hello there. | +| `tokens` | List[*int*] | :heavy_minus_sign: | Token IDs of the segment | | \ No newline at end of file diff --git a/docs/components/stttimestampgranularity.mdx b/docs/components/stttimestampgranularity.mdx new file mode 100644 index 00000000..3505a518 --- /dev/null +++ b/docs/components/stttimestampgranularity.mdx @@ -0,0 +1,22 @@ +--- +title: "STTTimestampGranularity" +--- + +A timestamp detail level for verbose_json transcription responses. + +## Example Usage + +```python +from openrouter.components import STTTimestampGranularity + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: STTTimestampGranularity = "word" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"word"` +- `"segment"` diff --git a/docs/components/sttword.mdx b/docs/components/sttword.mdx new file mode 100644 index 00000000..994522a5 --- /dev/null +++ b/docs/components/sttword.mdx @@ -0,0 +1,14 @@ +--- +title: "STTWord" +--- + +A timestamped word, returned when the provider includes word-level timestamps + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `end` | *float* | :heavy_check_mark: | Word end time in seconds | 0.4 | +| `start` | *float* | :heavy_check_mark: | Word start time in seconds | 0 | +| `word` | *str* | :heavy_check_mark: | The transcribed word | Hello | \ No newline at end of file diff --git a/docs/operations/contextbucket.mdx b/docs/operations/contextbucket.mdx new file mode 100644 index 00000000..d2461612 --- /dev/null +++ b/docs/operations/contextbucket.mdx @@ -0,0 +1,25 @@ +--- +title: "ContextBucket" +--- + +Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`. + +## Example Usage + +```python +from openrouter.operations import ContextBucket + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ContextBucket = "1K" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"1K"` +- `"10K"` +- `"100K"` +- `"1M"` +- `"10M"` diff --git a/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx b/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx index 70f754bb..3054ebe9 100644 --- a/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx +++ b/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx @@ -4,10 +4,11 @@ title: "CreateAudioTranscriptionsMultipartRequestBody" ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `file` | [operations.CreateAudioTranscriptionsMultipartFile](../operations/createaudiotranscriptionsmultipartfile.mdx) | :heavy_check_mark: | The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio. | -| `language` | *Optional[str]* | :heavy_minus_sign: | The language of the input audio (ISO-639-1). | -| `model` | *str* | :heavy_check_mark: | The model to use for transcription. | -| `response_format` | [Optional[operations.ResponseFormat]](../operations/responseformat.mdx) | :heavy_minus_sign: | The response format. Only "json" is supported. | -| `temperature` | *Optional[float]* | :heavy_minus_sign: | The sampling temperature. | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `file` | [operations.CreateAudioTranscriptionsMultipartFile](../operations/createaudiotranscriptionsmultipartfile.mdx) | :heavy_check_mark: | The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio. | +| `language` | *Optional[str]* | :heavy_minus_sign: | The language of the input audio (ISO-639-1). | +| `model` | *str* | :heavy_check_mark: | The model to use for transcription. | +| `response_format` | [Optional[operations.ResponseFormat]](../operations/responseformat.mdx) | :heavy_minus_sign: | The response format. "json" (default) returns \{ text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). | +| `temperature` | *Optional[float]* | :heavy_minus_sign: | The sampling temperature. | +| `timestamp_granularities` | List[[operations.TimestampGranularities](../operations/timestampgranularities.mdx)] | :heavy_minus_sign: | Timestamp detail levels to include when response_format is "verbose_json". "word" additionally returns word-level timestamps in the words array. | \ No newline at end of file diff --git a/docs/operations/getrankingsdailycategory.mdx b/docs/operations/getrankingsdailycategory.mdx new file mode 100644 index 00000000..a81ff4b5 --- /dev/null +++ b/docs/operations/getrankingsdailycategory.mdx @@ -0,0 +1,32 @@ +--- +title: "GetRankingsDailyCategory" +--- + +Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`. + +## Example Usage + +```python +from openrouter.operations import GetRankingsDailyCategory + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: GetRankingsDailyCategory = "programming" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"programming"` +- `"roleplay"` +- `"marketing"` +- `"marketing/seo"` +- `"technology"` +- `"science"` +- `"translation"` +- `"legal"` +- `"finance"` +- `"health"` +- `"trivia"` +- `"academia"` diff --git a/docs/operations/getrankingsdailyrequest.mdx b/docs/operations/getrankingsdailyrequest.mdx index 1788b942..04784a9f 100644 --- a/docs/operations/getrankingsdailyrequest.mdx +++ b/docs/operations/getrankingsdailyrequest.mdx @@ -4,10 +4,15 @@ title: "GetRankingsDailyRequest" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `start_date` | *Optional[str]* | :heavy_minus_sign: | Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`. | 2026-04-12 | -| `end_date` | *Optional[str]* | :heavy_minus_sign: | End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400. | 2026-05-11 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `start_date` | *Optional[str]* | :heavy_minus_sign: | Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`. | 2026-04-12 | +| `end_date` | *Optional[str]* | :heavy_minus_sign: | End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400. | 2026-05-11 | +| `period` | [Optional[operations.Period]](../operations/period.mdx) | :heavy_minus_sign: | Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries. | day | +| `modality` | [Optional[operations.Modality]](../operations/modality.mdx) | :heavy_minus_sign: | Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`. | text | +| `context_bucket` | [Optional[operations.ContextBucket]](../operations/contextbucket.mdx) | :heavy_minus_sign: | Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`. | 100K | +| `category` | [Optional[operations.GetRankingsDailyCategory]](../operations/getrankingsdailycategory.mdx) | :heavy_minus_sign: | Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`. | programming | +| `language_type` | [Optional[operations.LanguageType]](../operations/languagetype.mdx) | :heavy_minus_sign: | Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`. | natural | \ No newline at end of file diff --git a/docs/operations/languagetype.mdx b/docs/operations/languagetype.mdx new file mode 100644 index 00000000..0d94d66d --- /dev/null +++ b/docs/operations/languagetype.mdx @@ -0,0 +1,22 @@ +--- +title: "LanguageType" +--- + +Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`. + +## Example Usage + +```python +from openrouter.operations import LanguageType + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: LanguageType = "natural" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"natural"` +- `"programming"` diff --git a/docs/operations/modality.mdx b/docs/operations/modality.mdx new file mode 100644 index 00000000..63f8e985 --- /dev/null +++ b/docs/operations/modality.mdx @@ -0,0 +1,25 @@ +--- +title: "Modality" +--- + +Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`. + +## Example Usage + +```python +from openrouter.operations import Modality + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: Modality = "text" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"text"` +- `"image"` +- `"image_output"` +- `"audio"` +- `"tool_calling"` diff --git a/docs/operations/period.mdx b/docs/operations/period.mdx new file mode 100644 index 00000000..a1fdee31 --- /dev/null +++ b/docs/operations/period.mdx @@ -0,0 +1,23 @@ +--- +title: "Period" +--- + +Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries. + +## Example Usage + +```python +from openrouter.operations import Period + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: Period = "day" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"day"` +- `"week"` +- `"month"` diff --git a/docs/operations/responseformat.mdx b/docs/operations/responseformat.mdx index 83b1634e..b7f77231 100644 --- a/docs/operations/responseformat.mdx +++ b/docs/operations/responseformat.mdx @@ -2,16 +2,21 @@ title: "ResponseFormat" --- -The response format. Only "json" is supported. +The response format. "json" (default) returns \{ text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). ## Example Usage ```python from openrouter.operations import ResponseFormat + +# Open enum: unrecognized values are captured as UnrecognizedStr value: ResponseFormat = "json" ``` ## Values +This is an open enum. Unrecognized values will not fail type checks. + - `"json"` +- `"verbose_json"` diff --git a/docs/operations/timestampgranularities.mdx b/docs/operations/timestampgranularities.mdx new file mode 100644 index 00000000..c783ad06 --- /dev/null +++ b/docs/operations/timestampgranularities.mdx @@ -0,0 +1,20 @@ +--- +title: "TimestampGranularities" +--- + +## Example Usage + +```python +from openrouter.operations import TimestampGranularities + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: TimestampGranularities = "word" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"word"` +- `"segment"` diff --git a/docs/sdks/datasets/README.mdx b/docs/sdks/datasets/README.mdx index 9cdcae1f..ef43241c 100644 --- a/docs/sdks/datasets/README.mdx +++ b/docs/sdks/datasets/README.mdx @@ -102,6 +102,13 @@ Each row is a distinct `(date, model_permaslug)` pair. The `other` row uses the reserved permaslug `other` and is always returned last within its date, so callers can compute `top-50 traffic / total daily traffic` without a second request. +Optional filters slice the dataset. `period` (`day`/`week`/`month`) sets the time +grain. `modality` and `context_bucket` narrow the exact dataset by output/input +modality (or tool-calling activity) and request context length. `category` and +`language_type` instead read a sampled, upsampled dataset whose `total_tokens` are +weekly-grain estimates — they cannot be combined with each other or with the exact +filters, and reject `period=day` with a 400. + Authenticate with any valid OpenRouter API key (same key used for inference). Rate-limited to 30 requests/minute per key and 500 requests/day per account. @@ -136,14 +143,19 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `start_date` | *Optional[str]* | :heavy_minus_sign: | Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`. | 2026-04-12 | -| `end_date` | *Optional[str]* | :heavy_minus_sign: | End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400. | 2026-05-11 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `start_date` | *Optional[str]* | :heavy_minus_sign: | Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`. | 2026-04-12 | +| `end_date` | *Optional[str]* | :heavy_minus_sign: | End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400. | 2026-05-11 | +| `period` | [Optional[operations.Period]](../../operations/period.mdx) | :heavy_minus_sign: | Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries. | day | +| `modality` | [Optional[operations.Modality]](../../operations/modality.mdx) | :heavy_minus_sign: | Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`. | text | +| `context_bucket` | [Optional[operations.ContextBucket]](../../operations/contextbucket.mdx) | :heavy_minus_sign: | Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`. | 100K | +| `category` | [Optional[operations.GetRankingsDailyCategory]](../../operations/getrankingsdailycategory.mdx) | :heavy_minus_sign: | Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`. | programming | +| `language_type` | [Optional[operations.LanguageType]](../../operations/languagetype.mdx) | :heavy_minus_sign: | Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`. | natural | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/docs/sdks/stt/README.mdx b/docs/sdks/stt/README.mdx index 4ca73650..003f8599 100644 --- a/docs/sdks/stt/README.mdx +++ b/docs/sdks/stt/README.mdx @@ -42,17 +42,19 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `input_audio` | [components.STTInputAudio](../../components/sttinputaudio.mdx) | :heavy_check_mark: | Base64-encoded audio to transcribe | \{
"data": "UklGRiQA...",
"format": "wav"
} | -| `model` | *str* | :heavy_check_mark: | STT model identifier | openai/whisper-large-v3 | -| `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `language` | *Optional[str]* | :heavy_minus_sign: | ISO-639-1 language code (e.g., "en", "ja"). Auto-detected if omitted. | en | -| `provider` | [Optional[components.STTRequestProvider]](../../components/sttrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | -| `temperature` | *Optional[float]* | :heavy_minus_sign: | Sampling temperature for transcription | 0 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `input_audio` | [components.STTInputAudio](../../components/sttinputaudio.mdx) | :heavy_check_mark: | Base64-encoded audio to transcribe | \{
"data": "UklGRiQA...",
"format": "wav"
} | +| `model` | *str* | :heavy_check_mark: | STT model identifier | openai/whisper-large-v3 | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `language` | *Optional[str]* | :heavy_minus_sign: | ISO-639-1 language code (e.g., "en", "ja"). Auto-detected if omitted. | en | +| `provider` | [Optional[components.STTRequestProvider]](../../components/sttrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | +| `response_format` | [Optional[components.STTRequestResponseFormat]](../../components/sttrequestresponseformat.mdx) | :heavy_minus_sign: | Output format. "json" (default) returns \{ text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. | json | +| `temperature` | *Optional[float]* | :heavy_minus_sign: | Sampling temperature for transcription | 0 | +| `timestamp_granularities` | List[[components.STTTimestampGranularity](../../components/stttimestampgranularity.mdx)] | :heavy_minus_sign: | Timestamp detail levels to include when response_format is "verbose_json". "segment" returns segment-level timestamps; "word" additionally returns word-level timestamps in the words array. Ignored unless response_format is "verbose_json". | [
"segment"
] | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -104,17 +106,18 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `file` | [operations.CreateAudioTranscriptionsMultipartFile](../../operations/createaudiotranscriptionsmultipartfile.mdx) | :heavy_check_mark: | The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio. | -| `model` | *str* | :heavy_check_mark: | The model to use for transcription. | -| `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| -| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| -| `language` | *Optional[str]* | :heavy_minus_sign: | The language of the input audio (ISO-639-1). | -| `response_format` | [Optional[operations.ResponseFormat]](../../operations/responseformat.mdx) | :heavy_minus_sign: | The response format. Only "json" is supported. | -| `temperature` | *Optional[float]* | :heavy_minus_sign: | The sampling temperature. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `file` | [operations.CreateAudioTranscriptionsMultipartFile](../../operations/createaudiotranscriptionsmultipartfile.mdx) | :heavy_check_mark: | The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio. | +| `model` | *str* | :heavy_check_mark: | The model to use for transcription. | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| +| `language` | *Optional[str]* | :heavy_minus_sign: | The language of the input audio (ISO-639-1). | +| `response_format` | [Optional[operations.ResponseFormat]](../../operations/responseformat.mdx) | :heavy_minus_sign: | The response format. "json" (default) returns \{ text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). | +| `temperature` | *Optional[float]* | :heavy_minus_sign: | The sampling temperature. | +| `timestamp_granularities` | List[[operations.TimestampGranularities](../../operations/timestampgranularities.mdx)] | :heavy_minus_sign: | Timestamp detail levels to include when response_format is "verbose_json". "word" additionally returns word-level timestamps in the words array. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response diff --git a/docs/sdks/tts/README.mdx b/docs/sdks/tts/README.mdx index ece7fa92..dca713aa 100644 --- a/docs/sdks/tts/README.mdx +++ b/docs/sdks/tts/README.mdx @@ -47,7 +47,7 @@ with OpenRouter( | `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `provider` | [Optional[components.SpeechRequestProvider]](../../components/speechrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | -| `response_format` | [Optional[components.ResponseFormatEnum]](../../components/responseformatenum.mdx) | :heavy_minus_sign: | Audio output format | pcm | +| `response_format` | [Optional[components.SpeechRequestResponseFormat]](../../components/speechrequestresponseformat.mdx) | :heavy_minus_sign: | Audio output format | pcm | | `speed` | *Optional[float]* | :heavy_minus_sign: | Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers. | 1 | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | diff --git a/pyproject.toml b/pyproject.toml index 501f0c59..0ab0806b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.6" +version = "0.11.7" 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 e8f04f54..56b88337 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.6" +__version__: str = "0.11.7" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.6 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.7 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 6e630423..6fd49989 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -2366,10 +2366,10 @@ ShellServerToolEnvironmentTypedDict, ) from .speechrequest import ( - ResponseFormatEnum, SpeechRequest, SpeechRequestProvider, SpeechRequestProviderTypedDict, + SpeechRequestResponseFormat, SpeechRequestTypedDict, ) from .stopservertoolswhencondition import ( @@ -2443,10 +2443,14 @@ STTRequest, STTRequestProvider, STTRequestProviderTypedDict, + STTRequestResponseFormat, STTRequestTypedDict, ) from .sttresponse import STTResponse, STTResponseTypedDict + from .sttsegment import STTSegment, STTSegmentTypedDict + from .stttimestampgranularity import STTTimestampGranularity from .sttusage import STTUsage, STTUsageTypedDict + from .sttword import STTWord, STTWordTypedDict from .subagentnestedtool import SubagentNestedTool, SubagentNestedToolTypedDict from .subagentreasoning import ( SubagentReasoning, @@ -4296,7 +4300,6 @@ "ResetInterval", "Response", "ResponseFormat", - "ResponseFormatEnum", "ResponseFormatTypedDict", "ResponseHealingPlugin", "ResponseHealingPluginID", @@ -4334,11 +4337,17 @@ "STTRequest", "STTRequestProvider", "STTRequestProviderTypedDict", + "STTRequestResponseFormat", "STTRequestTypedDict", "STTResponse", "STTResponseTypedDict", + "STTSegment", + "STTSegmentTypedDict", + "STTTimestampGranularity", "STTUsage", "STTUsageTypedDict", + "STTWord", + "STTWordTypedDict", "SearchContextSizeEnum", "SearchModelsServerToolConfig", "SearchModelsServerToolConfigTypedDict", @@ -4384,6 +4393,7 @@ "SpeechRequest", "SpeechRequestProvider", "SpeechRequestProviderTypedDict", + "SpeechRequestResponseFormat", "SpeechRequestTypedDict", "Speed", "Stance", @@ -6471,10 +6481,10 @@ "ShellServerToolEngine": ".shellservertoolengine", "ShellServerToolEnvironment": ".shellservertoolenvironment", "ShellServerToolEnvironmentTypedDict": ".shellservertoolenvironment", - "ResponseFormatEnum": ".speechrequest", "SpeechRequest": ".speechrequest", "SpeechRequestProvider": ".speechrequest", "SpeechRequestProviderTypedDict": ".speechrequest", + "SpeechRequestResponseFormat": ".speechrequest", "SpeechRequestTypedDict": ".speechrequest", "StopServerToolsWhenCondition": ".stopservertoolswhencondition", "StopServerToolsWhenConditionTypedDict": ".stopservertoolswhencondition", @@ -6524,11 +6534,17 @@ "STTRequest": ".sttrequest", "STTRequestProvider": ".sttrequest", "STTRequestProviderTypedDict": ".sttrequest", + "STTRequestResponseFormat": ".sttrequest", "STTRequestTypedDict": ".sttrequest", "STTResponse": ".sttresponse", "STTResponseTypedDict": ".sttresponse", + "STTSegment": ".sttsegment", + "STTSegmentTypedDict": ".sttsegment", + "STTTimestampGranularity": ".stttimestampgranularity", "STTUsage": ".sttusage", "STTUsageTypedDict": ".sttusage", + "STTWord": ".sttword", + "STTWordTypedDict": ".sttword", "SubagentNestedTool": ".subagentnestedtool", "SubagentNestedToolTypedDict": ".subagentnestedtool", "SubagentReasoning": ".subagentreasoning", diff --git a/src/openrouter/components/speechrequest.py b/src/openrouter/components/speechrequest.py index cb7e1b2a..f903339e 100644 --- a/src/openrouter/components/speechrequest.py +++ b/src/openrouter/components/speechrequest.py @@ -38,7 +38,7 @@ def serialize_model(self, handler): return m -ResponseFormatEnum = Union[ +SpeechRequestResponseFormat = Union[ Literal[ "mp3", "pcm", @@ -59,7 +59,7 @@ class SpeechRequestTypedDict(TypedDict): r"""Voice identifier (provider-specific).""" provider: NotRequired[SpeechRequestProviderTypedDict] r"""Provider-specific passthrough configuration""" - response_format: NotRequired[ResponseFormatEnum] + response_format: NotRequired[SpeechRequestResponseFormat] r"""Audio output format""" speed: NotRequired[float] r"""Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers.""" @@ -80,7 +80,7 @@ class SpeechRequest(BaseModel): provider: Optional[SpeechRequestProvider] = None r"""Provider-specific passthrough configuration""" - response_format: Optional[ResponseFormatEnum] = "pcm" + response_format: Optional[SpeechRequestResponseFormat] = "pcm" r"""Audio output format""" speed: Optional[float] = None diff --git a/src/openrouter/components/sttrequest.py b/src/openrouter/components/sttrequest.py index d5497b98..ce7ba259 100644 --- a/src/openrouter/components/sttrequest.py +++ b/src/openrouter/components/sttrequest.py @@ -3,9 +3,10 @@ from __future__ import annotations from .provideroptions import ProviderOptions, ProviderOptionsTypedDict from .sttinputaudio import STTInputAudio, STTInputAudioTypedDict -from openrouter.types import BaseModel, UNSET_SENTINEL +from .stttimestampgranularity import STTTimestampGranularity +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr from pydantic import model_serializer -from typing import Optional +from typing import List, Literal, Optional, Union from typing_extensions import NotRequired, TypedDict @@ -39,6 +40,16 @@ def serialize_model(self, handler): return m +STTRequestResponseFormat = Union[ + Literal[ + "json", + "verbose_json", + ], + UnrecognizedStr, +] +r"""Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.""" + + class STTRequestTypedDict(TypedDict): r"""Speech-to-text request input. Accepts a JSON body with input_audio containing base64-encoded audio.""" @@ -50,8 +61,12 @@ class STTRequestTypedDict(TypedDict): r"""ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted.""" provider: NotRequired[STTRequestProviderTypedDict] r"""Provider-specific passthrough configuration""" + response_format: NotRequired[STTRequestResponseFormat] + r"""Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.""" temperature: NotRequired[float] r"""Sampling temperature for transcription""" + timestamp_granularities: NotRequired[List[STTTimestampGranularity]] + r"""Timestamp detail levels to include when response_format is \"verbose_json\". \"segment\" returns segment-level timestamps; \"word\" additionally returns word-level timestamps in the words array. Ignored unless response_format is \"verbose_json\".""" class STTRequest(BaseModel): @@ -69,12 +84,26 @@ class STTRequest(BaseModel): provider: Optional[STTRequestProvider] = None r"""Provider-specific passthrough configuration""" + response_format: Optional[STTRequestResponseFormat] = None + r"""Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.""" + temperature: Optional[float] = None r"""Sampling temperature for transcription""" + timestamp_granularities: Optional[List[STTTimestampGranularity]] = None + r"""Timestamp detail levels to include when response_format is \"verbose_json\". \"segment\" returns segment-level timestamps; \"word\" additionally returns word-level timestamps in the words array. Ignored unless response_format is \"verbose_json\".""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["language", "provider", "temperature"]) + optional_fields = set( + [ + "language", + "provider", + "response_format", + "temperature", + "timestamp_granularities", + ] + ) serialized = handler(self) m = {} diff --git a/src/openrouter/components/sttresponse.py b/src/openrouter/components/sttresponse.py index 19ff065a..61daeb24 100644 --- a/src/openrouter/components/sttresponse.py +++ b/src/openrouter/components/sttresponse.py @@ -1,10 +1,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .sttsegment import STTSegment, STTSegmentTypedDict from .sttusage import STTUsage, STTUsageTypedDict +from .sttword import STTWord, STTWordTypedDict from openrouter.types import BaseModel, UNSET_SENTINEL from pydantic import model_serializer -from typing import Optional +from typing import List, Optional from typing_extensions import NotRequired, TypedDict @@ -13,8 +15,18 @@ class STTResponseTypedDict(TypedDict): text: str r"""The transcribed text""" + duration: NotRequired[float] + r"""Duration of the input audio in seconds, present when response_format is verbose_json""" + language: NotRequired[str] + r"""Detected or forced language, present when response_format is verbose_json""" + segments: NotRequired[List[STTSegmentTypedDict]] + r"""Timestamped transcript segments, present when response_format is verbose_json""" + task: NotRequired[str] + r"""The task performed, present when response_format is verbose_json""" usage: NotRequired[STTUsageTypedDict] r"""Aggregated usage statistics for the request""" + words: NotRequired[List[STTWordTypedDict]] + r"""Timestamped words, present when the provider returns word-level timestamps""" class STTResponse(BaseModel): @@ -23,12 +35,29 @@ class STTResponse(BaseModel): text: str r"""The transcribed text""" + duration: Optional[float] = None + r"""Duration of the input audio in seconds, present when response_format is verbose_json""" + + language: Optional[str] = None + r"""Detected or forced language, present when response_format is verbose_json""" + + segments: Optional[List[STTSegment]] = None + r"""Timestamped transcript segments, present when response_format is verbose_json""" + + task: Optional[str] = None + r"""The task performed, present when response_format is verbose_json""" + usage: Optional[STTUsage] = None r"""Aggregated usage statistics for the request""" + words: Optional[List[STTWord]] = None + r"""Timestamped words, present when the provider returns word-level timestamps""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["usage"]) + optional_fields = set( + ["duration", "language", "segments", "task", "usage", "words"] + ) serialized = handler(self) m = {} diff --git a/src/openrouter/components/sttsegment.py b/src/openrouter/components/sttsegment.py new file mode 100644 index 00000000..471a0806 --- /dev/null +++ b/src/openrouter/components/sttsegment.py @@ -0,0 +1,91 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict + + +class STTSegmentTypedDict(TypedDict): + r"""A timestamped transcript segment, returned when response_format is verbose_json""" + + end: float + r"""Segment end time in seconds""" + id: int + r"""Segment index within the transcript""" + start: float + r"""Segment start time in seconds""" + text: str + r"""Transcribed text of the segment""" + avg_logprob: NotRequired[float] + r"""Average log probability of the segment""" + compression_ratio: NotRequired[float] + r"""Compression ratio of the segment""" + no_speech_prob: NotRequired[float] + r"""Probability the segment contains no speech""" + seek: NotRequired[int] + r"""Seek offset of the segment""" + temperature: NotRequired[float] + r"""Temperature used for the segment""" + tokens: NotRequired[List[int]] + r"""Token IDs of the segment""" + + +class STTSegment(BaseModel): + r"""A timestamped transcript segment, returned when response_format is verbose_json""" + + end: float + r"""Segment end time in seconds""" + + id: int + r"""Segment index within the transcript""" + + start: float + r"""Segment start time in seconds""" + + text: str + r"""Transcribed text of the segment""" + + avg_logprob: Optional[float] = None + r"""Average log probability of the segment""" + + compression_ratio: Optional[float] = None + r"""Compression ratio of the segment""" + + no_speech_prob: Optional[float] = None + r"""Probability the segment contains no speech""" + + seek: Optional[int] = None + r"""Seek offset of the segment""" + + temperature: Optional[float] = None + r"""Temperature used for the segment""" + + tokens: Optional[List[int]] = None + r"""Token IDs of the segment""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "avg_logprob", + "compression_ratio", + "no_speech_prob", + "seek", + "temperature", + "tokens", + ] + ) + 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/components/stttimestampgranularity.py b/src/openrouter/components/stttimestampgranularity.py new file mode 100644 index 00000000..30edd2ff --- /dev/null +++ b/src/openrouter/components/stttimestampgranularity.py @@ -0,0 +1,15 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import UnrecognizedStr +from typing import Literal, Union + + +STTTimestampGranularity = Union[ + Literal[ + "word", + "segment", + ], + UnrecognizedStr, +] +r"""A timestamp detail level for verbose_json transcription responses.""" diff --git a/src/openrouter/components/sttword.py b/src/openrouter/components/sttword.py new file mode 100644 index 00000000..020dd012 --- /dev/null +++ b/src/openrouter/components/sttword.py @@ -0,0 +1,29 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class STTWordTypedDict(TypedDict): + r"""A timestamped word, returned when the provider includes word-level timestamps""" + + end: float + r"""Word end time in seconds""" + start: float + r"""Word start time in seconds""" + word: str + r"""The transcribed word""" + + +class STTWord(BaseModel): + r"""A timestamped word, returned when the provider includes word-level timestamps""" + + end: float + r"""Word end time in seconds""" + + start: float + r"""Word start time in seconds""" + + word: str + r"""The transcribed word""" diff --git a/src/openrouter/datasets.py b/src/openrouter/datasets.py index 04200589..3d9437c8 100644 --- a/src/openrouter/datasets.py +++ b/src/openrouter/datasets.py @@ -444,6 +444,11 @@ def get_rankings_daily( x_open_router_categories: Optional[str] = None, start_date: Optional[str] = None, end_date: Optional[str] = None, + period: Optional[operations.Period] = None, + modality: Optional[operations.Modality] = None, + context_bucket: Optional[operations.ContextBucket] = None, + category: Optional[operations.GetRankingsDailyCategory] = None, + language_type: Optional[operations.LanguageType] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -460,6 +465,13 @@ def get_rankings_daily( reserved permaslug `other` and is always returned last within its date, so callers can compute `top-50 traffic / total daily traffic` without a second request. + Optional filters slice the dataset. `period` (`day`/`week`/`month`) sets the time + grain. `modality` and `context_bucket` narrow the exact dataset by output/input + modality (or tool-calling activity) and request context length. `category` and + `language_type` instead read a sampled, upsampled dataset whose `total_tokens` are + weekly-grain estimates — they cannot be combined with each other or with the exact + filters, and reject `period=day` with a 400. + Authenticate with any valid OpenRouter API key (same key used for inference). Rate-limited to 30 requests/minute per key and 500 requests/day per account. @@ -480,6 +492,11 @@ def get_rankings_daily( :param start_date: Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`. :param end_date: End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400. + :param period: Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries. + :param modality: Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`. + :param context_bucket: Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`. + :param category: Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`. + :param language_type: Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`. :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 @@ -501,6 +518,11 @@ def get_rankings_daily( x_open_router_categories=x_open_router_categories, start_date=start_date, end_date=end_date, + period=period, + modality=modality, + context_bucket=context_bucket, + category=category, + language_type=language_type, ) req = self._build_request( @@ -598,6 +620,11 @@ async def get_rankings_daily_async( x_open_router_categories: Optional[str] = None, start_date: Optional[str] = None, end_date: Optional[str] = None, + period: Optional[operations.Period] = None, + modality: Optional[operations.Modality] = None, + context_bucket: Optional[operations.ContextBucket] = None, + category: Optional[operations.GetRankingsDailyCategory] = None, + language_type: Optional[operations.LanguageType] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -614,6 +641,13 @@ async def get_rankings_daily_async( reserved permaslug `other` and is always returned last within its date, so callers can compute `top-50 traffic / total daily traffic` without a second request. + Optional filters slice the dataset. `period` (`day`/`week`/`month`) sets the time + grain. `modality` and `context_bucket` narrow the exact dataset by output/input + modality (or tool-calling activity) and request context length. `category` and + `language_type` instead read a sampled, upsampled dataset whose `total_tokens` are + weekly-grain estimates — they cannot be combined with each other or with the exact + filters, and reject `period=day` with a 400. + Authenticate with any valid OpenRouter API key (same key used for inference). Rate-limited to 30 requests/minute per key and 500 requests/day per account. @@ -634,6 +668,11 @@ async def get_rankings_daily_async( :param start_date: Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`. :param end_date: End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400. + :param period: Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries. + :param modality: Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`. + :param context_bucket: Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`. + :param category: Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`. + :param language_type: Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`. :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 @@ -655,6 +694,11 @@ async def get_rankings_daily_async( x_open_router_categories=x_open_router_categories, start_date=start_date, end_date=end_date, + period=period, + modality=modality, + context_bucket=context_bucket, + category=category, + language_type=language_type, ) req = self._build_request_async( diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 737838df..ab9fa9e4 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -63,6 +63,7 @@ CreateAudioTranscriptionsMultipartRequestBodyTypedDict, CreateAudioTranscriptionsMultipartRequestTypedDict, ResponseFormat, + TimestampGranularities, ) from .createauthkeyscode import ( CreateAuthKeysCodeCodeChallengeMethod, @@ -411,10 +412,15 @@ GetPresetVersionRequestTypedDict, ) from .getrankingsdaily import ( + ContextBucket, + GetRankingsDailyCategory, GetRankingsDailyGlobals, GetRankingsDailyGlobalsTypedDict, GetRankingsDailyRequest, GetRankingsDailyRequestTypedDict, + LanguageType, + Modality, + Period, ) from .gettaskclassifications import ( GetTaskClassificationsGlobals, @@ -766,6 +772,7 @@ "ContentText", "ContentTextTypedDict", "ContentTypedDict", + "ContextBucket", "CostDetails", "CostDetailsTypedDict", "CreateAudioSpeechGlobals", @@ -1018,6 +1025,7 @@ "GetPresetVersionGlobalsTypedDict", "GetPresetVersionRequest", "GetPresetVersionRequestTypedDict", + "GetRankingsDailyCategory", "GetRankingsDailyGlobals", "GetRankingsDailyGlobalsTypedDict", "GetRankingsDailyRequest", @@ -1048,6 +1056,7 @@ "InputTypedDict", "InputUnion", "InputUnionTypedDict", + "LanguageType", "ListBYOKKeysGlobals", "ListBYOKKeysGlobalsTypedDict", "ListBYOKKeysRequest", @@ -1200,6 +1209,7 @@ "MetadataTypedDict", "Metric", "MetricTypedDict", + "Modality", "Object", "ObjectEmbedding", "Operator", @@ -1207,6 +1217,7 @@ "OperatorTypedDict", "OrderBy", "OrderByTypedDict", + "Period", "PromptTokensDetails", "PromptTokensDetailsTypedDict", "Provider", @@ -1240,6 +1251,7 @@ "TaskType", "TimeRange", "TimeRangeTypedDict", + "TimestampGranularities", "TypeImageURL", "TypeText", "UpdateBYOKKeyGlobals", @@ -1333,6 +1345,7 @@ "CreateAudioTranscriptionsMultipartRequestBodyTypedDict": ".createaudiotranscriptions_multipart", "CreateAudioTranscriptionsMultipartRequestTypedDict": ".createaudiotranscriptions_multipart", "ResponseFormat": ".createaudiotranscriptions_multipart", + "TimestampGranularities": ".createaudiotranscriptions_multipart", "CreateAuthKeysCodeCodeChallengeMethod": ".createauthkeyscode", "CreateAuthKeysCodeData": ".createauthkeyscode", "CreateAuthKeysCodeDataTypedDict": ".createauthkeyscode", @@ -1603,10 +1616,15 @@ "GetPresetVersionGlobalsTypedDict": ".getpresetversion", "GetPresetVersionRequest": ".getpresetversion", "GetPresetVersionRequestTypedDict": ".getpresetversion", + "ContextBucket": ".getrankingsdaily", + "GetRankingsDailyCategory": ".getrankingsdaily", "GetRankingsDailyGlobals": ".getrankingsdaily", "GetRankingsDailyGlobalsTypedDict": ".getrankingsdaily", "GetRankingsDailyRequest": ".getrankingsdaily", "GetRankingsDailyRequestTypedDict": ".getrankingsdaily", + "LanguageType": ".getrankingsdaily", + "Modality": ".getrankingsdaily", + "Period": ".getrankingsdaily", "GetTaskClassificationsGlobals": ".gettaskclassifications", "GetTaskClassificationsGlobalsTypedDict": ".gettaskclassifications", "GetTaskClassificationsRequest": ".gettaskclassifications", diff --git a/src/openrouter/operations/createaudiotranscriptions_multipart.py b/src/openrouter/operations/createaudiotranscriptions_multipart.py index 2697d1e9..ff5459ee 100644 --- a/src/openrouter/operations/createaudiotranscriptions_multipart.py +++ b/src/openrouter/operations/createaudiotranscriptions_multipart.py @@ -2,7 +2,7 @@ from __future__ import annotations import io -from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr from openrouter.utils import ( FieldMetadata, HeaderMetadata, @@ -11,7 +11,7 @@ ) import pydantic from pydantic import model_serializer -from typing import IO, Literal, Optional, Union +from typing import IO, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict @@ -119,8 +119,23 @@ def serialize_model(self, handler): return m -ResponseFormat = Literal["json",] -r"""The response format. Only \"json\" is supported.""" +ResponseFormat = Union[ + Literal[ + "json", + "verbose_json", + ], + UnrecognizedStr, +] +r"""The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only).""" + + +TimestampGranularities = Union[ + Literal[ + "word", + "segment", + ], + UnrecognizedStr, +] class CreateAudioTranscriptionsMultipartRequestBodyTypedDict(TypedDict): @@ -131,9 +146,11 @@ class CreateAudioTranscriptionsMultipartRequestBodyTypedDict(TypedDict): language: NotRequired[str] r"""The language of the input audio (ISO-639-1).""" response_format: NotRequired[ResponseFormat] - r"""The response format. Only \"json\" is supported.""" + r"""The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only).""" temperature: NotRequired[float] r"""The sampling temperature.""" + timestamp_granularities: NotRequired[List[TimestampGranularities]] + r"""Timestamp detail levels to include when response_format is \"verbose_json\". \"word\" additionally returns word-level timestamps in the words array.""" class CreateAudioTranscriptionsMultipartRequestBody(BaseModel): @@ -152,14 +169,23 @@ class CreateAudioTranscriptionsMultipartRequestBody(BaseModel): response_format: Annotated[ Optional[ResponseFormat], FieldMetadata(multipart=True) ] = None - r"""The response format. Only \"json\" is supported.""" + r"""The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only).""" temperature: Annotated[Optional[float], FieldMetadata(multipart=True)] = None r"""The sampling temperature.""" + timestamp_granularities: Annotated[ + Optional[List[TimestampGranularities]], + pydantic.Field(alias="timestamp_granularities[]"), + FieldMetadata(multipart=True), + ] = None + r"""Timestamp detail levels to include when response_format is \"verbose_json\". \"word\" additionally returns word-level timestamps in the words array.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["language", "response_format", "temperature"]) + optional_fields = set( + ["language", "response_format", "temperature", "timestamp_granularities[]"] + ) serialized = handler(self) m = {} diff --git a/src/openrouter/operations/getrankingsdaily.py b/src/openrouter/operations/getrankingsdaily.py index efa494fa..fb9267c7 100644 --- a/src/openrouter/operations/getrankingsdaily.py +++ b/src/openrouter/operations/getrankingsdaily.py @@ -1,11 +1,11 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata import pydantic from pydantic import model_serializer -from typing import Optional +from typing import Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict @@ -73,6 +73,73 @@ def serialize_model(self, handler): return m +Period = Union[ + Literal[ + "day", + "week", + "month", + ], + UnrecognizedStr, +] +r"""Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries.""" + + +Modality = Union[ + Literal[ + "text", + "image", + "image_output", + "audio", + "tool_calling", + ], + UnrecognizedStr, +] +r"""Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`.""" + + +ContextBucket = Union[ + Literal[ + "1K", + "10K", + "100K", + "1M", + "10M", + ], + UnrecognizedStr, +] +r"""Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`.""" + + +GetRankingsDailyCategory = Union[ + Literal[ + "programming", + "roleplay", + "marketing", + "marketing/seo", + "technology", + "science", + "translation", + "legal", + "finance", + "health", + "trivia", + "academia", + ], + UnrecognizedStr, +] +r"""Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`.""" + + +LanguageType = Union[ + Literal[ + "natural", + "programming", + ], + UnrecognizedStr, +] +r"""Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`.""" + + class GetRankingsDailyRequestTypedDict(TypedDict): http_referer: NotRequired[str] r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -91,6 +158,16 @@ class GetRankingsDailyRequestTypedDict(TypedDict): r"""Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`.""" end_date: NotRequired[str] r"""End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400.""" + period: NotRequired[Period] + r"""Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries.""" + modality: NotRequired[Modality] + r"""Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`.""" + context_bucket: NotRequired[ContextBucket] + r"""Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`.""" + category: NotRequired[GetRankingsDailyCategory] + r"""Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`.""" + language_type: NotRequired[LanguageType] + r"""Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`.""" class GetRankingsDailyRequest(BaseModel): @@ -134,6 +211,36 @@ class GetRankingsDailyRequest(BaseModel): ] = None r"""End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400.""" + period: Annotated[ + Optional[Period], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries.""" + + modality: Annotated[ + Optional[Modality], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`.""" + + context_bucket: Annotated[ + Optional[ContextBucket], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`.""" + + category: Annotated[ + Optional[GetRankingsDailyCategory], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`.""" + + language_type: Annotated[ + Optional[LanguageType], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( @@ -143,6 +250,11 @@ def serialize_model(self, handler): "X-OpenRouter-Categories", "start_date", "end_date", + "period", + "modality", + "context_bucket", + "category", + "language_type", ] ) serialized = handler(self) diff --git a/src/openrouter/stt.py b/src/openrouter/stt.py index b5895f3b..4bcc6d03 100644 --- a/src/openrouter/stt.py +++ b/src/openrouter/stt.py @@ -6,7 +6,7 @@ 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, Mapping, Optional, Union +from typing import Any, Iterable, List, Mapping, Optional, Union class Stt(BaseSDK): @@ -24,7 +24,11 @@ def create_transcription( provider: Optional[ Union[components.STTRequestProvider, components.STTRequestProviderTypedDict] ] = None, + response_format: Optional[components.STTRequestResponseFormat] = None, temperature: Optional[float] = None, + timestamp_granularities: Optional[ + Iterable[components.STTTimestampGranularity] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -45,7 +49,9 @@ def create_transcription( :param language: ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted. :param provider: Provider-specific passthrough configuration + :param response_format: Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. :param temperature: Sampling temperature for transcription + :param timestamp_granularities: Timestamp detail levels to include when response_format is \"verbose_json\". \"segment\" returns segment-level timestamps; \"word\" additionally returns word-level timestamps in the words array. Ignored unless response_format is \"verbose_json\". :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 @@ -74,7 +80,12 @@ def create_transcription( provider=utils.get_pydantic_model( provider, Optional[components.STTRequestProvider] ), + response_format=response_format, temperature=temperature, + timestamp_granularities=utils.unmarshal( + timestamp_granularities, + Optional[List[components.STTTimestampGranularity]], + ), ), ) @@ -210,7 +221,11 @@ async def create_transcription_async( provider: Optional[ Union[components.STTRequestProvider, components.STTRequestProviderTypedDict] ] = None, + response_format: Optional[components.STTRequestResponseFormat] = None, temperature: Optional[float] = None, + timestamp_granularities: Optional[ + Iterable[components.STTTimestampGranularity] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -231,7 +246,9 @@ async def create_transcription_async( :param language: ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted. :param provider: Provider-specific passthrough configuration + :param response_format: Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. :param temperature: Sampling temperature for transcription + :param timestamp_granularities: Timestamp detail levels to include when response_format is \"verbose_json\". \"segment\" returns segment-level timestamps; \"word\" additionally returns word-level timestamps in the words array. Ignored unless response_format is \"verbose_json\". :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 @@ -260,7 +277,12 @@ async def create_transcription_async( provider=utils.get_pydantic_model( provider, Optional[components.STTRequestProvider] ), + response_format=response_format, temperature=temperature, + timestamp_granularities=utils.unmarshal( + timestamp_granularities, + Optional[List[components.STTTimestampGranularity]], + ), ), ) @@ -398,6 +420,9 @@ def create_transcription_multipart( language: Optional[str] = None, response_format: Optional[operations.ResponseFormat] = None, temperature: Optional[float] = None, + timestamp_granularities: Optional[ + Iterable[operations.TimestampGranularities] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -417,8 +442,9 @@ def create_transcription_multipart( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param language: The language of the input audio (ISO-639-1). - :param response_format: The response format. Only \"json\" is supported. + :param response_format: The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). :param temperature: The sampling temperature. + :param timestamp_granularities: Timestamp detail levels to include when response_format is \"verbose_json\". \"word\" additionally returns word-level timestamps in the words array. :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 @@ -446,6 +472,10 @@ def create_transcription_multipart( model=model, response_format=response_format, temperature=temperature, + timestamp_granularities=utils.unmarshal( + timestamp_granularities, + Optional[List[operations.TimestampGranularities]], + ), ), ) @@ -587,6 +617,9 @@ async def create_transcription_multipart_async( language: Optional[str] = None, response_format: Optional[operations.ResponseFormat] = None, temperature: Optional[float] = None, + timestamp_granularities: Optional[ + Iterable[operations.TimestampGranularities] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -606,8 +639,9 @@ async def create_transcription_multipart_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param language: The language of the input audio (ISO-639-1). - :param response_format: The response format. Only \"json\" is supported. + :param response_format: The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). :param temperature: The sampling temperature. + :param timestamp_granularities: Timestamp detail levels to include when response_format is \"verbose_json\". \"word\" additionally returns word-level timestamps in the words array. :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 @@ -635,6 +669,10 @@ async def create_transcription_multipart_async( model=model, response_format=response_format, temperature=temperature, + timestamp_granularities=utils.unmarshal( + timestamp_granularities, + Optional[List[operations.TimestampGranularities]], + ), ), ) diff --git a/src/openrouter/tts.py b/src/openrouter/tts.py index 68ae54d0..5ccc4b9b 100644 --- a/src/openrouter/tts.py +++ b/src/openrouter/tts.py @@ -28,7 +28,7 @@ def create_speech( components.SpeechRequestProviderTypedDict, ] ] = None, - response_format: Optional[components.ResponseFormatEnum] = "pcm", + response_format: Optional[components.SpeechRequestResponseFormat] = "pcm", speed: Optional[float] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -246,7 +246,7 @@ async def create_speech_async( components.SpeechRequestProviderTypedDict, ] ] = None, - response_format: Optional[components.ResponseFormatEnum] = "pcm", + response_format: Optional[components.SpeechRequestResponseFormat] = "pcm", speed: Optional[float] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, diff --git a/uv.lock b/uv.lock index 2e847f01..7d3ca0a9 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.6" +version = "0.11.7" source = { editable = "." } dependencies = [ { name = "httpcore" },