diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 018409721..1ed025d86 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: 24bcc1c62d441e4d0bad468fe794bbe9 + docChecksum: 008831fad14f3f8944c471d04ded3043 docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.3.211 - configChecksum: 1d03c87037f0a61053584f4f1898d35f + releaseVersion: 1.3.212 + configChecksum: dc9fb28166e948365f42ce4b943fe57f repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 776f0be6-18d0-4185-84c5-bf1b105d0ec7 - pristine_commit_hash: aa8ac54fca166dc10eff9de5be098cff7bb91bfa - pristine_tree_hash: bf19082dac7ae1ab6958d8625ed2e5b869b818e4 + generation_id: 5310aeb0-becc-4782-ac43-0459edbe840b + pristine_commit_hash: f1f7d600bca15c3ae4cd34ce6b137d6d0457d543 + pristine_tree_hash: 35b582cd969731a5bb5dab954059a20e99fbca1a features: python: acceptHeaders: 3.0.0 @@ -298,10 +298,6 @@ trackedFiles: id: f0240e4c81df last_write_checksum: sha1:c456f41de971d64e3bd7bad4aa3fc5f698944cc8 pristine_git_object: 9e51317c7ac0c2e04b03bb0c1aa30eec06d854b3 - docs/components/annotation.mdx: - id: e494ef314124 - last_write_checksum: sha1:c2d1aa4a57a1c0a83fbe18d7355d8d7d68a16b8b - pristine_git_object: a91fc0f17d0ff23280837e5ec4998f23202b3b25 docs/components/annotationaddedevent.mdx: id: 772ab3c03c65 last_write_checksum: sha1:0a5602d60756d26eac5740cc6b5537e96bd13c97 @@ -310,30 +306,6 @@ trackedFiles: id: 14f2eb561997 last_write_checksum: sha1:c2d3663907d09f4bd8248d715384f3c45e18e241 pristine_git_object: ad9a606318c037d4fce78642297cd490ddd64878 - docs/components/annotationcontentunion.mdx: - id: 0621a5f17826 - last_write_checksum: sha1:8e3f36eb417989b9a00b67abf98628a699d55745 - pristine_git_object: 9c590a1b3bdde8d487747bc13f292af3c4e2d762 - docs/components/annotationfile.mdx: - id: 69244c07430e - last_write_checksum: sha1:93c17024acc1759a32a06d0c64fe7904135fa20b - pristine_git_object: 1e596bf7d02a521a57d62a696c17df4f7c44f552 - docs/components/annotationtypefile.mdx: - id: d537307e5be5 - last_write_checksum: sha1:3d59bebdc887e893cdc98c55ae9d9a92191d2b89 - pristine_git_object: 8f6888ad80a1a241ef2a2301c4e9d48f6370fdf3 - docs/components/annotationtypeurlcitation.mdx: - id: 08b3b4126f05 - last_write_checksum: sha1:7bc8ea6f0c479f8878bd2d1daa7258e97aa25e37 - pristine_git_object: a859249f51cc6669419d2a69f7bfe8c63b240b9a - docs/components/annotationurlcitation.mdx: - id: 80e5c4a3d4ab - last_write_checksum: sha1:a801af1e2937f83a2063dea22e95aa8a9a2aa3ae - pristine_git_object: 96b88247ddfcd6bd33bf25c99291e8c5fb4b812b - docs/components/annotationwebsearchcitation.mdx: - id: 3548da377e76 - last_write_checksum: sha1:5971de690221bb04b13701125af0e0e5fd6005dc - pristine_git_object: d0e61b435d9ae4f0ffd0a4a13c4fd73564357d90 docs/components/anthropicadvisormessageusageiteration.mdx: id: ca0effff715e last_write_checksum: sha1:e6f879860ffd51e40118d0c2970fa39834395637 @@ -1352,12 +1324,12 @@ trackedFiles: pristine_git_object: 0bde2a43c5a7940888df46dac9ba5ab3669185a6 docs/components/audiopcm1.mdx: id: 0d9e561d3657 - last_write_checksum: sha1:512956fbe16e68404df957e4893c51212680706b - pristine_git_object: 5470626a5efeca41db12697fa754e29d263f4502 + last_write_checksum: sha1:42d706d1e5e10deec9225eaa5e7719dc10128024 + pristine_git_object: ea96fc8b8307ad58575dec46331b7cf84059594f docs/components/audiopcm2.mdx: id: 817bede92729 - last_write_checksum: sha1:ed7138963448dfcae6bcd95226b919b837f98250 - pristine_git_object: 5fdefb6462d7e081bde74a011b5c20802acb6d90 + last_write_checksum: sha1:fe635b912bce29ea168caa2adf3a665b8ab15a28 + pristine_git_object: 099254b9400cf24b6d6f29ebcec48724efdd18a4 docs/components/audiourl.mdx: id: c457db82a4ac last_write_checksum: sha1:bad796549e68c147f1799575e982b57664d84288 @@ -1556,8 +1528,8 @@ trackedFiles: pristine_git_object: c7629b16bb3a2df3eb7a2c784a30953e137f6d60 docs/components/batchobject.mdx: id: 58b4e759b75f - last_write_checksum: sha1:83c29ff7e55ab99b3d2866bda3ff81a87dc588b9 - pristine_git_object: 415e6269c4ee0dab46457f41c38606c22ecc594e + last_write_checksum: sha1:fc1cb86b6624b7ae4ed7a0791aa012543037d581 + pristine_git_object: af764ef6d27791f721ba327dbfcfa9c79d6a2702 docs/components/batchobjectcompletiontokensdetails.mdx: id: a27cfa43c4a8 last_write_checksum: sha1:12ac8d5a81f625e607190425946f2cd5af941a38 @@ -1566,46 +1538,14 @@ trackedFiles: id: 22682f41616d last_write_checksum: sha1:e41112cfea7fc9222edb80327f7c1724a1d5e864 pristine_git_object: e2fc9fd2368fefc0ba33224fdb58809596869d06 - docs/components/batchobjectdata.mdx: - id: ffbd6c621d43 - last_write_checksum: sha1:4d365b46d6ab0a8a73e5950ac116af941886fe0c - pristine_git_object: 53afc1a47c0f5b46d6cd3d2bf9474a8ebb4e3756 - docs/components/batchobjectdebug.mdx: - id: d1b46e566034 - last_write_checksum: sha1:187f310c8a97e1bcd65dcdd0e9a29234d2d68845 - pristine_git_object: 8c26216a22625443f166d438f82006279136fab8 docs/components/batchobjecterror.mdx: id: 9ad5df04589b last_write_checksum: sha1:fd130fe01c8007c06922a9c4d0db586fad9127df pristine_git_object: b5dea551e89df85694df227192edc0a7aab1d6f1 - docs/components/batchobjectevent.mdx: - id: 7a56a13b69a3 - last_write_checksum: sha1:3fff91c322650a91e8ae53a31e18d1d0c8a2f9d9 - pristine_git_object: fd15fa8794617c7649cc5c3d042c71ee433c4b70 - docs/components/batchobjectfile.mdx: - id: e33ab9d77832 - last_write_checksum: sha1:dc16c3f8969de224d506830015e82cd995914f0a - pristine_git_object: 14f045ed9fc30fbe0b62d3991114ef7c237cf473 - docs/components/batchobjectformat1.mdx: - id: 1ca56ab46c42 - last_write_checksum: sha1:b7c640f171489479780c7693dd690ef5cad75698 - pristine_git_object: 33d785a91d6c7db0ac0bef00f924b71982b86654 - docs/components/batchobjectformat2.mdx: - id: c4157adfd9fd - last_write_checksum: sha1:02fa50cb9e9e833c66a2dff3cf1cdbe27027ed95 - pristine_git_object: f84e3bf1e4312a60806f70aef47d5a722ad2dcc7 - docs/components/batchobjectfunction.mdx: - id: d93e178d8bbd - last_write_checksum: sha1:20912f0ee8cec79bf8fb482fdcb7437fd81451e9 - pristine_git_object: 5dac7a006f96d5a546013634160bdeb89ac5dc5e - docs/components/batchobjectimageurl.mdx: - id: 1e761df563db - last_write_checksum: sha1:a64dab99a0d78f7fac7066a6d81e1fac28c1f40c - pristine_git_object: d59fe1963fccf890fc5eb1cd8c197a462280e47a - docs/components/batchobjectobjectbatch.mdx: - id: e9afccaf72ba - last_write_checksum: sha1:ae3f066aa565dd2d9a7e45d5c7b91c979ded52f1 - pristine_git_object: 0f98fc84391760097c9d77d63b6fffdb90c733e0 + docs/components/batchobjectobject.mdx: + id: 1711e00e8846 + last_write_checksum: sha1:2884bdc8ae7430cfe2f436728076e8757b24a35c + pristine_git_object: 3d2ff355980572827c1856b3c67e413ef693716e docs/components/batchobjectprompttokensdetails.mdx: id: d2ccbe597149 last_write_checksum: sha1:479abdf4ba9ad3ad99127f09c750487383300f10 @@ -1614,38 +1554,14 @@ trackedFiles: id: a8eb0e004210 last_write_checksum: sha1:3a467611e721e8435c8846385bec80c839873e94 pristine_git_object: 3e29892f48aec89a90c460e85985773b34b7178a - docs/components/batchobjectresponse.mdx: - id: 4f09f891e6ca - last_write_checksum: sha1:57be813ba8f6082aa839ad39c9063b0629edf78b - pristine_git_object: 43a6dadc25d23509e453ac44da617203d451cc29 - docs/components/batchobjectrole.mdx: - id: 6f44efc7f138 - last_write_checksum: sha1:d17852c94ad545ac601d09b10f8a1b9f73c53007 - pristine_git_object: 012b7107a9d54b65ef5de806cdf138e55e19d19a docs/components/batchobjectservertooluse.mdx: id: 7b24d1f30654 last_write_checksum: sha1:bfc7c03e4bf2ba64a26d8c0f89aa2b91c360b249 pristine_git_object: 1e73359577864526aa5afe2c97a84f7335784880 - docs/components/batchobjectservertoolusedetails.mdx: - id: a0023f2867b7 - last_write_checksum: sha1:78748e9dd85bb91d62012888ea3e3110b843e71b - pristine_git_object: 42c5a669f233805be1280ed87311ce8d4d313026 docs/components/batchobjectstatus.mdx: id: b06615563d00 last_write_checksum: sha1:94209ead92a1a300198a2b77585ca1203f002a74 pristine_git_object: de882a33ad954d22f521d9604f5c65b1692a73e2 - docs/components/batchobjecttimings.mdx: - id: b3d3429e1cf0 - last_write_checksum: sha1:434180de265951cff5dca0673a59e49d12d26ef6 - pristine_git_object: b96298280bec97275d23c1e391e2924d8e103305 - docs/components/batchobjecttypemessage.mdx: - id: 43c950ac1751 - last_write_checksum: sha1:181ab18f2166bbbb3c47cb8a6382dbb7f74a4a13 - pristine_git_object: 25bd6ec281e6dcf5b48689f2100c7f9d4f56d515 - docs/components/batchobjecturlcitation.mdx: - id: 8caab1acc6ba - last_write_checksum: sha1:8d048e64999cd5caeb6e02a757ce845be876ab7c - pristine_git_object: 293c96b5e3a21e18d8db1a508ca724659806adf0 docs/components/batchobjectusage.mdx: id: eb710c8f044a last_write_checksum: sha1:ab3efbc4596bc00eac51a627189fa5c58ee87a0c @@ -1698,6 +1614,114 @@ trackedFiles: id: 329c99c0e347 last_write_checksum: sha1:38504173efff3e8585037c39c3c1a14f6dacb63b pristine_git_object: d25f8767c5f193ee085eca684f5af8c606392c17 + docs/components/batchresult.mdx: + id: da8b64cd81c0 + last_write_checksum: sha1:644db0fbccecb89320213f4943284edbd4d7b66b + pristine_git_object: 629ebcc0fb79beb2a72e55e49ce7e109ba259b7a + docs/components/batchresultcompletiontokensdetails.mdx: + id: 240d0aef5ba7 + last_write_checksum: sha1:ba582141b21db44cf665dbf3f843b134fc3b3c20 + pristine_git_object: 77108077203005427117c2133a539f97190c3faf + docs/components/batchresultcontent.mdx: + id: e2c8050549e3 + last_write_checksum: sha1:d4c153031e7cf56eed5ac54b58c8de97bb6823bb + pristine_git_object: 544cc88dc189119a64a0ff773b887a829bdd2891 + docs/components/batchresultdata.mdx: + id: b7cd5600f6e1 + last_write_checksum: sha1:623eee72c90fec49b7661698724c16a92dcbc56e + pristine_git_object: 74bcce52379e122f3a8582a7b67cb1a7ab33d6f7 + docs/components/batchresultdebug.mdx: + id: cfe506b7f161 + last_write_checksum: sha1:34ee333a8bcd0c30760cacd92b648da90e08c13f + pristine_git_object: c726d292890f51fe2b4fa9ae12331c1130e0b13d + docs/components/batchresulterror.mdx: + id: bee09c12de83 + last_write_checksum: sha1:0d72dd7d796f805ea091a2912c1b7fd868deb84d + pristine_git_object: 2fb9119e2865db177bf7528eccb885ed5be1bd82 + docs/components/batchresultevent.mdx: + id: 41bef9981400 + last_write_checksum: sha1:f39c3e2700fdc69656572c026e5d2033f687ec81 + pristine_git_object: e09435942f849883196943991ddee54e350cfb70 + docs/components/batchresultformat1.mdx: + id: cab1b8dbdb22 + last_write_checksum: sha1:d405258cf73c4c9af1257b3e2a68441d6ae8961a + pristine_git_object: 960ece304723aac8cecc142326b0fa15c84b6700 + docs/components/batchresultformat2.mdx: + id: 5ab3091397b4 + last_write_checksum: sha1:73e006902d24e0cd19a7c1b5083079cf50b17190 + pristine_git_object: 56be3375faeeb89ebf772fb9e5c09365a746bdd8 + docs/components/batchresultfunction.mdx: + id: 8532b79aaa54 + last_write_checksum: sha1:69472e694c22cfd6ffb0b6bda529be419b53826a + pristine_git_object: 3f02010cc09fb81814acb271dc34df970c57541b + docs/components/batchresultimageurl.mdx: + id: 918f80933a68 + last_write_checksum: sha1:3957882fc41191cd8e3cdd18e91dc563ae0ec41d + pristine_git_object: 402b5a423ba3175e73251db350624c2943a06614 + docs/components/batchresultobjectchatcompletion.mdx: + id: 7446b20f90fe + last_write_checksum: sha1:2c700dc7c4db4562dd48165e00b40738d6af8386 + pristine_git_object: db1289acf02e2d9b7c287f2007d17c92fadc0dce + docs/components/batchresultobjectlist.mdx: + id: 3afacd0ef392 + last_write_checksum: sha1:1ae63a4afe8e6701062a1b39b6cd8424afff2f0f + pristine_git_object: 51ccaa828a6a9857375a346e9959f3b74d4c5cad + docs/components/batchresultprompttokensdetails1.mdx: + id: 52c86a1ad734 + last_write_checksum: sha1:ad4d60ba625f91a2f364a171e02859ca89b28457 + pristine_git_object: da0bbe62d6e2ea893e0a376c3d26ecf471d6ca06 + docs/components/batchresultprompttokensdetails2.mdx: + id: a8f5a66e205c + last_write_checksum: sha1:efd749fa7e410bac7e79ced71cb014115f3a77e9 + pristine_git_object: 0de095447d12cd7611c540dc3094c06ba44e699b + docs/components/batchresultresponse.mdx: + id: 316f9b6987f9 + last_write_checksum: sha1:38f7816d57e2e873d42b1550ea0f4d2ddc1898a6 + pristine_git_object: 90d691723d529d632f0bb9da6668c4d9dee12bfe + docs/components/batchresultrole.mdx: + id: afcd1d5d5a5b + last_write_checksum: sha1:9cdfe6263aea62dfe45e9325802a5ec62e2672dc + pristine_git_object: 2a06ca44a935beeacd3dcf7ae1f4d9e908970570 + docs/components/batchresultservertooluse.mdx: + id: a9805cc81ce5 + last_write_checksum: sha1:93d63c79cc1c57142c4d1332e4c726ab5ff12a04 + pristine_git_object: 60f61cc238cbd5f1335f92680263f039f21f1ab3 + docs/components/batchresultservertoolusedetails.mdx: + id: a33b86e8a21b + last_write_checksum: sha1:985df93a7233c6369b3fd51381fb0f6eb8692609 + pristine_git_object: 665755f82184c3657663efe9dd9acfc05cc82b78 + docs/components/batchresultspageresponse.mdx: + id: 610431f3f576 + last_write_checksum: sha1:bbd31cc3832012f793b3745e4635a2a1677b012c + pristine_git_object: 8f4af362e64de3c2925ae52482704910eaf2cb98 + docs/components/batchresultspageresponseobject.mdx: + id: 86b13d4f392c + last_write_checksum: sha1:1cdcede0c4f87f9b4d2fc435245854b630231cb5 + pristine_git_object: 166800a9f061990812f6835b3272cb0abc3c586b + docs/components/batchresulttimings.mdx: + id: 8ebe797a63ee + last_write_checksum: sha1:dbad0bff049189fcbf9d952a21de21c2dd48c802 + pristine_git_object: 3edd3609539fa77915c8bae56b33361a9b9f8e45 + docs/components/batchresulttypemessage.mdx: + id: de8518d8042f + last_write_checksum: sha1:8f7a2a784f645af8c2840ba954c71123e501c802 + pristine_git_object: 2ec7d8a0f1c327d26c351ab7ef15255d03a62d8f + docs/components/batchresultusage1.mdx: + id: 40cca1304e85 + last_write_checksum: sha1:189289ed43d9c1b58e1808f57a307b0ad7b682d6 + pristine_git_object: ccc4b1eae8aae13fb7351eaf1568303a83fd2783 + docs/components/batchresultusage2.mdx: + id: "723067701e04" + last_write_checksum: sha1:e68006266cc3b96fd85f5de0cd283969af61cebd + pristine_git_object: 4057d2ababd8198b31eb84fd14d3792b9e6e1aa3 + docs/components/batchresultusage3.mdx: + id: 51e07351c309 + last_write_checksum: sha1:185cd18067041554074a344a3e8564e537c90aaa + pristine_git_object: 42f0b9e3e1499cabf9e929b1f464715ea9ef5e1f + docs/components/batchresultusage4.mdx: + id: a805f72d0e5f + last_write_checksum: sha1:824a6d299f80e5582af972e97e5c832c87359e43 + pristine_git_object: 575cae87e7c41b7ed7657488c9463a11314301ee docs/components/batchsubmitbody.mdx: id: 2102d576a5e0 last_write_checksum: sha1:bd32c1b4e22d632e1982d5bac840029c554c267b @@ -1716,60 +1740,20 @@ trackedFiles: pristine_git_object: bbbf166d9fd2738e14622e0f8d07a719931e8ade docs/components/bodyaudiospeech.mdx: id: 887ed62d2933 - last_write_checksum: sha1:389aff12a53c91c8f35f0411010ec71778f43b16 - pristine_git_object: caa64aa906fba587b62540b19bff2aa5ca8e9628 + last_write_checksum: sha1:5035cb850dd2cbddd2e77491a0e799400cf211e6 + pristine_git_object: 963e4e49170378a0857bd479b771f8430e748778 docs/components/bodychatcompletion.mdx: id: e03ae2d0f8d2 - last_write_checksum: sha1:3ec2fff2a48bea904edc391d9c63c022ae4445cb - pristine_git_object: 0e970e2d6adb926563105b2d40a85b7150d15fc2 - docs/components/bodycompletiontokensdetails.mdx: - id: 1509f7a0b29d - last_write_checksum: sha1:f861af262cd975014d754fb1a0017b551e895ee0 - pristine_git_object: 69b8630ebbae00364553dfc217ac665490e8e937 + last_write_checksum: sha1:1dd0101bc77d1194e4067143ba3780fcad2b9b38 + pristine_git_object: f01a4d388526748fd1868d2f93834879c7823fd3 docs/components/bodylist.mdx: id: 6782e3e22759 - last_write_checksum: sha1:ec7ba9c9bfb0456b02d27e7ab8b909204a244107 - pristine_git_object: b1cc699b94b7d95ddbb35be3e52f71ce85e8a7c3 + last_write_checksum: sha1:e4b70f5b72cbe2e1b060193ebdc65dd985c7f7c4 + pristine_git_object: 80b39332616b88f837caf1c98e33ad049ebb1be4 docs/components/bodymessage.mdx: id: 1b60240104a1 - last_write_checksum: sha1:9aed54f268a90635ea40696824fc4a183c9f3484 - pristine_git_object: 4cdba566c70b20f3affde268b02086d916675540 - docs/components/bodyobjectchatcompletion.mdx: - id: 2260d296d47e - last_write_checksum: sha1:ee36f3d63322e350ebb6c4e425f799b4ddc5663d - pristine_git_object: f16cab8d73ed78559deb0bfe157c21cf185a9c7f - docs/components/bodyobjectlist.mdx: - id: b99c4d98d90a - last_write_checksum: sha1:aaeb5af0c7e97c26ac50dd1ba2f066e63adcacd0 - pristine_git_object: c9a4024fbb65314564721db12b718626f1fda56d - docs/components/bodyprompttokensdetails1.mdx: - id: 88f525432ca2 - last_write_checksum: sha1:d5d1f568489d9abe1b30087abb061c23a9588eae - pristine_git_object: 1de48e3dadbd15c813bb4ee04d077c11678a9f73 - docs/components/bodyprompttokensdetails2.mdx: - id: bb868d6b4f81 - last_write_checksum: sha1:2350882302a9d421e06ba21d40b52ce05b8b0a78 - pristine_git_object: 2f6072187caa6c23f31ca292137573e742448c36 - docs/components/bodyservertooluse.mdx: - id: 346ee474d959 - last_write_checksum: sha1:bbaba19d067d9383a74467bca4e4c1d485623a8b - pristine_git_object: 39af647bfd324d3b2ea5ce69e3e6a7270bbea5fa - docs/components/bodyusage1.mdx: - id: 371f1d9051d1 - last_write_checksum: sha1:5895ba10bbbdedbe0aa155aaf74f72a3cc443cf7 - pristine_git_object: 9684aa7568d16b424ce54e3149d987abf94a2b2b - docs/components/bodyusage2.mdx: - id: 689051c252ca - last_write_checksum: sha1:7ed8f09089f6d4efcf44544902fdfb6e069ec266 - pristine_git_object: 09aafefdadc7f3b13db370135fa3016541e7e407 - docs/components/bodyusage3.mdx: - id: d1f4fdaef272 - last_write_checksum: sha1:32f1341440b7f2e75bd576dc419d4d088c3d7294 - pristine_git_object: b7d2e1b7952bf80222a8a18cec557c389887da35 - docs/components/bodyusage4.mdx: - id: 4e9bfa13f237 - last_write_checksum: sha1:241f063dd216b578c7278aca9104b2e4b9894861 - pristine_git_object: 425d64aefd8452319ee14d74257f93793e2c33dd + last_write_checksum: sha1:f6e0cc9d9343140257a25585f004f9bb055f92b3 + pristine_git_object: 5b8a2b547a9cee04876970f9cfdd42bb2c0713ae docs/components/booleancapability.mdx: id: 514674d4ad70 last_write_checksum: sha1:0b9bd6471f97a6fb319bec066b96eea6b0d10fb6 @@ -1926,6 +1910,10 @@ trackedFiles: id: 6247bb0da7f3 last_write_checksum: sha1:8b01abf315c7d2ae600685862cda689c6410d8c8 pristine_git_object: b6b4b26bc5d920132a63227e40e2d38830c3b6eb + docs/components/chatannotation.mdx: + id: 41735cf2ecad + last_write_checksum: sha1:c867b27c7d5b2167ab1a48d7d546f3412a28d718 + pristine_git_object: 2004dbca5b9c77080358d49ef553bbba1f2df117 docs/components/chatassistantimages.mdx: id: ffb19be9dace last_write_checksum: sha1:9adcd2ee786493cc2e83d551673e7d092a599f80 @@ -2050,6 +2038,26 @@ trackedFiles: id: 78a4d3d29605 last_write_checksum: sha1:57dd09cc85e480f39302a29f29b2062bd5d90105 pristine_git_object: ea6fcc18234d553ff6255fdccc83a6ad1a0ef2d3 + docs/components/chatfileannotation.mdx: + id: 0c479f93eb58 + last_write_checksum: sha1:891572272b9f8449bbd4906efd2d17be69071f65 + pristine_git_object: beecaf460e95e36de4186347aabf34d7311c4caa + docs/components/chatfileannotationcontentunion.mdx: + id: 19c10c20a101 + last_write_checksum: sha1:a8391377b282c84b91837d4408d541e8b5c004fc + pristine_git_object: b2c71e29c014bbca958905caae7e4592a68789a5 + docs/components/chatfileannotationfile.mdx: + id: cda0a860a61d + last_write_checksum: sha1:8ca657458d24aff2d9e395484ec8ebc4ee6d2d44 + pristine_git_object: 37a7b81f31cee3f2618f7eb26b37e1dca3c15f83 + docs/components/chatfileannotationimageurl.mdx: + id: 741ea840ba7b + last_write_checksum: sha1:05996a82a0d5ff8e3fdd23de6e87177e8f0639ca + pristine_git_object: 849c659cc2e65db67f6ca876dad842f5a94ad11e + docs/components/chatfileannotationtypefile.mdx: + id: 48cb59240417 + last_write_checksum: sha1:4b7ade8d7097842c024531968abcc8755a947927 + pristine_git_object: dac75538a0af463a8f2082a3205bc33eb7d52dd1 docs/components/chatfinishreasonenum.mdx: id: 08f18ef0359b last_write_checksum: sha1:ac1cc050eab292b168ea6307c3206f8c3041a624 @@ -2294,6 +2302,18 @@ trackedFiles: id: 333428c22814 last_write_checksum: sha1:334d3743fda7feeebc1e35220713c58c816ba7a4 pristine_git_object: 48386287b072381a9b59de6ae804b0ffbbab221a + docs/components/chaturlcitationannotation.mdx: + id: f68ce6911611 + last_write_checksum: sha1:13c2546f2c5ea6fb08daefedb54ef9c6f7f1a7d7 + pristine_git_object: 72cac05a3b12d2ed333db2a08301f69783903020 + docs/components/chaturlcitationannotationtype.mdx: + id: 9de29161b6a7 + last_write_checksum: sha1:41289872d2a5f08a2f5f7c2f7992b07a8ff44f27 + pristine_git_object: ee857f900b33e0a147bc14223aa6612f1375cad3 + docs/components/chaturlcitationannotationurlcitation.mdx: + id: 0c0c54984fd8 + last_write_checksum: sha1:9cbbc680f53064d57a61ba54a91f8f778f3fdb94 + pristine_git_object: 460d3ad4d47cdb54364fbf81860e6a37d550fbc8 docs/components/chatusage.mdx: id: d7c2bc8b3eb2 last_write_checksum: sha1:7e88196fd7a48982974db6f0fa3d6f6da816fe47 @@ -2318,6 +2338,14 @@ trackedFiles: id: 6efb281f8696 last_write_checksum: sha1:ef431c77c58f00fa242c1bae969e057bbb405ae6 pristine_git_object: 11d6c22059efcf4e3b0d6b15b39a67678adc7a4b + docs/components/chatwebsearchcitationannotation.mdx: + id: 791dd7f1462e + last_write_checksum: sha1:58b53b793cb3526d49d5b98866ede8f573c51165 + pristine_git_object: 108a2b5d2654cd1322540ba8ccbb3a72e9ac917a + docs/components/chatwebsearchcitationannotationtype.mdx: + id: 0c5a248a3a91 + last_write_checksum: sha1:ad958bd4330bbd1ee07407f6174cbf4abc884342 + pristine_git_object: ec6de0d652c40c26b46f5ebd87d725ed12218239 docs/components/chatwebsearchshorthand.mdx: id: 40f0c0a47ef4 last_write_checksum: sha1:d6bae0fd9509d2c0c465e34445b248fec0b4e9dd @@ -2636,12 +2664,8 @@ trackedFiles: pristine_git_object: e76e781ebe9c10107d7981baa5ba49cbdc815421 docs/components/contentimageurl.mdx: id: 4092a59d86b4 - last_write_checksum: sha1:41a45a0483695585f05fbe1a4c7819ae8eba928f - pristine_git_object: f05add9d497e6ed54010b6f3cae4b0aaa95abd2e - docs/components/contentimageurlimageurl.mdx: - id: 623bd364af6b - last_write_checksum: sha1:a10504cba5c5aa91d6c1573f6c586697d6c05980 - pristine_git_object: 264d4dcf731e266ac233588d47aaf7a03c98d65f + last_write_checksum: sha1:24ec3b39f3c2b4a5c46d7b88ba38d7b0292c2b06 + pristine_git_object: d87e7e3565e9c51db7f68b0b12e3a89617688bcf docs/components/contentpartaddedevent.mdx: id: 785ea6a90328 last_write_checksum: sha1:474d5a566491104929ac6c1fcdb4d4362ee735d0 @@ -2820,8 +2844,8 @@ trackedFiles: pristine_git_object: ad32bc42c733d9c38b955e3857469481325d458d docs/components/createguardrailrequest.mdx: id: c1a768f054c0 - last_write_checksum: sha1:37460409a5edb142c4f41da3cc8364cc4cceab5f - pristine_git_object: c8a62d0b8a2476a43389e53bd2d600b30ab76b9e + last_write_checksum: sha1:2e9d86c109ba95d9a70ef0f3494f618e10cbfeff + pristine_git_object: 41a268568ffdc766b99d9dabd4eb7e95798b7d27 docs/components/createguardrailresponse.mdx: id: 1477eebdf505 last_write_checksum: sha1:e13e8bf981d83c771dfc6d3e4ab81a949487dbd3 @@ -4228,8 +4252,8 @@ trackedFiles: pristine_git_object: 6e17644dffb3aef799758f46d5ac781114b58c1f docs/components/guardrail.mdx: id: 91791d4c83b6 - last_write_checksum: sha1:d87333d50807fa9ef88090ab27c960c63cc5c6e7 - pristine_git_object: 66ba86817856aa6d8e1d641425cb1d36696f9ca9 + last_write_checksum: sha1:b6fb6ccfb595e877543afa13691c60f0edd90332 + pristine_git_object: 06ac9866f351cb2eb4f5bcffdc6f1932fc712576 docs/components/guardrailbudgetpolicyauthoringconfig.mdx: id: 9e5753c7f2e8 last_write_checksum: sha1:c1527680bab858136a3ceb69966af7aab285636b @@ -4252,12 +4276,12 @@ trackedFiles: pristine_git_object: 9e0a058e6a19b68f470eb0938670dff51b47f4b5 docs/components/guardrailmodelavailabilitypolicyauthoringconfig.mdx: id: ff434ead97c4 - last_write_checksum: sha1:495a69b29cf4b7d883b11db63a419fb3d4b7219e - pristine_git_object: 9e684ef4e76bde3f9e7dec5ff9950ddb697d9781 + last_write_checksum: sha1:a543e7fffc30a37c32801691fc30a08ef32c2a27 + pristine_git_object: 045aa5b9ec5af5289342a48faa3121925c32c598 docs/components/guardrailmodelavailabilitypolicyconfig.mdx: id: b6603993cee5 - last_write_checksum: sha1:b0da176aec561795585fb2ea01d5bb876692bab0 - pristine_git_object: 8d988f100d10c848477338e41bf52a2d634a47a2 + last_write_checksum: sha1:28931fe0dce5134fd6717e552a260cbb35fb29e1 + pristine_git_object: 2c04591574b872f0736e2e1673a23aa688d3be60 docs/components/guardrailmoderationpolicyconfig.mdx: id: 332531fba5ff last_write_checksum: sha1:c31df107ce8f84fd8aefcae9ecfe0c2181aafd95 @@ -4296,8 +4320,8 @@ trackedFiles: pristine_git_object: 16a3953084ef1007ea3a724142f430698b2b99aa docs/components/image.mdx: id: fcfab5677d29 - last_write_checksum: sha1:750eb2c63b46ae70c3e9bda0ec4a66e477eededd - pristine_git_object: b852b695741be174d34fd82accf10e15b3c083de + last_write_checksum: sha1:43bfd4ea37b7ef06b1f3fd0266f37ca7e1e9f477 + pristine_git_object: b81f18892362130982ff8cca94468ad68ee7b892 docs/components/imageconfig.mdx: id: 455a9f530ea8 last_write_checksum: sha1:b163b8b8e90a6011cc0d64a26febb459045f6019 @@ -4672,8 +4696,8 @@ trackedFiles: pristine_git_object: 37302a3f153c65e1c6e2596b76dbc47a6a93e1c8 docs/components/inputreference.mdx: id: f23a98f7a3b4 - last_write_checksum: sha1:b6b2e91d01493b2be4729979ced0fecf630d0563 - pristine_git_object: 02f31a8f6acdb41c9f91080508699b4df98a91bb + last_write_checksum: sha1:d53ba0c6f581e7cd4b096f5c344fc4863daec56b + pristine_git_object: 6d707c86ea8ff6427dffe39f274db50e0d64e75e docs/components/inputscontent1.mdx: id: 4d067cae8934 last_write_checksum: sha1:63fc75a1cd64347bbd378217fca9d0f6f760aba3 @@ -5012,12 +5036,8 @@ trackedFiles: pristine_git_object: d3cb191767aa7193cd25931c7c535700f9a0473b docs/components/logprobs.mdx: id: eec4f2764ea7 - last_write_checksum: sha1:28d67f0d4b24883ea62db2e927bd15050686c783 - pristine_git_object: 0e93af173f5ef31dc5c8709bf9fdc853dffd3d18 - docs/components/logprobscontent.mdx: - id: 235a699032ea - last_write_checksum: sha1:6cab400740b28b60b4ae545ea711e231616fab46 - pristine_git_object: ca4d842dbfda096fd9079e57e0c73874e95b4be6 + last_write_checksum: sha1:a8c6e10bdc6c97659a6592ac16154b7980d26e38 + pristine_git_object: 4a218aa2d505ced3f6647140082d11355c123442 docs/components/managedprivateendpoint.mdx: id: c2bb24179857 last_write_checksum: sha1:81e796f45c4ead3079a66b778c80f5aa63a68fa4 @@ -5276,8 +5296,8 @@ trackedFiles: pristine_git_object: 11421f055f1c2312710b637f72378d63e9df1d8b docs/components/message.mdx: id: ff609a40a5fb - last_write_checksum: sha1:3675dfbe3e5ced74b545ab5208f1734b217cf9db - pristine_git_object: 5e054eab7efe2c93f43479a7706232906c42dbfe + last_write_checksum: sha1:bd8fe7f2f9db00785c893b98b0e8e6cb8b8814f1 + pristine_git_object: f1eab7c7b0b90cf1fbd45b3ad0371c09f896de25 docs/components/messagesadvisortoolresultblock.mdx: id: 5a07a5b7964a last_write_checksum: sha1:296add187f8210abba2bfc1cca399f9f90320036 @@ -7858,14 +7878,6 @@ trackedFiles: id: 5eefe41f1850 last_write_checksum: sha1:77408cc0b4857a6d018b38515fbab176e61700ba pristine_git_object: 37d295179f03a00ca937874b8a5258217a33673c - docs/components/result.mdx: - id: c76c321807c9 - last_write_checksum: sha1:3902022037022fe720c18bb2d3e085b29274060e - pristine_git_object: 9b90dbabb7d5426bc004c9d490afad2724b245c8 - docs/components/resulterror.mdx: - id: 4ad56b7d7d1a - last_write_checksum: sha1:e102fec27e5cca2f4ad4d82a5a95c2f323105eaf - pristine_git_object: 4745590bfce1b63154bfab1b704a49ce9238e945 docs/components/route.mdx: id: f43dfcb07063 last_write_checksum: sha1:c8b59d940cb5877af6203012f667508a39e77e36 @@ -7920,8 +7932,8 @@ trackedFiles: pristine_git_object: 94331ee57f8ebf2b21903d5ebda22e0faf23044a docs/components/scimsyncjob.mdx: id: 4016ff89381c - last_write_checksum: sha1:275dc5668f3a210538e80d859a3592ab96460b4c - pristine_git_object: 2d1eebe783e6546eb314667d6b1e5d7a97bc39d9 + last_write_checksum: sha1:f08503db0547d5139dfd1b0bc95a5a5ffa97baa8 + pristine_git_object: c9e32a990267ed96eac50664e637a71378d514e9 docs/components/scimsyncjobstatus.mdx: id: 1fdb0adb6332 last_write_checksum: sha1:ce8e66b50b882d83464fef01336e9227a514a5cb @@ -8292,8 +8304,8 @@ trackedFiles: pristine_git_object: bd91e8ae980d60e10df4aeb9db617cbf3fd20e43 docs/components/speechrequestresponseformat.mdx: id: bd09f77a4a90 - last_write_checksum: sha1:1b87242f33c6d22a08dd085d0ef41335ec2e9b0c - pristine_git_object: 9af8a5aa6a7c26f353f552d369b87debb045b7cd + last_write_checksum: sha1:1cc50580c3e1594851a1cfbfe4b56ec7397817c2 + pristine_git_object: 9e08b7ba425de5f336923a69054fc4a238f504b6 docs/components/speechsupportedparameters.mdx: id: e40d7c8fb1e4 last_write_checksum: sha1:4d1613b404212e0367e88c6166140da61acb2364 @@ -8700,8 +8712,8 @@ trackedFiles: pristine_git_object: 970ae7c560e14863c0fb9bdb996ea48113970871 docs/components/toolcall.mdx: id: fa42aff5b218 - last_write_checksum: sha1:45d84903645a8676b2b943e6f002278e766f5549 - pristine_git_object: 7d15523372bf499337530ad6d7569b72345728a0 + last_write_checksum: sha1:c968698592555ea84c4ab6e82033cac6fc7ae94c + pristine_git_object: f42114c8da43f2ad293099c687a250cda49cccdb docs/components/toolcallstatus.mdx: id: e79e5ffbe798 last_write_checksum: sha1:338789050d562f0ac596d6a94783307e27a634b2 @@ -9046,10 +9058,6 @@ trackedFiles: id: f5e16e3838f3 last_write_checksum: sha1:4a7a35b4b66c86f65dcafe1e6fa313fcfa17e68a pristine_git_object: 9d06705d9db71cc0685cc3afc669f965f4a98d0f - docs/components/typewebsearchcitation.mdx: - id: bb828f6f1c61 - last_write_checksum: sha1:0adc7248631ed70de2b4c6533afa1216a96d22c7 - pristine_git_object: 98eb3478a0498518dfd0996d34538980139bfb6b docs/components/unauthorizedresponseerrordata.mdx: id: 74e10dac821b last_write_checksum: sha1:9306894ecd3f8dd494029bc0175a9c319d9a6256 @@ -9160,8 +9168,8 @@ trackedFiles: pristine_git_object: 72164eface6ceaa56e79abc5e52cd92a2af38884 docs/components/updateguardrailrequest.mdx: id: 450912b18db6 - last_write_checksum: sha1:f18a396bc85df7040468a7170a6b6a04db46133e - pristine_git_object: e393f4233f820489d39ff49b08bac5881d7a88a1 + last_write_checksum: sha1:9c7360b5e74bfddca62d41f480e6a4c7f79f8a37 + pristine_git_object: 8cf5078cc90380849b3bd0c1619fcbff7996c248 docs/components/updateguardrailresponse.mdx: id: e00dc0a0c6e0 last_write_checksum: sha1:dc52c008c9414a86215db2c8d74732ed37f71c09 @@ -9364,8 +9372,8 @@ trackedFiles: pristine_git_object: 47158d146ef4e92c5f47cb737170922102bfec11 docs/components/videogenerationrequest.mdx: id: b92ddbd15ee4 - last_write_checksum: sha1:85a09840fa642226a353ca8a164208ab3ca55972 - pristine_git_object: bbe542e9341a34a88378f1fdb541e47da0ce4c9a + last_write_checksum: sha1:2ff0d41b49b6fdb1d8acee643b82b8457a9deed9 + pristine_git_object: c7009a325b7c2b028a99ac4aec28d450c4f62295 docs/components/videogenerationrequestaspectratio.mdx: id: c14859c0d8c3 last_write_checksum: sha1:27537e5df9281880ba0ac6cc84d75166ea0f6915 @@ -9392,8 +9400,8 @@ trackedFiles: pristine_git_object: 0ddf6c9ae48cd55530b5a44d162a00f6fcaaff8c docs/components/videogenerationrequestprovider.mdx: id: d6424dd5de9d - last_write_checksum: sha1:86cf645130b70b9efa9ade4a0f9c506bb3163481 - pristine_git_object: 0fcfb3374fd2fcde479f61ad74eb3f014a43d059 + last_write_checksum: sha1:ad5c5233afe3caed2833d06ffbe3d94ca3000a24 + pristine_git_object: c03d3b5017a9d27662378b51cbf85d7434bd90ed docs/components/videogenerationrequestresolution.mdx: id: b4287dc60239 last_write_checksum: sha1:53e4bbc3b66ae6ef1aeabe2269192cbfc5126ce0 @@ -10490,6 +10498,18 @@ trackedFiles: id: fbedfcc0a82a last_write_checksum: sha1:fd2a4d163dc5dd6b3efc56cbc589c3373ae847e6 pristine_git_object: 27e41fb934e56d28676a16f55a3943d225422d69 + docs/operations/getbatchresultsglobals.mdx: + id: 1059a9f4a0c4 + last_write_checksum: sha1:46df5085a7cc280edc036e3becc1b8a5c716e57a + pristine_git_object: d01db302249289f22e242e5f0ad3caba4446dce3 + docs/operations/getbatchresultsrequest.mdx: + id: 1ff45a98d0df + last_write_checksum: sha1:4b02ead9eac7ac136d2ce7267b5a8419a960410f + pristine_git_object: 60547e98e6dfd6c45fc60af2023af8e8f948545e + docs/operations/getbatchresultsresponse.mdx: + id: 551c9efd44a1 + last_write_checksum: sha1:2b0f68c3e44ff2f2a34bcee98a91aa3745de50a8 + pristine_git_object: cd0620ad1e3c30ab56de00f2e47e6ab97b7a95d2 docs/operations/getbenchmarksglobals.mdx: id: 8fcba55e06c3 last_write_checksum: sha1:a2d75092f0b6de10e45d8216d70ee4a54826b20d @@ -11248,8 +11268,8 @@ trackedFiles: pristine_git_object: df35dcd1bd18f96a586f213c620bbb73197093bf docs/operations/listrequest.mdx: id: 2652e61cd671 - last_write_checksum: sha1:843417bf455bcfb50f582a7125f7cecd55da8b47 - pristine_git_object: e0298f128f4fac5b60ecbd405fc4f251ed23c128 + last_write_checksum: sha1:f1ea9b33d6f13334132b5884c82034c9629413f6 + pristine_git_object: 07e9fc86753b564074075a0781dc3acddf03f9ed docs/operations/listresponse.mdx: id: 0fbda0f81ae8 last_write_checksum: sha1:038d67577055fc228a26c28173b10968f116570a @@ -11724,8 +11744,8 @@ trackedFiles: pristine_git_object: 070e0c9100460700192c8658676671f931949fa6 docs/sdks/batch/README.mdx: id: e367aa4f4295 - last_write_checksum: sha1:e64f336f38e4d0f8fd3ca26d324aecf66f5076ca - pristine_git_object: 569ef3d149eed44d36c0e00c4507e5b3efa30ad1 + last_write_checksum: sha1:451cb8ea8a6aea041d2b85a44af34e880fe27313 + pristine_git_object: e37a1c680657805f1bb53f84b42fd9b8745b27b3 docs/sdks/benchmarks/README.mdx: id: 5b483a6770ba last_write_checksum: sha1:10a8edbf3bc300bab53ce72c3a37c974971b74bd @@ -11792,8 +11812,8 @@ trackedFiles: pristine_git_object: 04af1956ac221b8912203963d46e14848a9bef6e docs/sdks/guardrails/README.mdx: id: a0cd4218b8fa - last_write_checksum: sha1:c3c5c7c7536e87b0b2935bcb4d1e16593da0115b - pristine_git_object: 048b224ba1103cb467cfef9abe506ce94f4b78a7 + last_write_checksum: sha1:4b3cea0eefb36eaf94af17748398f0f221a45784 + pristine_git_object: a35a383273e85fd75d8b2161aa1dde6619fbda36 docs/sdks/images/README.mdx: id: 534a6c102c4f last_write_checksum: sha1:7d425634484b9e3150e3cdc11b2c9e8b8bd52d76 @@ -11864,8 +11884,8 @@ trackedFiles: pristine_git_object: 63da02745c8b365676c3a049a527dc6964b1480b docs/sdks/videogeneration/README.mdx: id: 9a8fa04c3872 - last_write_checksum: sha1:67bff94475ef74a38641026a9961c043ce0f37cd - pristine_git_object: 94f9c0c08b2942b9a2e809a82bb435995e94e74e + last_write_checksum: sha1:52b2d9c2b03dce92df1b4355feebdef2870a4f56 + pristine_git_object: 110f543ea988fbb33a6a6251d01687c403916624 docs/sdks/workspaces/README.mdx: id: 0c75d023ef6b last_write_checksum: sha1:de729c7c10c0503de8b658eeca0dda6721893a41 @@ -11876,8 +11896,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:1de4ba02787035c67ff109539c32f06ad7e57432 - pristine_git_object: 19c1b1d51210c68a60fc1d53158ff3edc28e08b8 + last_write_checksum: sha1:f61f7d027cce394a48dba6ac227973bc2a335952 + pristine_git_object: cf1ec5a34d662ae46248567a6ab9e76d4b46bf78 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -11904,8 +11924,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:76aebfe8c5f05ec3ccebdde61c335b33160a9176 - pristine_git_object: ca833f10879206d1cc99014af06651fb0e48e593 + last_write_checksum: sha1:35b8b1e3af9b1003b85eeddd8275af7a1e69dd4d + pristine_git_object: 59b82f600ff9ec94c7498cef214cea94199c716f src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766 @@ -11916,16 +11936,16 @@ trackedFiles: pristine_git_object: 6a8e172e48aa655bd57615b4110f285ab02a7368 src/openrouter/api_keys.py: id: 876fac88fff6 - last_write_checksum: sha1:4956d622986029e5f89f8a47b6b1980ff34b28d7 - pristine_git_object: 359f989def88f0223607d332bf3d72693fc3e78c + last_write_checksum: sha1:1232c9e30323be14c7395e2e82f6338317c9a0b2 + pristine_git_object: 1dffa8ac089cdc1152e8d1d638ca91645eda1838 src/openrouter/basesdk.py: id: c5733c5a1e12 last_write_checksum: sha1:65769ff2cb5473f85b364c6213a0ddc8c68644ea pristine_git_object: 7a562e21c7e66c9db666ead83748b73adefe4278 src/openrouter/batch.py: id: 148f61e34d5b - last_write_checksum: sha1:60f85c2427b36d836c0b3785cb7c68baa4dc4f0a - pristine_git_object: a333c0862a1f01a381e9d5323765a8dfbb12fb57 + last_write_checksum: sha1:74cf10dfd6e8b7776845108727740f230ed946fb + pristine_git_object: 4c1c1c81d393b0ed261c29cfd6c35871359d450e src/openrouter/benchmarks.py: id: 178d2ad8d706 last_write_checksum: sha1:be86f24d07ba86e9585f7d2bc2c384dba5185727 @@ -11952,8 +11972,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:ab8db2549669891efccac529b1a1b4afde2d5115 - pristine_git_object: 3506483d96019516b205c361ad456293e7538af7 + last_write_checksum: sha1:b0804e61e1cdda20a75ac294b31b2245030d2bf4 + pristine_git_object: 56bef4aeeed119ac0b25ea913903d725d44db6e0 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:08125e1d60df82793e11e8aed6e3c9fdb7512ebb @@ -12628,8 +12648,8 @@ trackedFiles: pristine_git_object: 8650957337063ba3aef94341108448ec19bd2945 src/openrouter/components/batchobject.py: id: caf1ef2414a3 - last_write_checksum: sha1:de50b64da94b208a7e672fa2a5c453d8a9da2748 - pristine_git_object: b5b450e1fea6e05672d3f9e945141c8b41307bfb + last_write_checksum: sha1:f4904cce2e99a22e33ecff41728bcd8ab2a882f8 + pristine_git_object: d9b2cebc2e37457fcf63bd1a592d065c6bb218b0 src/openrouter/components/batchoutputreference.py: id: 7790c9506cde last_write_checksum: sha1:977b0911254e1afafbd5b7235fedaefbe7417514 @@ -12642,6 +12662,14 @@ trackedFiles: id: bf5b14d53dfc last_write_checksum: sha1:55909ee26d0f0b35da8114da5d75fac640ad61c1 pristine_git_object: b2bbac635f94d6fe9f4eba2eded41b1990a9d5da + src/openrouter/components/batchresult.py: + id: 8a496db31329 + last_write_checksum: sha1:a08e1731bddab1ce01019d7a8304ed808670bd42 + pristine_git_object: 3b9106092b5af50837e3666b1061c788aefca239 + src/openrouter/components/batchresultspageresponse.py: + id: 9a03420787ed + last_write_checksum: sha1:580bf4a6ff3f1df739c880358abc0d6172b5fd9e + pristine_git_object: 8bb91f751e531fba8b3026431fb13e4d38254ac1 src/openrouter/components/batchsubmitbody.py: id: 26e5100bce4e last_write_checksum: sha1:ffe7a603d28009916fb1235a7f61abe14a79e27d @@ -12746,6 +12774,10 @@ trackedFiles: id: 8ea6504bed9d last_write_checksum: sha1:5b15572ac8f586bf9a3e2c806f196edb02ded7a9 pristine_git_object: bb4e21fc493e4eca2ffa92791958d6252d40bec2 + src/openrouter/components/chatannotation.py: + id: e45902910930 + last_write_checksum: sha1:876e3dd18b904109938cfaf23508ced8e2e2700a + pristine_git_object: 409abc1f80ca02b852c6260f420aa40b02e085f2 src/openrouter/components/chatassistantimages.py: id: 993f9dcd8575 last_write_checksum: sha1:0b6be31bb9c8b3bc8f2098af5b2bd12b62a710bb @@ -12806,6 +12838,10 @@ trackedFiles: id: ebd380d84eb9 last_write_checksum: sha1:ba1487cd474edaffa46f52bbbe7673dabf3bed86 pristine_git_object: b4e38070e2a4dfbf88a49b5a1482394e29146db3 + src/openrouter/components/chatfileannotation.py: + id: 59e925f41906 + last_write_checksum: sha1:97d49a0a2e72142be3a62a1534fb9d14acb11393 + pristine_git_object: f73bd8881c7a4d701052fa14bd9a51300d8cd0de src/openrouter/components/chatfinishreasonenum.py: id: "331394791883" last_write_checksum: sha1:98f6b15af15986f5b3e9ac60c29bf9e5a70eeb5f @@ -12914,6 +12950,10 @@ trackedFiles: id: 7c42588b57f4 last_write_checksum: sha1:67bbf68b10bde230884fc78093a665e73916e913 pristine_git_object: 2ccba8386486b7a730816a9829b01754935a2e96 + src/openrouter/components/chaturlcitationannotation.py: + id: 02f1736bb508 + last_write_checksum: sha1:d32ded0fe779b4ffd0a2f88217f3747f21aa2789 + pristine_git_object: 15dc2dfa06e40b5442f8babc476f6e3c26463c0f src/openrouter/components/chatusage.py: id: f224a054bf45 last_write_checksum: sha1:a16d2ff72e087e940ca5eeef75844baa7e9ca1a1 @@ -12922,6 +12962,10 @@ trackedFiles: id: 7777191e729a last_write_checksum: sha1:6e9d3d1a827832b947bbb688a8f78f43aaaa9f81 pristine_git_object: d5ebd465c8d843f4bc1f0763d136d31960ab2efa + src/openrouter/components/chatwebsearchcitationannotation.py: + id: d24462cffe4e + last_write_checksum: sha1:a12ed9fdb76a01bc64ceb064f0a37384e1d03dfd + pristine_git_object: f567419c02d963264e7692dd5bc745f4b12ee87d src/openrouter/components/chatwebsearchshorthand.py: id: 13091b97a3f6 last_write_checksum: sha1:f31f7f0a897b35ca82b6425d1e1cbd4b24bda068 @@ -13136,8 +13180,8 @@ trackedFiles: pristine_git_object: c575c3dbc1aeeb262172f88c60d0e4eddddf5e21 src/openrouter/components/createguardrailrequest.py: id: 34d69149fb33 - last_write_checksum: sha1:fe3257cb10a2f8f918644ea4edac106a6169878b - pristine_git_object: e7e93fd587dfaf0efe013c58882a431bdbe961fa + last_write_checksum: sha1:af74377e2538fa040f38ad84ee4b16cf45bc7300 + pristine_git_object: 16c336252618f001233c46667b4283c0269f038d src/openrouter/components/createguardrailresponse.py: id: b4e1bdf1de5b last_write_checksum: sha1:ae20a5e7425510c240e5697d847b1cae65940bd6 @@ -13708,8 +13752,8 @@ trackedFiles: pristine_git_object: 1268e32c9058ed4feb7482458a64366c56201676 src/openrouter/components/guardrail.py: id: 67ee78dd06e6 - last_write_checksum: sha1:6e7e7ac57ed9536407bb1c964c92851d93555030 - pristine_git_object: 2ac17be79e226506f69eddab66dee4cdc5a90acf + last_write_checksum: sha1:ed4abfbf72f6150ce518d2237fb409b756d8fa19 + pristine_git_object: fa1c7740bce5f1a05a4b6b1d700cc6e19c90e72a src/openrouter/components/guardrailbudgetpolicyauthoringconfig.py: id: 3011896fdeb5 last_write_checksum: sha1:604d6ec6906a391e0ce81e315ec077ab17e081a9 @@ -13728,12 +13772,12 @@ trackedFiles: pristine_git_object: 9cdf08ab3c380a8ea69b5884bcd40a09464589c6 src/openrouter/components/guardrailmodelavailabilitypolicyauthoringconfig.py: id: aa89978d2e99 - last_write_checksum: sha1:ef8cb28558ffcbccb6c873f49c1ddf00069c6001 - pristine_git_object: 939349b10c8d05aaa00b8082c03ec2c47e70d416 + last_write_checksum: sha1:cdb8eb779f87e1cde912520047582e70893836ac + pristine_git_object: 9a17416a509ca8e45b4900e14b4eb12810eedf95 src/openrouter/components/guardrailmodelavailabilitypolicyconfig.py: id: 3db2ab65ee94 - last_write_checksum: sha1:0cf731d21ac39fbb398a5e9abbe0692f3e191c9b - pristine_git_object: 1d1b95463b2648d5346a57d373600c18b6457ca8 + last_write_checksum: sha1:372415a9ef6c94947c13850f3d8f92f690b12759 + pristine_git_object: c1b0f478af6ae5240d4ea76a66305258f9e33e67 src/openrouter/components/guardrailmoderationpolicyconfig.py: id: 95252e545b13 last_write_checksum: sha1:a4f271e2e056520301737a25ee9072bb6b7e3e42 @@ -13900,8 +13944,8 @@ trackedFiles: pristine_git_object: 3b0c560bc9298bd40e2cdf1933ed0d5b98bb919b src/openrouter/components/inputreference.py: id: 445c38e318f9 - last_write_checksum: sha1:10cbedf134682fce77cfc0eac523e5d98eaa3617 - pristine_git_object: f499cbbb546232f5cfbfe2c44fb41aefb306c87f + last_write_checksum: sha1:dbf8c49e24fb26e9e21ded7c2cd2852ace09ba97 + pristine_git_object: 0347fb279f757b084116e5edc50b2f441c69e4a0 src/openrouter/components/inputs_union.py: id: 17d6239cb6a7 last_write_checksum: sha1:3c2703629e16d3d83d6bfe0102e427c1c5e7f76f @@ -15152,8 +15196,8 @@ trackedFiles: pristine_git_object: b2e0acc56568f3c0ff542ec141c761ad62ddad80 src/openrouter/components/scimsyncjob.py: id: a3d7fd291eb2 - last_write_checksum: sha1:2ba3f6314971f5d020f022296fc16bf608ff6505 - pristine_git_object: cc7c404fbad65b557005dcd525d46720baff6d7a + last_write_checksum: sha1:f845f10ad866dce1f3189da457a255d7ede41eab + pristine_git_object: db3ad168c02f0ea059c80b20830adf615661eb7d src/openrouter/components/searchcontextsizeenum.py: id: c246413c0bd7 last_write_checksum: sha1:863a664a9f17def86180b0407c8233c263acfae7 @@ -15336,8 +15380,8 @@ trackedFiles: pristine_git_object: 69c0355e7d575e6b7c52183d3cd5696611e4e8bf src/openrouter/components/speechrequest.py: id: 2a9400167112 - last_write_checksum: sha1:ad68e3edee8bada9d7a7cf487be8c0e00ee634b7 - pristine_git_object: bf95c5745e517b78184ce04f1e0c523fac0998f7 + last_write_checksum: sha1:50224010ebfabc4c63dca096b29f3a8825c9cb00 + pristine_git_object: b31d52439e6ecb7f04d6377b8d90923516b0bb94 src/openrouter/components/speechsupportedparameters.py: id: 618f33cc9229 last_write_checksum: sha1:9c152515a0cedad80d796c8981df706c08746d45 @@ -15640,8 +15684,8 @@ trackedFiles: pristine_git_object: 012b3aaddaeaedda9fc99afa4a817c10fe49239b src/openrouter/components/updateguardrailrequest.py: id: 6a557cd822a0 - last_write_checksum: sha1:548d5d097166aeb04c6db86c2b767f7b4b8d2291 - pristine_git_object: dc0ed7cc1941a6fecd114a805e5e0de1c1b39330 + last_write_checksum: sha1:3c3df310a471650669d479fa38a98f7fec56853b + pristine_git_object: 6e3d05b1d51ac74ac1e67be663ce2967084ce021 src/openrouter/components/updateguardrailresponse.py: id: 7b068d26ce31 last_write_checksum: sha1:2b63cbb90747f07f775d9a22e80f74c67221fea8 @@ -15756,8 +15800,8 @@ trackedFiles: pristine_git_object: c2f15eb53f14024dfd1e620c52a564bf4682854f src/openrouter/components/videogenerationrequest.py: id: 70e3c9ff288c - last_write_checksum: sha1:8eb551d91960c940a25971499e3e9c73292fa00c - pristine_git_object: 31b82404904570f0860532365c4f88dbf52249ea + last_write_checksum: sha1:40e6734712c63433f274f70d0b32ae72f55bfb4a + pristine_git_object: 193da8641b53c98a473380617876a078e6db6126 src/openrouter/components/videogenerationresponse.py: id: 541f1321b072 last_write_checksum: sha1:6b21b862a2da1009f5506144da69ecdbbd32fdf3 @@ -16036,8 +16080,8 @@ trackedFiles: pristine_git_object: b2b812577f8ea24153dce094cbab1fb2b229e769 src/openrouter/guardrails.py: id: 705839f34e66 - last_write_checksum: sha1:1b70c6d37d2126abd249e98c80aea82a6d0f9d28 - pristine_git_object: a9c7cae067722ed6b9afb6645e17747e6eaf4dce + last_write_checksum: sha1:d356c307b30fb5752149420e5e55ebf81aaaa5eb + pristine_git_object: 0507f7f86144e3e3890087104101e6810a674e81 src/openrouter/httpclient.py: id: e9311185443d last_write_checksum: sha1:5e55338d6ee9f01ab648cad4380201a8a3da7dd7 @@ -16072,8 +16116,8 @@ trackedFiles: pristine_git_object: 039fd484b407d7ca13177a892db5939b312ee50d src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:7c25d7304f0298876943ea893583c17e1ae537d1 - pristine_git_object: 70bc0a74a8ca60f3cdd4be4b64be3c93eed441f7 + last_write_checksum: sha1:80046e0118dc9cab426959d13e5bc0aa0f835f33 + pristine_git_object: bf81c87ace986ff5e2e5b18a7c8dd7771c09f99b src/openrouter/operations/activateprivateendpoint.py: id: 3b39eec5d66f last_write_checksum: sha1:9406e6b3d38c82895fd795f637702ef579cc6d36 @@ -16350,6 +16394,10 @@ trackedFiles: id: e734e28ebe62 last_write_checksum: sha1:0fd8969d081fd9f1c87bd5562f4ff14f4a1a495b pristine_git_object: 2e8240578f955bc7d8985533d4f57b81a85bd404 + src/openrouter/operations/getbatchresults.py: + id: d911025fa93c + last_write_checksum: sha1:3f82395590c6c5ccc5ac4c7b5d68f6d16513e947 + pristine_git_object: e94376226022431a3b1eefa5a156e5a18127d5d7 src/openrouter/operations/getbenchmarks.py: id: 5fb88644491e last_write_checksum: sha1:f3cb5df6279d1e381513fe4a4f7bb7d6f78bbe66 @@ -16484,8 +16532,8 @@ trackedFiles: pristine_git_object: 0365c6edd5a01c4086dfcf75d326fb48a67ad9d6 src/openrouter/operations/list.py: id: 3ced31e3804e - last_write_checksum: sha1:f139bef84fb09ba815b0529517988ff109c13cba - pristine_git_object: 8abf4d7aa09edae2e53f7fac0b90d701e9889f98 + last_write_checksum: sha1:997dc831dbb43b03cf81bca5921e9fe17306678b + pristine_git_object: dcabe942b77d27cff5e1422655c16138938d324c src/openrouter/operations/listaccountpolicies.py: id: 43e7588167c6 last_write_checksum: sha1:b45f72d17215528a2ae562e37ca99826ecea706b @@ -16908,8 +16956,8 @@ trackedFiles: pristine_git_object: 301f5a486f27e1dcfcb4c9029b47d6df7b683d95 src/openrouter/video_generation.py: id: d0a90c1b8efe - last_write_checksum: sha1:fefdd8724bd8804d41c999364418e98e6b97282a - pristine_git_object: ad510dfd4cbcb4544239161053d0c5fe4a824b71 + last_write_checksum: sha1:f53935f1d4522170633afbad7f251973a06d3cf8 + pristine_git_object: fd293ba5263b688b8982e43e15a990999b0997ef src/openrouter/workspaces.py: id: cd6c533b1802 last_write_checksum: sha1:ca0c91cf94644abcaa005b7d78449c034c3107ef @@ -17751,7 +17799,7 @@ examples: speakeasy-default-list-videos-models: responses: "200": - application/json: {"data": [{"allowed_passthrough_parameters": [], "canonical_slug": "google/veo-3.1", "created": 1700000000, "creativity": [], "generate_audio": true, "id": "google/veo-3.1", "name": "Veo 3.1", "seed": null, "supported_aspect_ratios": ["16:9"], "supported_durations": [5, 8], "supported_frame_images": ["first_frame", "last_frame"], "supported_resolutions": ["720p"], "supported_sizes": null, "upscale_factor": {}}]} + application/json: {"data": [{"allowed_passthrough_parameters": ["personGeneration", "aspectRatio", "negativePrompt", "conditioningScale", "enhancePrompt"], "canonical_slug": "google/veo-3.1-20260320", "created": 1774277148, "creativity": null, "generate_audio": true, "id": "google/veo-3.1", "name": "Google: Veo 3.1", "seed": true, "supported_aspect_ratios": ["16:9", "9:16"], "supported_durations": [4, 6, 8], "supported_frame_images": ["first_frame", "last_frame"], "supported_resolutions": ["720p", "1080p", "4K"], "supported_sizes": ["1280x720", "1080x1920", "1920x1080", "720x1280", "3840x2160", "2160x3840"], "upscale_factor": null}]} "400": application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "500": @@ -22034,7 +22082,19 @@ examples: application/json: {"error": {"code": 500, "message": "Internal Server Error"}} "503": application/json: {"error": {"code": 503, "message": "Service temporarily unavailable"}} + getBatchResults: + speakeasy-default-get-batch-results: + parameters: + path: + id: "batch_abc123" + responses: + "200": + application/json: {"data": [], "has_more": false, "next_cursor": null, "object": "list"} + "402": + application/json: {"completion_window": "24h", "created_at": 408348, "endpoint": "", "error": {"code": 455974, "message": ""}, "expires_at": 419566, "finalized_at": 282040, "id": "", "model": "Model S", "object": "batch", "provider": "", "request_counts": {"completed": 944277, "failed": 227610, "total": 745536}, "results": "", "status": "completed", "usage": {"completion_tokens": 648763, "prompt_tokens": 865459, "total_tokens": 861032}} + "400": + application/json: {"error": {"code": 400, "message": "custom_id is required on requests[0]."}} + "500": + application/json: {"error": {"code": 400, "message": "custom_id is required on requests[0]."}} examplesVersion: 1.0.2 -releaseNotes: | - ## Python SDK Changes: - * `open_router.presets.create_presets_responses()`: `request.context_management` **Added** +releaseNotes: "## Python SDK Changes:\n* `open_router.batch.get_results()`: **Added**\n* `open_router.tts.create_speech()`: \n * `request.response_format.enum(wav)` **Added**\n* `open_router.batch.delete()`: `error.status[503]` **Added**\n* `open_router.guardrails.list()`: `response.data[].allow_safety_retention_openai` **Added**\n* `open_router.guardrails.create()`: \n * `request.allow_safety_retention_openai` **Added**\n * `response.data.allow_safety_retention_openai` **Added**\n* `open_router.guardrails.get()`: `response.data.allow_safety_retention_openai` **Added**\n* `open_router.guardrails.update()`: \n * `request.allow_safety_retention_openai` **Added**\n * `response.data.allow_safety_retention_openai` **Added**\n* `open_router.guardrail_policies.list_account_policies()`: `response.data[].union(model_availability).config.allow_safety_retention_openai` **Added**\n* `open_router.guardrail_policies.create_account_policy()`: \n * `request.account_guardrail_policy_request.union(model_availability).config.allow_safety_retention_openai` **Added**\n * `response.data.union(model_availability).config.allow_safety_retention_openai` **Added**\n* `open_router.guardrail_policies.update_account_policy()`: \n * `request.account_guardrail_policy_request.union(model_availability).config.allow_safety_retention_openai` **Added**\n * `response.data.union(model_availability).config.allow_safety_retention_openai` **Added**\n* `open_router.guardrail_policies.list_model_availability_policies()`: `response.data[].config.allow_safety_retention_openai` **Added**\n* `open_router.guardrail_policies.create_model_availability_policy()`: \n * `request.config.allow_safety_retention_openai` **Added**\n * `response.data.config.allow_safety_retention_openai` **Added**\n* `open_router.guardrail_policies.get_model_availability_policy()`: `response.data.config.allow_safety_retention_openai` **Added**\n* `open_router.guardrail_policies.update_model_availability_policy()`: \n * `request.config.allow_safety_retention_openai` **Added**\n * `response.data.config.allow_safety_retention_openai` **Added**\n* `open_router.api_keys.list()`: \n * `request.creator_user_id` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 09d763888..ba76609aa 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.211 + version: 1.3.212 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 76bc4a1de..b12318ae5 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -5707,824 +5707,7 @@ components: type: 'object' results: items: - properties: - custom_id: - type: 'string' - error: - properties: - error_type: - $ref: '#/components/schemas/ApiErrorType' - message: - type: 'string' - param: - type: - - 'string' - - 'null' - type: - type: 'string' - required: - - 'type' - - 'message' - - 'param' - type: - - 'object' - - 'null' - id: - type: 'string' - response: - properties: - body: - anyOf: - - properties: - alignment: - $ref: '#/components/schemas/Alignment' - choices: - items: - properties: - finish_reason: - $ref: '#/components/schemas/FinishReason' - index: - type: 'integer' - logprobs: - properties: - content: - items: - properties: - bytes: - items: - type: 'integer' - type: - - 'array' - - 'null' - logprob: - format: 'double' - type: 'number' - token: - type: 'string' - top_logprobs: - items: - properties: - bytes: - items: - type: 'integer' - type: - - 'array' - - 'null' - logprob: - format: 'double' - type: 'number' - token: - type: 'string' - required: - - 'token' - - 'bytes' - - 'logprob' - type: 'object' - type: 'array' - required: - - 'token' - - 'bytes' - - 'logprob' - - 'top_logprobs' - type: 'object' - type: - - 'array' - - 'null' - refusal: - default: null - items: - properties: - bytes: - items: - type: 'integer' - type: - - 'array' - - 'null' - logprob: - format: 'double' - type: 'number' - token: - type: 'string' - top_logprobs: - items: - properties: - bytes: - items: - type: 'integer' - type: - - 'array' - - 'null' - logprob: - format: 'double' - type: 'number' - token: - type: 'string' - required: - - 'token' - - 'bytes' - - 'logprob' - type: 'object' - type: 'array' - required: - - 'token' - - 'bytes' - - 'logprob' - - 'top_logprobs' - type: 'object' - type: - - 'array' - - 'null' - required: - - 'content' - type: - - 'object' - - 'null' - message: - properties: - annotations: - items: - oneOf: - - properties: - file: - properties: - content: - items: - oneOf: - - properties: - text: - type: 'string' - type: - enum: - - 'text' - type: 'string' - required: - - 'type' - - 'text' - type: 'object' - - properties: - image_url: - properties: - url: - type: 'string' - required: - - 'url' - type: 'object' - type: - enum: - - 'image_url' - type: 'string' - required: - - 'type' - - 'image_url' - type: 'object' - type: 'array' - hash: - type: 'string' - name: - type: 'string' - required: - - 'hash' - - 'content' - type: 'object' - type: - enum: - - 'file' - type: 'string' - required: - - 'type' - - 'file' - type: 'object' - - properties: - type: - enum: - - 'url_citation' - type: 'string' - url_citation: - properties: - content: - type: 'string' - end_index: - type: 'integer' - start_index: - type: 'integer' - title: - type: 'string' - uncited: - const: true - type: 'boolean' - url: - type: 'string' - required: - - 'url' - - 'start_index' - - 'end_index' - - 'title' - type: 'object' - required: - - 'type' - - 'url_citation' - type: 'object' - - properties: - type: - enum: - - 'web_search_citation' - type: 'string' - web_search_citation: - properties: - cited_text: - type: 'string' - encrypted_index: - type: 'string' - title: - type: - - 'string' - - 'null' - url: - type: 'string' - required: - - 'url' - - 'title' - type: 'object' - required: - - 'type' - - 'web_search_citation' - type: 'object' - type: 'array' - content: - type: - - 'string' - - 'null' - images: - items: - properties: - image_url: - properties: - url: - minLength: 1 - type: 'string' - required: - - 'url' - type: 'object' - type: - enum: - - 'image_url' - type: 'string' - required: - - 'type' - - 'image_url' - type: 'object' - type: - - 'array' - - 'null' - reasoning: - type: - - 'string' - - 'null' - reasoning_details: - items: - anyOf: - - $ref: '#/components/schemas/ReasoningDetailSummary' - - $ref: '#/components/schemas/ReasoningDetailEncrypted' - - $ref: '#/components/schemas/ReasoningDetailText' - - $ref: '#/components/schemas/ReasoningDetailServerToolCall' - - type: 'null' - - type: 'null' - type: - - 'array' - - 'null' - refusal: - type: - - 'string' - - 'null' - role: - enum: - - 'assistant' - type: 'string' - tool_calls: - items: - properties: - function: - properties: - arguments: - type: 'string' - name: - type: 'string' - required: - - 'name' - - 'arguments' - type: 'object' - id: - type: 'string' - index: - type: 'integer' - type: - enum: - - 'function' - type: 'string' - required: - - 'index' - - 'id' - - 'type' - - 'function' - type: 'object' - type: 'array' - required: - - 'role' - - 'content' - - 'refusal' - type: 'object' - native_finish_reason: - type: - - 'string' - - 'null' - required: - - 'index' - - 'message' - - 'finish_reason' - - 'native_finish_reason' - - 'logprobs' - type: 'object' - type: 'array' - created: - type: 'integer' - debug: - additionalProperties: {} - properties: - echo_upstream_body: - additionalProperties: {} - type: 'object' - timings: - properties: - epoch_ms: - type: 'integer' - event: - enum: - - 'adapter_request' - - 'upstream_headers_received' - - 'first_token_received' - - 'upstream_body_ended' - type: 'string' - x-speakeasy-unknown-values: allow - start_ms: - type: 'integer' - required: - - 'start_ms' - - 'event' - - 'epoch_ms' - type: 'object' - type: 'object' - id: - type: 'string' - model: - type: 'string' - object: - enum: - - 'chat.completion' - type: 'string' - openrouter_metadata: - $ref: '#/components/schemas/OpenRouterMetadata' - provider: - type: - - 'string' - - 'null' - safeguard_results: - description: 'OpenRouter Armor''s verdict for each client tool call of this response, present whenever Armor evaluated the response (even when nothing was flagged). Independent of the `openrouter_metadata` opt-in.' - items: - $ref: '#/components/schemas/ArmorSafeguardResult' - type: 'array' - service_tier: - type: - - 'string' - - 'null' - system_fingerprint: - type: - - 'string' - - 'null' - usage: - properties: - completion_tokens: - description: 'The tokens generated' - type: 'integer' - completion_tokens_details: - properties: - audio_tokens: - description: 'Tokens generated by the model for audio output.' - type: - - 'integer' - - 'null' - image_tokens: - description: 'Tokens generated by the model for image output.' - type: - - 'integer' - - 'null' - reasoning_tokens: - description: 'Tokens generated by the model for reasoning.' - type: - - 'integer' - - 'null' - type: - - 'object' - - 'null' - prompt_tokens: - description: 'Including images, input audio, and tools if any' - type: 'integer' - prompt_tokens_details: - description: 'Breakdown of tokens used in the prompt.' - properties: - audio_tokens: - description: 'Tokens used for input audio.' - type: - - 'integer' - - 'null' - cache_write_tokens: - description: 'Tokens written to cache. Only returned for models with explicit caching and cache write pricing.' - type: - - 'integer' - - 'null' - cached_tokens: - description: 'Tokens cached by the endpoint.' - type: - - 'integer' - - 'null' - file_tokens: - description: 'Tokens used for input files/documents.' - type: - - 'integer' - - 'null' - video_tokens: - description: 'Tokens used for input video.' - type: - - 'integer' - - 'null' - type: - - 'object' - - 'null' - server_tool_use: - description: 'Usage for server-side tool execution (e.g., web search)' - properties: - tool_calls_executed: - description: 'Number of OpenRouter server tool calls that executed and produced a result.' - type: - - 'integer' - - 'null' - tool_calls_requested: - description: 'Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.' - type: - - 'integer' - - 'null' - web_search_requests: - description: 'Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.' - type: - - 'integer' - - 'null' - type: - - 'object' - - 'null' - server_tool_use_details: - description: 'Usage for server-side tool execution (e.g., web search)' - properties: - tool_calls_executed: - description: 'Number of OpenRouter server tool calls that executed and produced a result.' - type: - - 'integer' - - 'null' - tool_calls_requested: - description: 'Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.' - type: - - 'integer' - - 'null' - web_search_requests: - description: 'Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.' - type: - - 'integer' - - 'null' - type: - - 'object' - - 'null' - total_tokens: - description: 'Sum of the above two fields' - type: 'integer' - required: - - 'prompt_tokens' - - 'completion_tokens' - - 'total_tokens' - type: 'object' - required: - - 'model' - - 'id' - - 'created' - - 'object' - - 'choices' - type: 'object' - - $ref: '#/components/schemas/OpenResponsesResult' - - properties: - container: - $ref: '#/components/schemas/AnthropicContainer' - content: - items: - $ref: '#/components/schemas/ORAnthropicContentBlock' - type: 'array' - id: - type: 'string' - input_transformations: - items: - $ref: '#/components/schemas/AnthropicInputTransformation' - type: - - 'array' - - 'null' - model: - type: 'string' - role: - enum: - - 'assistant' - type: 'string' - stop_details: - $ref: '#/components/schemas/AnthropicRefusalStopDetails' - stop_reason: - $ref: '#/components/schemas/ORAnthropicStopReason' - stop_sequence: - type: - - 'string' - - 'null' - type: - enum: - - 'message' - type: 'string' - usage: - allOf: - - $ref: '#/components/schemas/AnthropicUsage' - - properties: - iterations: - items: - $ref: '#/components/schemas/AnthropicUsageIteration' - type: 'array' - speed: - $ref: '#/components/schemas/AnthropicSpeed' - type: 'object' - example: - cache_creation: null - cache_creation_input_tokens: null - cache_read_input_tokens: null - inference_geo: null - input_tokens: 100 - output_tokens: 50 - output_tokens_details: null - server_tool_use: null - service_tier: 'standard' - required: - - 'id' - - 'type' - - 'role' - - 'container' - - 'content' - - 'model' - - 'stop_reason' - - 'stop_details' - - 'stop_sequence' - - 'usage' - type: 'object' - - description: 'Embeddings response containing embedding vectors' - example: - data: - - embedding: - - 0.0023064255 - - -0.009327292 - - 0.015797347 - index: 0 - object: 'embedding' - model: 'openai/text-embedding-3-small' - object: 'list' - usage: - prompt_tokens: 8 - total_tokens: 8 - properties: - data: - description: 'List of embedding objects' - example: - - embedding: - - 0.0023064255 - - -0.009327292 - - 0.015797347 - index: 0 - object: 'embedding' - items: - description: 'A single embedding object' - example: - embedding: - - 0.0023064255 - - -0.009327292 - - 0.015797347 - index: 0 - object: 'embedding' - properties: - document_index: - description: 'Index of the source document when `input` was a list of documents (contextual embeddings). Absent otherwise.' - example: 0 - type: 'integer' - embedding: - anyOf: - - items: - type: 'number' - type: 'array' - - type: 'string' - description: 'Embedding vector as an array of floats or a base64 string' - example: - - 0.0023064255 - - -0.009327292 - - 0.015797347 - index: - description: 'Index of the embedding in the input list' - example: 0 - type: 'integer' - object: - enum: - - 'embedding' - type: 'string' - required: - - 'object' - - 'embedding' - type: 'object' - type: 'array' - id: - description: 'Unique identifier for the embeddings response' - example: 'embd-1234567890' - type: 'string' - model: - description: 'The model used for embeddings' - example: 'openai/text-embedding-3-small' - type: 'string' - object: - enum: - - 'list' - type: 'string' - usage: - description: 'Token usage statistics' - example: - prompt_tokens: 8 - total_tokens: 8 - properties: - cost: - description: 'Cost of the request in credits' - example: 0.0001 - format: 'double' - type: 'number' - cost_details: - $ref: '#/components/schemas/CostDetails' - is_byok: - description: 'Whether a request was made using a Bring Your Own Key configuration' - type: 'boolean' - prompt_tokens: - description: 'Number of tokens in the input' - example: 8 - type: 'integer' - prompt_tokens_details: - description: 'Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.' - properties: - audio_tokens: - description: 'Number of audio tokens in the input' - type: 'integer' - file_tokens: - description: 'Number of file/document tokens in the input' - type: 'integer' - image_tokens: - description: 'Number of image tokens in the input' - example: 258 - type: 'integer' - text_tokens: - description: 'Number of text tokens in the input' - example: 8 - type: 'integer' - video_tokens: - description: 'Number of video tokens in the input' - type: 'integer' - type: 'object' - total_tokens: - description: 'Total number of tokens used' - example: 8 - type: 'integer' - required: - - 'prompt_tokens' - - 'total_tokens' - type: 'object' - required: - - 'object' - - 'data' - - 'model' - type: 'object' - - additionalProperties: false - properties: - audio: - anyOf: - - additionalProperties: false - properties: - bits_per_sample: - enum: - - 16 - type: 'number' - channels: - exclusiveMinimum: true - minimum: 0 - type: 'integer' - data: - description: 'Base64-encoded PCM16 audio in the format the sibling fields give.' - minLength: 1 - type: 'string' - format: - enum: - - 'pcm' - type: 'string' - sample_rate: - exclusiveMinimum: true - minimum: 0 - type: 'integer' - required: - - 'format' - - 'sample_rate' - - 'channels' - - 'bits_per_sample' - - 'data' - type: 'object' - - additionalProperties: false - properties: - bits_per_sample: - enum: - - 16 - type: 'number' - byte_length: - exclusiveMinimum: true - minimum: 0 - type: 'integer' - channels: - exclusiveMinimum: true - minimum: 0 - type: 'integer' - format: - enum: - - 'pcm' - type: 'string' - sample_rate: - exclusiveMinimum: true - minimum: 0 - type: 'integer' - sha256: - pattern: '^[0-9a-f]{64}$' - type: 'string' - required: - - 'format' - - 'sample_rate' - - 'channels' - - 'bits_per_sample' - - 'byte_length' - - 'sha256' - type: 'object' - model: - type: 'string' - object: - enum: - - 'audio.speech' - type: 'string' - usage: - additionalProperties: false - properties: - completion_tokens: - minimum: 0 - type: 'integer' - prompt_tokens: - minimum: 0 - type: 'integer' - total_tokens: - minimum: 0 - type: 'integer' - required: - - 'prompt_tokens' - - 'completion_tokens' - - 'total_tokens' - type: 'object' - required: - - 'object' - - 'model' - - 'audio' - - 'usage' - type: 'object' - request_id: - type: - - 'string' - - 'null' - status_code: - type: 'integer' - required: - - 'status_code' - - 'request_id' - - 'body' - type: - - 'object' - - 'null' - required: - - 'id' - - 'custom_id' - - 'response' - - 'error' - type: 'object' + $ref: '#/components/schemas/BatchResult' type: - 'array' - 'null' @@ -6914,6 +6097,748 @@ components: type: - 'object' - 'null' + BatchResult: + properties: + custom_id: + type: 'string' + error: + properties: + error_type: + $ref: '#/components/schemas/ApiErrorType' + message: + type: 'string' + param: + type: + - 'string' + - 'null' + type: + type: 'string' + required: + - 'type' + - 'message' + - 'param' + type: + - 'object' + - 'null' + id: + type: 'string' + response: + properties: + body: + anyOf: + - properties: + alignment: + $ref: '#/components/schemas/Alignment' + choices: + items: + properties: + finish_reason: + $ref: '#/components/schemas/FinishReason' + index: + type: 'integer' + logprobs: + properties: + content: + items: + properties: + bytes: + items: + type: 'integer' + type: + - 'array' + - 'null' + logprob: + format: 'double' + type: 'number' + token: + type: 'string' + top_logprobs: + items: + properties: + bytes: + items: + type: 'integer' + type: + - 'array' + - 'null' + logprob: + format: 'double' + type: 'number' + token: + type: 'string' + required: + - 'token' + - 'bytes' + - 'logprob' + type: 'object' + type: 'array' + required: + - 'token' + - 'bytes' + - 'logprob' + - 'top_logprobs' + type: 'object' + type: + - 'array' + - 'null' + refusal: + default: null + items: + properties: + bytes: + items: + type: 'integer' + type: + - 'array' + - 'null' + logprob: + format: 'double' + type: 'number' + token: + type: 'string' + top_logprobs: + items: + properties: + bytes: + items: + type: 'integer' + type: + - 'array' + - 'null' + logprob: + format: 'double' + type: 'number' + token: + type: 'string' + required: + - 'token' + - 'bytes' + - 'logprob' + type: 'object' + type: 'array' + required: + - 'token' + - 'bytes' + - 'logprob' + - 'top_logprobs' + type: 'object' + type: + - 'array' + - 'null' + required: + - 'content' + type: + - 'object' + - 'null' + message: + properties: + annotations: + items: + $ref: '#/components/schemas/ChatAnnotation' + type: 'array' + content: + type: + - 'string' + - 'null' + images: + items: + properties: + image_url: + properties: + url: + minLength: 1 + type: 'string' + required: + - 'url' + type: 'object' + type: + enum: + - 'image_url' + type: 'string' + required: + - 'type' + - 'image_url' + type: 'object' + type: + - 'array' + - 'null' + reasoning: + type: + - 'string' + - 'null' + reasoning_details: + items: + anyOf: + - $ref: '#/components/schemas/ReasoningDetailSummary' + - $ref: '#/components/schemas/ReasoningDetailEncrypted' + - $ref: '#/components/schemas/ReasoningDetailText' + - $ref: '#/components/schemas/ReasoningDetailServerToolCall' + - type: 'null' + - type: 'null' + type: + - 'array' + - 'null' + refusal: + type: + - 'string' + - 'null' + role: + enum: + - 'assistant' + type: 'string' + tool_calls: + items: + properties: + function: + properties: + arguments: + type: 'string' + name: + type: 'string' + required: + - 'name' + - 'arguments' + type: 'object' + id: + type: 'string' + index: + type: 'integer' + type: + enum: + - 'function' + type: 'string' + required: + - 'index' + - 'id' + - 'type' + - 'function' + type: 'object' + type: 'array' + required: + - 'role' + - 'content' + - 'refusal' + type: 'object' + native_finish_reason: + type: + - 'string' + - 'null' + required: + - 'index' + - 'message' + - 'finish_reason' + - 'native_finish_reason' + - 'logprobs' + type: 'object' + type: 'array' + created: + type: 'integer' + debug: + additionalProperties: {} + properties: + echo_upstream_body: + additionalProperties: {} + type: 'object' + timings: + properties: + epoch_ms: + type: 'integer' + event: + enum: + - 'adapter_request' + - 'upstream_headers_received' + - 'first_token_received' + - 'upstream_body_ended' + type: 'string' + x-speakeasy-unknown-values: allow + start_ms: + type: 'integer' + required: + - 'start_ms' + - 'event' + - 'epoch_ms' + type: 'object' + type: 'object' + id: + type: 'string' + model: + type: 'string' + object: + enum: + - 'chat.completion' + type: 'string' + openrouter_metadata: + $ref: '#/components/schemas/OpenRouterMetadata' + provider: + type: + - 'string' + - 'null' + safeguard_results: + description: 'OpenRouter Armor''s verdict for each client tool call of this response, present whenever Armor evaluated the response (even when nothing was flagged). Independent of the `openrouter_metadata` opt-in.' + items: + $ref: '#/components/schemas/ArmorSafeguardResult' + type: 'array' + service_tier: + type: + - 'string' + - 'null' + system_fingerprint: + type: + - 'string' + - 'null' + usage: + properties: + completion_tokens: + description: 'The tokens generated' + type: 'integer' + completion_tokens_details: + properties: + audio_tokens: + description: 'Tokens generated by the model for audio output.' + type: + - 'integer' + - 'null' + image_tokens: + description: 'Tokens generated by the model for image output.' + type: + - 'integer' + - 'null' + reasoning_tokens: + description: 'Tokens generated by the model for reasoning.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + prompt_tokens: + description: 'Including images, input audio, and tools if any' + type: 'integer' + prompt_tokens_details: + description: 'Breakdown of tokens used in the prompt.' + properties: + audio_tokens: + description: 'Tokens used for input audio.' + type: + - 'integer' + - 'null' + cache_write_tokens: + description: 'Tokens written to cache. Only returned for models with explicit caching and cache write pricing.' + type: + - 'integer' + - 'null' + cached_tokens: + description: 'Tokens cached by the endpoint.' + type: + - 'integer' + - 'null' + file_tokens: + description: 'Tokens used for input files/documents.' + type: + - 'integer' + - 'null' + video_tokens: + description: 'Tokens used for input video.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + server_tool_use: + description: 'Usage for server-side tool execution (e.g., web search)' + properties: + tool_calls_executed: + description: 'Number of OpenRouter server tool calls that executed and produced a result.' + type: + - 'integer' + - 'null' + tool_calls_requested: + description: 'Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.' + type: + - 'integer' + - 'null' + web_search_requests: + description: 'Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + server_tool_use_details: + description: 'Usage for server-side tool execution (e.g., web search)' + properties: + tool_calls_executed: + description: 'Number of OpenRouter server tool calls that executed and produced a result.' + type: + - 'integer' + - 'null' + tool_calls_requested: + description: 'Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.' + type: + - 'integer' + - 'null' + web_search_requests: + description: 'Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.' + type: + - 'integer' + - 'null' + type: + - 'object' + - 'null' + total_tokens: + description: 'Sum of the above two fields' + type: 'integer' + required: + - 'prompt_tokens' + - 'completion_tokens' + - 'total_tokens' + type: 'object' + required: + - 'model' + - 'id' + - 'created' + - 'object' + - 'choices' + type: 'object' + - $ref: '#/components/schemas/OpenResponsesResult' + - properties: + container: + $ref: '#/components/schemas/AnthropicContainer' + content: + items: + $ref: '#/components/schemas/ORAnthropicContentBlock' + type: 'array' + id: + type: 'string' + input_transformations: + items: + $ref: '#/components/schemas/AnthropicInputTransformation' + type: + - 'array' + - 'null' + model: + type: 'string' + role: + enum: + - 'assistant' + type: 'string' + stop_details: + $ref: '#/components/schemas/AnthropicRefusalStopDetails' + stop_reason: + $ref: '#/components/schemas/ORAnthropicStopReason' + stop_sequence: + type: + - 'string' + - 'null' + type: + enum: + - 'message' + type: 'string' + usage: + allOf: + - $ref: '#/components/schemas/AnthropicUsage' + - properties: + iterations: + items: + $ref: '#/components/schemas/AnthropicUsageIteration' + type: 'array' + speed: + $ref: '#/components/schemas/AnthropicSpeed' + type: 'object' + example: + cache_creation: null + cache_creation_input_tokens: null + cache_read_input_tokens: null + inference_geo: null + input_tokens: 100 + output_tokens: 50 + output_tokens_details: null + server_tool_use: null + service_tier: 'standard' + required: + - 'id' + - 'type' + - 'role' + - 'container' + - 'content' + - 'model' + - 'stop_reason' + - 'stop_details' + - 'stop_sequence' + - 'usage' + type: 'object' + - description: 'Embeddings response containing embedding vectors' + example: + data: + - embedding: + - 0.0023064255 + - -0.009327292 + - 0.015797347 + index: 0 + object: 'embedding' + model: 'openai/text-embedding-3-small' + object: 'list' + usage: + prompt_tokens: 8 + total_tokens: 8 + properties: + data: + description: 'List of embedding objects' + example: + - embedding: + - 0.0023064255 + - -0.009327292 + - 0.015797347 + index: 0 + object: 'embedding' + items: + description: 'A single embedding object' + example: + embedding: + - 0.0023064255 + - -0.009327292 + - 0.015797347 + index: 0 + object: 'embedding' + properties: + document_index: + description: 'Index of the source document when `input` was a list of documents (contextual embeddings). Absent otherwise.' + example: 0 + type: 'integer' + embedding: + anyOf: + - items: + type: 'number' + type: 'array' + - type: 'string' + description: 'Embedding vector as an array of floats or a base64 string' + example: + - 0.0023064255 + - -0.009327292 + - 0.015797347 + index: + description: 'Index of the embedding in the input list' + example: 0 + type: 'integer' + object: + enum: + - 'embedding' + type: 'string' + required: + - 'object' + - 'embedding' + type: 'object' + type: 'array' + id: + description: 'Unique identifier for the embeddings response' + example: 'embd-1234567890' + type: 'string' + model: + description: 'The model used for embeddings' + example: 'openai/text-embedding-3-small' + type: 'string' + object: + enum: + - 'list' + type: 'string' + usage: + description: 'Token usage statistics' + example: + prompt_tokens: 8 + total_tokens: 8 + properties: + cost: + description: 'Cost of the request in credits' + example: 0.0001 + format: 'double' + type: 'number' + cost_details: + $ref: '#/components/schemas/CostDetails' + is_byok: + description: 'Whether a request was made using a Bring Your Own Key configuration' + type: 'boolean' + prompt_tokens: + description: 'Number of tokens in the input' + example: 8 + type: 'integer' + prompt_tokens_details: + description: 'Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.' + properties: + audio_tokens: + description: 'Number of audio tokens in the input' + type: 'integer' + file_tokens: + description: 'Number of file/document tokens in the input' + type: 'integer' + image_tokens: + description: 'Number of image tokens in the input' + example: 258 + type: 'integer' + text_tokens: + description: 'Number of text tokens in the input' + example: 8 + type: 'integer' + video_tokens: + description: 'Number of video tokens in the input' + type: 'integer' + type: 'object' + total_tokens: + description: 'Total number of tokens used' + example: 8 + type: 'integer' + required: + - 'prompt_tokens' + - 'total_tokens' + type: 'object' + required: + - 'object' + - 'data' + - 'model' + type: 'object' + - additionalProperties: false + properties: + audio: + anyOf: + - additionalProperties: false + properties: + bits_per_sample: + enum: + - 16 + type: 'number' + channels: + exclusiveMinimum: true + minimum: 0 + type: 'integer' + data: + description: 'Base64-encoded PCM16 audio in the format the sibling fields give.' + minLength: 1 + type: 'string' + format: + enum: + - 'pcm' + type: 'string' + sample_rate: + exclusiveMinimum: true + minimum: 0 + type: 'integer' + required: + - 'format' + - 'sample_rate' + - 'channels' + - 'bits_per_sample' + - 'data' + type: 'object' + - additionalProperties: false + properties: + bits_per_sample: + enum: + - 16 + type: 'number' + byte_length: + exclusiveMinimum: true + minimum: 0 + type: 'integer' + channels: + exclusiveMinimum: true + minimum: 0 + type: 'integer' + format: + enum: + - 'pcm' + type: 'string' + sample_rate: + exclusiveMinimum: true + minimum: 0 + type: 'integer' + sha256: + pattern: '^[0-9a-f]{64}$' + type: 'string' + required: + - 'format' + - 'sample_rate' + - 'channels' + - 'bits_per_sample' + - 'byte_length' + - 'sha256' + type: 'object' + model: + type: 'string' + object: + enum: + - 'audio.speech' + type: 'string' + usage: + additionalProperties: false + properties: + completion_tokens: + minimum: 0 + type: 'integer' + prompt_tokens: + minimum: 0 + type: 'integer' + total_tokens: + minimum: 0 + type: 'integer' + required: + - 'prompt_tokens' + - 'completion_tokens' + - 'total_tokens' + type: 'object' + required: + - 'object' + - 'model' + - 'audio' + - 'usage' + type: 'object' + request_id: + type: + - 'string' + - 'null' + status_code: + type: 'integer' + required: + - 'status_code' + - 'request_id' + - 'body' + type: + - 'object' + - 'null' + required: + - 'id' + - 'custom_id' + - 'response' + - 'error' + type: 'object' + BatchResultsPageResponse: + description: 'A cursor-paginated page of normalized batch result rows.' + example: + data: [] + has_more: false + next_cursor: null + object: 'list' + properties: + data: + items: + $ref: '#/components/schemas/BatchResult' + type: 'array' + has_more: + type: 'boolean' + next_cursor: + type: + - 'string' + - 'null' + object: + enum: + - 'list' + type: 'string' + required: + - 'object' + - 'data' + - 'has_more' + - 'next_cursor' + type: 'object' BatchSubmitBody: description: 'Batch submit request body.' properties: @@ -7839,6 +7764,25 @@ components: required: - 'data' type: 'object' + ChatAnnotation: + description: 'Citation or file annotation on an assistant message' + discriminator: + mapping: + file: '#/components/schemas/ChatFileAnnotation' + url_citation: '#/components/schemas/ChatUrlCitationAnnotation' + web_search_citation: '#/components/schemas/ChatWebSearchCitationAnnotation' + propertyName: 'type' + example: + type: 'url_citation' + url_citation: + end_index: 42 + start_index: 0 + title: 'OpenRouter docs' + url: 'https://openrouter.ai/docs' + oneOf: + - $ref: '#/components/schemas/ChatFileAnnotation' + - $ref: '#/components/schemas/ChatUrlCitationAnnotation' + - $ref: '#/components/schemas/ChatWebSearchCitationAnnotation' ChatAssistantImages: description: 'Generated images from image generation models' example: @@ -8188,6 +8132,66 @@ components: required: - 'type' type: 'object' + ChatFileAnnotation: + description: 'File annotation with the parsed file content' + example: + file: + content: + - text: 'Quarterly revenue grew 12%.' + type: 'text' + hash: 'abc123' + name: 'report.pdf' + type: 'file' + properties: + file: + properties: + content: + items: + oneOf: + - properties: + text: + type: 'string' + type: + enum: + - 'text' + type: 'string' + required: + - 'type' + - 'text' + type: 'object' + - properties: + image_url: + properties: + url: + type: 'string' + required: + - 'url' + type: 'object' + type: + enum: + - 'image_url' + type: 'string' + required: + - 'type' + - 'image_url' + type: 'object' + type: 'array' + hash: + type: 'string' + name: + type: 'string' + required: + - 'hash' + - 'content' + type: 'object' + type: + enum: + - 'file' + type: 'string' + required: + - 'type' + - 'file' + type: 'object' ChatFinishReasonEnum: enum: - 'tool_calls' @@ -9364,6 +9368,45 @@ components: - 'content' - 'tool_call_id' type: 'object' + ChatUrlCitationAnnotation: + description: 'URL citation annotation' + example: + type: 'url_citation' + url_citation: + end_index: 42 + start_index: 0 + title: 'OpenRouter docs' + url: 'https://openrouter.ai/docs' + properties: + type: + enum: + - 'url_citation' + type: 'string' + url_citation: + properties: + content: + type: 'string' + end_index: + type: 'integer' + start_index: + type: 'integer' + title: + type: 'string' + uncited: + const: true + type: 'boolean' + url: + type: 'string' + required: + - 'url' + - 'start_index' + - 'end_index' + - 'title' + type: 'object' + required: + - 'type' + - 'url_citation' + type: 'object' ChatUsage: description: 'Token usage statistics' example: @@ -9483,6 +9526,39 @@ components: - 'role' - 'content' type: 'object' + ChatWebSearchCitationAnnotation: + description: 'Web search citation annotation' + example: + type: 'web_search_citation' + web_search_citation: + cited_text: 'OpenRouter provides a unified API.' + title: 'OpenRouter docs' + url: 'https://openrouter.ai/docs' + properties: + type: + enum: + - 'web_search_citation' + type: 'string' + web_search_citation: + properties: + cited_text: + type: 'string' + encrypted_index: + type: 'string' + title: + type: + - 'string' + - 'null' + url: + type: 'string' + required: + - 'url' + - 'title' + type: 'object' + required: + - 'type' + - 'web_search_citation' + type: 'object' ChatWebSearchShorthand: description: 'Web search tool using OpenAI Responses API syntax. Automatically converted to openrouter:web_search.' example: @@ -10867,6 +10943,12 @@ components: type: - 'boolean' - 'null' + allow_safety_retention_openai: + description: 'Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting.' + example: true + type: + - 'boolean' + - 'null' allow_safety_retention_other: description: 'Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.' example: true @@ -16077,6 +16159,12 @@ components: type: - 'boolean' - 'null' + allow_safety_retention_openai: + description: 'Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting.' + example: true + type: + - 'boolean' + - 'null' allow_safety_retention_other: description: 'Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.' example: true @@ -16358,6 +16446,10 @@ components: type: - 'boolean' - 'null' + allow_safety_retention_openai: + type: + - 'boolean' + - 'null' allow_safety_retention_other: type: - 'boolean' @@ -16476,6 +16568,10 @@ components: type: - 'boolean' - 'null' + allow_safety_retention_openai: + type: + - 'boolean' + - 'null' allow_safety_retention_other: type: - 'boolean' @@ -18171,7 +18267,7 @@ components: type: 'string' x-speakeasy-unknown-values: allow InputReference: - description: 'A reference asset used to guide video generation. Image references are supported by all providers; audio and video references are only honored by providers that support them (including BytePlus Seedance generation 2 and newer).' + description: 'A reference asset used to guide video generation. Image references are the most widely supported; audio and video references are only accepted by providers that advertise those input modalities (including BytePlus Seedance generation 2 and newer).' discriminator: mapping: audio_url: '#/components/schemas/ContentPartAudio' @@ -33642,7 +33738,7 @@ components: - 'integer' - 'null' error_message: - description: 'Stable error message when the job failed.' + description: 'Stable message code, or null. On a failed job, the failure reason. On a succeeded job, set when optional work beyond the group synchronization could not be completed; the groups were still synchronized.' type: - 'string' - 'null' @@ -35016,6 +35112,7 @@ components: enum: - 'mp3' - 'pcm' + - 'wav' example: 'pcm' type: 'string' x-speakeasy-unknown-values: allow @@ -37874,6 +37971,12 @@ components: type: - 'boolean' - 'null' + allow_safety_retention_openai: + description: 'Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting.' + example: false + type: + - 'boolean' + - 'null' allow_safety_retention_other: description: 'Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.' example: false @@ -39446,16 +39549,16 @@ components: minimum: -1 type: 'integer' frame_images: - description: 'Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame.' + description: 'Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame, and each frame_type may appear at most once. Combining frame_images with input_references is provider-specific: some models reject the combination (as a 400 on submit or as a failed job), some use the frame images alone, and some use both (e.g. Runway applies image references as style/guidance alongside the frame anchors).' items: $ref: '#/components/schemas/FrameImage' type: 'array' generate_audio: - description: 'Whether to generate audio alongside the video. Defaults to the endpoint''s generate_audio capability flag, false if not set. When neither is set, some providers (such as xAI) apply their own default and generate audio, so send false to request a silent video. Some models always include audio and ignore false.' + description: 'Whether to generate audio alongside the video. Defaults to the endpoint''s generate_audio capability flag, false if not set. When neither is set, some providers (such as xAI) apply their own default and generate audio, so send false to request a silent video. Some models always include audio and ignore false. POST /videos returns 400 for true if every otherwise eligible endpoint explicitly disables audio generation.' example: true type: 'boolean' input_references: - description: 'Reference assets to guide video generation. Accepts image, audio, and video references. Audio and video references are only honored by providers that support them (including BytePlus Seedance generation 2 and newer); other providers use image references and ignore the rest.' + description: 'Reference assets to guide video generation. Accepts image, audio, and video references. POST /videos rejects the request with a 400 when the model or its provider integration does not support a supplied reference modality. Combining input_references with frame_images is provider-specific: some models reject the combination (as a 400 on submit or as a failed job), some use the frame images alone, and some use both (e.g. Runway applies image references as style/guidance alongside the frame anchors).' items: $ref: '#/components/schemas/InputReference' type: 'array' @@ -39471,7 +39574,7 @@ components: example: 'A serene mountain landscape at sunset' type: 'string' provider: - description: 'Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing.' + description: 'Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. Sorting by price, latency, or throughput and automatic provider fallbacks are not supported. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing.' properties: data_collection: description: "Data collection setting. If no available model provider meets the requirement, your request will return an error.\n- allow: (default) allow providers that may train on user data\n\n- deny: use only providers that do not train on user data. Providers may still retain prompts; set `zdr: true` to exclude retention." @@ -39517,10 +39620,9 @@ components: output_config: effort: 'low' order: - description: 'An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.' + description: 'An ordered list of provider slugs to prefer when choosing an eligible video endpoint. The request is submitted to one endpoint and is not retried on another provider if submission fails.' example: - - 'openai' - - 'anthropic' + - 'minimax' items: anyOf: - $ref: '#/components/schemas/ProviderName' @@ -39550,7 +39652,7 @@ components: type: 'string' x-speakeasy-unknown-values: allow seed: - description: 'If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers.' + description: 'If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. POST /videos returns 400 if every otherwise eligible endpoint explicitly declares seed unsupported.' type: 'integer' session_id: description: 'A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.' @@ -39659,27 +39761,48 @@ components: type: 'object' VideoModel: example: - allowed_passthrough_parameters: [] - canonical_slug: 'google/veo-3.1' - created: 1700000000 + allowed_passthrough_parameters: + - 'personGeneration' + - 'aspectRatio' + - 'negativePrompt' + - 'conditioningScale' + - 'enhancePrompt' + canonical_slug: 'google/veo-3.1-20260320' + created: 1774277148 + creativity: null description: 'Google video generation model' generate_audio: true + hugging_face_id: null id: 'google/veo-3.1' - name: 'Veo 3.1' + name: 'Google: Veo 3.1' pricing_skus: - generate: '0.50' - seed: null + duration_seconds_with_audio: '0.40' + duration_seconds_with_audio_4k: '0.60' + duration_seconds_without_audio: '0.20' + duration_seconds_without_audio_4k: '0.40' + seed: true supported_aspect_ratios: - '16:9' + - '9:16' supported_durations: - - 5 + - 4 + - 6 - 8 supported_frame_images: - 'first_frame' - 'last_frame' supported_resolutions: - '720p' - supported_sizes: null + - '1080p' + - '4K' + supported_sizes: + - '1280x720' + - '1080x1920' + - '1920x1080' + - '720x1280' + - '3840x2160' + - '2160x3840' + upscale_factor: null properties: allowed_passthrough_parameters: description: 'List of parameters that are allowed to be passed through to the provider' @@ -39922,27 +40045,48 @@ components: VideoModelsListResponse: example: data: - - allowed_passthrough_parameters: [] - canonical_slug: 'google/veo-3.1' - created: 1700000000 + - allowed_passthrough_parameters: + - 'personGeneration' + - 'aspectRatio' + - 'negativePrompt' + - 'conditioningScale' + - 'enhancePrompt' + canonical_slug: 'google/veo-3.1-20260320' + created: 1774277148 + creativity: null description: 'Google video generation model' generate_audio: true + hugging_face_id: null id: 'google/veo-3.1' - name: 'Veo 3.1' + name: 'Google: Veo 3.1' pricing_skus: - generate: '0.50' - seed: null + duration_seconds_with_audio: '0.40' + duration_seconds_with_audio_4k: '0.60' + duration_seconds_without_audio: '0.20' + duration_seconds_without_audio_4k: '0.40' + seed: true supported_aspect_ratios: - '16:9' + - '9:16' supported_durations: - - 5 + - 4 + - 6 - 8 supported_frame_images: - 'first_frame' - 'last_frame' supported_resolutions: - '720p' - supported_sizes: null + - '1080p' + - '4K' + supported_sizes: + - '1280x720' + - '1080x1920' + - '1920x1080' + - '720x1280' + - '3840x2160' + - '2160x3840' + upscale_factor: null properties: data: items: @@ -42671,102 +42815,225 @@ paths: message: 'Upstream batch-api is unavailable.' schema: $ref: '#/components/schemas/BatchErrorResponse' - description: 'The batch service is unavailable, or an upstream provider operation failed, including batch or file cleanup.' - summary: 'List batches' + description: 'The batch service is unavailable, or an upstream provider operation failed.' + summary: 'List batches' + tags: + - 'Batch' + x-speakeasy-name-override: 'list' + x-speakeasy-pagination: + inputs: + - in: 'parameters' + name: 'after' + type: 'cursor' + outputs: + nextCursor: '$.last_id' + results: '$.data' + type: 'cursor' + post: + description: 'Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`, `/v1/audio/speech`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).' + operationId: 'createBatches' + requestBody: + content: + application/json: + examples: + chatCompletions: + summary: 'Chat completions batch' + value: + endpoint: '/v1/chat/completions' + model: 'openai/gpt-4o' + requests: + - body: + messages: + - content: 'Summarize ...' + role: 'user' + model: 'openai/gpt-4o' + custom_id: 'req-0001' + messages: + summary: 'Messages batch' + value: + endpoint: '/v1/messages' + model: 'openai/gpt-5-nano' + requests: + - body: + max_tokens: 1024 + messages: + - content: 'Summarize ...' + role: 'user' + model: 'openai/gpt-5-nano' + custom_id: 'req-0001' + providerPinned: + summary: 'Batch pinned to Vertex' + value: + endpoint: '/v1/chat/completions' + model: 'google/gemini-3.6-flash' + provider: + only: + - 'google-vertex' + requests: + - body: + messages: + - content: 'Summarize ...' + role: 'user' + model: 'google/gemini-3.6-flash' + custom_id: 'req-0001' + responses: + summary: 'Responses batch' + value: + endpoint: '/v1/responses' + model: 'openai/gpt-4o' + requests: + - body: + input: + - content: + - text: 'Summarize ...' + type: 'input_text' + role: 'user' + model: 'openai/gpt-4o' + custom_id: 'req-0001' + schema: + $ref: '#/components/schemas/BatchSubmitBody' + description: 'The batch to create. Each item in `requests` has a unique `custom_id` and a `body` in the request format of the chosen `endpoint`.' + required: true + responses: + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/BatchObject' + description: 'Batch payload durably persisted and queued for asynchronous validation and provider submission (`status: "validating"`).' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'custom_id is required on requests[0].' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Malformed batch input or an unknown/incompatible batch model.' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'No auth credentials found.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Missing or invalid API key.' + '402': + content: + application/json: + example: + error: + code: 402 + message: 'Insufficient balance for this batch.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'The estimated batch cost exceeds the available balance.' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'The selected provider or model is not allowed.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'The resolved batch endpoint is blocked by account policy.' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Batch not found.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'No batch exists for the given id.' + '413': + content: + application/json: + example: + error: + code: 413 + message: 'Batch input exceeds the 200 MB payload limit.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Batch input exceeds the maximum payload size.' + '422': + content: + application/json: + example: + error: + code: 422 + message: 'The batch request could not be processed.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'The requested model variant or custom IDs violate Batch API constraints.' + '429': + content: + application/json: + example: + error: + code: 429 + message: 'Rate limit exceeded.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Batch API rate limit exceeded for the billable entity.' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal server error.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Unexpected error in the ingress or upstream batch-api.' + '502': + content: + application/json: + example: + error: + code: 502 + message: 'Upstream batch-api is unavailable.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'The batch service is unavailable, or an upstream provider operation failed.' + summary: 'Create a batch' tags: - 'Batch' - x-speakeasy-name-override: 'list' - x-speakeasy-pagination: - inputs: - - in: 'parameters' - name: 'after' - type: 'cursor' - outputs: - nextCursor: '$.last_id' - results: '$.data' - type: 'cursor' - post: - description: 'Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`, `/v1/audio/speech`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).' - operationId: 'createBatches' - requestBody: - content: - application/json: - examples: - chatCompletions: - summary: 'Chat completions batch' - value: - endpoint: '/v1/chat/completions' - model: 'openai/gpt-4o' - requests: - - body: - messages: - - content: 'Summarize ...' - role: 'user' - model: 'openai/gpt-4o' - custom_id: 'req-0001' - messages: - summary: 'Messages batch' - value: - endpoint: '/v1/messages' - model: 'openai/gpt-5-nano' - requests: - - body: - max_tokens: 1024 - messages: - - content: 'Summarize ...' - role: 'user' - model: 'openai/gpt-5-nano' - custom_id: 'req-0001' - providerPinned: - summary: 'Batch pinned to Vertex' - value: - endpoint: '/v1/chat/completions' - model: 'google/gemini-3.6-flash' - provider: - only: - - 'google-vertex' - requests: - - body: - messages: - - content: 'Summarize ...' - role: 'user' - model: 'google/gemini-3.6-flash' - custom_id: 'req-0001' - responses: - summary: 'Responses batch' - value: - endpoint: '/v1/responses' - model: 'openai/gpt-4o' - requests: - - body: - input: - - content: - - text: 'Summarize ...' - type: 'input_text' - role: 'user' - model: 'openai/gpt-4o' - custom_id: 'req-0001' - schema: - $ref: '#/components/schemas/BatchSubmitBody' - description: 'The batch to create. Each item in `requests` has a unique `custom_id` and a `body` in the request format of the chosen `endpoint`.' - required: true + x-speakeasy-retries: + retryConnectionErrors: false + statusCodes: + - '429' + strategy: 'backoff' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /batches/{id}: + delete: + description: 'Deletes a batch in a terminal status (`completed`, `failed`, `expired`, or `cancelled`) and its stored requests and results. Batches still in progress return `409`. Billing and usage records are kept. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).' + operationId: 'deleteBatch' + parameters: + - description: 'The batch job id returned from submit.' + in: 'path' + name: 'id' + required: true + schema: + description: 'The batch job id returned from submit.' + example: 'batch_abc123' + minLength: 1 + type: 'string' responses: - '202': + '200': content: application/json: schema: - $ref: '#/components/schemas/BatchObject' - description: 'Batch payload durably persisted and queued for asynchronous validation and provider submission (`status: "validating"`).' - '400': - content: - application/json: - example: - error: - code: 400 - message: 'custom_id is required on requests[0].' - schema: - $ref: '#/components/schemas/BatchErrorResponse' - description: 'Malformed batch input or an unknown/incompatible batch model.' + $ref: '#/components/schemas/BatchDeletedObject' + description: 'The batch was deleted; per-target outcomes are reported under `deletion`.' '401': content: application/json: @@ -42777,26 +43044,6 @@ paths: schema: $ref: '#/components/schemas/BatchErrorResponse' description: 'Missing or invalid API key.' - '402': - content: - application/json: - example: - error: - code: 402 - message: 'Insufficient balance for this batch.' - schema: - $ref: '#/components/schemas/BatchErrorResponse' - description: 'The estimated batch cost exceeds the available balance.' - '403': - content: - application/json: - example: - error: - code: 403 - message: 'The selected provider or model is not allowed.' - schema: - $ref: '#/components/schemas/BatchErrorResponse' - description: 'The resolved batch endpoint is blocked by account policy.' '404': content: application/json: @@ -42807,26 +43054,16 @@ paths: schema: $ref: '#/components/schemas/BatchErrorResponse' description: 'No batch exists for the given id.' - '413': - content: - application/json: - example: - error: - code: 413 - message: 'Batch input exceeds the 200 MB payload limit.' - schema: - $ref: '#/components/schemas/BatchErrorResponse' - description: 'Batch input exceeds the maximum payload size.' - '422': + '409': content: application/json: example: error: - code: 422 - message: 'The batch request could not be processed.' + code: 409 + message: 'Only completed, failed, expired, or cancelled batches can be deleted. Wait for the batch to finish and try again.' schema: $ref: '#/components/schemas/BatchErrorResponse' - description: 'The requested model variant or custom IDs violate Batch API constraints.' + description: 'The batch is still processing, its required provider key is unavailable, or its state changed during deletion.' '429': content: application/json: @@ -42856,23 +43093,24 @@ paths: message: 'Upstream batch-api is unavailable.' schema: $ref: '#/components/schemas/BatchErrorResponse' - description: 'The batch service is unavailable, or an upstream provider operation failed, including batch or file cleanup.' - summary: 'Create a batch' + description: 'The batch service is unavailable, or an upstream provider operation failed.' + '503': + content: + application/json: + example: + error: + code: 503 + message: 'Failed to delete the upstream batch or its files; retry the request.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'The provider did not confirm batch or file cleanup; retry the request.' + summary: 'Delete a batch' tags: - 'Batch' - x-speakeasy-retries: - retryConnectionErrors: false - statusCodes: - - '429' - strategy: 'backoff' - parameters: - - $ref: "#/components/parameters/AppIdentifier" - - $ref: "#/components/parameters/AppDisplayName" - - $ref: "#/components/parameters/AppCategories" - /batches/{id}: - delete: - description: 'Deletes a batch in a terminal status (`completed`, `failed`, `expired`, or `cancelled`) and its stored requests and results. Batches still in progress return `409`. Billing and usage records are kept. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).' - operationId: 'deleteBatch' + x-speakeasy-name-override: 'delete' + get: + description: 'Returns a batch with its status and request counts. Batches in a terminal status include `results`. Failed batches report the reason in `error.message`. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).' + operationId: 'getBatches' parameters: - description: 'The batch job id returned from submit.' in: 'path' @@ -42888,8 +43126,8 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/BatchDeletedObject' - description: 'The batch was deleted; per-target outcomes are reported under `deletion`.' + $ref: '#/components/schemas/BatchObject' + description: 'The current batch job status.' '401': content: application/json: @@ -42900,6 +43138,12 @@ paths: schema: $ref: '#/components/schemas/BatchErrorResponse' description: 'Missing or invalid API key.' + '402': + content: + application/json: + schema: + $ref: '#/components/schemas/BatchPaymentRequiredResponse' + description: 'The finalized batch cost exceeds the available balance; metadata is returned with `results: null`. Top up credits and poll again to receive the persisted results.' '404': content: application/json: @@ -42910,16 +43154,16 @@ paths: schema: $ref: '#/components/schemas/BatchErrorResponse' description: 'No batch exists for the given id.' - '409': + '410': content: application/json: example: error: - code: 409 - message: 'Only completed, failed, expired, or cancelled batches can be deleted. Wait for the batch to finish and try again.' + code: 410 + message: 'Batch results have expired. OpenRouter deletes batch results 30 days after the batch is created.' schema: $ref: '#/components/schemas/BatchErrorResponse' - description: 'The batch is still processing, its required provider key is unavailable, or its state changed during deletion.' + description: 'The batch results were deleted after the 30-day retention window.' '429': content: application/json: @@ -42949,14 +43193,18 @@ paths: message: 'Upstream batch-api is unavailable.' schema: $ref: '#/components/schemas/BatchErrorResponse' - description: 'The batch service is unavailable, or an upstream provider operation failed, including batch or file cleanup.' - summary: 'Delete a batch' + description: 'The batch service is unavailable, or an upstream provider operation failed.' + summary: 'Get a batch' tags: - 'Batch' - x-speakeasy-name-override: 'delete' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /batches/{id}/results: get: - description: 'Returns a batch with its status and request counts. Batches in a terminal status include `results`. Failed batches report the reason in `error.message`. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).' - operationId: 'getBatches' + description: 'Returns a cursor-paginated page of normalized OpenRouter-format results for a finished batch. Pass the previous page''s `next_cursor` as `cursor` to read the next page. Pages are stable across retries for the 30-day artifact retention window. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).' + operationId: 'getBatchResults' parameters: - description: 'The batch job id returned from submit.' in: 'path' @@ -42967,13 +43215,41 @@ paths: example: 'batch_abc123' minLength: 1 type: 'string' + - description: 'Maximum number of result items to return, from 1 through 1000.' + in: 'query' + name: 'limit' + required: false + schema: + description: 'Maximum number of result items to return, from 1 through 1000.' + example: 500 + type: 'integer' + - description: 'Opaque pagination cursor from the previous page''s `next_cursor`. Omit for the first page.' + in: 'query' + name: 'cursor' + required: false + schema: + description: 'Opaque pagination cursor from the previous page''s `next_cursor`. Omit for the first page.' + example: 'djE6YmF0Y2hfYWJjMTIzOjEwMjQ' + maxLength: 128 + minLength: 1 + type: 'string' responses: '200': content: application/json: schema: - $ref: '#/components/schemas/BatchObject' - description: 'The current batch job status.' + $ref: '#/components/schemas/BatchResultsPageResponse' + description: 'A page of normalized batch result items.' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid batch results query.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'Malformed or unsupported batch results query parameters or cursor.' '401': content: application/json: @@ -43000,6 +43276,16 @@ paths: schema: $ref: '#/components/schemas/BatchErrorResponse' description: 'No batch exists for the given id.' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Batch results are not ready yet. Wait for the batch to finish and try again.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'The batch has not finished finalizing its results yet.' '410': content: application/json: @@ -43010,6 +43296,16 @@ paths: schema: $ref: '#/components/schemas/BatchErrorResponse' description: 'The batch results were deleted after the 30-day retention window.' + '413': + content: + application/json: + example: + error: + code: 413 + message: 'Batch result row exceeds the maximum readable page size. Read the batch via GET /api/v1/batches/{id} for inline batches, or read output.uri from GET /api/v1/batches/{id} for caller-owned input batches.' + schema: + $ref: '#/components/schemas/BatchErrorResponse' + description: 'A single result row exceeds the maximum page payload size; lowering `limit` does not resolve this.' '429': content: application/json: @@ -43039,10 +43335,20 @@ paths: message: 'Upstream batch-api is unavailable.' schema: $ref: '#/components/schemas/BatchErrorResponse' - description: 'The batch service is unavailable, or an upstream provider operation failed, including batch or file cleanup.' - summary: 'Get a batch' + description: 'The batch service is unavailable, or an upstream provider operation failed.' + summary: 'Get batch results' tags: - 'Batch' + x-speakeasy-name-override: 'getResults' + x-speakeasy-pagination: + inputs: + - in: 'parameters' + name: 'cursor' + type: 'cursor' + outputs: + nextCursor: '$.next_cursor' + results: '$.data' + type: 'cursor' parameters: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" @@ -52022,6 +52328,16 @@ paths: example: '0df9e665-d932-5740-b2c7-b52af166bc11' format: 'uuid' type: 'string' + - description: 'Only return API keys created by this user ID (the `creator_user_id` on each key). Requires a management key that can view key creators.' + in: 'query' + name: 'creator_user_id' + required: false + schema: + description: 'Only return API keys created by this user ID (the `creator_user_id` on each key). Requires a management key that can view key creators.' + example: 'user_2dHFtVWx2n56w6HkM0000000000' + maxLength: 255 + minLength: 1 + type: 'string' responses: '200': content: @@ -52317,7 +52633,7 @@ paths: summary: 'List API keys' tags: - 'API Keys' - x-speakeasy-max-method-params: 5 + x-speakeasy-max-method-params: 6 x-speakeasy-name-override: 'list' x-speakeasy-pagination: inputs: @@ -63011,27 +63327,48 @@ paths: application/json: example: data: - - allowed_passthrough_parameters: [] - canonical_slug: 'google/veo-3.1' - created: 1700000000 + - allowed_passthrough_parameters: + - 'personGeneration' + - 'aspectRatio' + - 'negativePrompt' + - 'conditioningScale' + - 'enhancePrompt' + canonical_slug: 'google/veo-3.1-20260320' + created: 1774277148 + creativity: null description: 'Google video generation model' generate_audio: true + hugging_face_id: null id: 'google/veo-3.1' - name: 'Veo 3.1' + name: 'Google: Veo 3.1' pricing_skus: - generate: '0.50' - seed: null + duration_seconds_with_audio: '0.40' + duration_seconds_with_audio_4k: '0.60' + duration_seconds_without_audio: '0.20' + duration_seconds_without_audio_4k: '0.40' + seed: true supported_aspect_ratios: - '16:9' + - '9:16' supported_durations: - - 5 + - 4 + - 6 - 8 supported_frame_images: - 'first_frame' - 'last_frame' supported_resolutions: - '720p' - supported_sizes: null + - '1080p' + - '4K' + supported_sizes: + - '1280x720' + - '1080x1920' + - '1920x1080' + - '720x1280' + - '3840x2160' + - '2160x3840' + upscale_factor: null schema: $ref: '#/components/schemas/VideoModelsListResponse' description: 'Returns a list of video generation models' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 78807cf2b..293bd9752 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.803.2 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:0ffb38c715c97b308afbdc76670c0a3e53c8558b7eecefb1682998a30b46d4f0 - sourceBlobDigest: sha256:4f19dac2c49b3f8a6c219dd305e8c1d6a0d995b7ee4b9b48b00c9d61b7e6e36a + sourceRevisionDigest: sha256:7969cc34c0838eab9463be5d4e81c64866732b3cbc8f144c5bab6542835236c7 + sourceBlobDigest: sha256:090f7d8f36fef54c65c562e285818219e14a1f2c368c1073e7f75c8c39501be1 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:0ffb38c715c97b308afbdc76670c0a3e53c8558b7eecefb1682998a30b46d4f0 - sourceBlobDigest: sha256:4f19dac2c49b3f8a6c219dd305e8c1d6a0d995b7ee4b9b48b00c9d61b7e6e36a + sourceRevisionDigest: sha256:7969cc34c0838eab9463be5d4e81c64866732b3cbc8f144c5bab6542835236c7 + sourceBlobDigest: sha256:090f7d8f36fef54c65c562e285818219e14a1f2c368c1073e7f75c8c39501be1 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:3433ed086fb16115dc0641cd720be47758f4a10056094a920587f7c552876a13 + codeSamplesRevisionDigest: sha256:620974df16d7bca2b429f6d77670ae3de55fa55cc9de4687e0b25bff380cb3f3 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index e0699c78a..1bfab0a0a 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4879,4 +4879,14 @@ Based on: ### Generated - [python v1.3.211] . ### Releases -- [PyPI v1.3.211] https://pypi.org/project/openrouter/1.3.211 - . \ No newline at end of file +- [PyPI v1.3.211] https://pypi.org/project/openrouter/1.3.211 - . + +## 2026-11-27 19:44:22 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.212] . +### Releases +- [PyPI v1.3.212] https://pypi.org/project/openrouter/1.3.212 - . \ No newline at end of file diff --git a/docs/components/annotation.mdx b/docs/components/annotation.mdx deleted file mode 100644 index a91fc0f17..000000000 --- a/docs/components/annotation.mdx +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: "Annotation" ---- - -## Supported Types - -### `components.AnnotationFile` - -```python -value: components.AnnotationFile = /* values here */ -``` - -### `components.AnnotationURLCitation` - -```python -value: components.AnnotationURLCitation = /* values here */ -``` - -### `components.AnnotationWebSearchCitation` - -```python -value: components.AnnotationWebSearchCitation = /* values here */ -``` - diff --git a/docs/components/annotationfile.mdx b/docs/components/annotationfile.mdx deleted file mode 100644 index 1e596bf7d..000000000 --- a/docs/components/annotationfile.mdx +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: "AnnotationFile" ---- - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `file` | [components.BatchObjectFile](../components/batchobjectfile.mdx) | ✔️ | N/A | -| `type` | [components.AnnotationTypeFile](../components/annotationtypefile.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/annotationtypefile.mdx b/docs/components/annotationtypefile.mdx deleted file mode 100644 index 8f6888ad8..000000000 --- a/docs/components/annotationtypefile.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "AnnotationTypeFile" ---- - -## Example Usage - -```python -from openrouter.components import AnnotationTypeFile -value: AnnotationTypeFile = "file" -``` - - -## Values - -- `"file"` diff --git a/docs/components/annotationtypeurlcitation.mdx b/docs/components/annotationtypeurlcitation.mdx deleted file mode 100644 index a859249f5..000000000 --- a/docs/components/annotationtypeurlcitation.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "AnnotationTypeURLCitation" ---- - -## Example Usage - -```python -from openrouter.components import AnnotationTypeURLCitation -value: AnnotationTypeURLCitation = "url_citation" -``` - - -## Values - -- `"url_citation"` diff --git a/docs/components/annotationurlcitation.mdx b/docs/components/annotationurlcitation.mdx deleted file mode 100644 index 96b88247d..000000000 --- a/docs/components/annotationurlcitation.mdx +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: "AnnotationURLCitation" ---- - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `type` | [components.AnnotationTypeURLCitation](../components/annotationtypeurlcitation.mdx) | ✔️ | N/A | -| `url_citation` | [components.BatchObjectURLCitation](../components/batchobjecturlcitation.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/annotationwebsearchcitation.mdx b/docs/components/annotationwebsearchcitation.mdx deleted file mode 100644 index d0e61b435..000000000 --- a/docs/components/annotationwebsearchcitation.mdx +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: "AnnotationWebSearchCitation" ---- - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `type` | [components.TypeWebSearchCitation](../components/typewebsearchcitation.mdx) | ✔️ | N/A | -| `web_search_citation` | [components.WebSearchCitation](../components/websearchcitation.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/audiopcm1.mdx b/docs/components/audiopcm1.mdx index 5470626a5..ea96fc8b8 100644 --- a/docs/components/audiopcm1.mdx +++ b/docs/components/audiopcm1.mdx @@ -9,5 +9,5 @@ title: "AudioPcm1" | `bits_per_sample` | *float* | ✔️ | N/A | | `channels` | *int* | ✔️ | N/A | | `data` | *str* | ✔️ | Base64-encoded PCM16 audio in the format the sibling fields give. | -| `format_` | [components.BatchObjectFormat1](../components/batchobjectformat1.mdx) | ✔️ | N/A | +| `format_` | [components.BatchResultFormat1](../components/batchresultformat1.mdx) | ✔️ | N/A | | `sample_rate` | *int* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/audiopcm2.mdx b/docs/components/audiopcm2.mdx index 5fdefb646..099254b94 100644 --- a/docs/components/audiopcm2.mdx +++ b/docs/components/audiopcm2.mdx @@ -9,6 +9,6 @@ title: "AudioPcm2" | `bits_per_sample` | *float* | ✔️ | N/A | | `byte_length` | *int* | ✔️ | N/A | | `channels` | *int* | ✔️ | N/A | -| `format_` | [components.BatchObjectFormat2](../components/batchobjectformat2.mdx) | ✔️ | N/A | +| `format_` | [components.BatchResultFormat2](../components/batchresultformat2.mdx) | ✔️ | N/A | | `sample_rate` | *int* | ✔️ | N/A | | `sha256` | *str* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/batchobject.mdx b/docs/components/batchobject.mdx index 415e6269c..af764ef6d 100644 --- a/docs/components/batchobject.mdx +++ b/docs/components/batchobject.mdx @@ -14,10 +14,10 @@ title: "BatchObject" | `finalized_at` | *Nullable[int]* | ✔️ | N/A | | `id` | *str* | ✔️ | N/A | | `model` | *str* | ✔️ | N/A | -| `object` | [components.BatchObjectObjectBatch](../components/batchobjectobjectbatch.mdx) | ✔️ | N/A | +| `object` | [components.BatchObjectObject](../components/batchobjectobject.mdx) | ✔️ | N/A | | `output` | [Optional[components.BatchOutputReference]](../components/batchoutputreference.mdx) | ➖ | The output location of a batch submitted with `input`, whose `results` are `null`. Returned only by `GET /batches/{id}`, once the batch has ended and the provider reported an output folder or table. Batch lists and responses for a batch with an unpaid charge leave it out. | | `provider` | *Nullable[str]* | ✔️ | Provider OpenRouter assigned to run the batch, using the same name as the `provider` field of sync responses. | | `request_counts` | [components.BatchObjectRequestCounts](../components/batchobjectrequestcounts.mdx) | ✔️ | N/A | -| `results` | List[[components.Result](../components/result.mdx)] | ✔️ | N/A | +| `results` | List[[components.BatchResult](../components/batchresult.mdx)] | ✔️ | N/A | | `status` | [components.BatchObjectStatus](../components/batchobjectstatus.mdx) | ✔️ | N/A | | `usage` | [Nullable[components.BatchObjectUsage]](../components/batchobjectusage.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/batchobjectfile.mdx b/docs/components/batchobjectfile.mdx deleted file mode 100644 index 14f045ed9..000000000 --- a/docs/components/batchobjectfile.mdx +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "BatchObjectFile" ---- - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `content` | List[[components.AnnotationContentUnion](../components/annotationcontentunion.mdx)] | ✔️ | N/A | -| `hash` | *str* | ✔️ | N/A | -| `name` | *Optional[str]* | ➖ | N/A | \ No newline at end of file diff --git a/docs/components/batchobjectformat1.mdx b/docs/components/batchobjectformat1.mdx deleted file mode 100644 index 33d785a91..000000000 --- a/docs/components/batchobjectformat1.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "BatchObjectFormat1" ---- - -## Example Usage - -```python -from openrouter.components import BatchObjectFormat1 -value: BatchObjectFormat1 = "pcm" -``` - - -## Values - -- `"pcm"` diff --git a/docs/components/batchobjectformat2.mdx b/docs/components/batchobjectformat2.mdx deleted file mode 100644 index f84e3bf1e..000000000 --- a/docs/components/batchobjectformat2.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "BatchObjectFormat2" ---- - -## Example Usage - -```python -from openrouter.components import BatchObjectFormat2 -value: BatchObjectFormat2 = "pcm" -``` - - -## Values - -- `"pcm"` diff --git a/docs/components/batchobjectobject.mdx b/docs/components/batchobjectobject.mdx new file mode 100644 index 000000000..3d2ff3559 --- /dev/null +++ b/docs/components/batchobjectobject.mdx @@ -0,0 +1,15 @@ +--- +title: "BatchObjectObject" +--- + +## Example Usage + +```python +from openrouter.components import BatchObjectObject +value: BatchObjectObject = "batch" +``` + + +## Values + +- `"batch"` diff --git a/docs/components/batchobjectobjectbatch.mdx b/docs/components/batchobjectobjectbatch.mdx deleted file mode 100644 index 0f98fc843..000000000 --- a/docs/components/batchobjectobjectbatch.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "BatchObjectObjectBatch" ---- - -## Example Usage - -```python -from openrouter.components import BatchObjectObjectBatch -value: BatchObjectObjectBatch = "batch" -``` - - -## Values - -- `"batch"` diff --git a/docs/components/batchobjectrole.mdx b/docs/components/batchobjectrole.mdx deleted file mode 100644 index 012b7107a..000000000 --- a/docs/components/batchobjectrole.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "BatchObjectRole" ---- - -## Example Usage - -```python -from openrouter.components import BatchObjectRole -value: BatchObjectRole = "assistant" -``` - - -## Values - -- `"assistant"` diff --git a/docs/components/batchobjecttypemessage.mdx b/docs/components/batchobjecttypemessage.mdx deleted file mode 100644 index 25bd6ec28..000000000 --- a/docs/components/batchobjecttypemessage.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "BatchObjectTypeMessage" ---- - -## Example Usage - -```python -from openrouter.components import BatchObjectTypeMessage -value: BatchObjectTypeMessage = "message" -``` - - -## Values - -- `"message"` diff --git a/docs/components/result.mdx b/docs/components/batchresult.mdx similarity index 86% rename from docs/components/result.mdx rename to docs/components/batchresult.mdx index 9b90dbabb..629ebcc0f 100644 --- a/docs/components/result.mdx +++ b/docs/components/batchresult.mdx @@ -1,5 +1,5 @@ --- -title: "Result" +title: "BatchResult" --- ## Fields @@ -7,6 +7,6 @@ title: "Result" | Field | Type | Required | Description | | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | | `custom_id` | *str* | ✔️ | N/A | -| `error` | [Nullable[components.ResultError]](../components/resulterror.mdx) | ✔️ | N/A | +| `error` | [Nullable[components.BatchResultError]](../components/batchresulterror.mdx) | ✔️ | N/A | | `id` | *str* | ✔️ | N/A | -| `response` | [Nullable[components.BatchObjectResponse]](../components/batchobjectresponse.mdx) | ✔️ | N/A | \ No newline at end of file +| `response` | [Nullable[components.BatchResultResponse]](../components/batchresultresponse.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/bodycompletiontokensdetails.mdx b/docs/components/batchresultcompletiontokensdetails.mdx similarity index 95% rename from docs/components/bodycompletiontokensdetails.mdx rename to docs/components/batchresultcompletiontokensdetails.mdx index 69b8630eb..771080772 100644 --- a/docs/components/bodycompletiontokensdetails.mdx +++ b/docs/components/batchresultcompletiontokensdetails.mdx @@ -1,5 +1,5 @@ --- -title: "BodyCompletionTokensDetails" +title: "BatchResultCompletionTokensDetails" --- ## Fields diff --git a/docs/components/logprobscontent.mdx b/docs/components/batchresultcontent.mdx similarity index 98% rename from docs/components/logprobscontent.mdx rename to docs/components/batchresultcontent.mdx index ca4d842db..544cc88dc 100644 --- a/docs/components/logprobscontent.mdx +++ b/docs/components/batchresultcontent.mdx @@ -1,5 +1,5 @@ --- -title: "LogprobsContent" +title: "BatchResultContent" --- ## Fields diff --git a/docs/components/batchobjectdata.mdx b/docs/components/batchresultdata.mdx similarity index 99% rename from docs/components/batchobjectdata.mdx rename to docs/components/batchresultdata.mdx index 53afc1a47..74bcce523 100644 --- a/docs/components/batchobjectdata.mdx +++ b/docs/components/batchresultdata.mdx @@ -1,5 +1,5 @@ --- -title: "BatchObjectData" +title: "BatchResultData" --- A single embedding object diff --git a/docs/components/batchobjectdebug.mdx b/docs/components/batchresultdebug.mdx similarity index 90% rename from docs/components/batchobjectdebug.mdx rename to docs/components/batchresultdebug.mdx index 8c26216a2..c726d2928 100644 --- a/docs/components/batchobjectdebug.mdx +++ b/docs/components/batchresultdebug.mdx @@ -1,5 +1,5 @@ --- -title: "BatchObjectDebug" +title: "BatchResultDebug" --- ## Fields @@ -7,5 +7,5 @@ title: "BatchObjectDebug" | Field | Type | Required | Description | | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | | `echo_upstream_body` | Dict[str, *Any*] | ➖ | N/A | -| `timings` | [Optional[components.BatchObjectTimings]](../components/batchobjecttimings.mdx) | ➖ | N/A | +| `timings` | [Optional[components.BatchResultTimings]](../components/batchresulttimings.mdx) | ➖ | N/A | | `__pydantic_extra__` | Dict[str, *Any*] | ➖ | N/A | \ No newline at end of file diff --git a/docs/components/resulterror.mdx b/docs/components/batchresulterror.mdx similarity index 98% rename from docs/components/resulterror.mdx rename to docs/components/batchresulterror.mdx index 4745590bf..2fb9119e2 100644 --- a/docs/components/resulterror.mdx +++ b/docs/components/batchresulterror.mdx @@ -1,5 +1,5 @@ --- -title: "ResultError" +title: "BatchResultError" --- ## Fields diff --git a/docs/components/batchobjectevent.mdx b/docs/components/batchresultevent.mdx similarity index 71% rename from docs/components/batchobjectevent.mdx rename to docs/components/batchresultevent.mdx index fd15fa879..e09435942 100644 --- a/docs/components/batchobjectevent.mdx +++ b/docs/components/batchresultevent.mdx @@ -1,14 +1,14 @@ --- -title: "BatchObjectEvent" +title: "BatchResultEvent" --- ## Example Usage ```python -from openrouter.components import BatchObjectEvent +from openrouter.components import BatchResultEvent # Open enum: unrecognized values are captured as UnrecognizedStr -value: BatchObjectEvent = "adapter_request" +value: BatchResultEvent = "adapter_request" ``` diff --git a/docs/components/batchresultformat1.mdx b/docs/components/batchresultformat1.mdx new file mode 100644 index 000000000..960ece304 --- /dev/null +++ b/docs/components/batchresultformat1.mdx @@ -0,0 +1,15 @@ +--- +title: "BatchResultFormat1" +--- + +## Example Usage + +```python +from openrouter.components import BatchResultFormat1 +value: BatchResultFormat1 = "pcm" +``` + + +## Values + +- `"pcm"` diff --git a/docs/components/batchresultformat2.mdx b/docs/components/batchresultformat2.mdx new file mode 100644 index 000000000..56be3375f --- /dev/null +++ b/docs/components/batchresultformat2.mdx @@ -0,0 +1,15 @@ +--- +title: "BatchResultFormat2" +--- + +## Example Usage + +```python +from openrouter.components import BatchResultFormat2 +value: BatchResultFormat2 = "pcm" +``` + + +## Values + +- `"pcm"` diff --git a/docs/components/batchobjectfunction.mdx b/docs/components/batchresultfunction.mdx similarity index 92% rename from docs/components/batchobjectfunction.mdx rename to docs/components/batchresultfunction.mdx index 5dac7a006..3f02010cc 100644 --- a/docs/components/batchobjectfunction.mdx +++ b/docs/components/batchresultfunction.mdx @@ -1,5 +1,5 @@ --- -title: "BatchObjectFunction" +title: "BatchResultFunction" --- ## Fields diff --git a/docs/components/batchobjectimageurl.mdx b/docs/components/batchresultimageurl.mdx similarity index 90% rename from docs/components/batchobjectimageurl.mdx rename to docs/components/batchresultimageurl.mdx index d59fe1963..402b5a423 100644 --- a/docs/components/batchobjectimageurl.mdx +++ b/docs/components/batchresultimageurl.mdx @@ -1,5 +1,5 @@ --- -title: "BatchObjectImageURL" +title: "BatchResultImageURL" --- ## Fields diff --git a/docs/components/batchresultobjectchatcompletion.mdx b/docs/components/batchresultobjectchatcompletion.mdx new file mode 100644 index 000000000..db1289acf --- /dev/null +++ b/docs/components/batchresultobjectchatcompletion.mdx @@ -0,0 +1,15 @@ +--- +title: "BatchResultObjectChatCompletion" +--- + +## Example Usage + +```python +from openrouter.components import BatchResultObjectChatCompletion +value: BatchResultObjectChatCompletion = "chat.completion" +``` + + +## Values + +- `"chat.completion"` diff --git a/docs/components/batchresultobjectlist.mdx b/docs/components/batchresultobjectlist.mdx new file mode 100644 index 000000000..51ccaa828 --- /dev/null +++ b/docs/components/batchresultobjectlist.mdx @@ -0,0 +1,15 @@ +--- +title: "BatchResultObjectList" +--- + +## Example Usage + +```python +from openrouter.components import BatchResultObjectList +value: BatchResultObjectList = "list" +``` + + +## Values + +- `"list"` diff --git a/docs/components/bodyprompttokensdetails1.mdx b/docs/components/batchresultprompttokensdetails1.mdx similarity index 98% rename from docs/components/bodyprompttokensdetails1.mdx rename to docs/components/batchresultprompttokensdetails1.mdx index 1de48e3da..da0bbe62d 100644 --- a/docs/components/bodyprompttokensdetails1.mdx +++ b/docs/components/batchresultprompttokensdetails1.mdx @@ -1,5 +1,5 @@ --- -title: "BodyPromptTokensDetails1" +title: "BatchResultPromptTokensDetails1" --- Breakdown of tokens used in the prompt. diff --git a/docs/components/bodyprompttokensdetails2.mdx b/docs/components/batchresultprompttokensdetails2.mdx similarity index 97% rename from docs/components/bodyprompttokensdetails2.mdx rename to docs/components/batchresultprompttokensdetails2.mdx index 2f6072187..0de095447 100644 --- a/docs/components/bodyprompttokensdetails2.mdx +++ b/docs/components/batchresultprompttokensdetails2.mdx @@ -1,5 +1,5 @@ --- -title: "BodyPromptTokensDetails2" +title: "BatchResultPromptTokensDetails2" --- Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included. diff --git a/docs/components/batchobjectresponse.mdx b/docs/components/batchresultresponse.mdx similarity index 96% rename from docs/components/batchobjectresponse.mdx rename to docs/components/batchresultresponse.mdx index 43a6dadc2..90d691723 100644 --- a/docs/components/batchobjectresponse.mdx +++ b/docs/components/batchresultresponse.mdx @@ -1,5 +1,5 @@ --- -title: "BatchObjectResponse" +title: "BatchResultResponse" --- ## Fields diff --git a/docs/components/batchresultrole.mdx b/docs/components/batchresultrole.mdx new file mode 100644 index 000000000..2a06ca44a --- /dev/null +++ b/docs/components/batchresultrole.mdx @@ -0,0 +1,15 @@ +--- +title: "BatchResultRole" +--- + +## Example Usage + +```python +from openrouter.components import BatchResultRole +value: BatchResultRole = "assistant" +``` + + +## Values + +- `"assistant"` diff --git a/docs/components/bodyservertooluse.mdx b/docs/components/batchresultservertooluse.mdx similarity index 99% rename from docs/components/bodyservertooluse.mdx rename to docs/components/batchresultservertooluse.mdx index 39af647bf..60f61cc23 100644 --- a/docs/components/bodyservertooluse.mdx +++ b/docs/components/batchresultservertooluse.mdx @@ -1,5 +1,5 @@ --- -title: "BodyServerToolUse" +title: "BatchResultServerToolUse" --- Usage for server-side tool execution (e.g., web search) diff --git a/docs/components/batchobjectservertoolusedetails.mdx b/docs/components/batchresultservertoolusedetails.mdx similarity index 99% rename from docs/components/batchobjectservertoolusedetails.mdx rename to docs/components/batchresultservertoolusedetails.mdx index 42c5a669f..665755f82 100644 --- a/docs/components/batchobjectservertoolusedetails.mdx +++ b/docs/components/batchresultservertoolusedetails.mdx @@ -1,5 +1,5 @@ --- -title: "BatchObjectServerToolUseDetails" +title: "BatchResultServerToolUseDetails" --- Usage for server-side tool execution (e.g., web search) diff --git a/docs/components/batchresultspageresponse.mdx b/docs/components/batchresultspageresponse.mdx new file mode 100644 index 000000000..8f4af362e --- /dev/null +++ b/docs/components/batchresultspageresponse.mdx @@ -0,0 +1,15 @@ +--- +title: "BatchResultsPageResponse" +--- + +A cursor-paginated page of normalized batch result rows. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `data` | List[[components.BatchResult](../components/batchresult.mdx)] | ✔️ | N/A | +| `has_more` | *bool* | ✔️ | N/A | +| `next_cursor` | *Nullable[str]* | ✔️ | N/A | +| `object` | [components.BatchResultsPageResponseObject](../components/batchresultspageresponseobject.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/batchresultspageresponseobject.mdx b/docs/components/batchresultspageresponseobject.mdx new file mode 100644 index 000000000..166800a9f --- /dev/null +++ b/docs/components/batchresultspageresponseobject.mdx @@ -0,0 +1,15 @@ +--- +title: "BatchResultsPageResponseObject" +--- + +## Example Usage + +```python +from openrouter.components import BatchResultsPageResponseObject +value: BatchResultsPageResponseObject = "list" +``` + + +## Values + +- `"list"` diff --git a/docs/components/batchobjecttimings.mdx b/docs/components/batchresulttimings.mdx similarity index 93% rename from docs/components/batchobjecttimings.mdx rename to docs/components/batchresulttimings.mdx index b96298280..3edd36095 100644 --- a/docs/components/batchobjecttimings.mdx +++ b/docs/components/batchresulttimings.mdx @@ -1,5 +1,5 @@ --- -title: "BatchObjectTimings" +title: "BatchResultTimings" --- ## Fields @@ -7,5 +7,5 @@ title: "BatchObjectTimings" | Field | Type | Required | Description | | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | | `epoch_ms` | *int* | ✔️ | N/A | -| `event` | [components.BatchObjectEvent](../components/batchobjectevent.mdx) | ✔️ | N/A | +| `event` | [components.BatchResultEvent](../components/batchresultevent.mdx) | ✔️ | N/A | | `start_ms` | *int* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/batchresulttypemessage.mdx b/docs/components/batchresulttypemessage.mdx new file mode 100644 index 000000000..2ec7d8a0f --- /dev/null +++ b/docs/components/batchresulttypemessage.mdx @@ -0,0 +1,15 @@ +--- +title: "BatchResultTypeMessage" +--- + +## Example Usage + +```python +from openrouter.components import BatchResultTypeMessage +value: BatchResultTypeMessage = "message" +``` + + +## Values + +- `"message"` diff --git a/docs/components/batchresultusage1.mdx b/docs/components/batchresultusage1.mdx new file mode 100644 index 000000000..ccc4b1eae --- /dev/null +++ b/docs/components/batchresultusage1.mdx @@ -0,0 +1,15 @@ +--- +title: "BatchResultUsage1" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `completion_tokens` | *int* | ✔️ | The tokens generated | +| `completion_tokens_details` | [OptionalNullable[components.BatchResultCompletionTokensDetails]](../components/batchresultcompletiontokensdetails.mdx) | ➖ | N/A | +| `prompt_tokens` | *int* | ✔️ | Including images, input audio, and tools if any | +| `prompt_tokens_details` | [OptionalNullable[components.BatchResultPromptTokensDetails1]](../components/batchresultprompttokensdetails1.mdx) | ➖ | Breakdown of tokens used in the prompt. | +| `server_tool_use` | [OptionalNullable[components.BatchResultServerToolUse]](../components/batchresultservertooluse.mdx) | ➖ | Usage for server-side tool execution (e.g., web search) | +| `server_tool_use_details` | [OptionalNullable[components.BatchResultServerToolUseDetails]](../components/batchresultservertoolusedetails.mdx) | ➖ | Usage for server-side tool execution (e.g., web search) | +| `total_tokens` | *int* | ✔️ | Sum of the above two fields | \ No newline at end of file diff --git a/docs/components/bodyusage2.mdx b/docs/components/batchresultusage2.mdx similarity index 99% rename from docs/components/bodyusage2.mdx rename to docs/components/batchresultusage2.mdx index 09aafefda..4057d2aba 100644 --- a/docs/components/bodyusage2.mdx +++ b/docs/components/batchresultusage2.mdx @@ -1,5 +1,5 @@ --- -title: "BodyUsage2" +title: "BatchResultUsage2" --- ## Fields diff --git a/docs/components/bodyusage3.mdx b/docs/components/batchresultusage3.mdx similarity index 98% rename from docs/components/bodyusage3.mdx rename to docs/components/batchresultusage3.mdx index b7d2e1b79..42f0b9e3e 100644 --- a/docs/components/bodyusage3.mdx +++ b/docs/components/batchresultusage3.mdx @@ -1,5 +1,5 @@ --- -title: "BodyUsage3" +title: "BatchResultUsage3" --- Token usage statistics @@ -13,5 +13,5 @@ Token usage statistics | `cost_details` | [OptionalNullable[components.CostDetails]](../components/costdetails.mdx) | ➖ | Breakdown of upstream inference costs | \{
"upstream_inference_completions_cost": 0.0004,
"upstream_inference_cost": null,
"upstream_inference_prompt_cost": 0.0008
} | | `is_byok` | *Optional[bool]* | ➖ | Whether a request was made using a Bring Your Own Key configuration | | | `prompt_tokens` | *int* | ✔️ | Number of tokens in the input | 8 | -| `prompt_tokens_details` | [Optional[components.BodyPromptTokensDetails2]](../components/bodyprompttokensdetails2.mdx) | ➖ | Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included. | | +| `prompt_tokens_details` | [Optional[components.BatchResultPromptTokensDetails2]](../components/batchresultprompttokensdetails2.mdx) | ➖ | Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included. | | | `total_tokens` | *int* | ✔️ | Total number of tokens used | 8 | \ No newline at end of file diff --git a/docs/components/bodyusage4.mdx b/docs/components/batchresultusage4.mdx similarity index 94% rename from docs/components/bodyusage4.mdx rename to docs/components/batchresultusage4.mdx index 425d64aef..575cae87e 100644 --- a/docs/components/bodyusage4.mdx +++ b/docs/components/batchresultusage4.mdx @@ -1,5 +1,5 @@ --- -title: "BodyUsage4" +title: "BatchResultUsage4" --- ## Fields diff --git a/docs/components/bodyaudiospeech.mdx b/docs/components/bodyaudiospeech.mdx index caa64aa90..963e4e491 100644 --- a/docs/components/bodyaudiospeech.mdx +++ b/docs/components/bodyaudiospeech.mdx @@ -9,4 +9,4 @@ title: "BodyAudioSpeech" | `audio` | [components.Audio](../components/audio.mdx) | ✔️ | N/A | | `model` | *str* | ✔️ | N/A | | `object` | [components.ObjectAudioSpeech](../components/objectaudiospeech.mdx) | ✔️ | N/A | -| `usage` | [components.BodyUsage4](../components/bodyusage4.mdx) | ✔️ | N/A | \ No newline at end of file +| `usage` | [components.BatchResultUsage4](../components/batchresultusage4.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/bodychatcompletion.mdx b/docs/components/bodychatcompletion.mdx index 0e970e2d6..f01a4d388 100644 --- a/docs/components/bodychatcompletion.mdx +++ b/docs/components/bodychatcompletion.mdx @@ -9,13 +9,13 @@ title: "BodyChatCompletion" | `alignment` | [Optional[components.Alignment]](../components/alignment.mdx) | ➖ | Beta. The result of the alignment plugin for this request; the shape may change. | \{
"calls": [
\{
"call": 1,
"outcome": "allowed",
"rules": [
\{
"applicable": true,
"broken": false,
"probability": 0.04
}
]
}
]
} | | `choices` | List[[components.Choice](../components/choice.mdx)] | ✔️ | N/A | | | `created` | *int* | ✔️ | N/A | | -| `debug` | [Optional[components.BatchObjectDebug]](../components/batchobjectdebug.mdx) | ➖ | N/A | | +| `debug` | [Optional[components.BatchResultDebug]](../components/batchresultdebug.mdx) | ➖ | N/A | | | `id` | *str* | ✔️ | N/A | | | `model` | *str* | ✔️ | N/A | | -| `object` | [components.BodyObjectChatCompletion](../components/bodyobjectchatcompletion.mdx) | ✔️ | N/A | | +| `object` | [components.BatchResultObjectChatCompletion](../components/batchresultobjectchatcompletion.mdx) | ✔️ | N/A | | | `openrouter_metadata` | [Optional[components.OpenRouterMetadata]](../components/openroutermetadata.mdx) | ➖ | N/A | \{
"attempt": 1,
"endpoints": \{
"available": [
\{
"model": "openai/gpt-4o",
"provider": "OpenAI",
"selected": true
}
],
"total": 1
},
"generation_time": 2016,
"is_byok": false,
"region": "iad",
"requested": "openai/gpt-4o",
"strategy": "direct",
"summary": "available=1, selected=OpenAI"
} | | `provider` | *OptionalNullable[str]* | ➖ | N/A | | | `safeguard_results` | List[[components.ArmorSafeguardResult](../components/armorsafeguardresult.mdx)] | ➖ | OpenRouter Armor's verdict for each client tool call of this response, present whenever Armor evaluated the response (even when nothing was flagged). Independent of the `openrouter_metadata` opt-in. | | | `service_tier` | *OptionalNullable[str]* | ➖ | N/A | | | `system_fingerprint` | *OptionalNullable[str]* | ➖ | N/A | | -| `usage` | [Optional[components.BodyUsage1]](../components/bodyusage1.mdx) | ➖ | N/A | | \ No newline at end of file +| `usage` | [Optional[components.BatchResultUsage1]](../components/batchresultusage1.mdx) | ➖ | N/A | | \ No newline at end of file diff --git a/docs/components/bodylist.mdx b/docs/components/bodylist.mdx index b1cc699b9..80b393326 100644 --- a/docs/components/bodylist.mdx +++ b/docs/components/bodylist.mdx @@ -9,8 +9,8 @@ Embeddings response containing embedding vectors | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -| `data` | List[[components.BatchObjectData](../components/batchobjectdata.mdx)] | ✔️ | List of embedding objects | [
\{
"embedding": [
0.0023064255,
-0.009327292,
0.015797347
],
"index": 0,
"object": "embedding"
}
] | +| `data` | List[[components.BatchResultData](../components/batchresultdata.mdx)] | ✔️ | List of embedding objects | [
\{
"embedding": [
0.0023064255,
-0.009327292,
0.015797347
],
"index": 0,
"object": "embedding"
}
] | | `id` | *Optional[str]* | ➖ | Unique identifier for the embeddings response | embd-1234567890 | | `model` | *str* | ✔️ | The model used for embeddings | openai/text-embedding-3-small | -| `object` | [components.BodyObjectList](../components/bodyobjectlist.mdx) | ✔️ | N/A | | -| `usage` | [Optional[components.BodyUsage3]](../components/bodyusage3.mdx) | ➖ | Token usage statistics | \{
"prompt_tokens": 8,
"total_tokens": 8
} | \ No newline at end of file +| `object` | [components.BatchResultObjectList](../components/batchresultobjectlist.mdx) | ✔️ | N/A | | +| `usage` | [Optional[components.BatchResultUsage3]](../components/batchresultusage3.mdx) | ➖ | Token usage statistics | \{
"prompt_tokens": 8,
"total_tokens": 8
} | \ No newline at end of file diff --git a/docs/components/bodymessage.mdx b/docs/components/bodymessage.mdx index 4cdba566c..5b8a2b547 100644 --- a/docs/components/bodymessage.mdx +++ b/docs/components/bodymessage.mdx @@ -11,9 +11,9 @@ title: "BodyMessage" | `id` | *str* | ✔️ | N/A | | | `input_transformations` | List[[components.AnthropicInputTransformation](../components/anthropicinputtransformation.mdx)] | ➖ | N/A | | | `model` | *str* | ✔️ | N/A | | -| `role` | [components.BatchObjectRole](../components/batchobjectrole.mdx) | ✔️ | N/A | | +| `role` | [components.BatchResultRole](../components/batchresultrole.mdx) | ✔️ | N/A | | | `stop_details` | [Nullable[components.AnthropicRefusalStopDetails]](../components/anthropicrefusalstopdetails.mdx) | ✔️ | Structured information about a refusal | \{
"category": "cyber",
"explanation": "The request was refused due to policy.",
"type": "refusal"
} | | `stop_reason` | [Nullable[components.ORAnthropicStopReason]](../components/oranthropicstopreason.mdx) | ✔️ | N/A | end_turn | | `stop_sequence` | *Nullable[str]* | ✔️ | N/A | | -| `type` | [components.BatchObjectTypeMessage](../components/batchobjecttypemessage.mdx) | ✔️ | N/A | | -| `usage` | [components.BodyUsage2](../components/bodyusage2.mdx) | ✔️ | N/A | \{
"cache_creation": null,
"cache_creation_input_tokens": null,
"cache_read_input_tokens": null,
"inference_geo": null,
"input_tokens": 100,
"output_tokens": 50,
"output_tokens_details": null,
"server_tool_use": null,
"service_tier": "standard"
} | \ No newline at end of file +| `type` | [components.BatchResultTypeMessage](../components/batchresulttypemessage.mdx) | ✔️ | N/A | | +| `usage` | [components.BatchResultUsage2](../components/batchresultusage2.mdx) | ✔️ | N/A | \{
"cache_creation": null,
"cache_creation_input_tokens": null,
"cache_read_input_tokens": null,
"inference_geo": null,
"input_tokens": 100,
"output_tokens": 50,
"output_tokens_details": null,
"server_tool_use": null,
"service_tier": "standard"
} | \ No newline at end of file diff --git a/docs/components/bodyobjectchatcompletion.mdx b/docs/components/bodyobjectchatcompletion.mdx deleted file mode 100644 index f16cab8d7..000000000 --- a/docs/components/bodyobjectchatcompletion.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "BodyObjectChatCompletion" ---- - -## Example Usage - -```python -from openrouter.components import BodyObjectChatCompletion -value: BodyObjectChatCompletion = "chat.completion" -``` - - -## Values - -- `"chat.completion"` diff --git a/docs/components/bodyobjectlist.mdx b/docs/components/bodyobjectlist.mdx deleted file mode 100644 index c9a4024fb..000000000 --- a/docs/components/bodyobjectlist.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "BodyObjectList" ---- - -## Example Usage - -```python -from openrouter.components import BodyObjectList -value: BodyObjectList = "list" -``` - - -## Values - -- `"list"` diff --git a/docs/components/bodyusage1.mdx b/docs/components/bodyusage1.mdx deleted file mode 100644 index 9684aa756..000000000 --- a/docs/components/bodyusage1.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "BodyUsage1" ---- - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -| `completion_tokens` | *int* | ✔️ | The tokens generated | -| `completion_tokens_details` | [OptionalNullable[components.BodyCompletionTokensDetails]](../components/bodycompletiontokensdetails.mdx) | ➖ | N/A | -| `prompt_tokens` | *int* | ✔️ | Including images, input audio, and tools if any | -| `prompt_tokens_details` | [OptionalNullable[components.BodyPromptTokensDetails1]](../components/bodyprompttokensdetails1.mdx) | ➖ | Breakdown of tokens used in the prompt. | -| `server_tool_use` | [OptionalNullable[components.BodyServerToolUse]](../components/bodyservertooluse.mdx) | ➖ | Usage for server-side tool execution (e.g., web search) | -| `server_tool_use_details` | [OptionalNullable[components.BatchObjectServerToolUseDetails]](../components/batchobjectservertoolusedetails.mdx) | ➖ | Usage for server-side tool execution (e.g., web search) | -| `total_tokens` | *int* | ✔️ | Sum of the above two fields | \ No newline at end of file diff --git a/docs/components/chatannotation.mdx b/docs/components/chatannotation.mdx new file mode 100644 index 000000000..2004dbca5 --- /dev/null +++ b/docs/components/chatannotation.mdx @@ -0,0 +1,27 @@ +--- +title: "ChatAnnotation" +--- + +Citation or file annotation on an assistant message + + +## Supported Types + +### `components.ChatFileAnnotation` + +```python +value: components.ChatFileAnnotation = /* values here */ +``` + +### `components.ChatURLCitationAnnotation` + +```python +value: components.ChatURLCitationAnnotation = /* values here */ +``` + +### `components.ChatWebSearchCitationAnnotation` + +```python +value: components.ChatWebSearchCitationAnnotation = /* values here */ +``` + diff --git a/docs/components/chatfileannotation.mdx b/docs/components/chatfileannotation.mdx new file mode 100644 index 000000000..beecaf460 --- /dev/null +++ b/docs/components/chatfileannotation.mdx @@ -0,0 +1,13 @@ +--- +title: "ChatFileAnnotation" +--- + +File annotation with the parsed file content + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `file` | [components.ChatFileAnnotationFile](../components/chatfileannotationfile.mdx) | ✔️ | N/A | +| `type` | [components.ChatFileAnnotationTypeFile](../components/chatfileannotationtypefile.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/annotationcontentunion.mdx b/docs/components/chatfileannotationcontentunion.mdx similarity index 85% rename from docs/components/annotationcontentunion.mdx rename to docs/components/chatfileannotationcontentunion.mdx index 9c590a1b3..b2c71e29c 100644 --- a/docs/components/annotationcontentunion.mdx +++ b/docs/components/chatfileannotationcontentunion.mdx @@ -1,5 +1,5 @@ --- -title: "AnnotationContentUnion" +title: "ChatFileAnnotationContentUnion" --- ## Supported Types diff --git a/docs/components/chatfileannotationfile.mdx b/docs/components/chatfileannotationfile.mdx new file mode 100644 index 000000000..37a7b81f3 --- /dev/null +++ b/docs/components/chatfileannotationfile.mdx @@ -0,0 +1,11 @@ +--- +title: "ChatFileAnnotationFile" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `content` | List[[components.ChatFileAnnotationContentUnion](../components/chatfileannotationcontentunion.mdx)] | ✔️ | N/A | +| `hash` | *str* | ✔️ | N/A | +| `name` | *Optional[str]* | ➖ | N/A | \ No newline at end of file diff --git a/docs/components/contentimageurlimageurl.mdx b/docs/components/chatfileannotationimageurl.mdx similarity index 88% rename from docs/components/contentimageurlimageurl.mdx rename to docs/components/chatfileannotationimageurl.mdx index 264d4dcf7..849c659cc 100644 --- a/docs/components/contentimageurlimageurl.mdx +++ b/docs/components/chatfileannotationimageurl.mdx @@ -1,5 +1,5 @@ --- -title: "ContentImageURLImageURL" +title: "ChatFileAnnotationImageURL" --- ## Fields diff --git a/docs/components/chatfileannotationtypefile.mdx b/docs/components/chatfileannotationtypefile.mdx new file mode 100644 index 000000000..dac75538a --- /dev/null +++ b/docs/components/chatfileannotationtypefile.mdx @@ -0,0 +1,15 @@ +--- +title: "ChatFileAnnotationTypeFile" +--- + +## Example Usage + +```python +from openrouter.components import ChatFileAnnotationTypeFile +value: ChatFileAnnotationTypeFile = "file" +``` + + +## Values + +- `"file"` diff --git a/docs/components/chaturlcitationannotation.mdx b/docs/components/chaturlcitationannotation.mdx new file mode 100644 index 000000000..72cac05a3 --- /dev/null +++ b/docs/components/chaturlcitationannotation.mdx @@ -0,0 +1,13 @@ +--- +title: "ChatURLCitationAnnotation" +--- + +URL citation annotation + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `type` | [components.ChatURLCitationAnnotationType](../components/chaturlcitationannotationtype.mdx) | ✔️ | N/A | +| `url_citation` | [components.ChatURLCitationAnnotationURLCitation](../components/chaturlcitationannotationurlcitation.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/chaturlcitationannotationtype.mdx b/docs/components/chaturlcitationannotationtype.mdx new file mode 100644 index 000000000..ee857f900 --- /dev/null +++ b/docs/components/chaturlcitationannotationtype.mdx @@ -0,0 +1,15 @@ +--- +title: "ChatURLCitationAnnotationType" +--- + +## Example Usage + +```python +from openrouter.components import ChatURLCitationAnnotationType +value: ChatURLCitationAnnotationType = "url_citation" +``` + + +## Values + +- `"url_citation"` diff --git a/docs/components/batchobjecturlcitation.mdx b/docs/components/chaturlcitationannotationurlcitation.mdx similarity index 94% rename from docs/components/batchobjecturlcitation.mdx rename to docs/components/chaturlcitationannotationurlcitation.mdx index 293c96b5e..460d3ad4d 100644 --- a/docs/components/batchobjecturlcitation.mdx +++ b/docs/components/chaturlcitationannotationurlcitation.mdx @@ -1,5 +1,5 @@ --- -title: "BatchObjectURLCitation" +title: "ChatURLCitationAnnotationURLCitation" --- ## Fields diff --git a/docs/components/chatwebsearchcitationannotation.mdx b/docs/components/chatwebsearchcitationannotation.mdx new file mode 100644 index 000000000..108a2b5d2 --- /dev/null +++ b/docs/components/chatwebsearchcitationannotation.mdx @@ -0,0 +1,13 @@ +--- +title: "ChatWebSearchCitationAnnotation" +--- + +Web search citation annotation + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `type` | [components.ChatWebSearchCitationAnnotationType](../components/chatwebsearchcitationannotationtype.mdx) | ✔️ | N/A | +| `web_search_citation` | [components.WebSearchCitation](../components/websearchcitation.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/chatwebsearchcitationannotationtype.mdx b/docs/components/chatwebsearchcitationannotationtype.mdx new file mode 100644 index 000000000..ec6de0d65 --- /dev/null +++ b/docs/components/chatwebsearchcitationannotationtype.mdx @@ -0,0 +1,15 @@ +--- +title: "ChatWebSearchCitationAnnotationType" +--- + +## Example Usage + +```python +from openrouter.components import ChatWebSearchCitationAnnotationType +value: ChatWebSearchCitationAnnotationType = "web_search_citation" +``` + + +## Values + +- `"web_search_citation"` diff --git a/docs/components/contentimageurl.mdx b/docs/components/contentimageurl.mdx index f05add9d4..d87e7e356 100644 --- a/docs/components/contentimageurl.mdx +++ b/docs/components/contentimageurl.mdx @@ -4,7 +4,7 @@ title: "ContentImageURL" ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `image_url` | [components.ContentImageURLImageURL](../components/contentimageurlimageurl.mdx) | ✔️ | N/A | -| `type` | [components.FileTypeImageURL](../components/filetypeimageurl.mdx) | ✔️ | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `image_url` | [components.ChatFileAnnotationImageURL](../components/chatfileannotationimageurl.mdx) | ✔️ | N/A | +| `type` | [components.FileTypeImageURL](../components/filetypeimageurl.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/createguardrailrequest.mdx b/docs/components/createguardrailrequest.mdx index c8a62d0b8..41a268568 100644 --- a/docs/components/createguardrailrequest.mdx +++ b/docs/components/createguardrailrequest.mdx @@ -4,31 +4,32 @@ title: "CreateGuardrailRequest" ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allow_provisional_providers` | *OptionalNullable[bool]* | ➖ | Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided. | false | -| `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | -| `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | -| `allowed_data_regions` | List[[components.GuardrailDataRegion](../components/guardraildataregion.mdx)] | ➖ | Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected. | [
"europe"
] | -| `allowed_models` | List[*str*] | ➖ | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | -| `allowed_providers` | List[*str*] | ➖ | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | -| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../components/contentfilterbuiltinentryinput.mdx)] | ➖ | Builtin content filters to apply. Every builtin slug supports "block", "redact", and the detect-only "flag" action. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | -| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | ➖ | Custom regex content filters to apply to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | -| `description` | *OptionalNullable[str]* | ➖ | Description of the guardrail | A guardrail for limiting API usage | -| `enable_free_model_publication` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that publish prompts. | false | -| `enable_free_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that train on request data. | true | -| `enable_paid_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows paid endpoints that train on request data. | true | -| `enforce_first_party_harness_models` | *OptionalNullable[bool]* | ➖ | Whether coding harnesses list only their vendor's own models: Codex lists OpenAI models and Claude Code and Claude Desktop list Anthropic models. Affects only the model list those harnesses request from GET /models; a model the client names directly is still routed. Any true across the workspace default, member, and API key guardrails applies. | false | -| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | ➖ | ⚠️ **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false | -| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_google` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_openai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_other` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_xai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false | -| `ignored_models` | List[*str*] | ➖ | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | -| `ignored_providers` | List[*str*] | ➖ | List of provider IDs to exclude from routing | [
"azure"
] | -| `include_byok_in_budgets` | *Optional[bool]* | ➖ | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false. | false | -| `limit_usd` | *OptionalNullable[float]* | ➖ | Spending limit in USD. Must be provided together with `reset_interval`: a request that sets only one of the two is rejected with a 400. | 50 | -| `name` | *str* | ✔️ | Name for the new guardrail | My New Guardrail | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | ➖ | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `workspace_id` | *Optional[str]* | ➖ | The workspace to create the guardrail in. When omitted, an organization management key creates the guardrail in the default workspace (a 400 if that default has been deleted, so pass `workspace_id` explicitly) and a workspace-scoped key creates it in its own workspace. A workspace-scoped key gets a 403 for any other workspace. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `allow_provisional_providers` | *OptionalNullable[bool]* | ➖ | Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided. | false | +| `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | +| `allow_safety_retention_openai` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting. | true | +| `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | +| `allowed_data_regions` | List[[components.GuardrailDataRegion](../components/guardraildataregion.mdx)] | ➖ | Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected. | [
"europe"
] | +| `allowed_models` | List[*str*] | ➖ | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | +| `allowed_providers` | List[*str*] | ➖ | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | +| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../components/contentfilterbuiltinentryinput.mdx)] | ➖ | Builtin content filters to apply. Every builtin slug supports "block", "redact", and the detect-only "flag" action. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | +| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | ➖ | Custom regex content filters to apply to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | +| `description` | *OptionalNullable[str]* | ➖ | Description of the guardrail | A guardrail for limiting API usage | +| `enable_free_model_publication` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that publish prompts. | false | +| `enable_free_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that train on request data. | true | +| `enable_paid_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows paid endpoints that train on request data. | true | +| `enforce_first_party_harness_models` | *OptionalNullable[bool]* | ➖ | Whether coding harnesses list only their vendor's own models: Codex lists OpenAI models and Claude Code and Claude Desktop list Anthropic models. Affects only the model list those harnesses request from GET /models; a model the client names directly is still routed. Any true across the workspace default, member, and API key guardrails applies. | false | +| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | ➖ | ⚠️ **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false | +| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_google` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_other` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_xai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false | +| `ignored_models` | List[*str*] | ➖ | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | +| `ignored_providers` | List[*str*] | ➖ | List of provider IDs to exclude from routing | [
"azure"
] | +| `include_byok_in_budgets` | *Optional[bool]* | ➖ | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false. | false | +| `limit_usd` | *OptionalNullable[float]* | ➖ | Spending limit in USD. Must be provided together with `reset_interval`: a request that sets only one of the two is rejected with a 400. | 50 | +| `name` | *str* | ✔️ | Name for the new guardrail | My New Guardrail | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | ➖ | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `workspace_id` | *Optional[str]* | ➖ | The workspace to create the guardrail in. When omitted, an organization management key creates the guardrail in the default workspace (a 400 if that default has been deleted, so pass `workspace_id` explicitly) and a workspace-scoped key creates it in its own workspace. A workspace-scoped key gets a 403 for any other workspace. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/components/guardrail.mdx b/docs/components/guardrail.mdx index 66ba86817..06ac9866f 100644 --- a/docs/components/guardrail.mdx +++ b/docs/components/guardrail.mdx @@ -4,34 +4,35 @@ title: "Guardrail" ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `allow_provisional_providers` | *OptionalNullable[bool]* | ➖ | Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided. | false | -| `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | -| `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | -| `allowed_data_regions` | List[[components.GuardrailDataRegion](../components/guardraildataregion.mdx)] | ➖ | Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. | [
"europe"
] | -| `allowed_models` | List[*str*] | ➖ | Array of model canonical_slugs (immutable identifiers) | [
"openai/gpt-5.2-20251211",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | -| `allowed_providers` | List[*str*] | ➖ | List of allowed provider IDs | [
"openai",
"anthropic",
"google"
] | -| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntry](../components/contentfilterbuiltinentry.mdx)] | ➖ | Builtin content filters applied to requests. Includes PII detectors and the regex-based prompt injection detector. | [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
] | -| `content_filters` | List[[components.ContentFilterReadEntry](../components/contentfilterreadentry.mdx)] | ➖ | Custom regex content filters applied to request messages | [
\{
"action": "redact",
"is_enforced": true,
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | -| `created_at` | *str* | ✔️ | ISO 8601 timestamp of when the guardrail was created | 2025-08-24T10:30:00Z | -| `description` | *OptionalNullable[str]* | ➖ | Description of the guardrail | Guardrail for production environment | -| `enable_free_model_publication` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that publish prompts. | false | -| `enable_free_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that train on request data. | true | -| `enable_paid_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows paid endpoints that train on request data. | true | -| `enforce_first_party_harness_models` | *OptionalNullable[bool]* | ➖ | Whether coding harnesses list only their vendor's own models: Codex lists OpenAI models and Claude Code and Claude Desktop list Anthropic models. Affects only the model list those harnesses request from GET /models; a model the client names directly is still routed. Any true across the workspace default, member, and API key guardrails applies. | false | -| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | ➖ | ⚠️ **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false | -| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_google` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_openai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_other` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_xai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false | -| `id` | *str* | ✔️ | Unique identifier for the guardrail | 550e8400-e29b-41d4-a716-446655440000 | -| `ignored_models` | List[*str*] | ➖ | Array of model canonical_slugs to exclude from routing | [
"openai/gpt-4o-mini-2024-07-18"
] | -| `ignored_providers` | List[*str*] | ➖ | List of provider IDs to exclude from routing | [
"azure"
] | -| `include_byok_in_budgets` | *bool* | ✔️ | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. | false | -| `limit_usd` | *OptionalNullable[float]* | ➖ | Spending limit in USD | 100 | -| `name` | *str* | ✔️ | Name of the guardrail | Production Guardrail | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | ➖ | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `updated_at` | *OptionalNullable[str]* | ➖ | ISO 8601 timestamp of when the guardrail was last updated | 2025-08-24T15:45:00Z | -| `workspace_id` | *Nullable[str]* | ✔️ | The workspace this guardrail belongs to, or `null` for an unscoped legacy guardrail predating workspaces. Workspace membership organizes the guardrail; it does not apply the guardrail to the workspace's traffic. A `null` value does not mean the default workspace, and does not apply the guardrail across every workspace. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `allow_provisional_providers` | *OptionalNullable[bool]* | ➖ | Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided. | false | +| `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | +| `allow_safety_retention_openai` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting. | true | +| `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | +| `allowed_data_regions` | List[[components.GuardrailDataRegion](../components/guardraildataregion.mdx)] | ➖ | Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. | [
"europe"
] | +| `allowed_models` | List[*str*] | ➖ | Array of model canonical_slugs (immutable identifiers) | [
"openai/gpt-5.2-20251211",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | +| `allowed_providers` | List[*str*] | ➖ | List of allowed provider IDs | [
"openai",
"anthropic",
"google"
] | +| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntry](../components/contentfilterbuiltinentry.mdx)] | ➖ | Builtin content filters applied to requests. Includes PII detectors and the regex-based prompt injection detector. | [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
] | +| `content_filters` | List[[components.ContentFilterReadEntry](../components/contentfilterreadentry.mdx)] | ➖ | Custom regex content filters applied to request messages | [
\{
"action": "redact",
"is_enforced": true,
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | +| `created_at` | *str* | ✔️ | ISO 8601 timestamp of when the guardrail was created | 2025-08-24T10:30:00Z | +| `description` | *OptionalNullable[str]* | ➖ | Description of the guardrail | Guardrail for production environment | +| `enable_free_model_publication` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that publish prompts. | false | +| `enable_free_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that train on request data. | true | +| `enable_paid_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows paid endpoints that train on request data. | true | +| `enforce_first_party_harness_models` | *OptionalNullable[bool]* | ➖ | Whether coding harnesses list only their vendor's own models: Codex lists OpenAI models and Claude Code and Claude Desktop list Anthropic models. Affects only the model list those harnesses request from GET /models; a model the client names directly is still routed. Any true across the workspace default, member, and API key guardrails applies. | false | +| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | ➖ | ⚠️ **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false | +| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_google` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_other` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_xai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false | +| `id` | *str* | ✔️ | Unique identifier for the guardrail | 550e8400-e29b-41d4-a716-446655440000 | +| `ignored_models` | List[*str*] | ➖ | Array of model canonical_slugs to exclude from routing | [
"openai/gpt-4o-mini-2024-07-18"
] | +| `ignored_providers` | List[*str*] | ➖ | List of provider IDs to exclude from routing | [
"azure"
] | +| `include_byok_in_budgets` | *bool* | ✔️ | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. | false | +| `limit_usd` | *OptionalNullable[float]* | ➖ | Spending limit in USD | 100 | +| `name` | *str* | ✔️ | Name of the guardrail | Production Guardrail | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | ➖ | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `updated_at` | *OptionalNullable[str]* | ➖ | ISO 8601 timestamp of when the guardrail was last updated | 2025-08-24T15:45:00Z | +| `workspace_id` | *Nullable[str]* | ✔️ | The workspace this guardrail belongs to, or `null` for an unscoped legacy guardrail predating workspaces. Workspace membership organizes the guardrail; it does not apply the guardrail to the workspace's traffic. A `null` value does not mean the default workspace, and does not apply the guardrail across every workspace. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/components/guardrailmodelavailabilitypolicyauthoringconfig.mdx b/docs/components/guardrailmodelavailabilitypolicyauthoringconfig.mdx index 9e684ef4e..045aa5b9e 100644 --- a/docs/components/guardrailmodelavailabilitypolicyauthoringconfig.mdx +++ b/docs/components/guardrailmodelavailabilitypolicyauthoringconfig.mdx @@ -8,6 +8,7 @@ title: "GuardrailModelAvailabilityPolicyAuthoringConfig" | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | | `allow_provisional_providers` | *OptionalNullable[bool]* | ➖ | N/A | | `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | N/A | +| `allow_safety_retention_openai` | *OptionalNullable[bool]* | ➖ | N/A | | `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | N/A | | `allowed_data_regions` | List[*str*] | ➖ | N/A | | `allowed_models` | List[*str*] | ➖ | N/A | diff --git a/docs/components/guardrailmodelavailabilitypolicyconfig.mdx b/docs/components/guardrailmodelavailabilitypolicyconfig.mdx index 8d988f100..2c0459157 100644 --- a/docs/components/guardrailmodelavailabilitypolicyconfig.mdx +++ b/docs/components/guardrailmodelavailabilitypolicyconfig.mdx @@ -8,6 +8,7 @@ title: "GuardrailModelAvailabilityPolicyConfig" | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | | `allow_provisional_providers` | *OptionalNullable[bool]* | ➖ | N/A | | `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | N/A | +| `allow_safety_retention_openai` | *OptionalNullable[bool]* | ➖ | N/A | | `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | N/A | | `allowed_data_regions` | List[*str*] | ➖ | N/A | | `allowed_models` | List[*str*] | ➖ | N/A | diff --git a/docs/components/image.mdx b/docs/components/image.mdx index b852b6957..b81f18892 100644 --- a/docs/components/image.mdx +++ b/docs/components/image.mdx @@ -6,5 +6,5 @@ title: "Image" | Field | Type | Required | Description | | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `image_url` | [components.BatchObjectImageURL](../components/batchobjectimageurl.mdx) | ✔️ | N/A | +| `image_url` | [components.BatchResultImageURL](../components/batchresultimageurl.mdx) | ✔️ | N/A | | `type` | [components.ChoiceTypeImageURL](../components/choicetypeimageurl.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/inputreference.mdx b/docs/components/inputreference.mdx index 02f31a8f6..6d707c86e 100644 --- a/docs/components/inputreference.mdx +++ b/docs/components/inputreference.mdx @@ -2,7 +2,7 @@ title: "InputReference" --- -A reference asset used to guide video generation. Image references are supported by all providers; audio and video references are only honored by providers that support them (including BytePlus Seedance generation 2 and newer). +A reference asset used to guide video generation. Image references are the most widely supported; audio and video references are only accepted by providers that advertise those input modalities (including BytePlus Seedance generation 2 and newer). ## Supported Types diff --git a/docs/components/logprobs.mdx b/docs/components/logprobs.mdx index 0e93af173..4a218aa2d 100644 --- a/docs/components/logprobs.mdx +++ b/docs/components/logprobs.mdx @@ -4,7 +4,7 @@ title: "Logprobs" ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `content` | List[[components.LogprobsContent](../components/logprobscontent.mdx)] | ✔️ | N/A | -| `refusal` | List[[components.Refusal](../components/refusal.mdx)] | ➖ | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `content` | List[[components.BatchResultContent](../components/batchresultcontent.mdx)] | ✔️ | N/A | +| `refusal` | List[[components.Refusal](../components/refusal.mdx)] | ➖ | N/A | \ No newline at end of file diff --git a/docs/components/message.mdx b/docs/components/message.mdx index 5e054eab7..f1eab7c7b 100644 --- a/docs/components/message.mdx +++ b/docs/components/message.mdx @@ -6,7 +6,7 @@ title: "Message" | Field | Type | Required | Description | | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `annotations` | List[[components.Annotation](../components/annotation.mdx)] | ➖ | N/A | +| `annotations` | List[[components.ChatAnnotation](../components/chatannotation.mdx)] | ➖ | N/A | | `content` | *Nullable[str]* | ✔️ | N/A | | `images` | List[[components.Image](../components/image.mdx)] | ➖ | N/A | | `reasoning` | *OptionalNullable[str]* | ➖ | N/A | diff --git a/docs/components/scimsyncjob.mdx b/docs/components/scimsyncjob.mdx index 2d1eebe78..c9e32a990 100644 --- a/docs/components/scimsyncjob.mdx +++ b/docs/components/scimsyncjob.mdx @@ -4,13 +4,13 @@ title: "ScimSyncJob" ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `created_at` | *str* | ✔️ | Time when the sync job was created. | -| `deleted_groups` | *Nullable[int]* | ✔️ | Number of groups deleted, when the job completed successfully. | -| `error_message` | *Nullable[str]* | ✔️ | Stable error message when the job failed. | -| `finished_at` | *Nullable[str]* | ✔️ | Time when synchronization finished. | -| `id` | *str* | ✔️ | Unique identifier for the sync job. | -| `started_at` | *Nullable[str]* | ✔️ | Time when synchronization started. | -| `status` | [components.ScimSyncJobStatus](../components/scimsyncjobstatus.mdx) | ✔️ | Current status of the sync job: queued, running, succeeded, or failed. | -| `synced_groups` | *Nullable[int]* | ✔️ | Number of groups synchronized, when the job completed successfully. | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `created_at` | *str* | ✔️ | Time when the sync job was created. | +| `deleted_groups` | *Nullable[int]* | ✔️ | Number of groups deleted, when the job completed successfully. | +| `error_message` | *Nullable[str]* | ✔️ | Stable message code, or null. On a failed job, the failure reason. On a succeeded job, set when optional work beyond the group synchronization could not be completed; the groups were still synchronized. | +| `finished_at` | *Nullable[str]* | ✔️ | Time when synchronization finished. | +| `id` | *str* | ✔️ | Unique identifier for the sync job. | +| `started_at` | *Nullable[str]* | ✔️ | Time when synchronization started. | +| `status` | [components.ScimSyncJobStatus](../components/scimsyncjobstatus.mdx) | ✔️ | Current status of the sync job: queued, running, succeeded, or failed. | +| `synced_groups` | *Nullable[int]* | ✔️ | Number of groups synchronized, when the job completed successfully. | \ No newline at end of file diff --git a/docs/components/speechrequestresponseformat.mdx b/docs/components/speechrequestresponseformat.mdx index 9af8a5aa6..9e08b7ba4 100644 --- a/docs/components/speechrequestresponseformat.mdx +++ b/docs/components/speechrequestresponseformat.mdx @@ -20,3 +20,4 @@ This is an open enum. Unrecognized values will not fail type checks. - `"mp3"` - `"pcm"` +- `"wav"` diff --git a/docs/components/toolcall.mdx b/docs/components/toolcall.mdx index 7d1552337..f42114c8d 100644 --- a/docs/components/toolcall.mdx +++ b/docs/components/toolcall.mdx @@ -6,7 +6,7 @@ title: "ToolCall" | Field | Type | Required | Description | | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `function` | [components.BatchObjectFunction](../components/batchobjectfunction.mdx) | ✔️ | N/A | +| `function` | [components.BatchResultFunction](../components/batchresultfunction.mdx) | ✔️ | N/A | | `id` | *str* | ✔️ | N/A | | `index` | *int* | ✔️ | N/A | | `type` | [components.ChoiceTypeFunction](../components/choicetypefunction.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/typewebsearchcitation.mdx b/docs/components/typewebsearchcitation.mdx deleted file mode 100644 index 98eb3478a..000000000 --- a/docs/components/typewebsearchcitation.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "TypeWebSearchCitation" ---- - -## Example Usage - -```python -from openrouter.components import TypeWebSearchCitation -value: TypeWebSearchCitation = "web_search_citation" -``` - - -## Values - -- `"web_search_citation"` diff --git a/docs/components/updateguardrailrequest.mdx b/docs/components/updateguardrailrequest.mdx index e393f4233..8cf5078cc 100644 --- a/docs/components/updateguardrailrequest.mdx +++ b/docs/components/updateguardrailrequest.mdx @@ -4,30 +4,31 @@ title: "UpdateGuardrailRequest" ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allow_provisional_providers` | *OptionalNullable[bool]* | ➖ | Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided. | false | -| `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | false | -| `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | false | -| `allowed_data_regions` | List[[components.GuardrailDataRegion](../components/guardraildataregion.mdx)] | ➖ | Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected. | [
"europe"
] | -| `allowed_models` | List[*str*] | ➖ | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2"
] | -| `allowed_providers` | List[*str*] | ➖ | New list of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | -| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../components/contentfilterbuiltinentryinput.mdx)] | ➖ | Builtin content filters to apply. Set to null to remove. Every builtin slug supports "block", "redact", and the detect-only "flag" action. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | -| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | ➖ | Custom regex content filters to apply. Set to null to remove. | null | -| `description` | *OptionalNullable[str]* | ➖ | New description for the guardrail | Updated description | -| `enable_free_model_publication` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that publish prompts. | false | -| `enable_free_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that train on request data. | true | -| `enable_paid_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows paid endpoints that train on request data. | true | -| `enforce_first_party_harness_models` | *OptionalNullable[bool]* | ➖ | Whether coding harnesses list only their vendor's own models: Codex lists OpenAI models and Claude Code and Claude Desktop list Anthropic models. Affects only the model list those harnesses request from GET /models; a model the client names directly is still routed. Any true across the workspace default, member, and API key guardrails applies. | true | -| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | ➖ | ⚠️ **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | true | -| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_google` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_openai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_other` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_xai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | true | -| `ignored_models` | List[*str*] | ➖ | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | -| `ignored_providers` | List[*str*] | ➖ | List of provider IDs to exclude from routing | [
"azure"
] | -| `include_byok_in_budgets` | *Optional[bool]* | ➖ | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Omit to leave unchanged. | true | -| `limit_usd` | *OptionalNullable[float]* | ➖ | New spending limit in USD | 75 | -| `name` | *Optional[str]* | ➖ | New name for the guardrail | Updated Guardrail Name | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | ➖ | Interval at which the limit resets (daily, weekly, monthly) | monthly | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `allow_provisional_providers` | *OptionalNullable[bool]* | ➖ | Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided. | false | +| `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | false | +| `allow_safety_retention_openai` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting. | false | +| `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | false | +| `allowed_data_regions` | List[[components.GuardrailDataRegion](../components/guardraildataregion.mdx)] | ➖ | Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected. | [
"europe"
] | +| `allowed_models` | List[*str*] | ➖ | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2"
] | +| `allowed_providers` | List[*str*] | ➖ | New list of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | +| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../components/contentfilterbuiltinentryinput.mdx)] | ➖ | Builtin content filters to apply. Set to null to remove. Every builtin slug supports "block", "redact", and the detect-only "flag" action. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | +| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | ➖ | Custom regex content filters to apply. Set to null to remove. | null | +| `description` | *OptionalNullable[str]* | ➖ | New description for the guardrail | Updated description | +| `enable_free_model_publication` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that publish prompts. | false | +| `enable_free_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that train on request data. | true | +| `enable_paid_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows paid endpoints that train on request data. | true | +| `enforce_first_party_harness_models` | *OptionalNullable[bool]* | ➖ | Whether coding harnesses list only their vendor's own models: Codex lists OpenAI models and Claude Code and Claude Desktop list Anthropic models. Affects only the model list those harnesses request from GET /models; a model the client names directly is still routed. Any true across the workspace default, member, and API key guardrails applies. | true | +| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | ➖ | ⚠️ **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | true | +| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_google` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_other` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_xai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | true | +| `ignored_models` | List[*str*] | ➖ | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | +| `ignored_providers` | List[*str*] | ➖ | List of provider IDs to exclude from routing | [
"azure"
] | +| `include_byok_in_budgets` | *Optional[bool]* | ➖ | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Omit to leave unchanged. | true | +| `limit_usd` | *OptionalNullable[float]* | ➖ | New spending limit in USD | 75 | +| `name` | *Optional[str]* | ➖ | New name for the guardrail | Updated Guardrail Name | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | ➖ | Interval at which the limit resets (daily, weekly, monthly) | monthly | \ No newline at end of file diff --git a/docs/components/videogenerationrequest.mdx b/docs/components/videogenerationrequest.mdx index bbe542e93..c7009a325 100644 --- a/docs/components/videogenerationrequest.mdx +++ b/docs/components/videogenerationrequest.mdx @@ -4,23 +4,23 @@ title: "VideoGenerationRequest" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `aspect_ratio` | [Optional[components.VideoGenerationRequestAspectRatio]](../components/videogenerationrequestaspectratio.mdx) | ➖ | Aspect ratio of the generated video. Omit it to use the model default, which on models with adaptive aspect ratio (e.g. BytePlus Seedance) follows the input image or video. | 16:9 | -| `callback_url` | *Optional[str]* | ➖ | URL to receive a webhook notification when the video generation job completes. Overrides the workspace-level default callback URL if set. Must be HTTPS. | https://example.com/webhook | -| `creativity` | *Optional[int]* | ➖ | Creativity level for video upscaling models only. This parameter is not supported by video generation models. | 1 | -| `duration` | *Optional[int]* | ➖ | Duration of the generated video in seconds, or -1 to let the provider choose the length (e.g. following an input video). -1 is only accepted by models that list it in supported_durations. | 8 | -| `frame_images` | List[[components.FrameImage](../components/frameimage.mdx)] | ➖ | Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame. | | -| `generate_audio` | *Optional[bool]* | ➖ | Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set. When neither is set, some providers (such as xAI) apply their own default and generate audio, so send false to request a silent video. Some models always include audio and ignore false. | true | -| `input_references` | List[[components.InputReference](../components/inputreference.mdx)] | ➖ | Reference assets to guide video generation. Accepts image, audio, and video references. Audio and video references are only honored by providers that support them (including BytePlus Seedance generation 2 and newer); other providers use image references and ignore the rest. | | -| `model` | *str* | ✔️ | N/A | | -| `previous_job_id` | *Optional[str]* | ➖ | ID of a completed video job to edit or extend, as returned by the submit response. The new job runs on the same model and endpoint that produced the previous one. Only models that support continuation accept this field. | gen-vid-1789493115-a1B2c3D4e5F6g7H8i9J0 | -| `prompt` | *Optional[str]* | ➖ | Text prompt describing the video to generate. Optional for models that support generating a video from image input alone; required by all other models. | A serene mountain landscape at sunset | -| `provider` | [Optional[components.VideoGenerationRequestProvider]](../components/videogenerationrequestprovider.mdx) | ➖ | Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing. | | -| `resolution` | [Optional[components.VideoGenerationRequestResolution]](../components/videogenerationrequestresolution.mdx) | ➖ | Resolution of the generated video | 720p | -| `seed` | *Optional[int]* | ➖ | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. | | -| `session_id` | *Optional[str]* | ➖ | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. | session-1234 | -| `size` | *Optional[str]* | ➖ | Exact pixel dimensions of the generated video in "WIDTHxHEIGHT" format (e.g. "1280x720"). Interchangeable with resolution + aspect_ratio. | 1280x720 | -| `trace` | [Optional[components.TraceConfig]](../components/traceconfig.mdx) | ➖ | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | \{
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
} | -| `upscale_factor` | *Optional[float]* | ➖ | Upscale factor for video upscaling models only. This parameter is not supported by video generation models. | 2 | -| `user` | *Optional[str]* | ➖ | A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider. | user-1234 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `aspect_ratio` | [Optional[components.VideoGenerationRequestAspectRatio]](../components/videogenerationrequestaspectratio.mdx) | ➖ | Aspect ratio of the generated video. Omit it to use the model default, which on models with adaptive aspect ratio (e.g. BytePlus Seedance) follows the input image or video. | 16:9 | +| `callback_url` | *Optional[str]* | ➖ | URL to receive a webhook notification when the video generation job completes. Overrides the workspace-level default callback URL if set. Must be HTTPS. | https://example.com/webhook | +| `creativity` | *Optional[int]* | ➖ | Creativity level for video upscaling models only. This parameter is not supported by video generation models. | 1 | +| `duration` | *Optional[int]* | ➖ | Duration of the generated video in seconds, or -1 to let the provider choose the length (e.g. following an input video). -1 is only accepted by models that list it in supported_durations. | 8 | +| `frame_images` | List[[components.FrameImage](../components/frameimage.mdx)] | ➖ | Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame, and each frame_type may appear at most once. Combining frame_images with input_references is provider-specific: some models reject the combination (as a 400 on submit or as a failed job), some use the frame images alone, and some use both (e.g. Runway applies image references as style/guidance alongside the frame anchors). | | +| `generate_audio` | *Optional[bool]* | ➖ | Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set. When neither is set, some providers (such as xAI) apply their own default and generate audio, so send false to request a silent video. Some models always include audio and ignore false. POST /videos returns 400 for true if every otherwise eligible endpoint explicitly disables audio generation. | true | +| `input_references` | List[[components.InputReference](../components/inputreference.mdx)] | ➖ | Reference assets to guide video generation. Accepts image, audio, and video references. POST /videos rejects the request with a 400 when the model or its provider integration does not support a supplied reference modality. Combining input_references with frame_images is provider-specific: some models reject the combination (as a 400 on submit or as a failed job), some use the frame images alone, and some use both (e.g. Runway applies image references as style/guidance alongside the frame anchors). | | +| `model` | *str* | ✔️ | N/A | | +| `previous_job_id` | *Optional[str]* | ➖ | ID of a completed video job to edit or extend, as returned by the submit response. The new job runs on the same model and endpoint that produced the previous one. Only models that support continuation accept this field. | gen-vid-1789493115-a1B2c3D4e5F6g7H8i9J0 | +| `prompt` | *Optional[str]* | ➖ | Text prompt describing the video to generate. Optional for models that support generating a video from image input alone; required by all other models. | A serene mountain landscape at sunset | +| `provider` | [Optional[components.VideoGenerationRequestProvider]](../components/videogenerationrequestprovider.mdx) | ➖ | Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. Sorting by price, latency, or throughput and automatic provider fallbacks are not supported. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing. | | +| `resolution` | [Optional[components.VideoGenerationRequestResolution]](../components/videogenerationrequestresolution.mdx) | ➖ | Resolution of the generated video | 720p | +| `seed` | *Optional[int]* | ➖ | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. POST /videos returns 400 if every otherwise eligible endpoint explicitly declares seed unsupported. | | +| `session_id` | *Optional[str]* | ➖ | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. | session-1234 | +| `size` | *Optional[str]* | ➖ | Exact pixel dimensions of the generated video in "WIDTHxHEIGHT" format (e.g. "1280x720"). Interchangeable with resolution + aspect_ratio. | 1280x720 | +| `trace` | [Optional[components.TraceConfig]](../components/traceconfig.mdx) | ➖ | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | \{
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
} | +| `upscale_factor` | *Optional[float]* | ➖ | Upscale factor for video upscaling models only. This parameter is not supported by video generation models. | 2 | +| `user` | *Optional[str]* | ➖ | A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider. | user-1234 | \ No newline at end of file diff --git a/docs/components/videogenerationrequestprovider.mdx b/docs/components/videogenerationrequestprovider.mdx index 0fcfb3374..c03d3b501 100644 --- a/docs/components/videogenerationrequestprovider.mdx +++ b/docs/components/videogenerationrequestprovider.mdx @@ -2,7 +2,7 @@ title: "VideoGenerationRequestProvider" --- -Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing. +Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. Sorting by price, latency, or throughput and automatic provider fallbacks are not supported. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing. ## Fields @@ -13,5 +13,5 @@ Provider routing preferences (order, only, ignore), request-level data policy (z | `ignore` | List[[components.VideoGenerationRequestIgnore](../components/videogenerationrequestignore.mdx)] | ➖ | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | [
"openai",
"anthropic"
] | | `only` | List[[components.VideoGenerationRequestOnly](../components/videogenerationrequestonly.mdx)] | ➖ | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | [
"openai",
"anthropic"
] | | `options` | [Optional[components.VideoGenerationRequestOptions]](../components/videogenerationrequestoptions.mdx) | ➖ | N/A | \{
"google-vertex": \{
"output_config": \{
"effort": "low"
}
}
} | -| `order` | List[[components.VideoGenerationRequestOrder](../components/videogenerationrequestorder.mdx)] | ➖ | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | [
"openai",
"anthropic"
] | +| `order` | List[[components.VideoGenerationRequestOrder](../components/videogenerationrequestorder.mdx)] | ➖ | An ordered list of provider slugs to prefer when choosing an eligible video endpoint. The request is submitted to one endpoint and is not retried on another provider if submission fails. | [
"minimax"
] | | `zdr` | *OptionalNullable[bool]* | ➖ | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true | \ No newline at end of file diff --git a/docs/operations/getbatchresultsglobals.mdx b/docs/operations/getbatchresultsglobals.mdx new file mode 100644 index 000000000..d01db3022 --- /dev/null +++ b/docs/operations/getbatchresultsglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "GetBatchResultsGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/getbatchresultsrequest.mdx b/docs/operations/getbatchresultsrequest.mdx new file mode 100644 index 000000000..60547e98e --- /dev/null +++ b/docs/operations/getbatchresultsrequest.mdx @@ -0,0 +1,14 @@ +--- +title: "GetBatchResultsRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `id` | *str* | ✔️ | The batch job id returned from submit. | batch_abc123 | +| `limit` | *Optional[int]* | ➖ | Maximum number of result items to return, from 1 through 1000. | 500 | +| `cursor` | *Optional[str]* | ➖ | Opaque pagination cursor from the previous page's `next_cursor`. Omit for the first page. | djE6YmF0Y2hfYWJjMTIzOjEwMjQ | \ No newline at end of file diff --git a/docs/operations/getbatchresultsresponse.mdx b/docs/operations/getbatchresultsresponse.mdx new file mode 100644 index 000000000..cd0620ad1 --- /dev/null +++ b/docs/operations/getbatchresultsresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "GetBatchResultsResponse" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `result` | [components.BatchResultsPageResponse](../components/batchresultspageresponse.mdx) | ✔️ | N/A | \{
"data": [],
"has_more": false,
"next_cursor": null,
"object": "list"
} | \ No newline at end of file diff --git a/docs/operations/listrequest.mdx b/docs/operations/listrequest.mdx index e0298f128..07e9fc867 100644 --- a/docs/operations/listrequest.mdx +++ b/docs/operations/listrequest.mdx @@ -12,4 +12,5 @@ title: "ListRequest" | `include_disabled` | *Optional[bool]* | ➖ | Whether to include disabled API keys in the response | false | | `include_expired` | *Optional[bool]* | ➖ | Whether to include expired API keys in the response. Expired keys are excluded by default and returned only when this is true. | false | | `offset` | *OptionalNullable[int]* | ➖ | Number of API keys to skip for pagination | 0 | -| `workspace_id` | *Optional[str]* | ➖ | Filter API keys by workspace ID. By default an organization-scoped management key gets the default workspace; a workspace-scoped management key always gets its own workspace and cannot list another. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file +| `workspace_id` | *Optional[str]* | ➖ | Filter API keys by workspace ID. By default an organization-scoped management key gets the default workspace; a workspace-scoped management key always gets its own workspace and cannot list another. | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `creator_user_id` | *Optional[str]* | ➖ | Only return API keys created by this user ID (the `creator_user_id` on each key). Requires a management key that can view key creators. | user_2dHFtVWx2n56w6HkM0000000000 | \ No newline at end of file diff --git a/docs/sdks/batch/README.mdx b/docs/sdks/batch/README.mdx index 569ef3d14..e37a1c680 100644 --- a/docs/sdks/batch/README.mdx +++ b/docs/sdks/batch/README.mdx @@ -13,6 +13,7 @@ Submit, list, poll, and delete asynchronous batches of inference requests. See h * [create_batches](#create_batches) - Create a batch * [delete](#delete) - Delete a batch * [get_batches](#get_batches) - Get a batch +* [get_results](#get_results) - Get batch results ## list @@ -224,7 +225,7 @@ with OpenRouter( | Error Type | Status Code | Content Type | | ----------------------------- | ----------------------------- | ----------------------------- | | errors.BatchErrorResponse | 401, 404, 409, 429 | application/json | -| errors.BatchErrorResponse | 500, 502 | application/json | +| errors.BatchErrorResponse | 500, 502, 503 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | ## get_batches @@ -273,4 +274,56 @@ with OpenRouter( | errors.BatchPaymentRequiredResponseError | 402 | application/json | | errors.BatchErrorResponse | 401, 404, 410, 429 | application/json | | errors.BatchErrorResponse | 500, 502 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## get_results + +Returns a cursor-paginated page of normalized OpenRouter-format results for a finished batch. Pass the previous page's `next_cursor` as `cursor` to read the next page. Pages are stable across retries for the 30-day artifact retention window. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart). + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.batch.get_results(id="batch_abc123") + + while res is not None: + # Handle items + + res = res.next() + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | ✔️ | The batch job id returned from submit. | batch_abc123 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `limit` | *Optional[int]* | ➖ | Maximum number of result items to return, from 1 through 1000. | 500 | +| `cursor` | *Optional[str]* | ➖ | Opaque pagination cursor from the previous page's `next_cursor`. Omit for the first page. | djE6YmF0Y2hfYWJjMTIzOjEwMjQ | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[operations.GetBatchResultsResponse](../../operations/getbatchresultsresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | +| errors.BatchPaymentRequiredResponseError | 402 | application/json | +| errors.BatchErrorResponse | 400, 401, 404, 409, 410, 413, 429 | application/json | +| errors.BatchErrorResponse | 500, 502 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/guardrails/README.mdx b/docs/sdks/guardrails/README.mdx index 048b224ba..a35a38327 100644 --- a/docs/sdks/guardrails/README.mdx +++ b/docs/sdks/guardrails/README.mdx @@ -109,38 +109,39 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `name` | *str* | ✔️ | Name for the new guardrail | My New Guardrail | -| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | -| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `allow_provisional_providers` | *OptionalNullable[bool]* | ➖ | Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided. | false | -| `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | -| `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | -| `allowed_data_regions` | List[[components.GuardrailDataRegion](../../components/guardraildataregion.mdx)] | ➖ | Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected. | [
"europe"
] | -| `allowed_models` | List[*str*] | ➖ | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | -| `allowed_providers` | List[*str*] | ➖ | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | -| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../../components/contentfilterbuiltinentryinput.mdx)] | ➖ | Builtin content filters to apply. Every builtin slug supports "block", "redact", and the detect-only "flag" action. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | -| `content_filters` | List[[components.ContentFilterEntry](../../components/contentfilterentry.mdx)] | ➖ | Custom regex content filters to apply to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | -| `description` | *OptionalNullable[str]* | ➖ | Description of the guardrail | A guardrail for limiting API usage | -| `enable_free_model_publication` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that publish prompts. | false | -| `enable_free_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that train on request data. | true | -| `enable_paid_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows paid endpoints that train on request data. | true | -| `enforce_first_party_harness_models` | *OptionalNullable[bool]* | ➖ | Whether coding harnesses list only their vendor's own models: Codex lists OpenAI models and Claude Code and Claude Desktop list Anthropic models. Affects only the model list those harnesses request from GET /models; a model the client names directly is still routed. Any true across the workspace default, member, and API key guardrails applies. | false | -| `enforce_zdr` | *OptionalNullable[bool]* | ➖ | ⚠️ **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false | -| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_google` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_openai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_other` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_xai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false | -| `ignored_models` | List[*str*] | ➖ | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | -| `ignored_providers` | List[*str*] | ➖ | List of provider IDs to exclude from routing | [
"azure"
] | -| `include_byok_in_budgets` | *Optional[bool]* | ➖ | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false. | false | -| `limit_usd` | *OptionalNullable[float]* | ➖ | Spending limit in USD. Must be provided together with `reset_interval`: a request that sets only one of the two is rejected with a 400. | 50 | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../../components/guardrailinterval.mdx) | ➖ | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `workspace_id` | *Optional[str]* | ➖ | The workspace to create the guardrail in. When omitted, an organization management key creates the guardrail in the default workspace (a 400 if that default has been deleted, so pass `workspace_id` explicitly) and a workspace-scoped key creates it in its own workspace. A workspace-scoped key gets a 403 for any other workspace. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead. | 0df9e665-d932-5740-b2c7-b52af166bc11 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `name` | *str* | ✔️ | Name for the new guardrail | My New Guardrail | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `allow_provisional_providers` | *OptionalNullable[bool]* | ➖ | Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided. | false | +| `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | +| `allow_safety_retention_openai` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting. | true | +| `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | true | +| `allowed_data_regions` | List[[components.GuardrailDataRegion](../../components/guardraildataregion.mdx)] | ➖ | Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected. | [
"europe"
] | +| `allowed_models` | List[*str*] | ➖ | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | +| `allowed_providers` | List[*str*] | ➖ | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | +| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../../components/contentfilterbuiltinentryinput.mdx)] | ➖ | Builtin content filters to apply. Every builtin slug supports "block", "redact", and the detect-only "flag" action. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | +| `content_filters` | List[[components.ContentFilterEntry](../../components/contentfilterentry.mdx)] | ➖ | Custom regex content filters to apply to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | +| `description` | *OptionalNullable[str]* | ➖ | Description of the guardrail | A guardrail for limiting API usage | +| `enable_free_model_publication` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that publish prompts. | false | +| `enable_free_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that train on request data. | true | +| `enable_paid_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows paid endpoints that train on request data. | true | +| `enforce_first_party_harness_models` | *OptionalNullable[bool]* | ➖ | Whether coding harnesses list only their vendor's own models: Codex lists OpenAI models and Claude Code and Claude Desktop list Anthropic models. Affects only the model list those harnesses request from GET /models; a model the client names directly is still routed. Any true across the workspace default, member, and API key guardrails applies. | false | +| `enforce_zdr` | *OptionalNullable[bool]* | ➖ | ⚠️ **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false | +| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_google` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_other` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_xai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false | +| `ignored_models` | List[*str*] | ➖ | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | +| `ignored_providers` | List[*str*] | ➖ | List of provider IDs to exclude from routing | [
"azure"
] | +| `include_byok_in_budgets` | *Optional[bool]* | ➖ | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false. | false | +| `limit_usd` | *OptionalNullable[float]* | ➖ | Spending limit in USD. Must be provided together with `reset_interval`: a request that sets only one of the two is rejected with a 400. | 50 | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../../components/guardrailinterval.mdx) | ➖ | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `workspace_id` | *Optional[str]* | ➖ | The workspace to create the guardrail in. When omitted, an organization management key creates the guardrail in the default workspace (a 400 if that default has been deleted, so pass `workspace_id` explicitly) and a workspace-scoped key creates it in its own workspace. A workspace-scoped key gets a 403 for any other workspace. This only places the guardrail in the workspace; the created guardrail enforces nothing for that workspace's traffic until it is assigned to API keys or members. To restrict all traffic in a workspace, update the workspace's default guardrail instead. | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | ### Response @@ -281,38 +282,39 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | ✔️ | The unique identifier of the guardrail to update | 550e8400-e29b-41d4-a716-446655440000 | -| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | -| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `allow_provisional_providers` | *OptionalNullable[bool]* | ➖ | Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided. | false | -| `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | false | -| `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | false | -| `allowed_data_regions` | List[[components.GuardrailDataRegion](../../components/guardraildataregion.mdx)] | ➖ | Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected. | [
"europe"
] | -| `allowed_models` | List[*str*] | ➖ | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2"
] | -| `allowed_providers` | List[*str*] | ➖ | New list of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | -| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../../components/contentfilterbuiltinentryinput.mdx)] | ➖ | Builtin content filters to apply. Set to null to remove. Every builtin slug supports "block", "redact", and the detect-only "flag" action. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | -| `content_filters` | List[[components.ContentFilterEntry](../../components/contentfilterentry.mdx)] | ➖ | Custom regex content filters to apply. Set to null to remove. | null | -| `description` | *OptionalNullable[str]* | ➖ | New description for the guardrail | Updated description | -| `enable_free_model_publication` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that publish prompts. | false | -| `enable_free_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that train on request data. | true | -| `enable_paid_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows paid endpoints that train on request data. | true | -| `enforce_first_party_harness_models` | *OptionalNullable[bool]* | ➖ | Whether coding harnesses list only their vendor's own models: Codex lists OpenAI models and Claude Code and Claude Desktop list Anthropic models. Affects only the model list those harnesses request from GET /models; a model the client names directly is still routed. Any true across the workspace default, member, and API key guardrails applies. | true | -| `enforce_zdr` | *OptionalNullable[bool]* | ➖ | ⚠️ **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | true | -| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_google` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_openai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_other` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_xai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | true | -| `ignored_models` | List[*str*] | ➖ | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | -| `ignored_providers` | List[*str*] | ➖ | List of provider IDs to exclude from routing | [
"azure"
] | -| `include_byok_in_budgets` | *Optional[bool]* | ➖ | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Omit to leave unchanged. | true | -| `limit_usd` | *OptionalNullable[float]* | ➖ | New spending limit in USD | 75 | -| `name` | *Optional[str]* | ➖ | New name for the guardrail | Updated Guardrail Name | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../../components/guardrailinterval.mdx) | ➖ | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `id` | *str* | ✔️ | The unique identifier of the guardrail to update | 550e8400-e29b-41d4-a716-446655440000 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `allow_provisional_providers` | *OptionalNullable[bool]* | ➖ | Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided. | false | +| `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | false | +| `allow_safety_retention_openai` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting. | false | +| `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. | false | +| `allowed_data_regions` | List[[components.GuardrailDataRegion](../../components/guardraildataregion.mdx)] | ➖ | Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected. | [
"europe"
] | +| `allowed_models` | List[*str*] | ➖ | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2"
] | +| `allowed_providers` | List[*str*] | ➖ | New list of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | +| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../../components/contentfilterbuiltinentryinput.mdx)] | ➖ | Builtin content filters to apply. Set to null to remove. Every builtin slug supports "block", "redact", and the detect-only "flag" action. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | +| `content_filters` | List[[components.ContentFilterEntry](../../components/contentfilterentry.mdx)] | ➖ | Custom regex content filters to apply. Set to null to remove. | null | +| `description` | *OptionalNullable[str]* | ➖ | New description for the guardrail | Updated description | +| `enable_free_model_publication` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that publish prompts. | false | +| `enable_free_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows free endpoints that train on request data. | true | +| `enable_paid_model_training` | *OptionalNullable[bool]* | ➖ | Whether this guardrail allows paid endpoints that train on request data. | true | +| `enforce_first_party_harness_models` | *OptionalNullable[bool]* | ➖ | Whether coding harnesses list only their vendor's own models: Codex lists OpenAI models and Claude Code and Claude Desktop list Anthropic models. Affects only the model list those harnesses request from GET /models; a model the client names directly is still routed. Any true across the workspace default, member, and API key guardrails applies. | true | +| `enforce_zdr` | *OptionalNullable[bool]* | ➖ | ⚠️ **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | true | +| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_google` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_other` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_xai` | *OptionalNullable[bool]* | ➖ | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | true | +| `ignored_models` | List[*str*] | ➖ | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | +| `ignored_providers` | List[*str*] | ➖ | List of provider IDs to exclude from routing | [
"azure"
] | +| `include_byok_in_budgets` | *Optional[bool]* | ➖ | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Omit to leave unchanged. | true | +| `limit_usd` | *OptionalNullable[float]* | ➖ | New spending limit in USD | 75 | +| `name` | *Optional[str]* | ➖ | New name for the guardrail | Updated Guardrail Name | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../../components/guardrailinterval.mdx) | ➖ | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/docs/sdks/videogeneration/README.mdx b/docs/sdks/videogeneration/README.mdx index 94f9c0c08..110f543ea 100644 --- a/docs/sdks/videogeneration/README.mdx +++ b/docs/sdks/videogeneration/README.mdx @@ -41,30 +41,30 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `model` | *str* | ✔️ | N/A | | -| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | -| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `aspect_ratio` | [Optional[components.VideoGenerationRequestAspectRatio]](../../components/videogenerationrequestaspectratio.mdx) | ➖ | Aspect ratio of the generated video. Omit it to use the model default, which on models with adaptive aspect ratio (e.g. BytePlus Seedance) follows the input image or video. | 16:9 | -| `callback_url` | *Optional[str]* | ➖ | URL to receive a webhook notification when the video generation job completes. Overrides the workspace-level default callback URL if set. Must be HTTPS. | https://example.com/webhook | -| `creativity` | *Optional[int]* | ➖ | Creativity level for video upscaling models only. This parameter is not supported by video generation models. | 1 | -| `duration` | *Optional[int]* | ➖ | Duration of the generated video in seconds, or -1 to let the provider choose the length (e.g. following an input video). -1 is only accepted by models that list it in supported_durations. | 8 | -| `frame_images` | List[[components.FrameImage](../../components/frameimage.mdx)] | ➖ | Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame. | | -| `generate_audio` | *Optional[bool]* | ➖ | Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set. When neither is set, some providers (such as xAI) apply their own default and generate audio, so send false to request a silent video. Some models always include audio and ignore false. | true | -| `input_references` | List[[components.InputReference](../../components/inputreference.mdx)] | ➖ | Reference assets to guide video generation. Accepts image, audio, and video references. Audio and video references are only honored by providers that support them (including BytePlus Seedance generation 2 and newer); other providers use image references and ignore the rest. | | -| `previous_job_id` | *Optional[str]* | ➖ | ID of a completed video job to edit or extend, as returned by the submit response. The new job runs on the same model and endpoint that produced the previous one. Only models that support continuation accept this field. | gen-vid-1789493115-a1B2c3D4e5F6g7H8i9J0 | -| `prompt` | *Optional[str]* | ➖ | Text prompt describing the video to generate. Optional for models that support generating a video from image input alone; required by all other models. | A serene mountain landscape at sunset | -| `provider` | [Optional[components.VideoGenerationRequestProvider]](../../components/videogenerationrequestprovider.mdx) | ➖ | Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing. | | -| `resolution` | [Optional[components.VideoGenerationRequestResolution]](../../components/videogenerationrequestresolution.mdx) | ➖ | Resolution of the generated video | 720p | -| `seed` | *Optional[int]* | ➖ | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. | | -| `session_id` | *Optional[str]* | ➖ | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. | session-1234 | -| `size` | *Optional[str]* | ➖ | Exact pixel dimensions of the generated video in "WIDTHxHEIGHT" format (e.g. "1280x720"). Interchangeable with resolution + aspect_ratio. | 1280x720 | -| `trace` | [Optional[components.TraceConfig]](../../components/traceconfig.mdx) | ➖ | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | \{
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
} | -| `upscale_factor` | *Optional[float]* | ➖ | Upscale factor for video upscaling models only. This parameter is not supported by video generation models. | 2 | -| `user` | *Optional[str]* | ➖ | A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider. | user-1234 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `model` | *str* | ✔️ | N/A | | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `aspect_ratio` | [Optional[components.VideoGenerationRequestAspectRatio]](../../components/videogenerationrequestaspectratio.mdx) | ➖ | Aspect ratio of the generated video. Omit it to use the model default, which on models with adaptive aspect ratio (e.g. BytePlus Seedance) follows the input image or video. | 16:9 | +| `callback_url` | *Optional[str]* | ➖ | URL to receive a webhook notification when the video generation job completes. Overrides the workspace-level default callback URL if set. Must be HTTPS. | https://example.com/webhook | +| `creativity` | *Optional[int]* | ➖ | Creativity level for video upscaling models only. This parameter is not supported by video generation models. | 1 | +| `duration` | *Optional[int]* | ➖ | Duration of the generated video in seconds, or -1 to let the provider choose the length (e.g. following an input video). -1 is only accepted by models that list it in supported_durations. | 8 | +| `frame_images` | List[[components.FrameImage](../../components/frameimage.mdx)] | ➖ | Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame, and each frame_type may appear at most once. Combining frame_images with input_references is provider-specific: some models reject the combination (as a 400 on submit or as a failed job), some use the frame images alone, and some use both (e.g. Runway applies image references as style/guidance alongside the frame anchors). | | +| `generate_audio` | *Optional[bool]* | ➖ | Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set. When neither is set, some providers (such as xAI) apply their own default and generate audio, so send false to request a silent video. Some models always include audio and ignore false. POST /videos returns 400 for true if every otherwise eligible endpoint explicitly disables audio generation. | true | +| `input_references` | List[[components.InputReference](../../components/inputreference.mdx)] | ➖ | Reference assets to guide video generation. Accepts image, audio, and video references. POST /videos rejects the request with a 400 when the model or its provider integration does not support a supplied reference modality. Combining input_references with frame_images is provider-specific: some models reject the combination (as a 400 on submit or as a failed job), some use the frame images alone, and some use both (e.g. Runway applies image references as style/guidance alongside the frame anchors). | | +| `previous_job_id` | *Optional[str]* | ➖ | ID of a completed video job to edit or extend, as returned by the submit response. The new job runs on the same model and endpoint that produced the previous one. Only models that support continuation accept this field. | gen-vid-1789493115-a1B2c3D4e5F6g7H8i9J0 | +| `prompt` | *Optional[str]* | ➖ | Text prompt describing the video to generate. Optional for models that support generating a video from image input alone; required by all other models. | A serene mountain landscape at sunset | +| `provider` | [Optional[components.VideoGenerationRequestProvider]](../../components/videogenerationrequestprovider.mdx) | ➖ | Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. Sorting by price, latency, or throughput and automatic provider fallbacks are not supported. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing. | | +| `resolution` | [Optional[components.VideoGenerationRequestResolution]](../../components/videogenerationrequestresolution.mdx) | ➖ | Resolution of the generated video | 720p | +| `seed` | *Optional[int]* | ➖ | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. POST /videos returns 400 if every otherwise eligible endpoint explicitly declares seed unsupported. | | +| `session_id` | *Optional[str]* | ➖ | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. | session-1234 | +| `size` | *Optional[str]* | ➖ | Exact pixel dimensions of the generated video in "WIDTHxHEIGHT" format (e.g. "1280x720"). Interchangeable with resolution + aspect_ratio. | 1280x720 | +| `trace` | [Optional[components.TraceConfig]](../../components/traceconfig.mdx) | ➖ | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | \{
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
} | +| `upscale_factor` | *Optional[float]* | ➖ | Upscale factor for video upscaling models only. This parameter is not supported by video generation models. | 2 | +| `user` | *Optional[str]* | ➖ | A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider. | user-1234 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/pyproject.toml b/pyproject.toml index 19c1b1d51..cf1ec5a34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.211" +version = "1.3.212" 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 ca833f108..59b82f600 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.3.211" +__version__: str = "1.3.212" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.950.13" -__user_agent__: str = "speakeasy-sdk/python 1.3.211 2.950.13 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.212 2.950.13 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/api_keys.py b/src/openrouter/api_keys.py index 359f989de..1dffa8ac0 100644 --- a/src/openrouter/api_keys.py +++ b/src/openrouter/api_keys.py @@ -361,6 +361,7 @@ def next_func() -> Optional[operations.ListResponse]: include_expired=request.include_expired, offset=next_offset, workspace_id=request.workspace_id, + creator_user_id=request.creator_user_id, ), retries=retries, server_url=server_url, @@ -527,6 +528,7 @@ async def empty_result(): include_expired=request.include_expired, offset=next_offset, workspace_id=request.workspace_id, + creator_user_id=request.creator_user_id, ), retries=retries, server_url=server_url, diff --git a/src/openrouter/batch.py b/src/openrouter/batch.py index a333c0862..4c1c1c81d 100644 --- a/src/openrouter/batch.py +++ b/src/openrouter/batch.py @@ -801,7 +801,7 @@ def delete( errors.BatchErrorResponseData, http_res ) raise errors.BatchErrorResponse(response_data, http_res) - if utils.match_response(http_res, ["500", "502"], "application/json"): + if utils.match_response(http_res, ["500", "502", "503"], "application/json"): response_data = unmarshal_json_response( errors.BatchErrorResponseData, http_res ) @@ -926,7 +926,7 @@ async def delete_async( errors.BatchErrorResponseData, http_res ) raise errors.BatchErrorResponse(response_data, http_res) - if utils.match_response(http_res, ["500", "502"], "application/json"): + if utils.match_response(http_res, ["500", "502", "503"], "application/json"): response_data = unmarshal_json_response( errors.BatchErrorResponseData, http_res ) @@ -1203,3 +1203,348 @@ async def get_batches_async( ) raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def get_results( + self, + *, + id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + limit: Optional[int] = None, + cursor: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[operations.GetBatchResultsResponse]: + r"""Get batch results + + Returns a cursor-paginated page of normalized OpenRouter-format results for a finished batch. Pass the previous page's `next_cursor` as `cursor` to read the next page. Pages are stable across retries for the 30-day artifact retention window. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart). + + :param id: The batch job id returned from submit. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param limit: Maximum number of result items to return, from 1 through 1000. + :param cursor: Opaque pagination cursor from the previous page's `next_cursor`. Omit for the first page. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetBatchResultsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + limit=limit, + cursor=cursor, + ) + + req = self._build_request( + method="GET", + path="/batches/{id}/results", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetBatchResultsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getBatchResults", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Batch"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + def next_func() -> Optional[operations.GetBatchResultsResponse]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + next_cursor = JSONPath("$.next_cursor").parse(body) + + if len(next_cursor) == 0: + return None + + next_cursor = next_cursor[0] + if next_cursor is None or str(next_cursor).strip() == "": + return None + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return None + + return self.get_results( + id=id, + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + limit=limit, + cursor=next_cursor, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.GetBatchResultsResponse( + result=unmarshal_json_response( + components.BatchResultsPageResponse, http_res + ), + next=next_func, + ) + if utils.match_response(http_res, "402", "application/json"): + response_data = unmarshal_json_response( + errors.BatchPaymentRequiredResponseErrorData, http_res + ) + raise errors.BatchPaymentRequiredResponseError(response_data, http_res) + if utils.match_response( + http_res, + ["400", "401", "404", "409", "410", "413", "429"], + "application/json", + ): + response_data = unmarshal_json_response( + errors.BatchErrorResponseData, http_res + ) + raise errors.BatchErrorResponse(response_data, http_res) + if utils.match_response(http_res, ["500", "502"], "application/json"): + response_data = unmarshal_json_response( + errors.BatchErrorResponseData, http_res + ) + raise errors.BatchErrorResponse(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def get_results_async( + self, + *, + id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + limit: Optional[int] = None, + cursor: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[operations.GetBatchResultsResponse]: + r"""Get batch results + + Returns a cursor-paginated page of normalized OpenRouter-format results for a finished batch. Pass the previous page's `next_cursor` as `cursor` to read the next page. Pages are stable across retries for the 30-day artifact retention window. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart). + + :param id: The batch job id returned from submit. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param limit: Maximum number of result items to return, from 1 through 1000. + :param cursor: Opaque pagination cursor from the previous page's `next_cursor`. Omit for the first page. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetBatchResultsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + limit=limit, + cursor=cursor, + ) + + req = self._build_request_async( + method="GET", + path="/batches/{id}/results", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetBatchResultsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getBatchResults", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Batch"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + def next_func() -> Awaitable[Optional[operations.GetBatchResultsResponse]]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + async def empty_result(): + return None + + next_cursor = JSONPath("$.next_cursor").parse(body) + + if len(next_cursor) == 0: + return empty_result() + + next_cursor = next_cursor[0] + if next_cursor is None or str(next_cursor).strip() == "": + return empty_result() + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return empty_result() + + return self.get_results_async( + id=id, + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + limit=limit, + cursor=next_cursor, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.GetBatchResultsResponse( + result=unmarshal_json_response( + components.BatchResultsPageResponse, http_res + ), + next=next_func, + ) + if utils.match_response(http_res, "402", "application/json"): + response_data = unmarshal_json_response( + errors.BatchPaymentRequiredResponseErrorData, http_res + ) + raise errors.BatchPaymentRequiredResponseError(response_data, http_res) + if utils.match_response( + http_res, + ["400", "401", "404", "409", "410", "413", "429"], + "application/json", + ): + response_data = unmarshal_json_response( + errors.BatchErrorResponseData, http_res + ) + raise errors.BatchErrorResponse(response_data, http_res) + if utils.match_response(http_res, ["500", "502"], "application/json"): + response_data = unmarshal_json_response( + errors.BatchErrorResponseData, http_res + ) + raise errors.BatchErrorResponse(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 3506483d9..56bef4aee 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -849,114 +849,123 @@ ) from .batchliststatus import BatchListStatus from .batchobject import ( - Annotation, - AnnotationContentUnion, - AnnotationContentUnionTypedDict, - AnnotationFile, - AnnotationFileTypedDict, - AnnotationTypeFile, - AnnotationTypeURLCitation, - AnnotationTypedDict, - AnnotationURLCitation, - AnnotationURLCitationTypedDict, - AnnotationWebSearchCitation, - AnnotationWebSearchCitationTypedDict, - Audio, - AudioPcm1, - AudioPcm1TypedDict, - AudioPcm2, - AudioPcm2TypedDict, - AudioTypedDict, BatchObject, BatchObjectCompletionTokensDetails, BatchObjectCompletionTokensDetailsTypedDict, BatchObjectCompletionWindow, - BatchObjectData, - BatchObjectDataTypedDict, - BatchObjectDebug, - BatchObjectDebugTypedDict, BatchObjectError, BatchObjectErrorTypedDict, - BatchObjectEvent, - BatchObjectFile, - BatchObjectFileTypedDict, - BatchObjectFormat1, - BatchObjectFormat2, - BatchObjectFunction, - BatchObjectFunctionTypedDict, - BatchObjectImageURL, - BatchObjectImageURLTypedDict, - BatchObjectObjectBatch, + BatchObjectObject, BatchObjectPromptTokensDetails, BatchObjectPromptTokensDetailsTypedDict, BatchObjectRequestCounts, BatchObjectRequestCountsTypedDict, - BatchObjectResponse, - BatchObjectResponseTypedDict, - BatchObjectRole, BatchObjectServerToolUse, - BatchObjectServerToolUseDetails, - BatchObjectServerToolUseDetailsTypedDict, BatchObjectServerToolUseTypedDict, BatchObjectStatus, - BatchObjectTimings, - BatchObjectTimingsTypedDict, - BatchObjectTypeMessage, BatchObjectTypedDict, - BatchObjectURLCitation, - BatchObjectURLCitationTypedDict, BatchObjectUsage, BatchObjectUsageTypedDict, + ) + from .batchoutputreference import ( + BatchOutputReference, + BatchOutputReferenceTypedDict, + ) + from .batchpaymentrequiredresponse_error import ( + BatchPaymentRequiredResponseCompletionTokensDetails, + BatchPaymentRequiredResponseCompletionTokensDetailsTypedDict, + BatchPaymentRequiredResponseCompletionWindow, + BatchPaymentRequiredResponseError, + BatchPaymentRequiredResponseErrorTypedDict, + BatchPaymentRequiredResponseObject, + BatchPaymentRequiredResponsePromptTokensDetails, + BatchPaymentRequiredResponsePromptTokensDetailsTypedDict, + BatchPaymentRequiredResponseRequestCounts, + BatchPaymentRequiredResponseRequestCountsTypedDict, + BatchPaymentRequiredResponseServerToolUse, + BatchPaymentRequiredResponseServerToolUseTypedDict, + BatchPaymentRequiredResponseStatus, + BatchPaymentRequiredResponseUsage, + BatchPaymentRequiredResponseUsageTypedDict, + ) + from .batchproviderpreferences import ( + BatchProviderPreferences, + BatchProviderPreferencesOnly, + BatchProviderPreferencesOnlyTypedDict, + BatchProviderPreferencesTypedDict, + ) + from .batchresult import ( + Audio, + AudioPcm1, + AudioPcm1TypedDict, + AudioPcm2, + AudioPcm2TypedDict, + AudioTypedDict, + BatchResult, + BatchResultCompletionTokensDetails, + BatchResultCompletionTokensDetailsTypedDict, + BatchResultContent, + BatchResultContentTypedDict, + BatchResultData, + BatchResultDataTypedDict, + BatchResultDebug, + BatchResultDebugTypedDict, + BatchResultError, + BatchResultErrorTypedDict, + BatchResultEvent, + BatchResultFormat1, + BatchResultFormat2, + BatchResultFunction, + BatchResultFunctionTypedDict, + BatchResultImageURL, + BatchResultImageURLTypedDict, + BatchResultObjectChatCompletion, + BatchResultObjectList, + BatchResultPromptTokensDetails1, + BatchResultPromptTokensDetails1TypedDict, + BatchResultPromptTokensDetails2, + BatchResultPromptTokensDetails2TypedDict, + BatchResultResponse, + BatchResultResponseTypedDict, + BatchResultRole, + BatchResultServerToolUse, + BatchResultServerToolUseDetails, + BatchResultServerToolUseDetailsTypedDict, + BatchResultServerToolUseTypedDict, + BatchResultTimings, + BatchResultTimingsTypedDict, + BatchResultTypeMessage, + BatchResultTypedDict, + BatchResultUsage1, + BatchResultUsage1TypedDict, + BatchResultUsage2, + BatchResultUsage2TypedDict, + BatchResultUsage3, + BatchResultUsage3TypedDict, + BatchResultUsage4, + BatchResultUsage4TypedDict, Body, BodyAudioSpeech, BodyAudioSpeechTypedDict, BodyChatCompletion, BodyChatCompletionTypedDict, - BodyCompletionTokensDetails, - BodyCompletionTokensDetailsTypedDict, BodyList, BodyListTypedDict, BodyMessage, BodyMessageTypedDict, - BodyObjectChatCompletion, - BodyObjectList, - BodyPromptTokensDetails1, - BodyPromptTokensDetails1TypedDict, - BodyPromptTokensDetails2, - BodyPromptTokensDetails2TypedDict, - BodyServerToolUse, - BodyServerToolUseTypedDict, BodyTypedDict, - BodyUsage1, - BodyUsage1TypedDict, - BodyUsage2, - BodyUsage2TypedDict, - BodyUsage3, - BodyUsage3TypedDict, - BodyUsage4, - BodyUsage4TypedDict, Choice, ChoiceRole, ChoiceTypeFunction, ChoiceTypeImageURL, ChoiceTypedDict, - ContentImageURL, - ContentImageURLImageURL, - ContentImageURLImageURLTypedDict, - ContentImageURLTypedDict, - ContentText, - ContentTextTypedDict, ContentTopLogprob, ContentTopLogprobTypedDict, Embedding, EmbeddingTypedDict, - FileTypeImageURL, - FileTypeText, Image, ImageTypedDict, Logprobs, - LogprobsContent, - LogprobsContentTypedDict, LogprobsTypedDict, Message, MessageTypedDict, @@ -968,45 +977,14 @@ RefusalTopLogprob, RefusalTopLogprobTypedDict, RefusalTypedDict, - Result, - ResultError, - ResultErrorTypedDict, - ResultTypedDict, ToolCall, ToolCallTypedDict, - TypeWebSearchCitation, - UnknownAnnotation, - UnknownAnnotationContentUnion, UnknownReasoningDetail, - WebSearchCitation, - WebSearchCitationTypedDict, ) - from .batchoutputreference import ( - BatchOutputReference, - BatchOutputReferenceTypedDict, - ) - from .batchpaymentrequiredresponse_error import ( - BatchPaymentRequiredResponseCompletionTokensDetails, - BatchPaymentRequiredResponseCompletionTokensDetailsTypedDict, - BatchPaymentRequiredResponseCompletionWindow, - BatchPaymentRequiredResponseError, - BatchPaymentRequiredResponseErrorTypedDict, - BatchPaymentRequiredResponseObject, - BatchPaymentRequiredResponsePromptTokensDetails, - BatchPaymentRequiredResponsePromptTokensDetailsTypedDict, - BatchPaymentRequiredResponseRequestCounts, - BatchPaymentRequiredResponseRequestCountsTypedDict, - BatchPaymentRequiredResponseServerToolUse, - BatchPaymentRequiredResponseServerToolUseTypedDict, - BatchPaymentRequiredResponseStatus, - BatchPaymentRequiredResponseUsage, - BatchPaymentRequiredResponseUsageTypedDict, - ) - from .batchproviderpreferences import ( - BatchProviderPreferences, - BatchProviderPreferencesOnly, - BatchProviderPreferencesOnlyTypedDict, - BatchProviderPreferencesTypedDict, + from .batchresultspageresponse import ( + BatchResultsPageResponse, + BatchResultsPageResponseObject, + BatchResultsPageResponseTypedDict, ) from .batchsubmitbody import ( BatchSubmitBody, @@ -1121,6 +1099,11 @@ ChangeGuardrailPolicyAssignmentResponse, ChangeGuardrailPolicyAssignmentResponseTypedDict, ) + from .chatannotation import ( + ChatAnnotation, + ChatAnnotationTypedDict, + UnknownChatAnnotation, + ) from .chatassistantimages import ( ChatAssistantImages, ChatAssistantImagesImageURL, @@ -1195,6 +1178,24 @@ ChatDynamicServerTool, ChatDynamicServerToolTypedDict, ) + from .chatfileannotation import ( + ChatFileAnnotation, + ChatFileAnnotationContentUnion, + ChatFileAnnotationContentUnionTypedDict, + ChatFileAnnotationFile, + ChatFileAnnotationFileTypedDict, + ChatFileAnnotationImageURL, + ChatFileAnnotationImageURLTypedDict, + ChatFileAnnotationTypeFile, + ChatFileAnnotationTypedDict, + ContentImageURL, + ContentImageURLTypedDict, + ContentText, + ContentTextTypedDict, + FileTypeImageURL, + FileTypeText, + UnknownChatFileAnnotationContentUnion, + ) from .chatfinishreasonenum import ChatFinishReasonEnum from .chatformatgrammarconfig import ( ChatFormatGrammarConfig, @@ -1331,6 +1332,13 @@ ChatToolMessageRole, ChatToolMessageTypedDict, ) + from .chaturlcitationannotation import ( + ChatURLCitationAnnotation, + ChatURLCitationAnnotationType, + ChatURLCitationAnnotationTypedDict, + ChatURLCitationAnnotationURLCitation, + ChatURLCitationAnnotationURLCitationTypedDict, + ) from .chatusage import ( ChatUsage, ChatUsageCompletionTokensDetails, @@ -1346,6 +1354,13 @@ ChatUserMessageRole, ChatUserMessageTypedDict, ) + from .chatwebsearchcitationannotation import ( + ChatWebSearchCitationAnnotation, + ChatWebSearchCitationAnnotationType, + ChatWebSearchCitationAnnotationTypedDict, + WebSearchCitation, + WebSearchCitationTypedDict, + ) from .chatwebsearchshorthand import ( ChatWebSearchShorthand, ChatWebSearchShorthandType, @@ -5314,21 +5329,9 @@ "AlignmentUnavailableCallRecordTypedDict", "Allow", "AllowTypedDict", - "Annotation", "AnnotationAddedEvent", "AnnotationAddedEventType", "AnnotationAddedEventTypedDict", - "AnnotationContentUnion", - "AnnotationContentUnionTypedDict", - "AnnotationFile", - "AnnotationFileTypedDict", - "AnnotationTypeFile", - "AnnotationTypeURLCitation", - "AnnotationTypedDict", - "AnnotationURLCitation", - "AnnotationURLCitationTypedDict", - "AnnotationWebSearchCitation", - "AnnotationWebSearchCitationTypedDict", "AnthropicAdvisorMessageUsageIteration", "AnthropicAdvisorMessageUsageIterationType", "AnthropicAdvisorMessageUsageIterationTypedDict", @@ -5803,40 +5806,17 @@ "BatchObjectCompletionTokensDetails", "BatchObjectCompletionTokensDetailsTypedDict", "BatchObjectCompletionWindow", - "BatchObjectData", - "BatchObjectDataTypedDict", - "BatchObjectDebug", - "BatchObjectDebugTypedDict", "BatchObjectError", "BatchObjectErrorTypedDict", - "BatchObjectEvent", - "BatchObjectFile", - "BatchObjectFileTypedDict", - "BatchObjectFormat1", - "BatchObjectFormat2", - "BatchObjectFunction", - "BatchObjectFunctionTypedDict", - "BatchObjectImageURL", - "BatchObjectImageURLTypedDict", - "BatchObjectObjectBatch", + "BatchObjectObject", "BatchObjectPromptTokensDetails", "BatchObjectPromptTokensDetailsTypedDict", "BatchObjectRequestCounts", "BatchObjectRequestCountsTypedDict", - "BatchObjectResponse", - "BatchObjectResponseTypedDict", - "BatchObjectRole", "BatchObjectServerToolUse", - "BatchObjectServerToolUseDetails", - "BatchObjectServerToolUseDetailsTypedDict", "BatchObjectServerToolUseTypedDict", "BatchObjectStatus", - "BatchObjectTimings", - "BatchObjectTimingsTypedDict", - "BatchObjectTypeMessage", "BatchObjectTypedDict", - "BatchObjectURLCitation", - "BatchObjectURLCitationTypedDict", "BatchObjectUsage", "BatchObjectUsageTypedDict", "BatchOutputReference", @@ -5860,6 +5840,52 @@ "BatchProviderPreferencesOnly", "BatchProviderPreferencesOnlyTypedDict", "BatchProviderPreferencesTypedDict", + "BatchResult", + "BatchResultCompletionTokensDetails", + "BatchResultCompletionTokensDetailsTypedDict", + "BatchResultContent", + "BatchResultContentTypedDict", + "BatchResultData", + "BatchResultDataTypedDict", + "BatchResultDebug", + "BatchResultDebugTypedDict", + "BatchResultError", + "BatchResultErrorTypedDict", + "BatchResultEvent", + "BatchResultFormat1", + "BatchResultFormat2", + "BatchResultFunction", + "BatchResultFunctionTypedDict", + "BatchResultImageURL", + "BatchResultImageURLTypedDict", + "BatchResultObjectChatCompletion", + "BatchResultObjectList", + "BatchResultPromptTokensDetails1", + "BatchResultPromptTokensDetails1TypedDict", + "BatchResultPromptTokensDetails2", + "BatchResultPromptTokensDetails2TypedDict", + "BatchResultResponse", + "BatchResultResponseTypedDict", + "BatchResultRole", + "BatchResultServerToolUse", + "BatchResultServerToolUseDetails", + "BatchResultServerToolUseDetailsTypedDict", + "BatchResultServerToolUseTypedDict", + "BatchResultTimings", + "BatchResultTimingsTypedDict", + "BatchResultTypeMessage", + "BatchResultTypedDict", + "BatchResultUsage1", + "BatchResultUsage1TypedDict", + "BatchResultUsage2", + "BatchResultUsage2TypedDict", + "BatchResultUsage3", + "BatchResultUsage3TypedDict", + "BatchResultUsage4", + "BatchResultUsage4TypedDict", + "BatchResultsPageResponse", + "BatchResultsPageResponseObject", + "BatchResultsPageResponseTypedDict", "BatchSubmitBody", "BatchSubmitBodyCompletionWindow", "BatchSubmitBodyTypedDict", @@ -5869,29 +5895,11 @@ "BodyAudioSpeechTypedDict", "BodyChatCompletion", "BodyChatCompletionTypedDict", - "BodyCompletionTokensDetails", - "BodyCompletionTokensDetailsTypedDict", "BodyList", "BodyListTypedDict", "BodyMessage", "BodyMessageTypedDict", - "BodyObjectChatCompletion", - "BodyObjectList", - "BodyPromptTokensDetails1", - "BodyPromptTokensDetails1TypedDict", - "BodyPromptTokensDetails2", - "BodyPromptTokensDetails2TypedDict", - "BodyServerToolUse", - "BodyServerToolUseTypedDict", "BodyTypedDict", - "BodyUsage1", - "BodyUsage1TypedDict", - "BodyUsage2", - "BodyUsage2TypedDict", - "BodyUsage3", - "BodyUsage3TypedDict", - "BodyUsage4", - "BodyUsage4TypedDict", "BooleanCapability", "BooleanCapabilityType", "BooleanCapabilityTypedDict", @@ -5952,6 +5960,8 @@ "ChangeGuardrailPolicyAssignmentRequestTypedDict", "ChangeGuardrailPolicyAssignmentResponse", "ChangeGuardrailPolicyAssignmentResponseTypedDict", + "ChatAnnotation", + "ChatAnnotationTypedDict", "ChatAssistantImages", "ChatAssistantImagesImageURL", "ChatAssistantImagesImageURLTypedDict", @@ -6004,6 +6014,15 @@ "ChatDeveloperMessageTypedDict", "ChatDynamicServerTool", "ChatDynamicServerToolTypedDict", + "ChatFileAnnotation", + "ChatFileAnnotationContentUnion", + "ChatFileAnnotationContentUnionTypedDict", + "ChatFileAnnotationFile", + "ChatFileAnnotationFileTypedDict", + "ChatFileAnnotationImageURL", + "ChatFileAnnotationImageURLTypedDict", + "ChatFileAnnotationTypeFile", + "ChatFileAnnotationTypedDict", "ChatFinishReasonEnum", "ChatFormatGrammarConfig", "ChatFormatGrammarConfigType", @@ -6103,6 +6122,11 @@ "ChatToolMessageContentTypedDict", "ChatToolMessageRole", "ChatToolMessageTypedDict", + "ChatURLCitationAnnotation", + "ChatURLCitationAnnotationType", + "ChatURLCitationAnnotationTypedDict", + "ChatURLCitationAnnotationURLCitation", + "ChatURLCitationAnnotationURLCitationTypedDict", "ChatUsage", "ChatUsageCompletionTokensDetails", "ChatUsageCompletionTokensDetailsTypedDict", @@ -6114,6 +6138,9 @@ "ChatUserMessageContentTypedDict", "ChatUserMessageRole", "ChatUserMessageTypedDict", + "ChatWebSearchCitationAnnotation", + "ChatWebSearchCitationAnnotationType", + "ChatWebSearchCitationAnnotationTypedDict", "ChatWebSearchShorthand", "ChatWebSearchShorthandType", "ChatWebSearchShorthandTypedDict", @@ -6240,8 +6267,6 @@ "ContentFilterReadEntryTypedDict", "ContentFilterTypedDict", "ContentImageURL", - "ContentImageURLImageURL", - "ContentImageURLImageURLTypedDict", "ContentImageURLTypedDict", "ContentPartAddedEvent", "ContentPartAddedEventPart", @@ -7207,8 +7232,6 @@ "Logprob", "LogprobTypedDict", "Logprobs", - "LogprobsContent", - "LogprobsContentTypedDict", "LogprobsTypedDict", "ManagedPrivateEndpoint", "ManagedPrivateEndpointResponse", @@ -8307,10 +8330,6 @@ "ResponsesRequestTypedDict", "ResponsesStreamingResponse", "ResponsesStreamingResponseTypedDict", - "Result", - "ResultError", - "ResultErrorTypedDict", - "ResultTypedDict", "Route", "RouteTypedDict", "RoutedServiceTier", @@ -8771,7 +8790,6 @@ "TypeToolSearchOutput", "TypeTypedDict", "TypeUnavailable", - "TypeWebSearchCitation", "URLCitation", "URLCitationType", "URLCitationTypedDict", @@ -8810,8 +8828,6 @@ "UnknownAccountGuardrailPolicy", "UnknownAlignmentCallRecord", "UnknownAlignmentResponsesRejected", - "UnknownAnnotation", - "UnknownAnnotationContentUnion", "UnknownAnthropicBashCodeExecutionContent", "UnknownAnthropicCaller", "UnknownAnthropicCodeExecutionContent", @@ -8823,7 +8839,9 @@ "UnknownApplyPatchCallOperation", "UnknownBaseInputsContent1", "UnknownCapabilityDescriptor", + "UnknownChatAnnotation", "UnknownChatContentItems", + "UnknownChatFileAnnotationContentUnion", "UnknownContentPartAddedEventPart", "UnknownContentPartDoneEventPart", "UnknownDecisionsResponseAnswers", @@ -9632,137 +9650,23 @@ "BatchListResponseObject": ".batchlistresponse", "BatchListResponseTypedDict": ".batchlistresponse", "BatchListStatus": ".batchliststatus", - "Annotation": ".batchobject", - "AnnotationContentUnion": ".batchobject", - "AnnotationContentUnionTypedDict": ".batchobject", - "AnnotationFile": ".batchobject", - "AnnotationFileTypedDict": ".batchobject", - "AnnotationTypeFile": ".batchobject", - "AnnotationTypeURLCitation": ".batchobject", - "AnnotationTypedDict": ".batchobject", - "AnnotationURLCitation": ".batchobject", - "AnnotationURLCitationTypedDict": ".batchobject", - "AnnotationWebSearchCitation": ".batchobject", - "AnnotationWebSearchCitationTypedDict": ".batchobject", - "Audio": ".batchobject", - "AudioPcm1": ".batchobject", - "AudioPcm1TypedDict": ".batchobject", - "AudioPcm2": ".batchobject", - "AudioPcm2TypedDict": ".batchobject", - "AudioTypedDict": ".batchobject", "BatchObject": ".batchobject", "BatchObjectCompletionTokensDetails": ".batchobject", "BatchObjectCompletionTokensDetailsTypedDict": ".batchobject", "BatchObjectCompletionWindow": ".batchobject", - "BatchObjectData": ".batchobject", - "BatchObjectDataTypedDict": ".batchobject", - "BatchObjectDebug": ".batchobject", - "BatchObjectDebugTypedDict": ".batchobject", "BatchObjectError": ".batchobject", "BatchObjectErrorTypedDict": ".batchobject", - "BatchObjectEvent": ".batchobject", - "BatchObjectFile": ".batchobject", - "BatchObjectFileTypedDict": ".batchobject", - "BatchObjectFormat1": ".batchobject", - "BatchObjectFormat2": ".batchobject", - "BatchObjectFunction": ".batchobject", - "BatchObjectFunctionTypedDict": ".batchobject", - "BatchObjectImageURL": ".batchobject", - "BatchObjectImageURLTypedDict": ".batchobject", - "BatchObjectObjectBatch": ".batchobject", + "BatchObjectObject": ".batchobject", "BatchObjectPromptTokensDetails": ".batchobject", "BatchObjectPromptTokensDetailsTypedDict": ".batchobject", "BatchObjectRequestCounts": ".batchobject", "BatchObjectRequestCountsTypedDict": ".batchobject", - "BatchObjectResponse": ".batchobject", - "BatchObjectResponseTypedDict": ".batchobject", - "BatchObjectRole": ".batchobject", "BatchObjectServerToolUse": ".batchobject", - "BatchObjectServerToolUseDetails": ".batchobject", - "BatchObjectServerToolUseDetailsTypedDict": ".batchobject", "BatchObjectServerToolUseTypedDict": ".batchobject", "BatchObjectStatus": ".batchobject", - "BatchObjectTimings": ".batchobject", - "BatchObjectTimingsTypedDict": ".batchobject", - "BatchObjectTypeMessage": ".batchobject", "BatchObjectTypedDict": ".batchobject", - "BatchObjectURLCitation": ".batchobject", - "BatchObjectURLCitationTypedDict": ".batchobject", "BatchObjectUsage": ".batchobject", "BatchObjectUsageTypedDict": ".batchobject", - "Body": ".batchobject", - "BodyAudioSpeech": ".batchobject", - "BodyAudioSpeechTypedDict": ".batchobject", - "BodyChatCompletion": ".batchobject", - "BodyChatCompletionTypedDict": ".batchobject", - "BodyCompletionTokensDetails": ".batchobject", - "BodyCompletionTokensDetailsTypedDict": ".batchobject", - "BodyList": ".batchobject", - "BodyListTypedDict": ".batchobject", - "BodyMessage": ".batchobject", - "BodyMessageTypedDict": ".batchobject", - "BodyObjectChatCompletion": ".batchobject", - "BodyObjectList": ".batchobject", - "BodyPromptTokensDetails1": ".batchobject", - "BodyPromptTokensDetails1TypedDict": ".batchobject", - "BodyPromptTokensDetails2": ".batchobject", - "BodyPromptTokensDetails2TypedDict": ".batchobject", - "BodyServerToolUse": ".batchobject", - "BodyServerToolUseTypedDict": ".batchobject", - "BodyTypedDict": ".batchobject", - "BodyUsage1": ".batchobject", - "BodyUsage1TypedDict": ".batchobject", - "BodyUsage2": ".batchobject", - "BodyUsage2TypedDict": ".batchobject", - "BodyUsage3": ".batchobject", - "BodyUsage3TypedDict": ".batchobject", - "BodyUsage4": ".batchobject", - "BodyUsage4TypedDict": ".batchobject", - "Choice": ".batchobject", - "ChoiceRole": ".batchobject", - "ChoiceTypeFunction": ".batchobject", - "ChoiceTypeImageURL": ".batchobject", - "ChoiceTypedDict": ".batchobject", - "ContentImageURL": ".batchobject", - "ContentImageURLImageURL": ".batchobject", - "ContentImageURLImageURLTypedDict": ".batchobject", - "ContentImageURLTypedDict": ".batchobject", - "ContentText": ".batchobject", - "ContentTextTypedDict": ".batchobject", - "ContentTopLogprob": ".batchobject", - "ContentTopLogprobTypedDict": ".batchobject", - "Embedding": ".batchobject", - "EmbeddingTypedDict": ".batchobject", - "FileTypeImageURL": ".batchobject", - "FileTypeText": ".batchobject", - "Image": ".batchobject", - "ImageTypedDict": ".batchobject", - "Logprobs": ".batchobject", - "LogprobsContent": ".batchobject", - "LogprobsContentTypedDict": ".batchobject", - "LogprobsTypedDict": ".batchobject", - "Message": ".batchobject", - "MessageTypedDict": ".batchobject", - "ObjectAudioSpeech": ".batchobject", - "ObjectEmbedding": ".batchobject", - "ReasoningDetail": ".batchobject", - "ReasoningDetailTypedDict": ".batchobject", - "Refusal": ".batchobject", - "RefusalTopLogprob": ".batchobject", - "RefusalTopLogprobTypedDict": ".batchobject", - "RefusalTypedDict": ".batchobject", - "Result": ".batchobject", - "ResultError": ".batchobject", - "ResultErrorTypedDict": ".batchobject", - "ResultTypedDict": ".batchobject", - "ToolCall": ".batchobject", - "ToolCallTypedDict": ".batchobject", - "TypeWebSearchCitation": ".batchobject", - "UnknownAnnotation": ".batchobject", - "UnknownAnnotationContentUnion": ".batchobject", - "UnknownReasoningDetail": ".batchobject", - "WebSearchCitation": ".batchobject", - "WebSearchCitationTypedDict": ".batchobject", "BatchOutputReference": ".batchoutputreference", "BatchOutputReferenceTypedDict": ".batchoutputreference", "BatchPaymentRequiredResponseCompletionTokensDetails": ".batchpaymentrequiredresponse_error", @@ -9784,6 +9688,94 @@ "BatchProviderPreferencesOnly": ".batchproviderpreferences", "BatchProviderPreferencesOnlyTypedDict": ".batchproviderpreferences", "BatchProviderPreferencesTypedDict": ".batchproviderpreferences", + "Audio": ".batchresult", + "AudioPcm1": ".batchresult", + "AudioPcm1TypedDict": ".batchresult", + "AudioPcm2": ".batchresult", + "AudioPcm2TypedDict": ".batchresult", + "AudioTypedDict": ".batchresult", + "BatchResult": ".batchresult", + "BatchResultCompletionTokensDetails": ".batchresult", + "BatchResultCompletionTokensDetailsTypedDict": ".batchresult", + "BatchResultContent": ".batchresult", + "BatchResultContentTypedDict": ".batchresult", + "BatchResultData": ".batchresult", + "BatchResultDataTypedDict": ".batchresult", + "BatchResultDebug": ".batchresult", + "BatchResultDebugTypedDict": ".batchresult", + "BatchResultError": ".batchresult", + "BatchResultErrorTypedDict": ".batchresult", + "BatchResultEvent": ".batchresult", + "BatchResultFormat1": ".batchresult", + "BatchResultFormat2": ".batchresult", + "BatchResultFunction": ".batchresult", + "BatchResultFunctionTypedDict": ".batchresult", + "BatchResultImageURL": ".batchresult", + "BatchResultImageURLTypedDict": ".batchresult", + "BatchResultObjectChatCompletion": ".batchresult", + "BatchResultObjectList": ".batchresult", + "BatchResultPromptTokensDetails1": ".batchresult", + "BatchResultPromptTokensDetails1TypedDict": ".batchresult", + "BatchResultPromptTokensDetails2": ".batchresult", + "BatchResultPromptTokensDetails2TypedDict": ".batchresult", + "BatchResultResponse": ".batchresult", + "BatchResultResponseTypedDict": ".batchresult", + "BatchResultRole": ".batchresult", + "BatchResultServerToolUse": ".batchresult", + "BatchResultServerToolUseDetails": ".batchresult", + "BatchResultServerToolUseDetailsTypedDict": ".batchresult", + "BatchResultServerToolUseTypedDict": ".batchresult", + "BatchResultTimings": ".batchresult", + "BatchResultTimingsTypedDict": ".batchresult", + "BatchResultTypeMessage": ".batchresult", + "BatchResultTypedDict": ".batchresult", + "BatchResultUsage1": ".batchresult", + "BatchResultUsage1TypedDict": ".batchresult", + "BatchResultUsage2": ".batchresult", + "BatchResultUsage2TypedDict": ".batchresult", + "BatchResultUsage3": ".batchresult", + "BatchResultUsage3TypedDict": ".batchresult", + "BatchResultUsage4": ".batchresult", + "BatchResultUsage4TypedDict": ".batchresult", + "Body": ".batchresult", + "BodyAudioSpeech": ".batchresult", + "BodyAudioSpeechTypedDict": ".batchresult", + "BodyChatCompletion": ".batchresult", + "BodyChatCompletionTypedDict": ".batchresult", + "BodyList": ".batchresult", + "BodyListTypedDict": ".batchresult", + "BodyMessage": ".batchresult", + "BodyMessageTypedDict": ".batchresult", + "BodyTypedDict": ".batchresult", + "Choice": ".batchresult", + "ChoiceRole": ".batchresult", + "ChoiceTypeFunction": ".batchresult", + "ChoiceTypeImageURL": ".batchresult", + "ChoiceTypedDict": ".batchresult", + "ContentTopLogprob": ".batchresult", + "ContentTopLogprobTypedDict": ".batchresult", + "Embedding": ".batchresult", + "EmbeddingTypedDict": ".batchresult", + "Image": ".batchresult", + "ImageTypedDict": ".batchresult", + "Logprobs": ".batchresult", + "LogprobsTypedDict": ".batchresult", + "Message": ".batchresult", + "MessageTypedDict": ".batchresult", + "ObjectAudioSpeech": ".batchresult", + "ObjectEmbedding": ".batchresult", + "ReasoningDetail": ".batchresult", + "ReasoningDetailTypedDict": ".batchresult", + "Refusal": ".batchresult", + "RefusalTopLogprob": ".batchresult", + "RefusalTopLogprobTypedDict": ".batchresult", + "RefusalTypedDict": ".batchresult", + "ToolCall": ".batchresult", + "ToolCallTypedDict": ".batchresult", + "UnknownReasoningDetail": ".batchresult", + "BatchResultsPageResponse": ".batchresultspageresponse", + "BatchResultsPageResponseObject": ".batchresultspageresponse", + "BatchResultsPageResponseTypedDict": ".batchresultspageresponse", "BatchSubmitBody": ".batchsubmitbody", "BatchSubmitBodyCompletionWindow": ".batchsubmitbody", "BatchSubmitBodyTypedDict": ".batchsubmitbody", @@ -9851,6 +9843,9 @@ "ChangeGuardrailPolicyAssignmentRequestTypedDict": ".changeguardrailpolicyassignmentrequest", "ChangeGuardrailPolicyAssignmentResponse": ".changeguardrailpolicyassignmentresponse", "ChangeGuardrailPolicyAssignmentResponseTypedDict": ".changeguardrailpolicyassignmentresponse", + "ChatAnnotation": ".chatannotation", + "ChatAnnotationTypedDict": ".chatannotation", + "UnknownChatAnnotation": ".chatannotation", "ChatAssistantImages": ".chatassistantimages", "ChatAssistantImagesImageURL": ".chatassistantimages", "ChatAssistantImagesImageURLTypedDict": ".chatassistantimages", @@ -9904,6 +9899,22 @@ "ChatDeveloperMessageTypedDict": ".chatdevelopermessage", "ChatDynamicServerTool": ".chatdynamicservertool", "ChatDynamicServerToolTypedDict": ".chatdynamicservertool", + "ChatFileAnnotation": ".chatfileannotation", + "ChatFileAnnotationContentUnion": ".chatfileannotation", + "ChatFileAnnotationContentUnionTypedDict": ".chatfileannotation", + "ChatFileAnnotationFile": ".chatfileannotation", + "ChatFileAnnotationFileTypedDict": ".chatfileannotation", + "ChatFileAnnotationImageURL": ".chatfileannotation", + "ChatFileAnnotationImageURLTypedDict": ".chatfileannotation", + "ChatFileAnnotationTypeFile": ".chatfileannotation", + "ChatFileAnnotationTypedDict": ".chatfileannotation", + "ContentImageURL": ".chatfileannotation", + "ContentImageURLTypedDict": ".chatfileannotation", + "ContentText": ".chatfileannotation", + "ContentTextTypedDict": ".chatfileannotation", + "FileTypeImageURL": ".chatfileannotation", + "FileTypeText": ".chatfileannotation", + "UnknownChatFileAnnotationContentUnion": ".chatfileannotation", "ChatFinishReasonEnum": ".chatfinishreasonenum", "ChatFormatGrammarConfig": ".chatformatgrammarconfig", "ChatFormatGrammarConfigType": ".chatformatgrammarconfig", @@ -10006,6 +10017,11 @@ "ChatToolMessageContentTypedDict": ".chattoolmessage", "ChatToolMessageRole": ".chattoolmessage", "ChatToolMessageTypedDict": ".chattoolmessage", + "ChatURLCitationAnnotation": ".chaturlcitationannotation", + "ChatURLCitationAnnotationType": ".chaturlcitationannotation", + "ChatURLCitationAnnotationTypedDict": ".chaturlcitationannotation", + "ChatURLCitationAnnotationURLCitation": ".chaturlcitationannotation", + "ChatURLCitationAnnotationURLCitationTypedDict": ".chaturlcitationannotation", "ChatUsage": ".chatusage", "ChatUsageCompletionTokensDetails": ".chatusage", "ChatUsageCompletionTokensDetailsTypedDict": ".chatusage", @@ -10017,6 +10033,11 @@ "ChatUserMessageContentTypedDict": ".chatusermessage", "ChatUserMessageRole": ".chatusermessage", "ChatUserMessageTypedDict": ".chatusermessage", + "ChatWebSearchCitationAnnotation": ".chatwebsearchcitationannotation", + "ChatWebSearchCitationAnnotationType": ".chatwebsearchcitationannotation", + "ChatWebSearchCitationAnnotationTypedDict": ".chatwebsearchcitationannotation", + "WebSearchCitation": ".chatwebsearchcitationannotation", + "WebSearchCitationTypedDict": ".chatwebsearchcitationannotation", "ChatWebSearchShorthand": ".chatwebsearchshorthand", "ChatWebSearchShorthandType": ".chatwebsearchshorthand", "ChatWebSearchShorthandTypedDict": ".chatwebsearchshorthand", diff --git a/src/openrouter/components/batchobject.py b/src/openrouter/components/batchobject.py index b5b450e1f..d9b2cebc2 100644 --- a/src/openrouter/components/batchobject.py +++ b/src/openrouter/components/batchobject.py @@ -1,1790 +1,57 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .alignment import Alignment, AlignmentTypedDict from .anthropiccachecreation import ( AnthropicCacheCreation, AnthropicCacheCreationTypedDict, ) -from .anthropiccontainer import AnthropicContainer, AnthropicContainerTypedDict -from .anthropicinputtransformation import ( - AnthropicInputTransformation, - AnthropicInputTransformationTypedDict, -) -from .anthropicoutputtokensdetails import ( - AnthropicOutputTokensDetails, - AnthropicOutputTokensDetailsTypedDict, -) -from .anthropicrefusalstopdetails import ( - AnthropicRefusalStopDetails, - AnthropicRefusalStopDetailsTypedDict, -) -from .anthropicservertoolusage import ( - AnthropicServerToolUsage, - AnthropicServerToolUsageTypedDict, -) -from .anthropicservicetier import AnthropicServiceTier -from .anthropicspeed import AnthropicSpeed -from .anthropicusageiteration import ( - AnthropicUsageIteration, - AnthropicUsageIterationTypedDict, -) -from .apierrortype import APIErrorType -from .armorsafeguardresult import ArmorSafeguardResult, ArmorSafeguardResultTypedDict -from .batchoutputreference import BatchOutputReference, BatchOutputReferenceTypedDict -from .costdetails import CostDetails, CostDetailsTypedDict -from .finishreason import FinishReason -from .openresponsesresult import OpenResponsesResult, OpenResponsesResultTypedDict -from .openroutermetadata import OpenRouterMetadata, OpenRouterMetadataTypedDict -from .oranthropiccontentblock import ( - ORAnthropicContentBlock, - ORAnthropicContentBlockTypedDict, -) -from .oranthropicstopreason import ORAnthropicStopReason -from .reasoningdetailencrypted import ( - ReasoningDetailEncrypted, - ReasoningDetailEncryptedTypedDict, -) -from .reasoningdetailservertoolcall import ( - ReasoningDetailServerToolCall, - ReasoningDetailServerToolCallTypedDict, -) -from .reasoningdetailsummary import ( - ReasoningDetailSummary, - ReasoningDetailSummaryTypedDict, -) -from .reasoningdetailtext import ReasoningDetailText, ReasoningDetailTextTypedDict -from functools import partial -from openrouter.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, - UnrecognizedStr, -) -from openrouter.utils import validate_const -from openrouter.utils.unions import parse_open_union -import pydantic -from pydantic import ConfigDict, model_serializer -from pydantic.functional_validators import AfterValidator, BeforeValidator -from typing import Any, Dict, List, Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict - - -BatchObjectCompletionWindow = Literal["24h",] - - -class BatchObjectErrorTypedDict(TypedDict): - message: str - - -class BatchObjectError(BaseModel): - message: str - - -BatchObjectObjectBatch = Literal["batch",] - - -class BatchObjectRequestCountsTypedDict(TypedDict): - completed: int - failed: int - total: int - - -class BatchObjectRequestCounts(BaseModel): - completed: int - - failed: int - - total: int - - -class ResultErrorTypedDict(TypedDict): - message: str - param: Nullable[str] - type: str - error_type: NotRequired[APIErrorType] - r"""Canonical OpenRouter error type, stable across all API formats""" - - -class ResultError(BaseModel): - message: str - - param: Nullable[str] - - type: str - - error_type: Optional[APIErrorType] = None - r"""Canonical OpenRouter error type, stable across all API formats""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["error_type"]) - nullable_fields = set(["param"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -BatchObjectFormat2 = Literal["pcm",] - - -class AudioPcm2TypedDict(TypedDict): - bits_per_sample: float - byte_length: int - channels: int - format_: BatchObjectFormat2 - sample_rate: int - sha256: str - - -class AudioPcm2(BaseModel): - bits_per_sample: float - - byte_length: int - - channels: int - - format_: Annotated[BatchObjectFormat2, pydantic.Field(alias="format")] - - sample_rate: int - - sha256: str - - -BatchObjectFormat1 = Literal["pcm",] - - -class AudioPcm1TypedDict(TypedDict): - bits_per_sample: float - channels: int - data: str - r"""Base64-encoded PCM16 audio in the format the sibling fields give.""" - format_: BatchObjectFormat1 - sample_rate: int - - -class AudioPcm1(BaseModel): - bits_per_sample: float - - channels: int - - data: str - r"""Base64-encoded PCM16 audio in the format the sibling fields give.""" - - format_: Annotated[BatchObjectFormat1, pydantic.Field(alias="format")] - - sample_rate: int - - -AudioTypedDict = TypeAliasType( - "AudioTypedDict", Union[AudioPcm1TypedDict, AudioPcm2TypedDict] -) - - -Audio = TypeAliasType("Audio", Union[AudioPcm1, AudioPcm2]) - - -ObjectAudioSpeech = Literal["audio.speech",] - - -class BodyUsage4TypedDict(TypedDict): - completion_tokens: int - prompt_tokens: int - total_tokens: int - - -class BodyUsage4(BaseModel): - completion_tokens: int - - prompt_tokens: int - - total_tokens: int - - -class BodyAudioSpeechTypedDict(TypedDict): - audio: AudioTypedDict - model: str - object: ObjectAudioSpeech - usage: BodyUsage4TypedDict - - -class BodyAudioSpeech(BaseModel): - audio: Audio - - model: str - - object: ObjectAudioSpeech - - usage: BodyUsage4 - - -EmbeddingTypedDict = TypeAliasType("EmbeddingTypedDict", Union[List[float], str]) -r"""Embedding vector as an array of floats or a base64 string""" - - -Embedding = TypeAliasType("Embedding", Union[List[float], str]) -r"""Embedding vector as an array of floats or a base64 string""" - - -ObjectEmbedding = Literal["embedding",] - - -class BatchObjectDataTypedDict(TypedDict): - r"""A single embedding object""" - - embedding: EmbeddingTypedDict - r"""Embedding vector as an array of floats or a base64 string""" - object: ObjectEmbedding - document_index: NotRequired[int] - r"""Index of the source document when `input` was a list of documents (contextual embeddings). Absent otherwise.""" - index: NotRequired[int] - r"""Index of the embedding in the input list""" - - -class BatchObjectData(BaseModel): - r"""A single embedding object""" - - embedding: Embedding - r"""Embedding vector as an array of floats or a base64 string""" - - object: ObjectEmbedding - - document_index: Optional[int] = None - r"""Index of the source document when `input` was a list of documents (contextual embeddings). Absent otherwise.""" - - index: Optional[int] = None - r"""Index of the embedding in the input list""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["document_index", "index"]) - 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 - - -BodyObjectList = Literal["list",] - - -class BodyPromptTokensDetails2TypedDict(TypedDict): - r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.""" - - audio_tokens: NotRequired[int] - r"""Number of audio tokens in the input""" - file_tokens: NotRequired[int] - r"""Number of file/document tokens in the input""" - image_tokens: NotRequired[int] - r"""Number of image tokens in the input""" - text_tokens: NotRequired[int] - r"""Number of text tokens in the input""" - video_tokens: NotRequired[int] - r"""Number of video tokens in the input""" - - -class BodyPromptTokensDetails2(BaseModel): - r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.""" - - audio_tokens: Optional[int] = None - r"""Number of audio tokens in the input""" - - file_tokens: Optional[int] = None - r"""Number of file/document tokens in the input""" - - image_tokens: Optional[int] = None - r"""Number of image tokens in the input""" - - text_tokens: Optional[int] = None - r"""Number of text tokens in the input""" - - video_tokens: Optional[int] = None - r"""Number of video tokens in the input""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "audio_tokens", - "file_tokens", - "image_tokens", - "text_tokens", - "video_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 - - -class BodyUsage3TypedDict(TypedDict): - r"""Token usage statistics""" - - prompt_tokens: int - r"""Number of tokens in the input""" - total_tokens: int - r"""Total number of tokens used""" - cost: NotRequired[float] - r"""Cost of the request in credits""" - cost_details: NotRequired[Nullable[CostDetailsTypedDict]] - r"""Breakdown of upstream inference costs""" - is_byok: NotRequired[bool] - r"""Whether a request was made using a Bring Your Own Key configuration""" - prompt_tokens_details: NotRequired[BodyPromptTokensDetails2TypedDict] - r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.""" - - -class BodyUsage3(BaseModel): - r"""Token usage statistics""" - - prompt_tokens: int - r"""Number of tokens in the input""" - - total_tokens: int - r"""Total number of tokens used""" - - cost: Optional[float] = None - r"""Cost of the request in credits""" - - cost_details: OptionalNullable[CostDetails] = UNSET - r"""Breakdown of upstream inference costs""" - - is_byok: Optional[bool] = None - r"""Whether a request was made using a Bring Your Own Key configuration""" - - prompt_tokens_details: Optional[BodyPromptTokensDetails2] = None - r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["cost", "cost_details", "is_byok", "prompt_tokens_details"] - ) - nullable_fields = set(["cost_details"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class BodyListTypedDict(TypedDict): - r"""Embeddings response containing embedding vectors""" - - data: List[BatchObjectDataTypedDict] - r"""List of embedding objects""" - model: str - r"""The model used for embeddings""" - object: BodyObjectList - id: NotRequired[str] - r"""Unique identifier for the embeddings response""" - usage: NotRequired[BodyUsage3TypedDict] - r"""Token usage statistics""" - - -class BodyList(BaseModel): - r"""Embeddings response containing embedding vectors""" - - data: List[BatchObjectData] - r"""List of embedding objects""" - - model: str - r"""The model used for embeddings""" - - object: BodyObjectList - - id: Optional[str] = None - r"""Unique identifier for the embeddings response""" - - usage: Optional[BodyUsage3] = None - r"""Token usage statistics""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["id", "usage"]) - 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 - - -BatchObjectRole = Literal["assistant",] - - -BatchObjectTypeMessage = Literal["message",] - - -class BodyUsage2TypedDict(TypedDict): - cache_creation: Nullable[AnthropicCacheCreationTypedDict] - cache_creation_input_tokens: Nullable[int] - cache_read_input_tokens: Nullable[int] - inference_geo: Nullable[str] - input_tokens: int - output_tokens: int - output_tokens_details: Nullable[AnthropicOutputTokensDetailsTypedDict] - server_tool_use: Nullable[AnthropicServerToolUsageTypedDict] - service_tier: Nullable[AnthropicServiceTier] - iterations: NotRequired[List[AnthropicUsageIterationTypedDict]] - speed: NotRequired[Nullable[AnthropicSpeed]] - - -class BodyUsage2(BaseModel): - cache_creation: Nullable[AnthropicCacheCreation] - - cache_creation_input_tokens: Nullable[int] - - cache_read_input_tokens: Nullable[int] - - inference_geo: Nullable[str] - - input_tokens: int - - output_tokens: int - - output_tokens_details: Nullable[AnthropicOutputTokensDetails] - - server_tool_use: Nullable[AnthropicServerToolUsage] - - service_tier: Nullable[AnthropicServiceTier] - - iterations: Optional[List[AnthropicUsageIteration]] = None - - speed: OptionalNullable[AnthropicSpeed] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["iterations", "speed"]) - nullable_fields = set( - [ - "cache_creation", - "cache_creation_input_tokens", - "cache_read_input_tokens", - "inference_geo", - "output_tokens_details", - "server_tool_use", - "service_tier", - "speed", - ] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class BodyMessageTypedDict(TypedDict): - container: Nullable[AnthropicContainerTypedDict] - content: List[ORAnthropicContentBlockTypedDict] - id: str - model: str - role: BatchObjectRole - stop_details: Nullable[AnthropicRefusalStopDetailsTypedDict] - r"""Structured information about a refusal""" - stop_reason: Nullable[ORAnthropicStopReason] - stop_sequence: Nullable[str] - type: BatchObjectTypeMessage - usage: BodyUsage2TypedDict - input_transformations: NotRequired[ - Nullable[List[AnthropicInputTransformationTypedDict]] - ] - - -class BodyMessage(BaseModel): - container: Nullable[AnthropicContainer] - - content: List[ORAnthropicContentBlock] - - id: str - - model: str - - role: BatchObjectRole - - stop_details: Nullable[AnthropicRefusalStopDetails] - r"""Structured information about a refusal""" - - stop_reason: Nullable[ORAnthropicStopReason] - - stop_sequence: Nullable[str] - - type: BatchObjectTypeMessage - - usage: BodyUsage2 - - input_transformations: OptionalNullable[List[AnthropicInputTransformation]] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["input_transformations"]) - nullable_fields = set( - [ - "container", - "input_transformations", - "stop_details", - "stop_reason", - "stop_sequence", - ] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class ContentTopLogprobTypedDict(TypedDict): - bytes_: Nullable[List[int]] - logprob: float - token: str - - -class ContentTopLogprob(BaseModel): - bytes_: Annotated[Nullable[List[int]], pydantic.Field(alias="bytes")] - - logprob: float - - token: str - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - m[k] = val - - return m - - -class LogprobsContentTypedDict(TypedDict): - bytes_: Nullable[List[int]] - logprob: float - token: str - top_logprobs: List[ContentTopLogprobTypedDict] - - -class LogprobsContent(BaseModel): - bytes_: Annotated[Nullable[List[int]], pydantic.Field(alias="bytes")] - - logprob: float - - token: str - - top_logprobs: List[ContentTopLogprob] - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - m[k] = val - - return m - - -class RefusalTopLogprobTypedDict(TypedDict): - bytes_: Nullable[List[int]] - logprob: float - token: str - - -class RefusalTopLogprob(BaseModel): - bytes_: Annotated[Nullable[List[int]], pydantic.Field(alias="bytes")] - - logprob: float - - token: str - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - m[k] = val - - return m - - -class RefusalTypedDict(TypedDict): - bytes_: Nullable[List[int]] - logprob: float - token: str - top_logprobs: List[RefusalTopLogprobTypedDict] - - -class Refusal(BaseModel): - bytes_: Annotated[Nullable[List[int]], pydantic.Field(alias="bytes")] - - logprob: float - - token: str - - top_logprobs: List[RefusalTopLogprob] - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - m[k] = val - - return m - - -class LogprobsTypedDict(TypedDict): - content: Nullable[List[LogprobsContentTypedDict]] - refusal: NotRequired[Nullable[List[RefusalTypedDict]]] - - -class Logprobs(BaseModel): - content: Nullable[List[LogprobsContent]] - - refusal: OptionalNullable[List[Refusal]] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["refusal"]) - nullable_fields = set(["content", "refusal"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -TypeWebSearchCitation = Literal["web_search_citation",] - - -class WebSearchCitationTypedDict(TypedDict): - title: Nullable[str] - url: str - cited_text: NotRequired[str] - encrypted_index: NotRequired[str] - - -class WebSearchCitation(BaseModel): - title: Nullable[str] - - url: str - - cited_text: Optional[str] = None - - encrypted_index: Optional[str] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["cited_text", "encrypted_index"]) - nullable_fields = set(["title"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class AnnotationWebSearchCitationTypedDict(TypedDict): - type: TypeWebSearchCitation - web_search_citation: WebSearchCitationTypedDict - - -class AnnotationWebSearchCitation(BaseModel): - type: TypeWebSearchCitation - - web_search_citation: WebSearchCitation - - -AnnotationTypeURLCitation = Literal["url_citation",] - - -class BatchObjectURLCitationTypedDict(TypedDict): - end_index: int - start_index: int - title: str - url: str - content: NotRequired[str] - uncited: Literal[True] - - -class BatchObjectURLCitation(BaseModel): - end_index: int - - start_index: int - - title: str - - url: str - - content: Optional[str] = None - - UNCITED: Annotated[ - Annotated[Optional[Literal[True]], AfterValidator(validate_const(True))], - pydantic.Field(alias="uncited"), - ] = True - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["content", "uncited"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class AnnotationURLCitationTypedDict(TypedDict): - type: AnnotationTypeURLCitation - url_citation: BatchObjectURLCitationTypedDict - - -class AnnotationURLCitation(BaseModel): - type: AnnotationTypeURLCitation - - url_citation: BatchObjectURLCitation - - -class ContentImageURLImageURLTypedDict(TypedDict): - url: str - - -class ContentImageURLImageURL(BaseModel): - url: str - - -FileTypeImageURL = Literal["image_url",] - - -class ContentImageURLTypedDict(TypedDict): - image_url: ContentImageURLImageURLTypedDict - type: FileTypeImageURL - - -class ContentImageURL(BaseModel): - image_url: ContentImageURLImageURL - - type: FileTypeImageURL - - -FileTypeText = Literal["text",] - - -class ContentTextTypedDict(TypedDict): - text: str - type: FileTypeText - - -class ContentText(BaseModel): - text: str - - type: FileTypeText - - -AnnotationContentUnionTypedDict = TypeAliasType( - "AnnotationContentUnionTypedDict", - Union[ContentTextTypedDict, ContentImageURLTypedDict], -) - - -class UnknownAnnotationContentUnion(BaseModel): - r"""A AnnotationContentUnion variant the SDK doesn't recognize. Preserves the raw payload.""" - - type: Literal["UNKNOWN"] = "UNKNOWN" - raw: Any - is_unknown: Literal[True] = True - - model_config = ConfigDict(frozen=True) - - -_ANNOTATION_CONTENT_UNION_VARIANTS: dict[str, Any] = { - "text": ContentText, - "image_url": ContentImageURL, -} - - -AnnotationContentUnion = Annotated[ - Union[ContentText, ContentImageURL, UnknownAnnotationContentUnion], - BeforeValidator( - partial( - parse_open_union, - disc_key="type", - variants=_ANNOTATION_CONTENT_UNION_VARIANTS, - unknown_cls=UnknownAnnotationContentUnion, - union_name="AnnotationContentUnion", - ) - ), -] - - -class BatchObjectFileTypedDict(TypedDict): - content: List[AnnotationContentUnionTypedDict] - hash: str - name: NotRequired[str] - - -class BatchObjectFile(BaseModel): - content: List[AnnotationContentUnion] - - hash: str - - name: Optional[str] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["name"]) - 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 - - -AnnotationTypeFile = Literal["file",] - - -class AnnotationFileTypedDict(TypedDict): - file: BatchObjectFileTypedDict - type: AnnotationTypeFile - - -class AnnotationFile(BaseModel): - file: BatchObjectFile - - type: AnnotationTypeFile - - -AnnotationTypedDict = TypeAliasType( - "AnnotationTypedDict", - Union[ - AnnotationFileTypedDict, - AnnotationURLCitationTypedDict, - AnnotationWebSearchCitationTypedDict, - ], -) - - -class UnknownAnnotation(BaseModel): - r"""A Annotation variant the SDK doesn't recognize. Preserves the raw payload.""" - - type: Literal["UNKNOWN"] = "UNKNOWN" - raw: Any - is_unknown: Literal[True] = True - - model_config = ConfigDict(frozen=True) - - -_ANNOTATION_VARIANTS: dict[str, Any] = { - "file": AnnotationFile, - "url_citation": AnnotationURLCitation, - "web_search_citation": AnnotationWebSearchCitation, -} - - -Annotation = Annotated[ - Union[ - AnnotationFile, - AnnotationURLCitation, - AnnotationWebSearchCitation, - UnknownAnnotation, - ], - BeforeValidator( - partial( - parse_open_union, - disc_key="type", - variants=_ANNOTATION_VARIANTS, - unknown_cls=UnknownAnnotation, - union_name="Annotation", - ) - ), -] - - -class BatchObjectImageURLTypedDict(TypedDict): - url: str - - -class BatchObjectImageURL(BaseModel): - url: str - - -ChoiceTypeImageURL = Literal["image_url",] - - -class ImageTypedDict(TypedDict): - image_url: BatchObjectImageURLTypedDict - type: ChoiceTypeImageURL - - -class Image(BaseModel): - image_url: BatchObjectImageURL - - type: ChoiceTypeImageURL - - -ReasoningDetailTypedDict = TypeAliasType( - "ReasoningDetailTypedDict", - Union[ - ReasoningDetailSummaryTypedDict, - ReasoningDetailEncryptedTypedDict, - ReasoningDetailTextTypedDict, - ReasoningDetailServerToolCallTypedDict, - ], -) - - -class UnknownReasoningDetail(BaseModel): - r"""A ReasoningDetail variant the SDK doesn't recognize. Preserves the raw payload.""" - - type: Literal["UNKNOWN"] = "UNKNOWN" - raw: Any - is_unknown: Literal[True] = True - - model_config = ConfigDict(frozen=True) - - -_REASONING_DETAIL_VARIANTS: dict[str, Any] = { - "reasoning.summary": ReasoningDetailSummary, - "reasoning.encrypted": ReasoningDetailEncrypted, - "reasoning.text": ReasoningDetailText, - "reasoning.server_tool_call": ReasoningDetailServerToolCall, -} - - -ReasoningDetail = Annotated[ - Union[ - ReasoningDetailSummary, - ReasoningDetailEncrypted, - ReasoningDetailText, - ReasoningDetailServerToolCall, - UnknownReasoningDetail, - ], - BeforeValidator( - partial( - parse_open_union, - disc_key="type", - variants=_REASONING_DETAIL_VARIANTS, - unknown_cls=UnknownReasoningDetail, - union_name="ReasoningDetail", - ) - ), -] - - -ChoiceRole = Literal["assistant",] - - -class BatchObjectFunctionTypedDict(TypedDict): - arguments: str - name: str - - -class BatchObjectFunction(BaseModel): - arguments: str - - name: str - - -ChoiceTypeFunction = Literal["function",] - - -class ToolCallTypedDict(TypedDict): - function: BatchObjectFunctionTypedDict - id: str - index: int - type: ChoiceTypeFunction - - -class ToolCall(BaseModel): - function: BatchObjectFunction - - id: str - - index: int - - type: ChoiceTypeFunction - - -class MessageTypedDict(TypedDict): - content: Nullable[str] - refusal: Nullable[str] - role: ChoiceRole - annotations: NotRequired[List[AnnotationTypedDict]] - images: NotRequired[Nullable[List[ImageTypedDict]]] - reasoning: NotRequired[Nullable[str]] - reasoning_details: NotRequired[Nullable[List[Nullable[ReasoningDetailTypedDict]]]] - tool_calls: NotRequired[List[ToolCallTypedDict]] - - -class Message(BaseModel): - content: Nullable[str] - - refusal: Nullable[str] - - role: ChoiceRole - - annotations: Optional[List[Annotation]] = None - - images: OptionalNullable[List[Image]] = UNSET - - reasoning: OptionalNullable[str] = UNSET - - reasoning_details: OptionalNullable[List[Nullable[ReasoningDetail]]] = UNSET - - tool_calls: Optional[List[ToolCall]] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["annotations", "images", "reasoning", "reasoning_details", "tool_calls"] - ) - nullable_fields = set( - ["content", "images", "reasoning", "reasoning_details", "refusal"] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class ChoiceTypedDict(TypedDict): - finish_reason: FinishReason - index: int - logprobs: Nullable[LogprobsTypedDict] - message: MessageTypedDict - native_finish_reason: Nullable[str] - - -class Choice(BaseModel): - finish_reason: FinishReason - - index: int - - logprobs: Nullable[Logprobs] - - message: Message - - native_finish_reason: Nullable[str] - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - m[k] = val - - return m - - -BatchObjectEvent = Union[ - Literal[ - "adapter_request", - "upstream_headers_received", - "first_token_received", - "upstream_body_ended", - ], - UnrecognizedStr, -] - - -class BatchObjectTimingsTypedDict(TypedDict): - epoch_ms: int - event: BatchObjectEvent - start_ms: int - - -class BatchObjectTimings(BaseModel): - epoch_ms: int - - event: BatchObjectEvent - - start_ms: int - - -class BatchObjectDebugTypedDict(TypedDict): - echo_upstream_body: NotRequired[Dict[str, Any]] - timings: NotRequired[BatchObjectTimingsTypedDict] - - -class BatchObjectDebug(BaseModel): - model_config = ConfigDict( - populate_by_name=True, arbitrary_types_allowed=True, extra="allow" - ) - __pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False) - - echo_upstream_body: Optional[Dict[str, Any]] = None - - timings: Optional[BatchObjectTimings] = None - - @property - def additional_properties(self): - return self.__pydantic_extra__ - - @additional_properties.setter - def additional_properties(self, value): - self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["echo_upstream_body", "timings"]) - 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)) - serialized.pop(k, serialized.pop(n, None)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - for k, v in serialized.items(): - m[k] = v - - return m - - -BodyObjectChatCompletion = Literal["chat.completion",] - - -class BodyCompletionTokensDetailsTypedDict(TypedDict): - audio_tokens: NotRequired[Nullable[int]] - r"""Tokens generated by the model for audio output.""" - image_tokens: NotRequired[Nullable[int]] - r"""Tokens generated by the model for image output.""" - reasoning_tokens: NotRequired[Nullable[int]] - r"""Tokens generated by the model for reasoning.""" - - -class BodyCompletionTokensDetails(BaseModel): - audio_tokens: OptionalNullable[int] = UNSET - r"""Tokens generated by the model for audio output.""" - - image_tokens: OptionalNullable[int] = UNSET - r"""Tokens generated by the model for image output.""" - - reasoning_tokens: OptionalNullable[int] = UNSET - r"""Tokens generated by the model for reasoning.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["audio_tokens", "image_tokens", "reasoning_tokens"]) - nullable_fields = set(["audio_tokens", "image_tokens", "reasoning_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)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class BodyPromptTokensDetails1TypedDict(TypedDict): - r"""Breakdown of tokens used in the prompt.""" - - audio_tokens: NotRequired[Nullable[int]] - r"""Tokens used for input audio.""" - cache_write_tokens: NotRequired[Nullable[int]] - r"""Tokens written to cache. Only returned for models with explicit caching and cache write pricing.""" - cached_tokens: NotRequired[Nullable[int]] - r"""Tokens cached by the endpoint.""" - file_tokens: NotRequired[Nullable[int]] - r"""Tokens used for input files/documents.""" - video_tokens: NotRequired[Nullable[int]] - r"""Tokens used for input video.""" - - -class BodyPromptTokensDetails1(BaseModel): - r"""Breakdown of tokens used in the prompt.""" - - audio_tokens: OptionalNullable[int] = UNSET - r"""Tokens used for input audio.""" - - cache_write_tokens: OptionalNullable[int] = UNSET - r"""Tokens written to cache. Only returned for models with explicit caching and cache write pricing.""" - - cached_tokens: OptionalNullable[int] = UNSET - r"""Tokens cached by the endpoint.""" - - file_tokens: OptionalNullable[int] = UNSET - r"""Tokens used for input files/documents.""" - - video_tokens: OptionalNullable[int] = UNSET - r"""Tokens used for input video.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "audio_tokens", - "cache_write_tokens", - "cached_tokens", - "file_tokens", - "video_tokens", - ] - ) - nullable_fields = set( - [ - "audio_tokens", - "cache_write_tokens", - "cached_tokens", - "file_tokens", - "video_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)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class BodyServerToolUseTypedDict(TypedDict): - r"""Usage for server-side tool execution (e.g., web search)""" - - tool_calls_executed: NotRequired[Nullable[int]] - r"""Number of OpenRouter server tool calls that executed and produced a result.""" - tool_calls_requested: NotRequired[Nullable[int]] - r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.""" - web_search_requests: NotRequired[Nullable[int]] - r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.""" - - -class BodyServerToolUse(BaseModel): - r"""Usage for server-side tool execution (e.g., web search)""" - - tool_calls_executed: OptionalNullable[int] = UNSET - r"""Number of OpenRouter server tool calls that executed and produced a result.""" - - tool_calls_requested: OptionalNullable[int] = UNSET - r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.""" - - web_search_requests: OptionalNullable[int] = UNSET - r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["tool_calls_executed", "tool_calls_requested", "web_search_requests"] - ) - nullable_fields = set( - ["tool_calls_executed", "tool_calls_requested", "web_search_requests"] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class BatchObjectServerToolUseDetailsTypedDict(TypedDict): - r"""Usage for server-side tool execution (e.g., web search)""" - - tool_calls_executed: NotRequired[Nullable[int]] - r"""Number of OpenRouter server tool calls that executed and produced a result.""" - tool_calls_requested: NotRequired[Nullable[int]] - r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.""" - web_search_requests: NotRequired[Nullable[int]] - r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.""" - - -class BatchObjectServerToolUseDetails(BaseModel): - r"""Usage for server-side tool execution (e.g., web search)""" - - tool_calls_executed: OptionalNullable[int] = UNSET - r"""Number of OpenRouter server tool calls that executed and produced a result.""" - - tool_calls_requested: OptionalNullable[int] = UNSET - r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.""" - - web_search_requests: OptionalNullable[int] = UNSET - r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["tool_calls_executed", "tool_calls_requested", "web_search_requests"] - ) - nullable_fields = set( - ["tool_calls_executed", "tool_calls_requested", "web_search_requests"] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class BodyUsage1TypedDict(TypedDict): - completion_tokens: int - r"""The tokens generated""" - prompt_tokens: int - r"""Including images, input audio, and tools if any""" - total_tokens: int - r"""Sum of the above two fields""" - completion_tokens_details: NotRequired[ - Nullable[BodyCompletionTokensDetailsTypedDict] - ] - prompt_tokens_details: NotRequired[Nullable[BodyPromptTokensDetails1TypedDict]] - r"""Breakdown of tokens used in the prompt.""" - server_tool_use: NotRequired[Nullable[BodyServerToolUseTypedDict]] - r"""Usage for server-side tool execution (e.g., web search)""" - server_tool_use_details: NotRequired[ - Nullable[BatchObjectServerToolUseDetailsTypedDict] - ] - r"""Usage for server-side tool execution (e.g., web search)""" - - -class BodyUsage1(BaseModel): - completion_tokens: int - r"""The tokens generated""" - - prompt_tokens: int - r"""Including images, input audio, and tools if any""" - - total_tokens: int - r"""Sum of the above two fields""" - - completion_tokens_details: OptionalNullable[BodyCompletionTokensDetails] = UNSET - - prompt_tokens_details: OptionalNullable[BodyPromptTokensDetails1] = UNSET - r"""Breakdown of tokens used in the prompt.""" - - server_tool_use: OptionalNullable[BodyServerToolUse] = UNSET - r"""Usage for server-side tool execution (e.g., web search)""" - - server_tool_use_details: OptionalNullable[BatchObjectServerToolUseDetails] = UNSET - r"""Usage for server-side tool execution (e.g., web search)""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "completion_tokens_details", - "prompt_tokens_details", - "server_tool_use", - "server_tool_use_details", - ] - ) - nullable_fields = set( - [ - "completion_tokens_details", - "prompt_tokens_details", - "server_tool_use", - "server_tool_use_details", - ] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class BodyChatCompletionTypedDict(TypedDict): - choices: List[ChoiceTypedDict] - created: int - id: str - model: str - object: BodyObjectChatCompletion - alignment: NotRequired[AlignmentTypedDict] - r"""Beta. The result of the alignment plugin for this request; the shape may change.""" - debug: NotRequired[BatchObjectDebugTypedDict] - openrouter_metadata: NotRequired[OpenRouterMetadataTypedDict] - provider: NotRequired[Nullable[str]] - safeguard_results: NotRequired[List[ArmorSafeguardResultTypedDict]] - r"""OpenRouter Armor's verdict for each client tool call of this response, present whenever Armor evaluated the response (even when nothing was flagged). Independent of the `openrouter_metadata` opt-in.""" - service_tier: NotRequired[Nullable[str]] - system_fingerprint: NotRequired[Nullable[str]] - usage: NotRequired[BodyUsage1TypedDict] - - -class BodyChatCompletion(BaseModel): - choices: List[Choice] - - created: int - - id: str - - model: str - - object: BodyObjectChatCompletion - - alignment: Optional[Alignment] = None - r"""Beta. The result of the alignment plugin for this request; the shape may change.""" - - debug: Optional[BatchObjectDebug] = None - - openrouter_metadata: Optional[OpenRouterMetadata] = None - - provider: OptionalNullable[str] = UNSET - - safeguard_results: Optional[List[ArmorSafeguardResult]] = None - r"""OpenRouter Armor's verdict for each client tool call of this response, present whenever Armor evaluated the response (even when nothing was flagged). Independent of the `openrouter_metadata` opt-in.""" - - service_tier: OptionalNullable[str] = UNSET - - system_fingerprint: OptionalNullable[str] = UNSET - - usage: Optional[BodyUsage1] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "alignment", - "debug", - "openrouter_metadata", - "provider", - "safeguard_results", - "service_tier", - "system_fingerprint", - "usage", - ] - ) - nullable_fields = set(["provider", "service_tier", "system_fingerprint"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -BodyTypedDict = TypeAliasType( - "BodyTypedDict", - Union[ - BodyAudioSpeechTypedDict, - BodyListTypedDict, - BodyMessageTypedDict, - BodyChatCompletionTypedDict, - OpenResponsesResultTypedDict, - ], +from .anthropicspeed import AnthropicSpeed +from .anthropicusageiteration import ( + AnthropicUsageIteration, + AnthropicUsageIterationTypedDict, ) - - -Body = TypeAliasType( - "Body", - Union[ - BodyAudioSpeech, BodyList, BodyMessage, BodyChatCompletion, OpenResponsesResult - ], +from .batchoutputreference import BatchOutputReference, BatchOutputReferenceTypedDict +from .batchresult import BatchResult, BatchResultTypedDict +from .costdetails import CostDetails, CostDetailsTypedDict +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, ) +from pydantic import model_serializer +from typing import List, Literal, Optional, Union +from typing_extensions import NotRequired, TypedDict -class BatchObjectResponseTypedDict(TypedDict): - body: BodyTypedDict - request_id: Nullable[str] - status_code: int - - -class BatchObjectResponse(BaseModel): - body: Body - - request_id: Nullable[str] - - status_code: int - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - m[k] = val +BatchObjectCompletionWindow = Literal["24h",] - return m +class BatchObjectErrorTypedDict(TypedDict): + message: str -class ResultTypedDict(TypedDict): - custom_id: str - error: Nullable[ResultErrorTypedDict] - id: str - response: Nullable[BatchObjectResponseTypedDict] +class BatchObjectError(BaseModel): + message: str -class Result(BaseModel): - custom_id: str - error: Nullable[ResultError] +BatchObjectObject = Literal["batch",] - id: str - response: Nullable[BatchObjectResponse] +class BatchObjectRequestCountsTypedDict(TypedDict): + completed: int + failed: int + total: int - @model_serializer(mode="wrap") - def serialize_model(self, handler): - serialized = handler(self) - m = {} - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) +class BatchObjectRequestCounts(BaseModel): + completed: int - if val != UNSET_SENTINEL: - m[k] = val + failed: int - return m + total: int BatchObjectStatus = Union[ @@ -2103,11 +370,11 @@ class BatchObjectTypedDict(TypedDict): finalized_at: Nullable[int] id: str model: str - object: BatchObjectObjectBatch + object: BatchObjectObject provider: Nullable[str] r"""Provider OpenRouter assigned to run the batch, using the same name as the `provider` field of sync responses.""" request_counts: BatchObjectRequestCountsTypedDict - results: Nullable[List[ResultTypedDict]] + results: Nullable[List[BatchResultTypedDict]] status: BatchObjectStatus usage: Nullable[BatchObjectUsageTypedDict] output: NotRequired[BatchOutputReferenceTypedDict] @@ -2132,14 +399,14 @@ class BatchObject(BaseModel): model: str - object: BatchObjectObjectBatch + object: BatchObjectObject provider: Nullable[str] r"""Provider OpenRouter assigned to run the batch, using the same name as the `provider` field of sync responses.""" request_counts: BatchObjectRequestCounts - results: Nullable[List[Result]] + results: Nullable[List[BatchResult]] status: BatchObjectStatus @@ -2174,33 +441,3 @@ def serialize_model(self, handler): m[k] = val return m - - -try: - AudioPcm2.model_rebuild() -except NameError: - pass -try: - AudioPcm1.model_rebuild() -except NameError: - pass -try: - ContentTopLogprob.model_rebuild() -except NameError: - pass -try: - LogprobsContent.model_rebuild() -except NameError: - pass -try: - RefusalTopLogprob.model_rebuild() -except NameError: - pass -try: - Refusal.model_rebuild() -except NameError: - pass -try: - BatchObjectURLCitation.model_rebuild() -except NameError: - pass diff --git a/src/openrouter/components/batchresult.py b/src/openrouter/components/batchresult.py new file mode 100644 index 000000000..3b9106092 --- /dev/null +++ b/src/openrouter/components/batchresult.py @@ -0,0 +1,1514 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .alignment import Alignment, AlignmentTypedDict +from .anthropiccachecreation import ( + AnthropicCacheCreation, + AnthropicCacheCreationTypedDict, +) +from .anthropiccontainer import AnthropicContainer, AnthropicContainerTypedDict +from .anthropicinputtransformation import ( + AnthropicInputTransformation, + AnthropicInputTransformationTypedDict, +) +from .anthropicoutputtokensdetails import ( + AnthropicOutputTokensDetails, + AnthropicOutputTokensDetailsTypedDict, +) +from .anthropicrefusalstopdetails import ( + AnthropicRefusalStopDetails, + AnthropicRefusalStopDetailsTypedDict, +) +from .anthropicservertoolusage import ( + AnthropicServerToolUsage, + AnthropicServerToolUsageTypedDict, +) +from .anthropicservicetier import AnthropicServiceTier +from .anthropicspeed import AnthropicSpeed +from .anthropicusageiteration import ( + AnthropicUsageIteration, + AnthropicUsageIterationTypedDict, +) +from .apierrortype import APIErrorType +from .armorsafeguardresult import ArmorSafeguardResult, ArmorSafeguardResultTypedDict +from .chatannotation import ChatAnnotation, ChatAnnotationTypedDict +from .costdetails import CostDetails, CostDetailsTypedDict +from .finishreason import FinishReason +from .openresponsesresult import OpenResponsesResult, OpenResponsesResultTypedDict +from .openroutermetadata import OpenRouterMetadata, OpenRouterMetadataTypedDict +from .oranthropiccontentblock import ( + ORAnthropicContentBlock, + ORAnthropicContentBlockTypedDict, +) +from .oranthropicstopreason import ORAnthropicStopReason +from .reasoningdetailencrypted import ( + ReasoningDetailEncrypted, + ReasoningDetailEncryptedTypedDict, +) +from .reasoningdetailservertoolcall import ( + ReasoningDetailServerToolCall, + ReasoningDetailServerToolCallTypedDict, +) +from .reasoningdetailsummary import ( + ReasoningDetailSummary, + ReasoningDetailSummaryTypedDict, +) +from .reasoningdetailtext import ReasoningDetailText, ReasoningDetailTextTypedDict +from functools import partial +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from openrouter.utils.unions import parse_open_union +import pydantic +from pydantic import ConfigDict, model_serializer +from pydantic.functional_validators import BeforeValidator +from typing import Any, Dict, List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class BatchResultErrorTypedDict(TypedDict): + message: str + param: Nullable[str] + type: str + error_type: NotRequired[APIErrorType] + r"""Canonical OpenRouter error type, stable across all API formats""" + + +class BatchResultError(BaseModel): + message: str + + param: Nullable[str] + + type: str + + error_type: Optional[APIErrorType] = None + r"""Canonical OpenRouter error type, stable across all API formats""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["error_type"]) + nullable_fields = set(["param"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +BatchResultFormat2 = Literal["pcm",] + + +class AudioPcm2TypedDict(TypedDict): + bits_per_sample: float + byte_length: int + channels: int + format_: BatchResultFormat2 + sample_rate: int + sha256: str + + +class AudioPcm2(BaseModel): + bits_per_sample: float + + byte_length: int + + channels: int + + format_: Annotated[BatchResultFormat2, pydantic.Field(alias="format")] + + sample_rate: int + + sha256: str + + +BatchResultFormat1 = Literal["pcm",] + + +class AudioPcm1TypedDict(TypedDict): + bits_per_sample: float + channels: int + data: str + r"""Base64-encoded PCM16 audio in the format the sibling fields give.""" + format_: BatchResultFormat1 + sample_rate: int + + +class AudioPcm1(BaseModel): + bits_per_sample: float + + channels: int + + data: str + r"""Base64-encoded PCM16 audio in the format the sibling fields give.""" + + format_: Annotated[BatchResultFormat1, pydantic.Field(alias="format")] + + sample_rate: int + + +AudioTypedDict = TypeAliasType( + "AudioTypedDict", Union[AudioPcm1TypedDict, AudioPcm2TypedDict] +) + + +Audio = TypeAliasType("Audio", Union[AudioPcm1, AudioPcm2]) + + +ObjectAudioSpeech = Literal["audio.speech",] + + +class BatchResultUsage4TypedDict(TypedDict): + completion_tokens: int + prompt_tokens: int + total_tokens: int + + +class BatchResultUsage4(BaseModel): + completion_tokens: int + + prompt_tokens: int + + total_tokens: int + + +class BodyAudioSpeechTypedDict(TypedDict): + audio: AudioTypedDict + model: str + object: ObjectAudioSpeech + usage: BatchResultUsage4TypedDict + + +class BodyAudioSpeech(BaseModel): + audio: Audio + + model: str + + object: ObjectAudioSpeech + + usage: BatchResultUsage4 + + +EmbeddingTypedDict = TypeAliasType("EmbeddingTypedDict", Union[List[float], str]) +r"""Embedding vector as an array of floats or a base64 string""" + + +Embedding = TypeAliasType("Embedding", Union[List[float], str]) +r"""Embedding vector as an array of floats or a base64 string""" + + +ObjectEmbedding = Literal["embedding",] + + +class BatchResultDataTypedDict(TypedDict): + r"""A single embedding object""" + + embedding: EmbeddingTypedDict + r"""Embedding vector as an array of floats or a base64 string""" + object: ObjectEmbedding + document_index: NotRequired[int] + r"""Index of the source document when `input` was a list of documents (contextual embeddings). Absent otherwise.""" + index: NotRequired[int] + r"""Index of the embedding in the input list""" + + +class BatchResultData(BaseModel): + r"""A single embedding object""" + + embedding: Embedding + r"""Embedding vector as an array of floats or a base64 string""" + + object: ObjectEmbedding + + document_index: Optional[int] = None + r"""Index of the source document when `input` was a list of documents (contextual embeddings). Absent otherwise.""" + + index: Optional[int] = None + r"""Index of the embedding in the input list""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["document_index", "index"]) + 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 + + +BatchResultObjectList = Literal["list",] + + +class BatchResultPromptTokensDetails2TypedDict(TypedDict): + r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.""" + + audio_tokens: NotRequired[int] + r"""Number of audio tokens in the input""" + file_tokens: NotRequired[int] + r"""Number of file/document tokens in the input""" + image_tokens: NotRequired[int] + r"""Number of image tokens in the input""" + text_tokens: NotRequired[int] + r"""Number of text tokens in the input""" + video_tokens: NotRequired[int] + r"""Number of video tokens in the input""" + + +class BatchResultPromptTokensDetails2(BaseModel): + r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.""" + + audio_tokens: Optional[int] = None + r"""Number of audio tokens in the input""" + + file_tokens: Optional[int] = None + r"""Number of file/document tokens in the input""" + + image_tokens: Optional[int] = None + r"""Number of image tokens in the input""" + + text_tokens: Optional[int] = None + r"""Number of text tokens in the input""" + + video_tokens: Optional[int] = None + r"""Number of video tokens in the input""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "audio_tokens", + "file_tokens", + "image_tokens", + "text_tokens", + "video_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 + + +class BatchResultUsage3TypedDict(TypedDict): + r"""Token usage statistics""" + + prompt_tokens: int + r"""Number of tokens in the input""" + total_tokens: int + r"""Total number of tokens used""" + cost: NotRequired[float] + r"""Cost of the request in credits""" + cost_details: NotRequired[Nullable[CostDetailsTypedDict]] + r"""Breakdown of upstream inference costs""" + is_byok: NotRequired[bool] + r"""Whether a request was made using a Bring Your Own Key configuration""" + prompt_tokens_details: NotRequired[BatchResultPromptTokensDetails2TypedDict] + r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.""" + + +class BatchResultUsage3(BaseModel): + r"""Token usage statistics""" + + prompt_tokens: int + r"""Number of tokens in the input""" + + total_tokens: int + r"""Total number of tokens used""" + + cost: Optional[float] = None + r"""Cost of the request in credits""" + + cost_details: OptionalNullable[CostDetails] = UNSET + r"""Breakdown of upstream inference costs""" + + is_byok: Optional[bool] = None + r"""Whether a request was made using a Bring Your Own Key configuration""" + + prompt_tokens_details: Optional[BatchResultPromptTokensDetails2] = None + r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["cost", "cost_details", "is_byok", "prompt_tokens_details"] + ) + nullable_fields = set(["cost_details"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class BodyListTypedDict(TypedDict): + r"""Embeddings response containing embedding vectors""" + + data: List[BatchResultDataTypedDict] + r"""List of embedding objects""" + model: str + r"""The model used for embeddings""" + object: BatchResultObjectList + id: NotRequired[str] + r"""Unique identifier for the embeddings response""" + usage: NotRequired[BatchResultUsage3TypedDict] + r"""Token usage statistics""" + + +class BodyList(BaseModel): + r"""Embeddings response containing embedding vectors""" + + data: List[BatchResultData] + r"""List of embedding objects""" + + model: str + r"""The model used for embeddings""" + + object: BatchResultObjectList + + id: Optional[str] = None + r"""Unique identifier for the embeddings response""" + + usage: Optional[BatchResultUsage3] = None + r"""Token usage statistics""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["id", "usage"]) + 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 + + +BatchResultRole = Literal["assistant",] + + +BatchResultTypeMessage = Literal["message",] + + +class BatchResultUsage2TypedDict(TypedDict): + cache_creation: Nullable[AnthropicCacheCreationTypedDict] + cache_creation_input_tokens: Nullable[int] + cache_read_input_tokens: Nullable[int] + inference_geo: Nullable[str] + input_tokens: int + output_tokens: int + output_tokens_details: Nullable[AnthropicOutputTokensDetailsTypedDict] + server_tool_use: Nullable[AnthropicServerToolUsageTypedDict] + service_tier: Nullable[AnthropicServiceTier] + iterations: NotRequired[List[AnthropicUsageIterationTypedDict]] + speed: NotRequired[Nullable[AnthropicSpeed]] + + +class BatchResultUsage2(BaseModel): + cache_creation: Nullable[AnthropicCacheCreation] + + cache_creation_input_tokens: Nullable[int] + + cache_read_input_tokens: Nullable[int] + + inference_geo: Nullable[str] + + input_tokens: int + + output_tokens: int + + output_tokens_details: Nullable[AnthropicOutputTokensDetails] + + server_tool_use: Nullable[AnthropicServerToolUsage] + + service_tier: Nullable[AnthropicServiceTier] + + iterations: Optional[List[AnthropicUsageIteration]] = None + + speed: OptionalNullable[AnthropicSpeed] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["iterations", "speed"]) + nullable_fields = set( + [ + "cache_creation", + "cache_creation_input_tokens", + "cache_read_input_tokens", + "inference_geo", + "output_tokens_details", + "server_tool_use", + "service_tier", + "speed", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class BodyMessageTypedDict(TypedDict): + container: Nullable[AnthropicContainerTypedDict] + content: List[ORAnthropicContentBlockTypedDict] + id: str + model: str + role: BatchResultRole + stop_details: Nullable[AnthropicRefusalStopDetailsTypedDict] + r"""Structured information about a refusal""" + stop_reason: Nullable[ORAnthropicStopReason] + stop_sequence: Nullable[str] + type: BatchResultTypeMessage + usage: BatchResultUsage2TypedDict + input_transformations: NotRequired[ + Nullable[List[AnthropicInputTransformationTypedDict]] + ] + + +class BodyMessage(BaseModel): + container: Nullable[AnthropicContainer] + + content: List[ORAnthropicContentBlock] + + id: str + + model: str + + role: BatchResultRole + + stop_details: Nullable[AnthropicRefusalStopDetails] + r"""Structured information about a refusal""" + + stop_reason: Nullable[ORAnthropicStopReason] + + stop_sequence: Nullable[str] + + type: BatchResultTypeMessage + + usage: BatchResultUsage2 + + input_transformations: OptionalNullable[List[AnthropicInputTransformation]] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["input_transformations"]) + nullable_fields = set( + [ + "container", + "input_transformations", + "stop_details", + "stop_reason", + "stop_sequence", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class ContentTopLogprobTypedDict(TypedDict): + bytes_: Nullable[List[int]] + logprob: float + token: str + + +class ContentTopLogprob(BaseModel): + bytes_: Annotated[Nullable[List[int]], pydantic.Field(alias="bytes")] + + logprob: float + + token: str + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m + + +class BatchResultContentTypedDict(TypedDict): + bytes_: Nullable[List[int]] + logprob: float + token: str + top_logprobs: List[ContentTopLogprobTypedDict] + + +class BatchResultContent(BaseModel): + bytes_: Annotated[Nullable[List[int]], pydantic.Field(alias="bytes")] + + logprob: float + + token: str + + top_logprobs: List[ContentTopLogprob] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m + + +class RefusalTopLogprobTypedDict(TypedDict): + bytes_: Nullable[List[int]] + logprob: float + token: str + + +class RefusalTopLogprob(BaseModel): + bytes_: Annotated[Nullable[List[int]], pydantic.Field(alias="bytes")] + + logprob: float + + token: str + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m + + +class RefusalTypedDict(TypedDict): + bytes_: Nullable[List[int]] + logprob: float + token: str + top_logprobs: List[RefusalTopLogprobTypedDict] + + +class Refusal(BaseModel): + bytes_: Annotated[Nullable[List[int]], pydantic.Field(alias="bytes")] + + logprob: float + + token: str + + top_logprobs: List[RefusalTopLogprob] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m + + +class LogprobsTypedDict(TypedDict): + content: Nullable[List[BatchResultContentTypedDict]] + refusal: NotRequired[Nullable[List[RefusalTypedDict]]] + + +class Logprobs(BaseModel): + content: Nullable[List[BatchResultContent]] + + refusal: OptionalNullable[List[Refusal]] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["refusal"]) + nullable_fields = set(["content", "refusal"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class BatchResultImageURLTypedDict(TypedDict): + url: str + + +class BatchResultImageURL(BaseModel): + url: str + + +ChoiceTypeImageURL = Literal["image_url",] + + +class ImageTypedDict(TypedDict): + image_url: BatchResultImageURLTypedDict + type: ChoiceTypeImageURL + + +class Image(BaseModel): + image_url: BatchResultImageURL + + type: ChoiceTypeImageURL + + +ReasoningDetailTypedDict = TypeAliasType( + "ReasoningDetailTypedDict", + Union[ + ReasoningDetailSummaryTypedDict, + ReasoningDetailEncryptedTypedDict, + ReasoningDetailTextTypedDict, + ReasoningDetailServerToolCallTypedDict, + ], +) + + +class UnknownReasoningDetail(BaseModel): + r"""A ReasoningDetail variant the SDK doesn't recognize. Preserves the raw payload.""" + + type: Literal["UNKNOWN"] = "UNKNOWN" + raw: Any + is_unknown: Literal[True] = True + + model_config = ConfigDict(frozen=True) + + +_REASONING_DETAIL_VARIANTS: dict[str, Any] = { + "reasoning.summary": ReasoningDetailSummary, + "reasoning.encrypted": ReasoningDetailEncrypted, + "reasoning.text": ReasoningDetailText, + "reasoning.server_tool_call": ReasoningDetailServerToolCall, +} + + +ReasoningDetail = Annotated[ + Union[ + ReasoningDetailSummary, + ReasoningDetailEncrypted, + ReasoningDetailText, + ReasoningDetailServerToolCall, + UnknownReasoningDetail, + ], + BeforeValidator( + partial( + parse_open_union, + disc_key="type", + variants=_REASONING_DETAIL_VARIANTS, + unknown_cls=UnknownReasoningDetail, + union_name="ReasoningDetail", + ) + ), +] + + +ChoiceRole = Literal["assistant",] + + +class BatchResultFunctionTypedDict(TypedDict): + arguments: str + name: str + + +class BatchResultFunction(BaseModel): + arguments: str + + name: str + + +ChoiceTypeFunction = Literal["function",] + + +class ToolCallTypedDict(TypedDict): + function: BatchResultFunctionTypedDict + id: str + index: int + type: ChoiceTypeFunction + + +class ToolCall(BaseModel): + function: BatchResultFunction + + id: str + + index: int + + type: ChoiceTypeFunction + + +class MessageTypedDict(TypedDict): + content: Nullable[str] + refusal: Nullable[str] + role: ChoiceRole + annotations: NotRequired[List[ChatAnnotationTypedDict]] + images: NotRequired[Nullable[List[ImageTypedDict]]] + reasoning: NotRequired[Nullable[str]] + reasoning_details: NotRequired[Nullable[List[Nullable[ReasoningDetailTypedDict]]]] + tool_calls: NotRequired[List[ToolCallTypedDict]] + + +class Message(BaseModel): + content: Nullable[str] + + refusal: Nullable[str] + + role: ChoiceRole + + annotations: Optional[List[ChatAnnotation]] = None + + images: OptionalNullable[List[Image]] = UNSET + + reasoning: OptionalNullable[str] = UNSET + + reasoning_details: OptionalNullable[List[Nullable[ReasoningDetail]]] = UNSET + + tool_calls: Optional[List[ToolCall]] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["annotations", "images", "reasoning", "reasoning_details", "tool_calls"] + ) + nullable_fields = set( + ["content", "images", "reasoning", "reasoning_details", "refusal"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class ChoiceTypedDict(TypedDict): + finish_reason: FinishReason + index: int + logprobs: Nullable[LogprobsTypedDict] + message: MessageTypedDict + native_finish_reason: Nullable[str] + + +class Choice(BaseModel): + finish_reason: FinishReason + + index: int + + logprobs: Nullable[Logprobs] + + message: Message + + native_finish_reason: Nullable[str] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m + + +BatchResultEvent = Union[ + Literal[ + "adapter_request", + "upstream_headers_received", + "first_token_received", + "upstream_body_ended", + ], + UnrecognizedStr, +] + + +class BatchResultTimingsTypedDict(TypedDict): + epoch_ms: int + event: BatchResultEvent + start_ms: int + + +class BatchResultTimings(BaseModel): + epoch_ms: int + + event: BatchResultEvent + + start_ms: int + + +class BatchResultDebugTypedDict(TypedDict): + echo_upstream_body: NotRequired[Dict[str, Any]] + timings: NotRequired[BatchResultTimingsTypedDict] + + +class BatchResultDebug(BaseModel): + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False) + + echo_upstream_body: Optional[Dict[str, Any]] = None + + timings: Optional[BatchResultTimings] = None + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["echo_upstream_body", "timings"]) + 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)) + serialized.pop(k, serialized.pop(n, None)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + for k, v in serialized.items(): + m[k] = v + + return m + + +BatchResultObjectChatCompletion = Literal["chat.completion",] + + +class BatchResultCompletionTokensDetailsTypedDict(TypedDict): + audio_tokens: NotRequired[Nullable[int]] + r"""Tokens generated by the model for audio output.""" + image_tokens: NotRequired[Nullable[int]] + r"""Tokens generated by the model for image output.""" + reasoning_tokens: NotRequired[Nullable[int]] + r"""Tokens generated by the model for reasoning.""" + + +class BatchResultCompletionTokensDetails(BaseModel): + audio_tokens: OptionalNullable[int] = UNSET + r"""Tokens generated by the model for audio output.""" + + image_tokens: OptionalNullable[int] = UNSET + r"""Tokens generated by the model for image output.""" + + reasoning_tokens: OptionalNullable[int] = UNSET + r"""Tokens generated by the model for reasoning.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["audio_tokens", "image_tokens", "reasoning_tokens"]) + nullable_fields = set(["audio_tokens", "image_tokens", "reasoning_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)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class BatchResultPromptTokensDetails1TypedDict(TypedDict): + r"""Breakdown of tokens used in the prompt.""" + + audio_tokens: NotRequired[Nullable[int]] + r"""Tokens used for input audio.""" + cache_write_tokens: NotRequired[Nullable[int]] + r"""Tokens written to cache. Only returned for models with explicit caching and cache write pricing.""" + cached_tokens: NotRequired[Nullable[int]] + r"""Tokens cached by the endpoint.""" + file_tokens: NotRequired[Nullable[int]] + r"""Tokens used for input files/documents.""" + video_tokens: NotRequired[Nullable[int]] + r"""Tokens used for input video.""" + + +class BatchResultPromptTokensDetails1(BaseModel): + r"""Breakdown of tokens used in the prompt.""" + + audio_tokens: OptionalNullable[int] = UNSET + r"""Tokens used for input audio.""" + + cache_write_tokens: OptionalNullable[int] = UNSET + r"""Tokens written to cache. Only returned for models with explicit caching and cache write pricing.""" + + cached_tokens: OptionalNullable[int] = UNSET + r"""Tokens cached by the endpoint.""" + + file_tokens: OptionalNullable[int] = UNSET + r"""Tokens used for input files/documents.""" + + video_tokens: OptionalNullable[int] = UNSET + r"""Tokens used for input video.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "audio_tokens", + "cache_write_tokens", + "cached_tokens", + "file_tokens", + "video_tokens", + ] + ) + nullable_fields = set( + [ + "audio_tokens", + "cache_write_tokens", + "cached_tokens", + "file_tokens", + "video_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)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class BatchResultServerToolUseTypedDict(TypedDict): + r"""Usage for server-side tool execution (e.g., web search)""" + + tool_calls_executed: NotRequired[Nullable[int]] + r"""Number of OpenRouter server tool calls that executed and produced a result.""" + tool_calls_requested: NotRequired[Nullable[int]] + r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.""" + web_search_requests: NotRequired[Nullable[int]] + r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.""" + + +class BatchResultServerToolUse(BaseModel): + r"""Usage for server-side tool execution (e.g., web search)""" + + tool_calls_executed: OptionalNullable[int] = UNSET + r"""Number of OpenRouter server tool calls that executed and produced a result.""" + + tool_calls_requested: OptionalNullable[int] = UNSET + r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.""" + + web_search_requests: OptionalNullable[int] = UNSET + r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["tool_calls_executed", "tool_calls_requested", "web_search_requests"] + ) + nullable_fields = set( + ["tool_calls_executed", "tool_calls_requested", "web_search_requests"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class BatchResultServerToolUseDetailsTypedDict(TypedDict): + r"""Usage for server-side tool execution (e.g., web search)""" + + tool_calls_executed: NotRequired[Nullable[int]] + r"""Number of OpenRouter server tool calls that executed and produced a result.""" + tool_calls_requested: NotRequired[Nullable[int]] + r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.""" + web_search_requests: NotRequired[Nullable[int]] + r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.""" + + +class BatchResultServerToolUseDetails(BaseModel): + r"""Usage for server-side tool execution (e.g., web search)""" + + tool_calls_executed: OptionalNullable[int] = UNSET + r"""Number of OpenRouter server tool calls that executed and produced a result.""" + + tool_calls_requested: OptionalNullable[int] = UNSET + r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.""" + + web_search_requests: OptionalNullable[int] = UNSET + r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["tool_calls_executed", "tool_calls_requested", "web_search_requests"] + ) + nullable_fields = set( + ["tool_calls_executed", "tool_calls_requested", "web_search_requests"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class BatchResultUsage1TypedDict(TypedDict): + completion_tokens: int + r"""The tokens generated""" + prompt_tokens: int + r"""Including images, input audio, and tools if any""" + total_tokens: int + r"""Sum of the above two fields""" + completion_tokens_details: NotRequired[ + Nullable[BatchResultCompletionTokensDetailsTypedDict] + ] + prompt_tokens_details: NotRequired[ + Nullable[BatchResultPromptTokensDetails1TypedDict] + ] + r"""Breakdown of tokens used in the prompt.""" + server_tool_use: NotRequired[Nullable[BatchResultServerToolUseTypedDict]] + r"""Usage for server-side tool execution (e.g., web search)""" + server_tool_use_details: NotRequired[ + Nullable[BatchResultServerToolUseDetailsTypedDict] + ] + r"""Usage for server-side tool execution (e.g., web search)""" + + +class BatchResultUsage1(BaseModel): + completion_tokens: int + r"""The tokens generated""" + + prompt_tokens: int + r"""Including images, input audio, and tools if any""" + + total_tokens: int + r"""Sum of the above two fields""" + + completion_tokens_details: OptionalNullable[BatchResultCompletionTokensDetails] = ( + UNSET + ) + + prompt_tokens_details: OptionalNullable[BatchResultPromptTokensDetails1] = UNSET + r"""Breakdown of tokens used in the prompt.""" + + server_tool_use: OptionalNullable[BatchResultServerToolUse] = UNSET + r"""Usage for server-side tool execution (e.g., web search)""" + + server_tool_use_details: OptionalNullable[BatchResultServerToolUseDetails] = UNSET + r"""Usage for server-side tool execution (e.g., web search)""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "completion_tokens_details", + "prompt_tokens_details", + "server_tool_use", + "server_tool_use_details", + ] + ) + nullable_fields = set( + [ + "completion_tokens_details", + "prompt_tokens_details", + "server_tool_use", + "server_tool_use_details", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class BodyChatCompletionTypedDict(TypedDict): + choices: List[ChoiceTypedDict] + created: int + id: str + model: str + object: BatchResultObjectChatCompletion + alignment: NotRequired[AlignmentTypedDict] + r"""Beta. The result of the alignment plugin for this request; the shape may change.""" + debug: NotRequired[BatchResultDebugTypedDict] + openrouter_metadata: NotRequired[OpenRouterMetadataTypedDict] + provider: NotRequired[Nullable[str]] + safeguard_results: NotRequired[List[ArmorSafeguardResultTypedDict]] + r"""OpenRouter Armor's verdict for each client tool call of this response, present whenever Armor evaluated the response (even when nothing was flagged). Independent of the `openrouter_metadata` opt-in.""" + service_tier: NotRequired[Nullable[str]] + system_fingerprint: NotRequired[Nullable[str]] + usage: NotRequired[BatchResultUsage1TypedDict] + + +class BodyChatCompletion(BaseModel): + choices: List[Choice] + + created: int + + id: str + + model: str + + object: BatchResultObjectChatCompletion + + alignment: Optional[Alignment] = None + r"""Beta. The result of the alignment plugin for this request; the shape may change.""" + + debug: Optional[BatchResultDebug] = None + + openrouter_metadata: Optional[OpenRouterMetadata] = None + + provider: OptionalNullable[str] = UNSET + + safeguard_results: Optional[List[ArmorSafeguardResult]] = None + r"""OpenRouter Armor's verdict for each client tool call of this response, present whenever Armor evaluated the response (even when nothing was flagged). Independent of the `openrouter_metadata` opt-in.""" + + service_tier: OptionalNullable[str] = UNSET + + system_fingerprint: OptionalNullable[str] = UNSET + + usage: Optional[BatchResultUsage1] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "alignment", + "debug", + "openrouter_metadata", + "provider", + "safeguard_results", + "service_tier", + "system_fingerprint", + "usage", + ] + ) + nullable_fields = set(["provider", "service_tier", "system_fingerprint"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +BodyTypedDict = TypeAliasType( + "BodyTypedDict", + Union[ + BodyAudioSpeechTypedDict, + BodyListTypedDict, + BodyMessageTypedDict, + BodyChatCompletionTypedDict, + OpenResponsesResultTypedDict, + ], +) + + +Body = TypeAliasType( + "Body", + Union[ + BodyAudioSpeech, BodyList, BodyMessage, BodyChatCompletion, OpenResponsesResult + ], +) + + +class BatchResultResponseTypedDict(TypedDict): + body: BodyTypedDict + request_id: Nullable[str] + status_code: int + + +class BatchResultResponse(BaseModel): + body: Body + + request_id: Nullable[str] + + status_code: int + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m + + +class BatchResultTypedDict(TypedDict): + custom_id: str + error: Nullable[BatchResultErrorTypedDict] + id: str + response: Nullable[BatchResultResponseTypedDict] + + +class BatchResult(BaseModel): + custom_id: str + + error: Nullable[BatchResultError] + + id: str + + response: Nullable[BatchResultResponse] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m + + +try: + AudioPcm2.model_rebuild() +except NameError: + pass +try: + AudioPcm1.model_rebuild() +except NameError: + pass +try: + ContentTopLogprob.model_rebuild() +except NameError: + pass +try: + BatchResultContent.model_rebuild() +except NameError: + pass +try: + RefusalTopLogprob.model_rebuild() +except NameError: + pass +try: + Refusal.model_rebuild() +except NameError: + pass diff --git a/src/openrouter/components/batchresultspageresponse.py b/src/openrouter/components/batchresultspageresponse.py new file mode 100644 index 000000000..8bb91f751 --- /dev/null +++ b/src/openrouter/components/batchresultspageresponse.py @@ -0,0 +1,46 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .batchresult import BatchResult, BatchResultTypedDict +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Literal +from typing_extensions import TypedDict + + +BatchResultsPageResponseObject = Literal["list",] + + +class BatchResultsPageResponseTypedDict(TypedDict): + r"""A cursor-paginated page of normalized batch result rows.""" + + data: List[BatchResultTypedDict] + has_more: bool + next_cursor: Nullable[str] + object: BatchResultsPageResponseObject + + +class BatchResultsPageResponse(BaseModel): + r"""A cursor-paginated page of normalized batch result rows.""" + + data: List[BatchResult] + + has_more: bool + + next_cursor: Nullable[str] + + object: BatchResultsPageResponseObject + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m diff --git a/src/openrouter/components/chatannotation.py b/src/openrouter/components/chatannotation.py new file mode 100644 index 000000000..409abc1f8 --- /dev/null +++ b/src/openrouter/components/chatannotation.py @@ -0,0 +1,67 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .chatfileannotation import ChatFileAnnotation, ChatFileAnnotationTypedDict +from .chaturlcitationannotation import ( + ChatURLCitationAnnotation, + ChatURLCitationAnnotationTypedDict, +) +from .chatwebsearchcitationannotation import ( + ChatWebSearchCitationAnnotation, + ChatWebSearchCitationAnnotationTypedDict, +) +from functools import partial +from openrouter.types import BaseModel +from openrouter.utils.unions import parse_open_union +from pydantic import ConfigDict +from pydantic.functional_validators import BeforeValidator +from typing import Any, Literal, Union +from typing_extensions import Annotated, TypeAliasType + + +ChatAnnotationTypedDict = TypeAliasType( + "ChatAnnotationTypedDict", + Union[ + ChatFileAnnotationTypedDict, + ChatURLCitationAnnotationTypedDict, + ChatWebSearchCitationAnnotationTypedDict, + ], +) +r"""Citation or file annotation on an assistant message""" + + +class UnknownChatAnnotation(BaseModel): + r"""A ChatAnnotation variant the SDK doesn't recognize. Preserves the raw payload.""" + + type: Literal["UNKNOWN"] = "UNKNOWN" + raw: Any + is_unknown: Literal[True] = True + + model_config = ConfigDict(frozen=True) + + +_CHAT_ANNOTATION_VARIANTS: dict[str, Any] = { + "file": ChatFileAnnotation, + "url_citation": ChatURLCitationAnnotation, + "web_search_citation": ChatWebSearchCitationAnnotation, +} + + +ChatAnnotation = Annotated[ + Union[ + ChatFileAnnotation, + ChatURLCitationAnnotation, + ChatWebSearchCitationAnnotation, + UnknownChatAnnotation, + ], + BeforeValidator( + partial( + parse_open_union, + disc_key="type", + variants=_CHAT_ANNOTATION_VARIANTS, + unknown_cls=UnknownChatAnnotation, + union_name="ChatAnnotation", + ) + ), +] +r"""Citation or file annotation on an assistant message""" diff --git a/src/openrouter/components/chatfileannotation.py b/src/openrouter/components/chatfileannotation.py new file mode 100644 index 000000000..f73bd8881 --- /dev/null +++ b/src/openrouter/components/chatfileannotation.py @@ -0,0 +1,130 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from functools import partial +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils.unions import parse_open_union +from pydantic import ConfigDict, model_serializer +from pydantic.functional_validators import BeforeValidator +from typing import Any, List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class ChatFileAnnotationImageURLTypedDict(TypedDict): + url: str + + +class ChatFileAnnotationImageURL(BaseModel): + url: str + + +FileTypeImageURL = Literal["image_url",] + + +class ContentImageURLTypedDict(TypedDict): + image_url: ChatFileAnnotationImageURLTypedDict + type: FileTypeImageURL + + +class ContentImageURL(BaseModel): + image_url: ChatFileAnnotationImageURL + + type: FileTypeImageURL + + +FileTypeText = Literal["text",] + + +class ContentTextTypedDict(TypedDict): + text: str + type: FileTypeText + + +class ContentText(BaseModel): + text: str + + type: FileTypeText + + +ChatFileAnnotationContentUnionTypedDict = TypeAliasType( + "ChatFileAnnotationContentUnionTypedDict", + Union[ContentTextTypedDict, ContentImageURLTypedDict], +) + + +class UnknownChatFileAnnotationContentUnion(BaseModel): + r"""A ChatFileAnnotationContentUnion variant the SDK doesn't recognize. Preserves the raw payload.""" + + type: Literal["UNKNOWN"] = "UNKNOWN" + raw: Any + is_unknown: Literal[True] = True + + model_config = ConfigDict(frozen=True) + + +_CHAT_FILE_ANNOTATION_CONTENT_UNION_VARIANTS: dict[str, Any] = { + "text": ContentText, + "image_url": ContentImageURL, +} + + +ChatFileAnnotationContentUnion = Annotated[ + Union[ContentText, ContentImageURL, UnknownChatFileAnnotationContentUnion], + BeforeValidator( + partial( + parse_open_union, + disc_key="type", + variants=_CHAT_FILE_ANNOTATION_CONTENT_UNION_VARIANTS, + unknown_cls=UnknownChatFileAnnotationContentUnion, + union_name="ChatFileAnnotationContentUnion", + ) + ), +] + + +class ChatFileAnnotationFileTypedDict(TypedDict): + content: List[ChatFileAnnotationContentUnionTypedDict] + hash: str + name: NotRequired[str] + + +class ChatFileAnnotationFile(BaseModel): + content: List[ChatFileAnnotationContentUnion] + + hash: str + + name: Optional[str] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["name"]) + 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 + + +ChatFileAnnotationTypeFile = Literal["file",] + + +class ChatFileAnnotationTypedDict(TypedDict): + r"""File annotation with the parsed file content""" + + file: ChatFileAnnotationFileTypedDict + type: ChatFileAnnotationTypeFile + + +class ChatFileAnnotation(BaseModel): + r"""File annotation with the parsed file content""" + + file: ChatFileAnnotationFile + + type: ChatFileAnnotationTypeFile diff --git a/src/openrouter/components/chaturlcitationannotation.py b/src/openrouter/components/chaturlcitationannotation.py new file mode 100644 index 000000000..15dc2dfa0 --- /dev/null +++ b/src/openrouter/components/chaturlcitationannotation.py @@ -0,0 +1,76 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import validate_const +import pydantic +from pydantic import model_serializer +from pydantic.functional_validators import AfterValidator +from typing import Literal, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +ChatURLCitationAnnotationType = Literal["url_citation",] + + +class ChatURLCitationAnnotationURLCitationTypedDict(TypedDict): + end_index: int + start_index: int + title: str + url: str + content: NotRequired[str] + uncited: Literal[True] + + +class ChatURLCitationAnnotationURLCitation(BaseModel): + end_index: int + + start_index: int + + title: str + + url: str + + content: Optional[str] = None + + UNCITED: Annotated[ + Annotated[Optional[Literal[True]], AfterValidator(validate_const(True))], + pydantic.Field(alias="uncited"), + ] = True + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["content", "uncited"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ChatURLCitationAnnotationTypedDict(TypedDict): + r"""URL citation annotation""" + + type: ChatURLCitationAnnotationType + url_citation: ChatURLCitationAnnotationURLCitationTypedDict + + +class ChatURLCitationAnnotation(BaseModel): + r"""URL citation annotation""" + + type: ChatURLCitationAnnotationType + + url_citation: ChatURLCitationAnnotationURLCitation + + +try: + ChatURLCitationAnnotationURLCitation.model_rebuild() +except NameError: + pass diff --git a/src/openrouter/components/chatwebsearchcitationannotation.py b/src/openrouter/components/chatwebsearchcitationannotation.py new file mode 100644 index 000000000..f567419c0 --- /dev/null +++ b/src/openrouter/components/chatwebsearchcitationannotation.py @@ -0,0 +1,67 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +ChatWebSearchCitationAnnotationType = Literal["web_search_citation",] + + +class WebSearchCitationTypedDict(TypedDict): + title: Nullable[str] + url: str + cited_text: NotRequired[str] + encrypted_index: NotRequired[str] + + +class WebSearchCitation(BaseModel): + title: Nullable[str] + + url: str + + cited_text: Optional[str] = None + + encrypted_index: Optional[str] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["cited_text", "encrypted_index"]) + nullable_fields = set(["title"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class ChatWebSearchCitationAnnotationTypedDict(TypedDict): + r"""Web search citation annotation""" + + type: ChatWebSearchCitationAnnotationType + web_search_citation: WebSearchCitationTypedDict + + +class ChatWebSearchCitationAnnotation(BaseModel): + r"""Web search citation annotation""" + + type: ChatWebSearchCitationAnnotationType + + web_search_citation: WebSearchCitation diff --git a/src/openrouter/components/createguardrailrequest.py b/src/openrouter/components/createguardrailrequest.py index e7e93fd58..16c336252 100644 --- a/src/openrouter/components/createguardrailrequest.py +++ b/src/openrouter/components/createguardrailrequest.py @@ -28,6 +28,8 @@ class CreateGuardrailRequestTypedDict(TypedDict): r"""Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided.""" allow_safety_retention_google: NotRequired[Nullable[bool]] r"""Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.""" + allow_safety_retention_openai: NotRequired[Nullable[bool]] + r"""Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting.""" allow_safety_retention_other: NotRequired[Nullable[bool]] r"""Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.""" allowed_data_regions: NotRequired[Nullable[List[GuardrailDataRegion]]] @@ -88,6 +90,9 @@ class CreateGuardrailRequest(BaseModel): allow_safety_retention_google: OptionalNullable[bool] = UNSET r"""Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.""" + allow_safety_retention_openai: OptionalNullable[bool] = UNSET + r"""Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting.""" + allow_safety_retention_other: OptionalNullable[bool] = UNSET r"""Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.""" @@ -170,6 +175,7 @@ def serialize_model(self, handler): [ "allow_provisional_providers", "allow_safety_retention_google", + "allow_safety_retention_openai", "allow_safety_retention_other", "allowed_data_regions", "allowed_models", @@ -199,6 +205,7 @@ def serialize_model(self, handler): [ "allow_provisional_providers", "allow_safety_retention_google", + "allow_safety_retention_openai", "allow_safety_retention_other", "allowed_data_regions", "allowed_models", diff --git a/src/openrouter/components/guardrail.py b/src/openrouter/components/guardrail.py index 2ac17be79..fa1c7740b 100644 --- a/src/openrouter/components/guardrail.py +++ b/src/openrouter/components/guardrail.py @@ -39,6 +39,8 @@ class GuardrailTypedDict(TypedDict): r"""Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided.""" allow_safety_retention_google: NotRequired[Nullable[bool]] r"""Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.""" + allow_safety_retention_openai: NotRequired[Nullable[bool]] + r"""Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting.""" allow_safety_retention_other: NotRequired[Nullable[bool]] r"""Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.""" allowed_data_regions: NotRequired[Nullable[List[GuardrailDataRegion]]] @@ -109,6 +111,9 @@ class Guardrail(BaseModel): allow_safety_retention_google: OptionalNullable[bool] = UNSET r"""Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.""" + allow_safety_retention_openai: OptionalNullable[bool] = UNSET + r"""Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting.""" + allow_safety_retention_other: OptionalNullable[bool] = UNSET r"""Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.""" @@ -186,6 +191,7 @@ def serialize_model(self, handler): [ "allow_provisional_providers", "allow_safety_retention_google", + "allow_safety_retention_openai", "allow_safety_retention_other", "allowed_data_regions", "allowed_models", @@ -214,6 +220,7 @@ def serialize_model(self, handler): [ "allow_provisional_providers", "allow_safety_retention_google", + "allow_safety_retention_openai", "allow_safety_retention_other", "allowed_data_regions", "allowed_models", diff --git a/src/openrouter/components/guardrailmodelavailabilitypolicyauthoringconfig.py b/src/openrouter/components/guardrailmodelavailabilitypolicyauthoringconfig.py index 939349b10..9a17416a5 100644 --- a/src/openrouter/components/guardrailmodelavailabilitypolicyauthoringconfig.py +++ b/src/openrouter/components/guardrailmodelavailabilitypolicyauthoringconfig.py @@ -16,6 +16,7 @@ class GuardrailModelAvailabilityPolicyAuthoringConfigTypedDict(TypedDict): allow_provisional_providers: NotRequired[Nullable[bool]] allow_safety_retention_google: NotRequired[Nullable[bool]] + allow_safety_retention_openai: NotRequired[Nullable[bool]] allow_safety_retention_other: NotRequired[Nullable[bool]] allowed_data_regions: NotRequired[Nullable[List[str]]] allowed_models: NotRequired[Nullable[List[str]]] @@ -43,6 +44,8 @@ class GuardrailModelAvailabilityPolicyAuthoringConfig(BaseModel): allow_safety_retention_google: OptionalNullable[bool] = UNSET + allow_safety_retention_openai: OptionalNullable[bool] = UNSET + allow_safety_retention_other: OptionalNullable[bool] = UNSET allowed_data_regions: OptionalNullable[List[str]] = UNSET @@ -89,6 +92,7 @@ def serialize_model(self, handler): [ "allow_provisional_providers", "allow_safety_retention_google", + "allow_safety_retention_openai", "allow_safety_retention_other", "allowed_data_regions", "allowed_models", @@ -115,6 +119,7 @@ def serialize_model(self, handler): [ "allow_provisional_providers", "allow_safety_retention_google", + "allow_safety_retention_openai", "allow_safety_retention_other", "allowed_data_regions", "allowed_models", diff --git a/src/openrouter/components/guardrailmodelavailabilitypolicyconfig.py b/src/openrouter/components/guardrailmodelavailabilitypolicyconfig.py index 1d1b95463..c1b0f478a 100644 --- a/src/openrouter/components/guardrailmodelavailabilitypolicyconfig.py +++ b/src/openrouter/components/guardrailmodelavailabilitypolicyconfig.py @@ -16,6 +16,7 @@ class GuardrailModelAvailabilityPolicyConfigTypedDict(TypedDict): allow_provisional_providers: NotRequired[Nullable[bool]] allow_safety_retention_google: NotRequired[Nullable[bool]] + allow_safety_retention_openai: NotRequired[Nullable[bool]] allow_safety_retention_other: NotRequired[Nullable[bool]] allowed_data_regions: NotRequired[Nullable[List[str]]] allowed_models: NotRequired[Nullable[List[str]]] @@ -43,6 +44,8 @@ class GuardrailModelAvailabilityPolicyConfig(BaseModel): allow_safety_retention_google: OptionalNullable[bool] = UNSET + allow_safety_retention_openai: OptionalNullable[bool] = UNSET + allow_safety_retention_other: OptionalNullable[bool] = UNSET allowed_data_regions: OptionalNullable[List[str]] = UNSET @@ -89,6 +92,7 @@ def serialize_model(self, handler): [ "allow_provisional_providers", "allow_safety_retention_google", + "allow_safety_retention_openai", "allow_safety_retention_other", "allowed_data_regions", "allowed_models", @@ -115,6 +119,7 @@ def serialize_model(self, handler): [ "allow_provisional_providers", "allow_safety_retention_google", + "allow_safety_retention_openai", "allow_safety_retention_other", "allowed_data_regions", "allowed_models", diff --git a/src/openrouter/components/inputreference.py b/src/openrouter/components/inputreference.py index f499cbbb5..0347fb279 100644 --- a/src/openrouter/components/inputreference.py +++ b/src/openrouter/components/inputreference.py @@ -16,7 +16,7 @@ ContentPartImageTypedDict, ContentPartAudioTypedDict, ContentPartVideoTypedDict ], ) -r"""A reference asset used to guide video generation. Image references are supported by all providers; audio and video references are only honored by providers that support them (including BytePlus Seedance generation 2 and newer).""" +r"""A reference asset used to guide video generation. Image references are the most widely supported; audio and video references are only accepted by providers that advertise those input modalities (including BytePlus Seedance generation 2 and newer).""" InputReference = Annotated[ @@ -27,4 +27,4 @@ ], Discriminator(lambda m: get_discriminator(m, "type", "type")), ] -r"""A reference asset used to guide video generation. Image references are supported by all providers; audio and video references are only honored by providers that support them (including BytePlus Seedance generation 2 and newer).""" +r"""A reference asset used to guide video generation. Image references are the most widely supported; audio and video references are only accepted by providers that advertise those input modalities (including BytePlus Seedance generation 2 and newer).""" diff --git a/src/openrouter/components/scimsyncjob.py b/src/openrouter/components/scimsyncjob.py index cc7c404fb..db3ad168c 100644 --- a/src/openrouter/components/scimsyncjob.py +++ b/src/openrouter/components/scimsyncjob.py @@ -25,7 +25,7 @@ class ScimSyncJobTypedDict(TypedDict): deleted_groups: Nullable[int] r"""Number of groups deleted, when the job completed successfully.""" error_message: Nullable[str] - r"""Stable error message when the job failed.""" + r"""Stable message code, or null. On a failed job, the failure reason. On a succeeded job, set when optional work beyond the group synchronization could not be completed; the groups were still synchronized.""" finished_at: Nullable[str] r"""Time when synchronization finished.""" id: str @@ -46,7 +46,7 @@ class ScimSyncJob(BaseModel): r"""Number of groups deleted, when the job completed successfully.""" error_message: Nullable[str] - r"""Stable error message when the job failed.""" + r"""Stable message code, or null. On a failed job, the failure reason. On a succeeded job, set when optional work beyond the group synchronization could not be completed; the groups were still synchronized.""" finished_at: Nullable[str] r"""Time when synchronization finished.""" diff --git a/src/openrouter/components/speechrequest.py b/src/openrouter/components/speechrequest.py index bf95c5745..b31d52439 100644 --- a/src/openrouter/components/speechrequest.py +++ b/src/openrouter/components/speechrequest.py @@ -168,6 +168,7 @@ def serialize_model(self, handler): Literal[ "mp3", "pcm", + "wav", ], UnrecognizedStr, ] diff --git a/src/openrouter/components/updateguardrailrequest.py b/src/openrouter/components/updateguardrailrequest.py index dc0ed7cc1..6e3d05b1d 100644 --- a/src/openrouter/components/updateguardrailrequest.py +++ b/src/openrouter/components/updateguardrailrequest.py @@ -26,6 +26,8 @@ class UpdateGuardrailRequestTypedDict(TypedDict): r"""Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided.""" allow_safety_retention_google: NotRequired[Nullable[bool]] r"""Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.""" + allow_safety_retention_openai: NotRequired[Nullable[bool]] + r"""Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting.""" allow_safety_retention_other: NotRequired[Nullable[bool]] r"""Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.""" allowed_data_regions: NotRequired[Nullable[List[GuardrailDataRegion]]] @@ -83,6 +85,9 @@ class UpdateGuardrailRequest(BaseModel): allow_safety_retention_google: OptionalNullable[bool] = UNSET r"""Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.""" + allow_safety_retention_openai: OptionalNullable[bool] = UNSET + r"""Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting.""" + allow_safety_retention_other: OptionalNullable[bool] = UNSET r"""Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.""" @@ -165,6 +170,7 @@ def serialize_model(self, handler): [ "allow_provisional_providers", "allow_safety_retention_google", + "allow_safety_retention_openai", "allow_safety_retention_other", "allowed_data_regions", "allowed_models", @@ -194,6 +200,7 @@ def serialize_model(self, handler): [ "allow_provisional_providers", "allow_safety_retention_google", + "allow_safety_retention_openai", "allow_safety_retention_other", "allowed_data_regions", "allowed_models", diff --git a/src/openrouter/components/videogenerationrequest.py b/src/openrouter/components/videogenerationrequest.py index 31b824049..193da8641 100644 --- a/src/openrouter/components/videogenerationrequest.py +++ b/src/openrouter/components/videogenerationrequest.py @@ -801,7 +801,7 @@ def serialize_model(self, handler): class VideoGenerationRequestProviderTypedDict(TypedDict): - r"""Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing.""" + r"""Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. Sorting by price, latency, or throughput and automatic provider fallbacks are not supported. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing.""" data_collection: NotRequired[Nullable[VideoGenerationRequestDataCollection]] r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. @@ -815,13 +815,13 @@ class VideoGenerationRequestProviderTypedDict(TypedDict): r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" options: NotRequired[VideoGenerationRequestOptionsTypedDict] order: NotRequired[Nullable[List[VideoGenerationRequestOrderTypedDict]]] - r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" + r"""An ordered list of provider slugs to prefer when choosing an eligible video endpoint. The request is submitted to one endpoint and is not retried on another provider if submission fails.""" zdr: NotRequired[Nullable[bool]] r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.""" class VideoGenerationRequestProvider(BaseModel): - r"""Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing.""" + r"""Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. Sorting by price, latency, or throughput and automatic provider fallbacks are not supported. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing.""" data_collection: OptionalNullable[VideoGenerationRequestDataCollection] = UNSET r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. @@ -839,7 +839,7 @@ class VideoGenerationRequestProvider(BaseModel): options: Optional[VideoGenerationRequestOptions] = None order: OptionalNullable[List[VideoGenerationRequestOrder]] = UNSET - r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" + r"""An ordered list of provider slugs to prefer when choosing an eligible video endpoint. The request is submitted to one endpoint and is not retried on another provider if submission fails.""" zdr: OptionalNullable[bool] = UNSET r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.""" @@ -899,21 +899,21 @@ class VideoGenerationRequestTypedDict(TypedDict): duration: NotRequired[int] r"""Duration of the generated video in seconds, or -1 to let the provider choose the length (e.g. following an input video). -1 is only accepted by models that list it in supported_durations.""" frame_images: NotRequired[List[FrameImageTypedDict]] - r"""Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame.""" + r"""Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame, and each frame_type may appear at most once. Combining frame_images with input_references is provider-specific: some models reject the combination (as a 400 on submit or as a failed job), some use the frame images alone, and some use both (e.g. Runway applies image references as style/guidance alongside the frame anchors).""" generate_audio: NotRequired[bool] - r"""Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set. When neither is set, some providers (such as xAI) apply their own default and generate audio, so send false to request a silent video. Some models always include audio and ignore false.""" + r"""Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set. When neither is set, some providers (such as xAI) apply their own default and generate audio, so send false to request a silent video. Some models always include audio and ignore false. POST /videos returns 400 for true if every otherwise eligible endpoint explicitly disables audio generation.""" input_references: NotRequired[List[InputReferenceTypedDict]] - r"""Reference assets to guide video generation. Accepts image, audio, and video references. Audio and video references are only honored by providers that support them (including BytePlus Seedance generation 2 and newer); other providers use image references and ignore the rest.""" + r"""Reference assets to guide video generation. Accepts image, audio, and video references. POST /videos rejects the request with a 400 when the model or its provider integration does not support a supplied reference modality. Combining input_references with frame_images is provider-specific: some models reject the combination (as a 400 on submit or as a failed job), some use the frame images alone, and some use both (e.g. Runway applies image references as style/guidance alongside the frame anchors).""" previous_job_id: NotRequired[str] r"""ID of a completed video job to edit or extend, as returned by the submit response. The new job runs on the same model and endpoint that produced the previous one. Only models that support continuation accept this field.""" prompt: NotRequired[str] r"""Text prompt describing the video to generate. Optional for models that support generating a video from image input alone; required by all other models.""" provider: NotRequired[VideoGenerationRequestProviderTypedDict] - r"""Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing.""" + r"""Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. Sorting by price, latency, or throughput and automatic provider fallbacks are not supported. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing.""" resolution: NotRequired[VideoGenerationRequestResolution] r"""Resolution of the generated video""" seed: NotRequired[int] - r"""If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers.""" + r"""If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. POST /videos returns 400 if every otherwise eligible endpoint explicitly declares seed unsupported.""" session_id: NotRequired[str] r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.""" size: NotRequired[str] @@ -942,13 +942,13 @@ class VideoGenerationRequest(BaseModel): r"""Duration of the generated video in seconds, or -1 to let the provider choose the length (e.g. following an input video). -1 is only accepted by models that list it in supported_durations.""" frame_images: Optional[List[FrameImage]] = None - r"""Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame.""" + r"""Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame, and each frame_type may appear at most once. Combining frame_images with input_references is provider-specific: some models reject the combination (as a 400 on submit or as a failed job), some use the frame images alone, and some use both (e.g. Runway applies image references as style/guidance alongside the frame anchors).""" generate_audio: Optional[bool] = None - r"""Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set. When neither is set, some providers (such as xAI) apply their own default and generate audio, so send false to request a silent video. Some models always include audio and ignore false.""" + r"""Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set. When neither is set, some providers (such as xAI) apply their own default and generate audio, so send false to request a silent video. Some models always include audio and ignore false. POST /videos returns 400 for true if every otherwise eligible endpoint explicitly disables audio generation.""" input_references: Optional[List[InputReference]] = None - r"""Reference assets to guide video generation. Accepts image, audio, and video references. Audio and video references are only honored by providers that support them (including BytePlus Seedance generation 2 and newer); other providers use image references and ignore the rest.""" + r"""Reference assets to guide video generation. Accepts image, audio, and video references. POST /videos rejects the request with a 400 when the model or its provider integration does not support a supplied reference modality. Combining input_references with frame_images is provider-specific: some models reject the combination (as a 400 on submit or as a failed job), some use the frame images alone, and some use both (e.g. Runway applies image references as style/guidance alongside the frame anchors).""" previous_job_id: Optional[str] = None r"""ID of a completed video job to edit or extend, as returned by the submit response. The new job runs on the same model and endpoint that produced the previous one. Only models that support continuation accept this field.""" @@ -957,13 +957,13 @@ class VideoGenerationRequest(BaseModel): r"""Text prompt describing the video to generate. Optional for models that support generating a video from image input alone; required by all other models.""" provider: Optional[VideoGenerationRequestProvider] = None - r"""Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing.""" + r"""Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. Sorting by price, latency, or throughput and automatic provider fallbacks are not supported. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing.""" resolution: Optional[VideoGenerationRequestResolution] = None r"""Resolution of the generated video""" seed: Optional[int] = None - r"""If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers.""" + r"""If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. POST /videos returns 400 if every otherwise eligible endpoint explicitly declares seed unsupported.""" session_id: Optional[str] = None r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.""" diff --git a/src/openrouter/guardrails.py b/src/openrouter/guardrails.py index a9c7cae06..0507f7f86 100644 --- a/src/openrouter/guardrails.py +++ b/src/openrouter/guardrails.py @@ -369,6 +369,7 @@ def create( x_open_router_categories: Optional[str] = None, allow_provisional_providers: OptionalNullable[bool] = UNSET, allow_safety_retention_google: OptionalNullable[bool] = UNSET, + allow_safety_retention_openai: OptionalNullable[bool] = UNSET, allow_safety_retention_other: OptionalNullable[bool] = UNSET, allowed_data_regions: OptionalNullable[ Iterable[components.GuardrailDataRegion] @@ -423,6 +424,7 @@ def create( :param allow_provisional_providers: Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided. :param allow_safety_retention_google: Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. + :param allow_safety_retention_openai: Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting. :param allow_safety_retention_other: Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. :param allowed_data_regions: Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected. :param allowed_models: Array of model identifiers (slug or canonical_slug accepted) @@ -468,6 +470,7 @@ def create( create_guardrail_request=components.CreateGuardrailRequest( allow_provisional_providers=allow_provisional_providers, allow_safety_retention_google=allow_safety_retention_google, + allow_safety_retention_openai=allow_safety_retention_openai, allow_safety_retention_other=allow_safety_retention_other, allowed_data_regions=utils.unmarshal( allowed_data_regions, @@ -615,6 +618,7 @@ async def create_async( x_open_router_categories: Optional[str] = None, allow_provisional_providers: OptionalNullable[bool] = UNSET, allow_safety_retention_google: OptionalNullable[bool] = UNSET, + allow_safety_retention_openai: OptionalNullable[bool] = UNSET, allow_safety_retention_other: OptionalNullable[bool] = UNSET, allowed_data_regions: OptionalNullable[ Iterable[components.GuardrailDataRegion] @@ -669,6 +673,7 @@ async def create_async( :param allow_provisional_providers: Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided. :param allow_safety_retention_google: Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. + :param allow_safety_retention_openai: Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting. :param allow_safety_retention_other: Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. :param allowed_data_regions: Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected. :param allowed_models: Array of model identifiers (slug or canonical_slug accepted) @@ -714,6 +719,7 @@ async def create_async( create_guardrail_request=components.CreateGuardrailRequest( allow_provisional_providers=allow_provisional_providers, allow_safety_retention_google=allow_safety_retention_google, + allow_safety_retention_openai=allow_safety_retention_openai, allow_safety_retention_other=allow_safety_retention_other, allowed_data_regions=utils.unmarshal( allowed_data_regions, @@ -1393,6 +1399,7 @@ def update( x_open_router_categories: Optional[str] = None, allow_provisional_providers: OptionalNullable[bool] = UNSET, allow_safety_retention_google: OptionalNullable[bool] = UNSET, + allow_safety_retention_openai: OptionalNullable[bool] = UNSET, allow_safety_retention_other: OptionalNullable[bool] = UNSET, allowed_data_regions: OptionalNullable[ Iterable[components.GuardrailDataRegion] @@ -1447,6 +1454,7 @@ def update( :param allow_provisional_providers: Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided. :param allow_safety_retention_google: Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. + :param allow_safety_retention_openai: Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting. :param allow_safety_retention_other: Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. :param allowed_data_regions: Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected. :param allowed_models: Array of model identifiers (slug or canonical_slug accepted) @@ -1493,6 +1501,7 @@ def update( update_guardrail_request=components.UpdateGuardrailRequest( allow_provisional_providers=allow_provisional_providers, allow_safety_retention_google=allow_safety_retention_google, + allow_safety_retention_openai=allow_safety_retention_openai, allow_safety_retention_other=allow_safety_retention_other, allowed_data_regions=utils.unmarshal( allowed_data_regions, @@ -1649,6 +1658,7 @@ async def update_async( x_open_router_categories: Optional[str] = None, allow_provisional_providers: OptionalNullable[bool] = UNSET, allow_safety_retention_google: OptionalNullable[bool] = UNSET, + allow_safety_retention_openai: OptionalNullable[bool] = UNSET, allow_safety_retention_other: OptionalNullable[bool] = UNSET, allowed_data_regions: OptionalNullable[ Iterable[components.GuardrailDataRegion] @@ -1703,6 +1713,7 @@ async def update_async( :param allow_provisional_providers: Whether requests may use provisional providers, whose security practices have not been reviewed by OpenRouter. false excludes them. true and null never override an account that excludes them. Inherits the account setting when not provided. :param allow_safety_retention_google: Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. + :param allow_safety_retention_openai: Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting. :param allow_safety_retention_other: Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided. :param allowed_data_regions: Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected. :param allowed_models: Array of model identifiers (slug or canonical_slug accepted) @@ -1749,6 +1760,7 @@ async def update_async( update_guardrail_request=components.UpdateGuardrailRequest( allow_provisional_providers=allow_provisional_providers, allow_safety_retention_google=allow_safety_retention_google, + allow_safety_retention_openai=allow_safety_retention_openai, allow_safety_retention_other=allow_safety_retention_other, allowed_data_regions=utils.unmarshal( allowed_data_regions, diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 70bc0a74a..bf81c87ac 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -532,6 +532,14 @@ GetBatchesRequest, GetBatchesRequestTypedDict, ) + from .getbatchresults import ( + GetBatchResultsGlobals, + GetBatchResultsGlobalsTypedDict, + GetBatchResultsRequest, + GetBatchResultsRequestTypedDict, + GetBatchResultsResponse, + GetBatchResultsResponseTypedDict, + ) from .getbenchmarks import ( Arena, BenchmarkType, @@ -1680,6 +1688,12 @@ "GetBYOKKeyGlobalsTypedDict", "GetBYOKKeyRequest", "GetBYOKKeyRequestTypedDict", + "GetBatchResultsGlobals", + "GetBatchResultsGlobalsTypedDict", + "GetBatchResultsRequest", + "GetBatchResultsRequestTypedDict", + "GetBatchResultsResponse", + "GetBatchResultsResponseTypedDict", "GetBatchesGlobals", "GetBatchesGlobalsTypedDict", "GetBatchesRequest", @@ -2653,6 +2667,12 @@ "GetBatchesGlobalsTypedDict": ".getbatches", "GetBatchesRequest": ".getbatches", "GetBatchesRequestTypedDict": ".getbatches", + "GetBatchResultsGlobals": ".getbatchresults", + "GetBatchResultsGlobalsTypedDict": ".getbatchresults", + "GetBatchResultsRequest": ".getbatchresults", + "GetBatchResultsRequestTypedDict": ".getbatchresults", + "GetBatchResultsResponse": ".getbatchresults", + "GetBatchResultsResponseTypedDict": ".getbatchresults", "Arena": ".getbenchmarks", "BenchmarkType": ".getbenchmarks", "GetBenchmarksGlobals": ".getbenchmarks", diff --git a/src/openrouter/operations/getbatchresults.py b/src/openrouter/operations/getbatchresults.py new file mode 100644 index 000000000..e94376226 --- /dev/null +++ b/src/openrouter/operations/getbatchresults.py @@ -0,0 +1,187 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + batchresultspageresponse as components_batchresultspageresponse, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Awaitable, Callable, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetBatchResultsGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetBatchResultsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class GetBatchResultsRequestTypedDict(TypedDict): + id: str + r"""The batch job id returned from submit.""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + limit: NotRequired[int] + r"""Maximum number of result items to return, from 1 through 1000.""" + cursor: NotRequired[str] + r"""Opaque pagination cursor from the previous page's `next_cursor`. Omit for the first page.""" + + +class GetBatchResultsRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""The batch job id returned from submit.""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + limit: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Maximum number of result items to return, from 1 through 1000.""" + + cursor: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Opaque pagination cursor from the previous page's `next_cursor`. Omit for the first page.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "HTTP-Referer", + "X-OpenRouter-Title", + "X-OpenRouter-Categories", + "limit", + "cursor", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class GetBatchResultsResponseTypedDict(TypedDict): + result: components_batchresultspageresponse.BatchResultsPageResponseTypedDict + + +class GetBatchResultsResponse(BaseModel): + next: Union[ + Callable[[], Optional[GetBatchResultsResponse]], + Callable[[], Awaitable[Optional[GetBatchResultsResponse]]], + ] + + result: components_batchresultspageresponse.BatchResultsPageResponse diff --git a/src/openrouter/operations/list.py b/src/openrouter/operations/list.py index 8abf4d7aa..dcabe942b 100644 --- a/src/openrouter/operations/list.py +++ b/src/openrouter/operations/list.py @@ -102,6 +102,8 @@ class ListRequestTypedDict(TypedDict): r"""Number of API keys to skip for pagination""" workspace_id: NotRequired[str] r"""Filter API keys by workspace ID. By default an organization-scoped management key gets the default workspace; a workspace-scoped management key always gets its own workspace and cannot list another.""" + creator_user_id: NotRequired[str] + r"""Only return API keys created by this user ID (the `creator_user_id` on each key). Requires a management key that can view key creators.""" class ListRequest(BaseModel): @@ -157,6 +159,12 @@ class ListRequest(BaseModel): ] = None r"""Filter API keys by workspace ID. By default an organization-scoped management key gets the default workspace; a workspace-scoped management key always gets its own workspace and cannot list another.""" + creator_user_id: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Only return API keys created by this user ID (the `creator_user_id` on each key). Requires a management key that can view key creators.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( @@ -168,6 +176,7 @@ def serialize_model(self, handler): "include_expired", "offset", "workspace_id", + "creator_user_id", ] ) nullable_fields = set(["offset"]) diff --git a/src/openrouter/video_generation.py b/src/openrouter/video_generation.py index ad510dfd4..fd293ba52 100644 --- a/src/openrouter/video_generation.py +++ b/src/openrouter/video_generation.py @@ -75,14 +75,14 @@ def generate( :param callback_url: URL to receive a webhook notification when the video generation job completes. Overrides the workspace-level default callback URL if set. Must be HTTPS. :param creativity: Creativity level for video upscaling models only. This parameter is not supported by video generation models. :param duration: Duration of the generated video in seconds, or -1 to let the provider choose the length (e.g. following an input video). -1 is only accepted by models that list it in supported_durations. - :param frame_images: Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame. - :param generate_audio: Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set. When neither is set, some providers (such as xAI) apply their own default and generate audio, so send false to request a silent video. Some models always include audio and ignore false. - :param input_references: Reference assets to guide video generation. Accepts image, audio, and video references. Audio and video references are only honored by providers that support them (including BytePlus Seedance generation 2 and newer); other providers use image references and ignore the rest. + :param frame_images: Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame, and each frame_type may appear at most once. Combining frame_images with input_references is provider-specific: some models reject the combination (as a 400 on submit or as a failed job), some use the frame images alone, and some use both (e.g. Runway applies image references as style/guidance alongside the frame anchors). + :param generate_audio: Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set. When neither is set, some providers (such as xAI) apply their own default and generate audio, so send false to request a silent video. Some models always include audio and ignore false. POST /videos returns 400 for true if every otherwise eligible endpoint explicitly disables audio generation. + :param input_references: Reference assets to guide video generation. Accepts image, audio, and video references. POST /videos rejects the request with a 400 when the model or its provider integration does not support a supplied reference modality. Combining input_references with frame_images is provider-specific: some models reject the combination (as a 400 on submit or as a failed job), some use the frame images alone, and some use both (e.g. Runway applies image references as style/guidance alongside the frame anchors). :param previous_job_id: ID of a completed video job to edit or extend, as returned by the submit response. The new job runs on the same model and endpoint that produced the previous one. Only models that support continuation accept this field. :param prompt: Text prompt describing the video to generate. Optional for models that support generating a video from image input alone; required by all other models. - :param provider: Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing. + :param provider: Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. Sorting by price, latency, or throughput and automatic provider fallbacks are not supported. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing. :param resolution: Resolution of the generated video - :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. + :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. POST /videos returns 400 if every otherwise eligible endpoint explicitly declares seed unsupported. :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. :param size: Exact pixel dimensions of the generated video in \"WIDTHxHEIGHT\" format (e.g. \"1280x720\"). Interchangeable with resolution + aspect_ratio. :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -321,14 +321,14 @@ async def generate_async( :param callback_url: URL to receive a webhook notification when the video generation job completes. Overrides the workspace-level default callback URL if set. Must be HTTPS. :param creativity: Creativity level for video upscaling models only. This parameter is not supported by video generation models. :param duration: Duration of the generated video in seconds, or -1 to let the provider choose the length (e.g. following an input video). -1 is only accepted by models that list it in supported_durations. - :param frame_images: Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame. - :param generate_audio: Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set. When neither is set, some providers (such as xAI) apply their own default and generate audio, so send false to request a silent video. Some models always include audio and ignore false. - :param input_references: Reference assets to guide video generation. Accepts image, audio, and video references. Audio and video references are only honored by providers that support them (including BytePlus Seedance generation 2 and newer); other providers use image references and ignore the rest. + :param frame_images: Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame, and each frame_type may appear at most once. Combining frame_images with input_references is provider-specific: some models reject the combination (as a 400 on submit or as a failed job), some use the frame images alone, and some use both (e.g. Runway applies image references as style/guidance alongside the frame anchors). + :param generate_audio: Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set. When neither is set, some providers (such as xAI) apply their own default and generate audio, so send false to request a silent video. Some models always include audio and ignore false. POST /videos returns 400 for true if every otherwise eligible endpoint explicitly disables audio generation. + :param input_references: Reference assets to guide video generation. Accepts image, audio, and video references. POST /videos rejects the request with a 400 when the model or its provider integration does not support a supplied reference modality. Combining input_references with frame_images is provider-specific: some models reject the combination (as a 400 on submit or as a failed job), some use the frame images alone, and some use both (e.g. Runway applies image references as style/guidance alongside the frame anchors). :param previous_job_id: ID of a completed video job to edit or extend, as returned by the submit response. The new job runs on the same model and endpoint that produced the previous one. Only models that support continuation accept this field. :param prompt: Text prompt describing the video to generate. Optional for models that support generating a video from image input alone; required by all other models. - :param provider: Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing. + :param provider: Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. Sorting by price, latency, or throughput and automatic provider fallbacks are not supported. No video endpoint currently offers Zero Data Retention, so `zdr: true` fails routing. :param resolution: Resolution of the generated video - :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. + :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. POST /videos returns 400 if every otherwise eligible endpoint explicitly declares seed unsupported. :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. :param size: Exact pixel dimensions of the generated video in \"WIDTHxHEIGHT\" format (e.g. \"1280x720\"). Interchangeable with resolution + aspect_ratio. :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. diff --git a/uv.lock b/uv.lock index d57765f94..e79a8abda 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.211" +version = "1.3.212" source = { editable = "." } dependencies = [ { name = "httpcore" },