diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index ed5f9a61..87809ec5 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: 32117153e3b76b100a2bc31ed1e162aa + docChecksum: 8c88ee1da5d109e287fc5958aebd53a4 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.1.156 - configChecksum: 5c41c3d1d7a24cff576ba99e5a3d87e6 + releaseVersion: 1.1.157 + configChecksum: 0c871c3ded730faa04195657a71aadb8 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 0a848989-5d90-41f1-a0b2-dc6e1080c605 - pristine_commit_hash: f63c115411f8a9fd2f01123c6319f1d08d9b88b3 - pristine_tree_hash: 5098e6125cece174513ddb1d61efe493f135e477 + generation_id: 62dea106-fc12-4a2a-9cce-01a7fb98c0b2 + pristine_commit_hash: 047d7c3e93a19c95bbc3cf9b704959631d30c4f7 + pristine_tree_hash: 7f9d26a81cf9a73fb04dd06fdc1efe54b2bb08a4 features: python: acceptHeaders: 3.0.0 @@ -162,8 +162,8 @@ trackedFiles: pristine_git_object: 6c75e26dd968ce8860e334fffec9543f851e7a11 docs/components/agentmessageitemcontentinputimage.mdx: id: a491c3154b29 - last_write_checksum: sha1:ae00600fdb044ef6055b821ea9e1c6ed1984059e - pristine_git_object: 67e9a2411f1fb7ed3dd9d20900ea39cca3c90536 + last_write_checksum: sha1:db0f3d969d0585497f4fd7c22498f8aa18b55ea8 + pristine_git_object: 94ab47b17b83c23707ff362d02b02dd7f416dc16 docs/components/agentmessageitemcontentunion.mdx: id: 1059ca11299e last_write_checksum: sha1:772f5e3f8bd01d99bddc12160bf5e3b448bbf8a6 @@ -204,6 +204,10 @@ trackedFiles: id: 14f2eb561997 last_write_checksum: sha1:c2d3663907d09f4bd8248d715384f3c45e18e241 pristine_git_object: ad9a606318c037d4fce78642297cd490ddd64878 + docs/components/answers.mdx: + id: 82e99c991e20 + last_write_checksum: sha1:66dd9e45903fcdb94b3303437662e481c0106c5b + pristine_git_object: b065c94fd50b108b90c0cfe16ae4359337002376 docs/components/anthropicadvisormessageusageiteration.mdx: id: ca0effff715e last_write_checksum: sha1:66558840a0330602b3e022e9686b3f2f8529b959 @@ -554,8 +558,8 @@ trackedFiles: pristine_git_object: 53c45463b67a1365c2700f73ddb7330b048e79f0 docs/components/apitype.mdx: id: 1a902c4c05f3 - last_write_checksum: sha1:a9f2bc6e9eee1a1834a8209e5683037894aa59db - pristine_git_object: 185a0faa93cb1332684421f556cb15ec06d81543 + last_write_checksum: sha1:b44371fc91cba50217bc1bea88874bc308308a1e + pristine_git_object: 32e8ae19301296d4eb6cc2d58574a4682e5814c4 docs/components/applypatchcallitem.mdx: id: 00fd75573009 last_write_checksum: sha1:8650be12909ab98cefc237e3499b73d9a79cf3d3 @@ -846,8 +850,8 @@ trackedFiles: pristine_git_object: a30dd4d969fae3008b81fb428f0b1a0f6769262d docs/components/byokproviderslug.mdx: id: 6ea70819f6d8 - last_write_checksum: sha1:df3472c47a6cc73180638cb85dab6190dd40ae97 - pristine_git_object: 3deb822b66041ddc59fac45182ec02192cbac778 + last_write_checksum: sha1:53f9d2353dba7cd7815e75282d273514d9d916d1 + pristine_git_object: 11af6f0ee5abcdbc26a8e96430d61c71829a448b docs/components/capabilitydescriptor.mdx: id: 34ac0e581d79 last_write_checksum: sha1:62ee9ccab6cec4572383cef654997ab4106d4676 @@ -1696,6 +1700,14 @@ trackedFiles: id: ee0c0ca3257e last_write_checksum: sha1:f6de7351ddd4d0bb8990ef8e40d8cdfb24fe6c53 pristine_git_object: aee384f40812ab73fa2a94ee1ee24decaee754f3 + docs/components/criteria.mdx: + id: 2598471a14a2 + last_write_checksum: sha1:b681aff077a72268d22afe6857d83c7da5224e9c + pristine_git_object: 5751a955bfec68e7dc7e809101c679f42dad4aed + docs/components/criterion.mdx: + id: 1d364d0a735b + last_write_checksum: sha1:5dd8cb9246af97470192d2aeab60b219ce29332e + pristine_git_object: 787ae244bec888e45d1cbfb8cf7ec018f4618b2a docs/components/crv.mdx: id: bd891a5d3518 last_write_checksum: sha1:d95f00e04283964e9fd32dfe2d4f1825d07f810c @@ -1738,8 +1750,8 @@ trackedFiles: pristine_git_object: ba63c6e461e3e083730d6a14666263355c7a9a24 docs/components/customtoolcalloutputitemoutputinputimage.mdx: id: 35c913e2c5ba - last_write_checksum: sha1:f4de00869fabcff45e9899269e8e007f9fc2322c - pristine_git_object: ccd8f2028dad331c809210160396f6ce90c9bc66 + last_write_checksum: sha1:229dbb8fb6130618c43bfa559f1029f67f672f3b + pristine_git_object: 41ee3d26a8735cfdf4a8dec6bf3b63aa2861775e docs/components/customtoolcalloutputitemoutputtype.mdx: id: 72fe576e0d6b last_write_checksum: sha1:c97a4d1832ac6cd82b95f6b3392226550790db8c @@ -1796,6 +1808,82 @@ trackedFiles: id: 8b6b222a5da7 last_write_checksum: sha1:e37576941ec9e2cb4fe176277bb02b9cc86f6f48 pristine_git_object: 5d2d4dc2ddfc8d88c4869242498affc0b46f969e + docs/components/decisionschoiceanswer.mdx: + id: 8453afbdc1aa + last_write_checksum: sha1:6c917d892506ab1257cf46468e58a0fb6f130f8b + pristine_git_object: a27de14af6f9ba0b213a05ceb16da059c140451d + docs/components/decisionschoiceanswertype.mdx: + id: 6d2ca459fb6a + last_write_checksum: sha1:1c069b4399b0fcd0d684ad08558cc1d70aba58d9 + pristine_git_object: 9b5c4119852b57aa78d4f570a6ed811414ce4d76 + docs/components/decisionschoicequestion.mdx: + id: 3c9e4dec24ec + last_write_checksum: sha1:818a0cc3b56284d6dbb266608fe5811635f6f458 + pristine_git_object: dfd098de0d4fd11426f765a370b4adf164b82fe3 + docs/components/decisionschoicequestioninstructions.mdx: + id: 4de2c92d0d81 + last_write_checksum: sha1:2e0a53b30d4579104bafd428dff117d1b48ee422 + pristine_git_object: f61eab9a584a2d16e64d489e93b5fa77adbdebe1 + docs/components/decisionschoicequestiontype.mdx: + id: a53a32984862 + last_write_checksum: sha1:b2b7e525f59c42432bd0bf8b9c0049c6a52b0324 + pristine_git_object: 37788d9a1e4081424b86591021cbdd6cd0c55e31 + docs/components/decisionsnoulanswer.mdx: + id: fbb03486d0c5 + last_write_checksum: sha1:b70bb2f0d27e081bdf6a7e40e331603ea2c845f1 + pristine_git_object: d34f71c347ae475b21fdf07890abc3da13db2fcb + docs/components/decisionsnoulanswertype.mdx: + id: 2f6441f45095 + last_write_checksum: sha1:3820e84651269af56e1bce6e8a4f248b26691acf + pristine_git_object: 4fdb8532804113ec7dcc22a1571e250881d1e04a + docs/components/decisionsnoulquestion.mdx: + id: 02d50e93bd1d + last_write_checksum: sha1:5031cacde93c4679d2f5d6387f12e4849c3c1d27 + pristine_git_object: bd0cd40b93e8af1b8a59ac4be2012402d59ce8db + docs/components/decisionsnoulquestioncriteria.mdx: + id: 6a86326b185c + last_write_checksum: sha1:647e07eaf522cc46be2b066b2a466d21a73dda4b + pristine_git_object: eafa2e834ebf1608492860db94ad202185d0c35e + docs/components/decisionsnoulquestioninstructions.mdx: + id: 4d75a913d6d6 + last_write_checksum: sha1:b9f0fad006e80a18d9810f13855faced17c9e084 + pristine_git_object: 1af5620d601f217c58b66cbf99839958bd52d09e + docs/components/decisionsnoulquestiontype.mdx: + id: ed026ac2ad26 + last_write_checksum: sha1:f8f63455cb8c018ef1082bc60125f62af7c46f42 + pristine_git_object: 66d2e59cbdc4c920b5be4970c130b11a737d53cd + docs/components/decisionsrequest.mdx: + id: "910490840961" + last_write_checksum: sha1:d99015dc458955a5141f43f1ee0688213aae0183 + pristine_git_object: a5f5e91cdd3e2c8bb5c2707953549c2cce7e96b8 + docs/components/decisionsresponse.mdx: + id: 5c77b727e5dc + last_write_checksum: sha1:7b7b1769afd4cc9fcd4f652d2c59f41260df776a + pristine_git_object: cdd215386ad33ce82b830306e5a19df287a0c98a + docs/components/decisionsresponseusage.mdx: + id: ab10cb1b5675 + last_write_checksum: sha1:16ce6f6d27529d2009420d583baab36a8d22c2d0 + pristine_git_object: d89f6e7176368c072f5a4172f5821d877086ea9e + docs/components/decisionsscoreanswer.mdx: + id: ed8cc3ae16c6 + last_write_checksum: sha1:679d229044db4577b685ddea07b73fb32d39cac3 + pristine_git_object: 4bc4bdee22778ce24392ddf7fb4cbb2bb3f5a392 + docs/components/decisionsscoreanswertype.mdx: + id: 9bfec9bc107d + last_write_checksum: sha1:6fe5a7438a2f9d5fe060c028366990ee5cc7fa54 + pristine_git_object: f3a1fc443664a853afe55af45af7e3bf32800fa8 + docs/components/decisionsscorequestion.mdx: + id: c3dc8f0d869a + last_write_checksum: sha1:0217b6d201c9f189d95cf798ce5e405a96d572c3 + pristine_git_object: c261757bc0ae83d40f7e3c1df7fe78fca8e1c706 + docs/components/decisionsscorequestioninstructions.mdx: + id: fc0693e34588 + last_write_checksum: sha1:db808e76929596a3b8db43eddb744de7f492ad2a + pristine_git_object: 5d8e218c00baa9c4e0eff52725c396711bca3e45 + docs/components/decisionsscorequestiontype.mdx: + id: 1585ec8ed6cd + last_write_checksum: sha1:692e2a7f68f6992eb2efa02107b467034acaf275 + pristine_git_object: a805b4c8fe3b93198c785cfeac5a2cab9fff4319 docs/components/defaulteffort.mdx: id: 13b9d543d674 last_write_checksum: sha1:3a64d36689446d36d4bd1ab08f85f16c0aac2c2e @@ -1838,8 +1926,8 @@ trackedFiles: pristine_git_object: 60e935b6dd892eb12905a4d38d92edba37f0c06b docs/components/easyinputmessagecontentinputimage.mdx: id: d9c28bca7c9c - last_write_checksum: sha1:118666ad8993025c9b405149e92a40ff1efe9ae4 - pristine_git_object: 502f118250862c20fbd5f8427389bb06a5f60020 + last_write_checksum: sha1:ae8a386311085c7497acb33dfe037f4e558b839f + pristine_git_object: d67f17f84c52feb0a445bd8b8cb34a7dcb27f178 docs/components/easyinputmessagecontentunion1.mdx: id: f0f84e4a62d7 last_write_checksum: sha1:ee6d451a988d7ad19acf9ce1763fe3b12e352125 @@ -1972,6 +2060,10 @@ trackedFiles: id: b19eb588a22c last_write_checksum: sha1:647182170d99695cdf4985f8b4e423765bbf6d2c pristine_git_object: 70d6de50d74b3d3a16f2b90ae5ff362c4d77a9d2 + docs/components/falset.mdx: + id: 538c871219f3 + last_write_checksum: sha1:52ed81e463594f421f6459f9d363b76cba584711 + pristine_git_object: 4b6c1a197ad3fa4a117c0919bbaf30129f454fed docs/components/fieldt.mdx: id: e7b48abef959 last_write_checksum: sha1:e535734499fa6e4afcc05ba296d0c54f49b2388b @@ -2052,6 +2144,10 @@ trackedFiles: id: dd890414ed4e last_write_checksum: sha1:9b6b6a4d23d49575240609517d4d2751645220c2 pristine_git_object: 89d1920451399329c5059da274654c41633e53fe + docs/components/finishreason.mdx: + id: 7a4d8a4b94f1 + last_write_checksum: sha1:aa34896bb38e1d7274a1a4c8987e2589b3f22a10 + pristine_git_object: 0693755f024fda70cc099c4df7731d293ddbc1ca docs/components/forbiddenresponseerrordata.mdx: id: "760721125246" last_write_checksum: sha1:0fe4b361de356d50554272941fd52c8c256ce2a0 @@ -2166,8 +2262,8 @@ trackedFiles: pristine_git_object: 086e8a674c4fe4174eb1129b0aa33f785dfe6044 docs/components/functioncalloutputitemoutputinputimage.mdx: id: 0b40b0d89709 - last_write_checksum: sha1:e865b62b96310c4f1555da723f3b68ed7b7c7215 - pristine_git_object: 61b3a7cb3fb593bc06e7a4434abfec53af1e78b0 + last_write_checksum: sha1:f12ab6f504897ba06e040f71b2bded4b99061df7 + pristine_git_object: 245498dc2aee992a82839f3c4b7480ebcb419844 docs/components/functioncalloutputitemoutputtype.mdx: id: db3d5a58af6b last_write_checksum: sha1:72e52567b78ac19860ebd08ba39bda30649cd7ae @@ -2454,8 +2550,8 @@ trackedFiles: pristine_git_object: 11f1471c8b6c04f52af89d74d6dec2e9d12c2d82 docs/components/imagegenerationproviderpreferencesoptions.mdx: id: 32d5c4b3e06b - last_write_checksum: sha1:e750d08ff9ba7f2da8f0a606e27012d9a6a339df - pristine_git_object: 6b21f978fdd0158d1151602ae3f66771cba0b953 + last_write_checksum: sha1:9ff0207d0e1ed360856255cd5a019e2612cd3462 + pristine_git_object: 15f8010d9eeaa88d0b51a38af28216e87edb0325 docs/components/imagegenerationproviderpreferencesorder.mdx: id: 0547877073f3 last_write_checksum: sha1:3e890c691097373cc9a2d7e47c3594f56b57809c @@ -2602,8 +2698,8 @@ trackedFiles: pristine_git_object: b5d695bd126df56bf6b58635855629585b76505b docs/components/imageoutputmodality.mdx: id: bbdf54215a95 - last_write_checksum: sha1:10bd9287d10686536a2f0d49bba5fae96b4ec773 - pristine_git_object: 52ec9d78ba530720587f29cd7412daa84de346ac + last_write_checksum: sha1:398e80f1f98720ac31b033ef9f5606d8c54f3ca5 + pristine_git_object: 23c58b010bc9f2311ee1e71109e6c4cde5ca03a0 docs/components/imagepricingentry.mdx: id: 349c100297ec last_write_checksum: sha1:a8e0dc272363e755f035d77d5920553b5b6edbd5 @@ -2618,8 +2714,12 @@ trackedFiles: pristine_git_object: 290f4510d7e41e612aefc61cefa9560a432b0ae1 docs/components/incompletedetails.mdx: id: d83c063d7285 - last_write_checksum: sha1:b24c3be63176609c48ae9b19582c520ba1683ce7 - pristine_git_object: 7c1490a5fa42012a60428023229ca9980b0602f6 + last_write_checksum: sha1:d030e9544ab0c356b299c05850a740de2803ba32 + pristine_git_object: 33c9c9317e66dd19801d826152054c43f9276c77 + docs/components/incompletedetailsreason.mdx: + id: 6a1c5cd23ea5 + last_write_checksum: sha1:eacda3b875edda65cdcabe75a30907101ed9419a + pristine_git_object: 21d0997769bfbe13a5f58dafa4b5fd77948e541c docs/components/input1.mdx: id: d94dc7f66d38 last_write_checksum: sha1:c645ebd86b024620cdbfe93dbeb7f35bb4a36840 @@ -2654,8 +2754,8 @@ trackedFiles: pristine_git_object: 15dd4af786386589c96dae3757bbd0be0c30ff5b docs/components/inputimage.mdx: id: 2e7cfa5069fa - last_write_checksum: sha1:3f6d268739884e923eb1f26dc906ff81e00d31c8 - pristine_git_object: 294eb9b52890b2247b6f0bf4cc64b15c503aff27 + last_write_checksum: sha1:29c68dff6c3a9cc3c4f5c6728106bcd174197516 + pristine_git_object: c4b373901a6034f1d035726f1d4671e61ae3fc42 docs/components/inputimagedetail.mdx: id: e0f846215c0f last_write_checksum: sha1:b3c873c60884089778476b6c88a3d16b5311d312 @@ -2674,8 +2774,8 @@ trackedFiles: pristine_git_object: 0a2f6e5d23a03c66e723da5779da9ce9d58e1b19 docs/components/inputmessageitemcontentinputimage.mdx: id: a07208b1eddf - last_write_checksum: sha1:dfb1c800e9a26b5b5d289a0b94f7c6bb3c2f5154 - pristine_git_object: d029dec16fd1143fa35cc5383f6bdce9feafcbf6 + last_write_checksum: sha1:a1a863bfb53f8d8fc3f3bffce3e0b8c84ef8f7d6 + pristine_git_object: 6c503806b513536ebca0c5d324a58607aa99900c docs/components/inputmessageitemcontentunion.mdx: id: bf1cd325720c last_write_checksum: sha1:6b1cea3884e1ea54028c1acbf9059b58ee7a27af @@ -2840,6 +2940,142 @@ trackedFiles: id: 9a443dea63c5 last_write_checksum: sha1:39c41704820f6cde2d67ec3b9f1bcac7bc1a81d0 pristine_git_object: 8ddf14e86902b5d1b69fd15b7098e489c741b993 + docs/components/internapprovalmode.mdx: + id: 52eda3fd8d4b + last_write_checksum: sha1:d7f1e11967398a04edae6ac80c6a21f13871c5b5 + pristine_git_object: 14f94bb02c48a460c14d50a0595fc0e89b52e6af + docs/components/internchatassistantmessage.mdx: + id: 041634b73e1e + last_write_checksum: sha1:1e1737a7dad6fe27cc46dd8ade384869c3405784 + pristine_git_object: c8cd00acd8a2ba6fc9deb39eb67c88f5df721d02 + docs/components/internchatassistantmessagerole.mdx: + id: 129e5368066f + last_write_checksum: sha1:82c992193fb0cc60c16db0c54e827830edd565dc + pristine_git_object: caef6da66201fc69d119282fa86bd54c5674d57b + docs/components/internchatchoice.mdx: + id: 5ef48232ae77 + last_write_checksum: sha1:cfd8789928dc8860a4c518d0db9e4f66291b7cb0 + pristine_git_object: 78a4f7f400f84c2e1f494530afa2066633443b9f + docs/components/internchatcompletionchunk.mdx: + id: 4f5dc2924625 + last_write_checksum: sha1:3f536b718ccf9e314e31f7aa5a0f5b25e4c740a2 + pristine_git_object: 8bc4eeb1907674c40964c00667264cdd9345ea21 + docs/components/internchatcompletionchunkobject.mdx: + id: 3a1962ac4886 + last_write_checksum: sha1:9602771c3a5fc48b22adf67daeaf1387bbdfb501 + pristine_git_object: ae29bb6aa4cc5e60a75270c19790621c0bce4244 + docs/components/internchatcompletionrequest.mdx: + id: 3ff4f362621e + last_write_checksum: sha1:4893b633792c7e3b5acc640e82855e067aa66f2b + pristine_git_object: 4d058112f350cd8fa9d3c27540d556cd86185273 + docs/components/internchatdelta.mdx: + id: 362ca71ada74 + last_write_checksum: sha1:d69514763165871299a922f8f0dac1890283f4ab + pristine_git_object: 950f73d45431fadb0467ceceefa0b3d3fe0b680c + docs/components/internchatdeltarole.mdx: + id: 15b022eaf454 + last_write_checksum: sha1:7c09b3f62fc917e5fd67dffae5abc2a37b110ed9 + pristine_git_object: 76b5ccf10b5c6391cca4ff9a61245154dcf553de + docs/components/internchatdevelopermessage.mdx: + id: f36efe2db963 + last_write_checksum: sha1:13ee091947d6804ff46bb9f8c88b3b8125949544 + pristine_git_object: 0fd5f0fbf2b56acac17b22d70b02e18c598e10bf + docs/components/internchatdevelopermessagerole.mdx: + id: 7c0a36643391 + last_write_checksum: sha1:ca797f5e414953653817b16b9150b1092ab5872b + pristine_git_object: c8a28fe93affb7e8afbcadf834e74342861c6f02 + docs/components/internchatechoedtoolcall.mdx: + id: 749fa26fe692 + last_write_checksum: sha1:fbf1763609c837284b65bb8be9354bffeb3eb90a + pristine_git_object: a869fcac252801165106e04ba5d6272a6b5bb16a + docs/components/internchatechoedtoolcallfunction.mdx: + id: e5e6d4096a43 + last_write_checksum: sha1:66c1bad71707501455eab6d14d81415df3637f06 + pristine_git_object: 7b057bd6aebd0261f7f15ac2e6189414001d0d09 + docs/components/internchaterror.mdx: + id: 64defb4bf787 + last_write_checksum: sha1:a6d4fb39f4cf2880b4eda8e6fa60bb6496b988f5 + pristine_git_object: ccdf070f589cf27dad47e6cd64e39d1e5729df51 + docs/components/internchaterrormetadata.mdx: + id: e5a6cafc8cf1 + last_write_checksum: sha1:307a2328b3d1f48f939b2e0bf2d903680aa81ab3 + pristine_git_object: c9de8ffb2200f8283e669fcfe8b03d20cf6a2b44 + docs/components/internchaterrormetadatareason.mdx: + id: e912c85957cc + last_write_checksum: sha1:f5c63a578391ef058999767b2fe00ac26861c8d8 + pristine_git_object: 7b17f0e23f07068ef2647c6fe2fade30de06add3 + docs/components/internchatmessage.mdx: + id: a04de4c0fe24 + last_write_checksum: sha1:ca74833b04478f52dbd2ff72cae083897f32f7ba + pristine_git_object: 95dcf6235634c9f345d8586e9226c3d8067f9e22 + docs/components/internchatmessagecontent.mdx: + id: 4a630696be4a + last_write_checksum: sha1:f577d36a8689634fa7a2d4dd63bce499a413dcef + pristine_git_object: 8330e45e79206d00503f2a0bc351503acf623bd8 + docs/components/internchatprompttokensdetails.mdx: + id: 6cf9cf093489 + last_write_checksum: sha1:a0555dca77b390a95c2bc79aae41b2ae53eb96f0 + pristine_git_object: 77b2e34176730645168f5953bca6c98134dc37e8 + docs/components/internchatstreamerror.mdx: + id: d960f7518865 + last_write_checksum: sha1:2a6201fe3472169e67b734eeb7aa6dc7f887e603 + pristine_git_object: 48f3773bca2854d5657e918fdefb5e12d8ca4b53 + docs/components/internchatstreamingresponse.mdx: + id: 5bcf4a593132 + last_write_checksum: sha1:8c36128d1cdac2822bbb2c223dabd6b63f508a5c + pristine_git_object: 04ad18b619361faed61723ead4007171644a9610 + docs/components/internchatsystemmessage.mdx: + id: 20c1225749a4 + last_write_checksum: sha1:40543c39b26a5b1486b4edba17087ee294cd064c + pristine_git_object: d456834151003cbeaa3256f5191d5da8254ae32f + docs/components/internchatsystemmessagerole.mdx: + id: dfaa737f415b + last_write_checksum: sha1:7a6a2f5de88707966ac7320a665f00529d1bb30a + pristine_git_object: 0a20d5dd7343a9569e7e4cc80fd062262bdb9bb2 + docs/components/internchattextpart.mdx: + id: e363a4e86181 + last_write_checksum: sha1:cb2dfa78910e924228712cffae81e20fda32e7ea + pristine_git_object: 0bd3a5dc937a9b4c76338a34275f32bb6e61d2c9 + docs/components/internchattextparttype.mdx: + id: c04229df62f6 + last_write_checksum: sha1:4a9332e97ed33ec7a8d4c4f49ee1e5fb7b18026a + pristine_git_object: 9807a99c339285e705d1af4b1970801b69c0afd0 + docs/components/internchattoolcall.mdx: + id: 3dda2839482f + last_write_checksum: sha1:1866d183693b5a3432de5ffe884463ccd999c2e6 + pristine_git_object: 6176afe83ecbf2d564838006f220860997d810d3 + docs/components/internchattoolcallfunction.mdx: + id: 6ea64a326f37 + last_write_checksum: sha1:fc071cd80e4b7493ea831f6bf3d9add756a62dac + pristine_git_object: 918fa0b276428acef9b4cf5736f8b03fbcd6ce75 + docs/components/internchattoolcallfunctionname.mdx: + id: 9058994c209d + last_write_checksum: sha1:73344765db3a55a6b9fff3110a86dd00f1f657ac + pristine_git_object: 15d42c44f67974c0848d3754902c24144176fddf + docs/components/internchattoolcalltype.mdx: + id: 6b4485cf3a70 + last_write_checksum: sha1:692f210071d07c7ce102f35ab79e552452b810ac + pristine_git_object: 8e1145d1024947c863d50a85912df036dafbed50 + docs/components/internchattoolmessage.mdx: + id: c438ca57c9cc + last_write_checksum: sha1:2a0b2fb4633d54127858a8855274fd673c219967 + pristine_git_object: f2673d01f14c621aa7ef8470771f7f97a1204d30 + docs/components/internchattoolmessagerole.mdx: + id: 753e17c5217f + last_write_checksum: sha1:02bdfc9ddb029426fe1e2b90c907bd6de1364001 + pristine_git_object: 8f338c95667ee82378da721fa349a3738b7f129f + docs/components/internchatusage.mdx: + id: f5aed0754540 + last_write_checksum: sha1:ea80b91e539a427ae7bafd34f422e3749fc77acc + pristine_git_object: 221095cfd370a8bd16911fe84405635b59369abe + docs/components/internchatusermessage.mdx: + id: 0073668c3d8d + last_write_checksum: sha1:53a8c52ead668be930deb9a3a0c7ecd4149503e0 + pristine_git_object: 55aae5818b0db37b735d95788602a76bf8237564 + docs/components/internchatusermessagerole.mdx: + id: b314b250af70 + last_write_checksum: sha1:22c9aaa210f59e0d4845a03a268b6ba879fb4132 + pristine_git_object: 4a98d72416014765c3e6b38b7b5eae9cbc8e2f34 docs/components/internlifecycleerrorerror.mdx: id: 501146f0d87d last_write_checksum: sha1:1b49f19b35c20245a088fc58825a9ee97d27c300 @@ -2916,6 +3152,10 @@ trackedFiles: id: 192fa7358f3b last_write_checksum: sha1:c82facbab1f9b4f53e06a6e3986b886f2a9b9b00 pristine_git_object: 3bb4205e59ddb7d332e8d900afd2ee5aaa120dc0 + docs/components/legend.mdx: + id: 241b46c3af41 + last_write_checksum: sha1:87f6ccd952555f98fa58ea6231cb5e02dea633ba + pristine_git_object: 84e5be99fde18ac05e85c2ec21e97204be5957c4 docs/components/links.mdx: id: 70a0fc77c7ab last_write_checksum: sha1:67b732d632e9dee1437f8de51c8160568a3a5ac5 @@ -4218,8 +4458,8 @@ trackedFiles: pristine_git_object: 5f80faa24ced13304a685894f4f01553531f0c3c docs/components/outputmodality.mdx: id: d0e5e32d8485 - last_write_checksum: sha1:ab35ad2a3d1ef1b6b024be920d78d538450fb563 - pristine_git_object: f052813506aab38d5d746aa56096d1d05dec8bb9 + last_write_checksum: sha1:9b198f071e37da4c4e5830d8f46b10d2d8a83151 + pristine_git_object: 25bd86a32b1a99d7ad5f30323e739ba4e78b3681 docs/components/outputmodalityenum.mdx: id: ff4d9d7b9e07 last_write_checksum: sha1:a9bbd20b85b23f8d3affe92d5c8b0a6d5b717142 @@ -4578,20 +4818,20 @@ trackedFiles: pristine_git_object: 1d91d32cd0bf4b64699bbbf05a7e95ab835b10cf docs/components/providername.mdx: id: aa3a4904b228 - last_write_checksum: sha1:87e7ce66174ca6017a9becf73a449a344c4b4cd1 - pristine_git_object: 390e29376d82cc71b7ba97787897f90845bc81a1 + last_write_checksum: sha1:054a978480335cb20d50ae71fc1a00d1cf148ada + pristine_git_object: 72302da75bf85ae9c78eea17a77bc67e415b3861 docs/components/provideroptions.mdx: id: 2697807524fe - last_write_checksum: sha1:e3c41b66c4ed80016c264cecfde6290a0b69b345 - pristine_git_object: f3ba3c9cb9425090c7678d75d21f65af5ae3ae7e + last_write_checksum: sha1:f43a41ec2868fa654f4e4a6a25302990b23deb89 + pristine_git_object: 545306fe7877411c77c5a3826536866b0eb2b78e docs/components/provideroverloadedresponseerrordata.mdx: id: dc500cd14889 last_write_checksum: sha1:8326118941c8899a398931c8c7871af21b716b00 pristine_git_object: 8318f521198142d8efdabba734e091545bf1a648 docs/components/providerpreferences.mdx: id: adbdfaa46438 - last_write_checksum: sha1:26ef79be79d733e12a89acc7687ccbd87ebc2f2e - pristine_git_object: a312c6f654c101959c3f182c268556c01e578a40 + last_write_checksum: sha1:b02ea5ad41a466836473215d67cd3599df9e6540 + pristine_git_object: f3203a1e3e121102c24cc9a397fa5ad1359a0fcb docs/components/providerpreferencesignore.mdx: id: e0455b31c87b last_write_checksum: sha1:823f56c785a5c80949105fc0f4297a5b0ff2c2b2 @@ -4614,8 +4854,8 @@ trackedFiles: pristine_git_object: dd376f0952fa0517dd83b06ed7afc2c856123dbc docs/components/providerresponseprovidername.mdx: id: 2fc17b61e546 - last_write_checksum: sha1:629498232b662daa4eb6aee912cd58f10477fda5 - pristine_git_object: 1e1073fb7e8df492c4f36944f04111c8cef0f914 + last_write_checksum: sha1:63dbf09de082a94add960a0db69bf9b1e3e7e868 + pristine_git_object: f7452e7780699ff8a426572727eabb869bc07ce1 docs/components/providersort.mdx: id: d73fa13eeb95 last_write_checksum: sha1:b7e9e6842741e3433d705bd576f2ac5383f00134 @@ -4644,6 +4884,10 @@ trackedFiles: id: 9d062e4ee362 last_write_checksum: sha1:0baac45af2448938fb70f2076caaac66834bd3ce pristine_git_object: 80f51dc8e90b6642365ab8d409b6f100f07ccab0 + docs/components/questions.mdx: + id: 75aa4ba39e9c + last_write_checksum: sha1:5239cbe0ce5d970b958a9f00551067e5cdd88c20 + pristine_git_object: 15be03f7c7723c3a2512cfe35d8f35083a21ebbb docs/components/rangecapability.mdx: id: 8c2d6524bd62 last_write_checksum: sha1:e583c16a52c5811d882ddbe20cee0a7006035356 @@ -4676,10 +4920,6 @@ trackedFiles: id: eaa8d80ab494 last_write_checksum: sha1:aa9ee8b3680fc576b4b295e8f46798ef61bedffe pristine_git_object: ff97dff4ba45e4a271b653e7722fca01e78af328 - docs/components/reason.mdx: - id: 0c3e75430162 - last_write_checksum: sha1:d46f2a9cba528c56bafb3150b3debcb7a138c2d8 - pristine_git_object: 99c4a374a4dacb8e64c8a1cf5efb815fb177e22d docs/components/reasoningconfig.mdx: id: e5500b541923 last_write_checksum: sha1:b0e83c1220f90bc3fec77e884c2c588f8b65bfbc @@ -5160,6 +5400,10 @@ trackedFiles: id: 6eb0f13ef2a1 last_write_checksum: sha1:64ee44794873236df5419e4f63e4963898ce6627 pristine_git_object: 3a93298ea9bc10f11e468d2eb33c2bd8e7e12f40 + docs/components/state.mdx: + id: 5f13bb58ae41 + last_write_checksum: sha1:3c1825cf0232520f8bf0a7d763391689c8ded8d0 + pristine_git_object: 00263cb8d99a3b5fabd9154030b29959a2f66fef docs/components/stop.mdx: id: 338b29992e2d last_write_checksum: sha1:9dda52333be95669e9c460690bed92ffa8a0bf14 @@ -5286,8 +5530,8 @@ trackedFiles: pristine_git_object: d016021a79783dfa11b1110edc231f49f45df4d0 docs/components/sttresponse.mdx: id: a421f69065a0 - last_write_checksum: sha1:438935b5dcb2fb9cf44c74fff733133937286bff - pristine_git_object: 5868e50f86df62aae9952c94f98ebb33570efff1 + last_write_checksum: sha1:25440205f1688ffcc95c14ff3d3b850079d9c828 + pristine_git_object: cc34241b8d783d307b5f4bd7ea96580810f6debc docs/components/sttsegment.mdx: id: 7264ea9cdd57 last_write_checksum: sha1:a72a8567ac80b37f20db0e483de5b1c96d45e5fe @@ -5302,8 +5546,8 @@ trackedFiles: pristine_git_object: f0b56839c067ce29024888f689d379ed83f86ff4 docs/components/sttword.mdx: id: 665227ec6052 - last_write_checksum: sha1:ca6d433725166bfcfd3399f17f1f02776e82ade7 - pristine_git_object: 906d1fe7948b251c227043b24dedb7d4c56bcea1 + last_write_checksum: sha1:e299fae37efb17ab322fdc3da5513a6d1798f361 + pristine_git_object: bccae8c6fefa5a1be61bf78a6bd6471afc56dde1 docs/components/subagentnestedtool.mdx: id: 12547a9efd5f last_write_checksum: sha1:60f49c10d3b5c552a65ef4462d24e02a615cbaa8 @@ -5560,6 +5804,10 @@ trackedFiles: id: 976c883cc61f last_write_checksum: sha1:08a2c96b4935b69f70b0b324351f93dc57df4c16 pristine_git_object: 45784f009f3b4278413cbded0f51ca9f0888bcb3 + docs/components/truet.mdx: + id: c0565da4e1ab + last_write_checksum: sha1:7d7d89b32780260b30405c30aecf721e46fb962b + pristine_git_object: 492acaa873655a076c497299ecbdb118baaf8e39 docs/components/truncation.mdx: id: d338e8ec18bd last_write_checksum: sha1:c8bc50c016758d48320643ce2965fedba9b1e3f1 @@ -5946,16 +6194,16 @@ trackedFiles: pristine_git_object: 0f7cc13e29aa234d72930b1a95cf56cdaf836d4d docs/components/videogenerationrequest.mdx: id: b92ddbd15ee4 - last_write_checksum: sha1:e93542172c41ff0cf1a45753be2cabb26447e78f - pristine_git_object: 7582da56662a19d658453a95f2f261218c408089 + last_write_checksum: sha1:cf0802ce9c76d95097c3b548a7b23f3a1520d298 + pristine_git_object: 8f8569b74b23defb73cd90aba2e14714151723de docs/components/videogenerationrequestaspectratio.mdx: id: c14859c0d8c3 last_write_checksum: sha1:4ad4aae702af1cd2ddee7b443c35c9b3df6824e8 pristine_git_object: 67f56887bb4758559189e3e9e6123dff9a38df81 docs/components/videogenerationrequestoptions.mdx: id: 1d67160e7e7a - last_write_checksum: sha1:95dcc823c48f0970e4692281ccfb24ead912639e - pristine_git_object: 379724e319ff99d01732ccf4ecfbc83c24b1cebf + last_write_checksum: sha1:3d5fd87e68b74ccb0ead6d4e920e32facb9a484a + pristine_git_object: 4c2feb0234f44b07f550185a9f9f3a9cd6e13c06 docs/components/videogenerationrequestprovider.mdx: id: d6424dd5de9d last_write_checksum: sha1:72aa46a3335220b579db56574ea179d150dbe2b6 @@ -5966,8 +6214,8 @@ trackedFiles: pristine_git_object: 520c2481273e5939b59a781712e9687991af79f6 docs/components/videogenerationresponse.mdx: id: 3a932213188e - last_write_checksum: sha1:7d170bdf13476392c6c7e2a32c99ca7c1e17d436 - pristine_git_object: dd365941c8213459966629c69bbdd8134635b823 + last_write_checksum: sha1:aca1b0916904ae4c7e44c61ffde557f0994504db + pristine_git_object: 31fceaaafa844fe18a8dd1b2cb4daf488e90cff2 docs/components/videogenerationresponsestatus.mdx: id: 637442fde0ff last_write_checksum: sha1:9368ca45d569e511e5faf18118efd7e3341473a7 @@ -6168,6 +6416,10 @@ trackedFiles: id: e3cb72f51ee2 last_write_checksum: sha1:144494af097e80aa9fdb921d094b2473bc598165 pristine_git_object: 2a892b08d47733e805a94c47c7f87252f262f753 + docs/errors/internchaterrorresponse.mdx: + id: 68f63d6ed931 + last_write_checksum: sha1:887bc2e4b9e53a33836eb4a7bd01392638498b49 + pristine_git_object: c8312437d9da083b4bf320af415a357b5471dee0 docs/errors/internlifecycleerror.mdx: id: 628a6023e104 last_write_checksum: sha1:bf1a5dd26e7c994c2bef5eef51e3a70dbccd2ceb @@ -6320,6 +6572,14 @@ trackedFiles: id: 9040b392c33c last_write_checksum: sha1:d8c41416f0226d69cbd6e7086531a6fbd76d6695 pristine_git_object: 17c655cf0eb8cb6128904ade075dd447ddc86755 + docs/operations/createapialphadecisionsglobals.mdx: + id: 0876f1e7d3f2 + last_write_checksum: sha1:9deed6dcbeb1a2f16f786739c886b8b91c1e7d4c + pristine_git_object: 2fc93732fa50f66f62325e05f97deeb4257ec562 + docs/operations/createapialphadecisionsrequest.mdx: + id: 493cca2a6d0d + last_write_checksum: sha1:a271c209cda3b4ec68655652eb5a58a68b741be1 + pristine_git_object: efdf720f645ba03fdb0802a9d2e661ac9a38051f docs/operations/createaudiospeechglobals.mdx: id: 9b19782b0fc7 last_write_checksum: sha1:620e2236612f7cdf7dc23e0f975671e979d7e4f5 @@ -6432,6 +6692,18 @@ trackedFiles: id: 852027a00620 last_write_checksum: sha1:f65739779d5b4cd6cbacf59817765623554abef6 pristine_git_object: 77636052b24b9c8973895543fc9bacebe8459844 + docs/operations/createinternchatcompletionglobals.mdx: + id: cce9167e906c + last_write_checksum: sha1:aecbc4296a988fce00115ba6313921ea94058901 + pristine_git_object: 561b72c40da1ebfe6e01a57bd313be238557f279 + docs/operations/createinternchatcompletionrequest.mdx: + id: 24bc5d86217b + last_write_checksum: sha1:a1b741aa4ebd6a388735452a827a58dd58c5c342 + pristine_git_object: a4bd48afd3faf36fa76a2d37561c5582af141ca0 + docs/operations/createinternchatcompletionresponse.mdx: + id: a5139c86a594 + last_write_checksum: sha1:dc7481067fc785d7db1163fe12b694a303a2df1a + pristine_git_object: 2e1d5764aa37e363aed5760421c9f6b8681f460c docs/operations/createinternglobals.mdx: id: 45b4d0de1076 last_write_checksum: sha1:d9bae324793bf0ceed41e23e92bf267574cd7834 @@ -6910,8 +7182,8 @@ trackedFiles: pristine_git_object: e6beafcf11154033e2951ae58103041a2af946b9 docs/operations/getmodelsrequest.mdx: id: b2627beb1959 - last_write_checksum: sha1:84a844c010cabf841713b39ef2cbd2373e493e46 - pristine_git_object: 2b88459a0d639e8fede6741e30e0b5058edc0230 + last_write_checksum: sha1:8dbbf8a4767657cee16dd783ae1072d58a3d2bcd + pristine_git_object: 95e4b488f22d3f1ae4c2cdd5458136554d4d2837 docs/operations/getmodelsresponse.mdx: id: acfd4707ddde last_write_checksum: sha1:0c0fb343b7965a76cc790355b7f43d1f52f13e89 @@ -7246,16 +7518,16 @@ trackedFiles: pristine_git_object: 0daab751f0e30b136ffdd342831b3fc0cba5aae1 docs/operations/listmodelscountrequest.mdx: id: 8cc6953df79a - last_write_checksum: sha1:dfef7f8c746b046f44d4f7ce310233d817dc6641 - pristine_git_object: e97bb8afc04a465f018bf71fa8b2c221713804da + last_write_checksum: sha1:a158cb0e18427a04caf690628e572ed8243ccc85 + pristine_git_object: 163aa28dd800b239d32f4e240f1611d612ff5cc9 docs/operations/listmodelsuserglobals.mdx: id: 199f6a8dda42 last_write_checksum: sha1:4d1918ce9fa370cf27f0de2ad725033dcc5beab8 pristine_git_object: f0a800135df0c6e4799128a4fbc901c576c8c6ce docs/operations/listmodelsuserrequest.mdx: id: 01537864056e - last_write_checksum: sha1:d977e2ae651f59b636911e6fc0c9b2cd5c90e149 - pristine_git_object: 047eaf5ae3ff92bc3a5e93141f9cd45c2055c812 + last_write_checksum: sha1:60310daa2bd8a0adbef484525680460e350172d1 + pristine_git_object: 0ad201f8af94bbf0dee823e9c3eeb841fcd56fc5 docs/operations/listmodelsuserresponse.mdx: id: 34f7a1648ceb last_write_checksum: sha1:bf1ee4a9b2ad707ff1c39ea8680e72e5d0c27b9a @@ -7486,8 +7758,8 @@ trackedFiles: pristine_git_object: 0f0b54e43577a8a835cd971f82e48c3921e3d88e docs/operations/provider.mdx: id: c75b3bbeeaa0 - last_write_checksum: sha1:86dc3e01802bb3a4e1477979535bbf2c2550bbcc - pristine_git_object: 2762e4d9f70f31b75cb43286c33064707461b129 + last_write_checksum: sha1:92b773191ba1c91d34863baa9d91c6f62a5e19b5 + pristine_git_object: bc2c971d904b1d27c23308dfcac54b35e41a3658 docs/operations/provisioninternglobals.mdx: id: 5e34eb9c579a last_write_checksum: sha1:e5ddc9680dd8f7c0bbec6bb900f0754c8d8da955 @@ -7788,6 +8060,10 @@ trackedFiles: id: 15e5ab0183de last_write_checksum: sha1:aa3ad8ca41dcb9d8657a31ea33b17045019ca1d3 pristine_git_object: fe31c0f4f765b9f8f3cf79f6dd403e730589db80 + docs/sdks/decisions/README.mdx: + id: a52a116ee1f3 + last_write_checksum: sha1:0ade193e7c99d9cc1144774465bad4f65530090a + pristine_git_object: 0b2877e3e1cae0e427a749e4290c6b3017be7b6f docs/sdks/embeddings/README.mdx: id: cd71581df291 last_write_checksum: sha1:2a965ecfe30c04bc70a42846e3b81523ac2db026 @@ -7814,12 +8090,12 @@ trackedFiles: pristine_git_object: 08c687694efbecf50406ae7929029d39fb121295 docs/sdks/interns/README.mdx: id: 2f8a053ffe78 - last_write_checksum: sha1:7bef8123763db516f82d5dccd4741f781ef67f2e - pristine_git_object: 4b26b50dbae23ee5b463344e845537f0898f91dc + last_write_checksum: sha1:ab668c5e503f8293c82e6ddd9b550fa9e7fac25e + pristine_git_object: 57fd0d26619a62e9e3c887f5bf49660579206638 docs/sdks/models/README.mdx: id: 58f1ca464e0b - last_write_checksum: sha1:e52eb8f94799aec2499f70e99ca46acedfe17ec9 - pristine_git_object: 704be1ed3f77b0ee75b738939864833e1cb52a2e + last_write_checksum: sha1:093dd30ebdd18b9763a6956915e0dcae4ae7d5e5 + pristine_git_object: 9131aee97e483384b6721a32936c05901dfeea5d docs/sdks/oauth/README.mdx: id: 42b5079343d2 last_write_checksum: sha1:e58bac6bbe1c443462510a1dc5dca91bb4996525 @@ -7866,8 +8142,8 @@ trackedFiles: pristine_git_object: 224e03abadbea39a7fa64d5d4733b9b5f80fefab docs/sdks/videogeneration/README.mdx: id: 9a8fa04c3872 - last_write_checksum: sha1:106d1c9682b11a43f84c619a08037e310f488b73 - pristine_git_object: 1d820c5a5b129d364b70d95eb433e4c66f84c5e0 + last_write_checksum: sha1:6b4cbab4adb8e8573c7f01f77760bb8e0abaaa6f + pristine_git_object: f317b0a45ac81d17124b0286e1df39c3eec14b99 docs/sdks/workspaces/README.mdx: id: 0c75d023ef6b last_write_checksum: sha1:25592df93519c9e742e7c2a3df49ea2337a47d64 @@ -7878,8 +8154,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:85a5a4a29b4e7d11abc3ecbfa150e4d41cbc7b54 - pristine_git_object: ab9aa030783b24f633d2d572f1d28b213281446f + last_write_checksum: sha1:ab77d36f611d3a5c30d4aa64b72399005d981f80 + pristine_git_object: 362e403ecbe15c78e05652edb36a4b987137451d scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -7906,8 +8182,12 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:fb5e9926210f311c22f6d28267f6306969fa6ed2 - pristine_git_object: 1c31f98a0e477fd3439e344061bb0e1e7aff7c64 + last_write_checksum: sha1:319fb8d06425241fafb92c795a5c0daf30a5384a + pristine_git_object: 54e28eba869ee18a5082005b0cb942a50a693868 + src/openrouter/alpha.py: + id: 306c4d93308d + last_write_checksum: sha1:0c25a52ed5fb688ec1e923e4e82bcfc9cae49465 + pristine_git_object: 785d065a4072de96cce85556d2f87f35d6046c29 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:1e0004d8d1d5d797e2b54cd1cabeb7f9489d08e9 @@ -7946,8 +8226,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:51f930611b2ea502afe28911bdef17d74960a6ff - pristine_git_object: 7f9810b0cb23bfc7225e1c408aba447e3c7c05c5 + last_write_checksum: sha1:d21e29eb27b9db4d1f75ea2d4c2a98ad18099e11 + pristine_git_object: 48647085cc6fe2b73d22ba0cf28de9aa8c35699d src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -7978,8 +8258,8 @@ trackedFiles: pristine_git_object: 4aca4ffde948a789118b9388fdf4638cb878e532 src/openrouter/components/agentmessageitem.py: id: 6dbe0c8e2c79 - last_write_checksum: sha1:475390ec86c90a835bb2f7a1d256d6b03acbbfd5 - pristine_git_object: 87dbb8cdeb74d04a1fd0133689bf948be74c04bd + last_write_checksum: sha1:d69c0722a54bcfa3dd26d5f7c1f49dd26326c95e + pristine_git_object: a9016410bd197d9778bfca56e91340ea846a2424 src/openrouter/components/annotationaddedevent.py: id: dc032c9ad744 last_write_checksum: sha1:8e5d49d2b57114df7f4559b611d40769e65f9f78 @@ -8322,8 +8602,8 @@ trackedFiles: pristine_git_object: faaeb8190aed90e810758aadaf59184aabe0b0d3 src/openrouter/components/byokproviderslug.py: id: 6738a8516caf - last_write_checksum: sha1:76c90ff739473d77c7c5c47e1ec63584279bf640 - pristine_git_object: d908cdc58b6b1342166074fcb47175614afcfcbb + last_write_checksum: sha1:e1a48daaa5ca076c76f00ad49c2e85d8aa96400c + pristine_git_object: 184097a3a76a097466fba1624e29c198115d4714 src/openrouter/components/capabilitydescriptor.py: id: 368790a86f10 last_write_checksum: sha1:a167551924ee82b4b5876a0ab698a45fe8c87a95 @@ -8730,8 +9010,8 @@ trackedFiles: pristine_git_object: 7725b78a34d2cd994fec5837f32e3ff1a3fdaba3 src/openrouter/components/customtoolcalloutputitem.py: id: 533940b12cd2 - last_write_checksum: sha1:68089e5a22099cc2d438eb7be71e39fdda816241 - pristine_git_object: f6c97dc258f59093ca23fd06ca4969952477ce73 + last_write_checksum: sha1:1934cb285468ce7e60f506412320c62b55239047 + pristine_git_object: da292bcf39a6a990c03d4ae3f7fcb4b0224c1a14 src/openrouter/components/dabenchmarkentry.py: id: 5f5745cbfe75 last_write_checksum: sha1:4416b41c6ca98d790893113ed5f6c3e0157e74dd @@ -8748,6 +9028,38 @@ trackedFiles: id: 5ecad6212326 last_write_checksum: sha1:e83da36b6ccf9401789c28b8056701b5f0cb6f68 pristine_git_object: dd463df81262f2fe4b51b33c9dde998e435f03c2 + src/openrouter/components/decisionschoiceanswer.py: + id: 53a9e8cdf870 + last_write_checksum: sha1:16380c24282a8d275d96bed268bf5d6410b56f43 + pristine_git_object: 8ace039989a6bdec7da3542d094e6a27fe12bdfb + src/openrouter/components/decisionschoicequestion.py: + id: 3e2db807f2d4 + last_write_checksum: sha1:9f7f323f555c3d0285924e7671e2a555b293dfd5 + pristine_git_object: 2bc00e588439e2d0254689bef6f69aae32f9ce1d + src/openrouter/components/decisionsnoulanswer.py: + id: 6970afd97d95 + last_write_checksum: sha1:b7b1b9b31fb71cb4d0d16c8135c3627605ad06b5 + pristine_git_object: 144095e118b62c54d8e6e0abdc7a29a69634c82c + src/openrouter/components/decisionsnoulquestion.py: + id: a04589349064 + last_write_checksum: sha1:3434eb7616fe1df0479dfa0e89ba55a0f3874759 + pristine_git_object: d6b2551a31bc9c7d8e2ed96913c097dc127c8311 + src/openrouter/components/decisionsrequest.py: + id: 5df43fede21b + last_write_checksum: sha1:671d51ba36a099390f2ed53230d7363f0644f02e + pristine_git_object: 3f40fcff3f6beaaa879d3f23e11d35e091ad4ede + src/openrouter/components/decisionsresponse.py: + id: b91b81c2cf95 + last_write_checksum: sha1:db05bebf1bd1d7cee86819ad649531f46574f294 + pristine_git_object: 534bf4bf7478e4c2c3f14e26243264169d381905 + src/openrouter/components/decisionsscoreanswer.py: + id: af8597465725 + last_write_checksum: sha1:e12a52051ccd6f841e0238d789b816a05156d299 + pristine_git_object: e06b49a8d96c88e79da123a1229b2dc4a1694210 + src/openrouter/components/decisionsscorequestion.py: + id: 2c10723569c6 + last_write_checksum: sha1:eb600123dc7156e5e5f2bf9a06ed022746ba680b + pristine_git_object: a5abe8e608aaaa6c4dc2a55e38bd6d6b23b8f970 src/openrouter/components/defaultparameters.py: id: 548f4f885c22 last_write_checksum: sha1:b4441a938ceb4511d0207256d0cfed6ca6d9ed4d @@ -8782,8 +9094,8 @@ trackedFiles: pristine_git_object: 708dfac62530c5fcd29f6bb0be113dc34fd24718 src/openrouter/components/easyinputmessage.py: id: 72619a312585 - last_write_checksum: sha1:ad4971990695b6565fe1f631966cba95e5289863 - pristine_git_object: 33a8b190d7c6d4df90560597ea7b90f8322578a0 + last_write_checksum: sha1:af0d941901294763a897362c201c494f9fb5ca1c + pristine_git_object: b8b9f2123c39b6cc71aed24338a4a50324d62d4a src/openrouter/components/edgenetworktimeoutresponseerrordata.py: id: dc53aae5b171 last_write_checksum: sha1:44373dac3bf06bd752f0c54122949a024f70d3b5 @@ -8894,8 +9206,8 @@ trackedFiles: pristine_git_object: 181d74766073f16555f30e129adc23d9003fc8bb src/openrouter/components/functioncalloutputitem.py: id: bf659aa04e7d - last_write_checksum: sha1:011dcfa6feb0042f5a20e1a0caee9d8b300b0457 - pristine_git_object: bbae407986dbec466356c39751216f07e879220b + last_write_checksum: sha1:e938b63769022d499419ffcd309fdd71edb36174 + pristine_git_object: 1974612313ea19da7c23987d1b7ddece7337038b src/openrouter/components/fusionanalysisresult.py: id: 8c88c59e344e last_write_checksum: sha1:b64559e722fac2ca6acf2d8e69ba29080d0350fd @@ -8974,8 +9286,8 @@ trackedFiles: pristine_git_object: 5caeacf169f3edff5b6e9823264aeeff8be1e8ff src/openrouter/components/generationresponse.py: id: 84d4e3e7da8b - last_write_checksum: sha1:b26bce951ba1ce6ffb0779809e4410b03d9b9e6a - pristine_git_object: 87454d8cc8cc00e853eb13331c496af8f7d0d0d6 + last_write_checksum: sha1:5f7053e062244d74159db0eea89a43cfd35f5c1d + pristine_git_object: 2d84649ead8f1173b79176d5bee4daf5402b5712 src/openrouter/components/getbyokkeyresponse.py: id: ca3a8db80018 last_write_checksum: sha1:9b428028a01ffb73915a278096ca51bd1c660326 @@ -9058,8 +9370,8 @@ trackedFiles: pristine_git_object: 6b9a8990973466285f9b49b366bbc5fc1ae42e41 src/openrouter/components/imagegenerationproviderpreferences.py: id: 100a82a54e2d - last_write_checksum: sha1:e521bd8812ba6cce11f82ae34e90be9524209e94 - pristine_git_object: b5ff31ce7a095884cf4f6c1110eca88f8f7863ff + last_write_checksum: sha1:7abb33fc8eb2d8ee5c5cfc876b458920138813b6 + pristine_git_object: fb8236693fccc4775c075ad14555d44a633c61a3 src/openrouter/components/imagegenerationrequest.py: id: f8291a7be9a0 last_write_checksum: sha1:fcaa6c8879469974a42e7a4e351c29965e71c52e @@ -9126,8 +9438,8 @@ trackedFiles: pristine_git_object: d36ed6324c9a9a973b1564fc08dcd7e30e9db25a src/openrouter/components/imageoutputmodality.py: id: 56bf82622455 - last_write_checksum: sha1:fdd714b24893d1cc9a488a8927f6659188427438 - pristine_git_object: 9c5a7a430aa6103cc10052b1d6c278181071180c + last_write_checksum: sha1:665417a512ccb71bbbf18698acc537c06f10bbe8 + pristine_git_object: c0686ea94677cab1726ff8853396bbd7831f1383 src/openrouter/components/imagepricingentry.py: id: 58bd958fe130 last_write_checksum: sha1:449dd6b21d7182940757fc6717dd7e3eddc2472a @@ -9138,8 +9450,8 @@ trackedFiles: pristine_git_object: d8a39f6587ab7b80f097dda43b908d406539a905 src/openrouter/components/incompletedetails.py: id: 1984e5246b23 - last_write_checksum: sha1:573c1e6509ff2a9e1224725ec74e69f1c720eb09 - pristine_git_object: 313c4e71ee7627cb0cbef4cef3d4923b4360fe31 + last_write_checksum: sha1:38a35c72db59842fff15b5e290dcb531c9cb7ba5 + pristine_git_object: 73633e4141e7e4d9794e900218ddfac9a7bb21e0 src/openrouter/components/inputaudio.py: id: f8f101a46dda last_write_checksum: sha1:c323d92f2fa9c816a3970b8d10b5ad025d223cfe @@ -9150,12 +9462,12 @@ trackedFiles: pristine_git_object: 96197cab114700e6069a4c291679a82804fb2361 src/openrouter/components/inputimage.py: id: 995d068f1073 - last_write_checksum: sha1:c04dcb20e1eb3b22c1da233029e4a0c8502215a0 - pristine_git_object: 0e7edf2ba9a0c7cfa1e395b240ab55ada9bbd436 + last_write_checksum: sha1:471382d05b91659ac33a68548fcb89438ae1276b + pristine_git_object: c8c1ca668c23e80ebb2eb044dd47a2975c8d9915 src/openrouter/components/inputmessageitem.py: id: 6c5260d62714 - last_write_checksum: sha1:28aa6d6daa23ef02c730d35b8009db86cba444e1 - pristine_git_object: aa949dde32cf64fe3bd02c01e0adf4f949288143 + last_write_checksum: sha1:cd2b40540498d1cd762ad5786c1b9d4fb43fba7b + pristine_git_object: 47023bf58e247654046852ab6da66027036a64ae src/openrouter/components/inputmodality.py: id: ffa999fb401a last_write_checksum: sha1:da607c1deed71fcc11d880b7cebe92471e2ec5d4 @@ -9188,6 +9500,98 @@ trackedFiles: id: 91397805fa13 last_write_checksum: sha1:6307236e36dc876dbfae76cfcc29ad49461b5b5d pristine_git_object: c3e202d3c93225aba92c8ed9b83633c98f25fb4c + src/openrouter/components/internapprovalmode.py: + id: c44c27f9902d + last_write_checksum: sha1:402f51e4a6cda3f69abf85843961df96b2cf7f0b + pristine_git_object: 988b3a736faf813db2adf006f36e0c400935bb46 + src/openrouter/components/internchatassistantmessage.py: + id: c730f5412099 + last_write_checksum: sha1:45ffb3fbffa40a876abaf6178c6a6cc520c49fee + pristine_git_object: dcace16b45df1feb6cff3cf26a81e4e57dcff01f + src/openrouter/components/internchatchoice.py: + id: 9ff5592609ff + last_write_checksum: sha1:485dfd417ca8af7b2be21f8618179db06f598076 + pristine_git_object: 54ccff74a20133907f201284b124727cba7e13cd + src/openrouter/components/internchatcompletionchunk.py: + id: 416076befae5 + last_write_checksum: sha1:c615056430a1fcac1be0658550d93dd5ae8d05b5 + pristine_git_object: b573c302f287e32d7e8af6b5a87fbe1b5f61b55b + src/openrouter/components/internchatcompletionrequest.py: + id: a354f4a174e3 + last_write_checksum: sha1:5b5fbe8ebd9a3950a0b2874d37c7f607c7c9942e + pristine_git_object: 740d3f28cd1d0bb8eaaea78adb9c456db934f0d8 + src/openrouter/components/internchatdelta.py: + id: d5bd69629fe9 + last_write_checksum: sha1:309b516f24413099d88cb232c9f12a95e1a01df0 + pristine_git_object: 1ce01a227583fec713bcb6a88bc7630969b6b56f + src/openrouter/components/internchatdevelopermessage.py: + id: d005bd37ce19 + last_write_checksum: sha1:dff8edd919ed9271b4e87fa91cae50224d924214 + pristine_git_object: 92b3981ebcc9afc31b15c5ccc6e8f0fbc37da873 + src/openrouter/components/internchatechoedtoolcall.py: + id: 893eafc39025 + last_write_checksum: sha1:3556da194fd4a33c0e6c4d72d152d36380623e5a + pristine_git_object: 36ce2369a30d72dbcf09a57e5c5e691a79bfb539 + src/openrouter/components/internchatechoedtoolcallfunction.py: + id: de0d0d50a277 + last_write_checksum: sha1:fa5ba1fc3eaaa5ccbb8094567e341abc9020e529 + pristine_git_object: e3ed05c3513244bc989c5deb14efbe7df2f0f046 + src/openrouter/components/internchaterror.py: + id: a517f7c13ccf + last_write_checksum: sha1:4d0498c675b7df3f7082837da34bd34cec8e98b6 + pristine_git_object: 6ddb8c0cb704f5d042e89077fdf487614ab92939 + src/openrouter/components/internchaterrormetadata.py: + id: 6285b9634aae + last_write_checksum: sha1:13100ae9f103fb6b5cfb130eeef37c36f7a77224 + pristine_git_object: ef32d56c946d1378f096cb81241dfa0b5c1b75c0 + src/openrouter/components/internchatmessage.py: + id: a1261b993693 + last_write_checksum: sha1:94fa02daf0022b3867764cb6de75587ee0b7b104 + pristine_git_object: c880eb7b262ef3fb08f7ccda78d9cf4030ca3e87 + src/openrouter/components/internchatmessagecontent.py: + id: ffa1d259ca0f + last_write_checksum: sha1:43ff1da9e943448d0ee5917a209475d661dcac96 + pristine_git_object: 15127e201afb08059dc72dca07157f6543f65a72 + src/openrouter/components/internchatprompttokensdetails.py: + id: db8fcf7252a0 + last_write_checksum: sha1:551079dcc7a264200845ed175ba23246a8e54797 + pristine_git_object: 592244a0e5455e3cb419bc725413c859d25f6ad9 + src/openrouter/components/internchatstreamerror.py: + id: c4e363e9080c + last_write_checksum: sha1:574315e1f05594bdaec0f34ff6b7052fbe3af23c + pristine_git_object: e862c7450bea59052295789fc565ea30837d99d9 + src/openrouter/components/internchatstreamingresponse.py: + id: 82046faca08f + last_write_checksum: sha1:2fb9525157cf16fc18a31247c741558ec034f6d2 + pristine_git_object: 3a5dcf60553f898ea5366fbf607900e2ad23d3e5 + src/openrouter/components/internchatsystemmessage.py: + id: 3cd679ed29a6 + last_write_checksum: sha1:93a7d7e3236c8f82414093756a79eef3534238e8 + pristine_git_object: b4d9ed2acd19382ce86a24afcb7c2fabc6cd7793 + src/openrouter/components/internchattextpart.py: + id: b23cdde69d55 + last_write_checksum: sha1:166555122a9b1069c53c27e9b13c10f27548cf78 + pristine_git_object: 32223695f161d21d5fe3457a982358a733b222d0 + src/openrouter/components/internchattoolcall.py: + id: 63256627d6b6 + last_write_checksum: sha1:5e88dc414ca40a337452e9eb2e62f38af3580272 + pristine_git_object: ceb01c943db04c4c248d270e56dc4ef0c64a0282 + src/openrouter/components/internchattoolcallfunction.py: + id: f40616f4c0ae + last_write_checksum: sha1:5d92b783605042e9ad24a1f91fc0589eabbf8b7f + pristine_git_object: b723d3eae51d2c2bc5db2a5cc7b5cb4d3648cf41 + src/openrouter/components/internchattoolmessage.py: + id: 7de707b1d7bd + last_write_checksum: sha1:3d49fda7fc0d02b47daef67d703a6797f937899b + pristine_git_object: af736a62114a4e117ffd6eba210039306ce57f8a + src/openrouter/components/internchatusage.py: + id: 6cea3da7bf0f + last_write_checksum: sha1:5e48130973ec6273f7765f5ef74259a5b6b7e118 + pristine_git_object: 439af87192202af664a28ce17f5423a69308f71e + src/openrouter/components/internchatusermessage.py: + id: 97fab5db9a7e + last_write_checksum: sha1:d7d2493ea2f82a9c1fa1f90fae5c5365e589345f + pristine_git_object: a87aacc5a001412a5789caace557974ccf931928 src/openrouter/components/internlifecycleerror.py: id: 2b89c094850e last_write_checksum: sha1:952dc08e0ed7a08c0ca8cde1798916305f16edba @@ -9698,8 +10102,8 @@ trackedFiles: pristine_git_object: cd48453a58e4d356a37c97cbf611bf62ea8c163c src/openrouter/components/outputmodality.py: id: 74c79e4cad45 - last_write_checksum: sha1:a7e7205a3469166de2bd6649d94b8da6475cc3bd - pristine_git_object: 08bfb228f9e602675b1ec68de800e5f0602212dc + last_write_checksum: sha1:b804aa3d61e91d4ad6040f23ca2988096e1dcfda + pristine_git_object: 0aaa500a3ec0bea78c575ec152b3a4019c4d7855 src/openrouter/components/outputmodalityenum.py: id: 82bebf193d55 last_write_checksum: sha1:2983ef9a3c82244eff5f8b1184637a1fef13573c @@ -9858,24 +10262,24 @@ trackedFiles: pristine_git_object: 170ae25c582bb8decd74e1c69bfa8353bd44e86d src/openrouter/components/providername.py: id: fcc722fa2fce - last_write_checksum: sha1:b396132f569d6bf33c6773ef940ba3140cb57655 - pristine_git_object: cd0eb1827587303283b52cb6fae4ca243363e288 + last_write_checksum: sha1:f05d8723278e2fb4afc5d78ae239b7e33632d285 + pristine_git_object: e54927ab93189b895a4b108a1fdcfc0d19cb7ddf src/openrouter/components/provideroptions.py: id: 73dde6c8f359 - last_write_checksum: sha1:819734d061c200c50442fba3099ac3ec93bac1d8 - pristine_git_object: b286e2871990cddac4185a715ecdb1524689a7bc + last_write_checksum: sha1:6a6c6dc4256f5577b7e1647b85aa2aa027be6cd6 + pristine_git_object: 3d4d89c197cd4dec48d205673dc79db86a32f382 src/openrouter/components/provideroverloadedresponseerrordata.py: id: 5b693682570e last_write_checksum: sha1:b54682560ff95dad18d26f9aaf887f8f6e0e1f71 pristine_git_object: abe660d025957d61f68148006ca2c6efdc6b13a8 src/openrouter/components/providerpreferences.py: id: cdd58c8d664d - last_write_checksum: sha1:f8c331e585c01cbf291852656412f73855c3783f - pristine_git_object: 54ef6ce91cc841aff1c74c0fed7c6f54f2f0ee2f + last_write_checksum: sha1:f8ce833648e42c8bf0bb5e60e42689b5c99a9b1a + pristine_git_object: aa6879d3d84a2740fff5af3c9391b513fc1e1c24 src/openrouter/components/providerresponse.py: id: ad3887be54c5 - last_write_checksum: sha1:2ad00790e45f7d3ae8f7bb9e0b34cc8c0d8bfb35 - pristine_git_object: abbdc8ac29f0dff725f640987d8dabe60aba6a04 + last_write_checksum: sha1:dbd2cdd182deeaf20097ee54c9f2c39596655865 + pristine_git_object: ad81456315b8885bb7d6ec5801897b0015052701 src/openrouter/components/providersort.py: id: 348e382bf494 last_write_checksum: sha1:57551507f95cd2e16ef995e1c13f859fd0726152 @@ -10218,8 +10622,8 @@ trackedFiles: pristine_git_object: 44c22985654d81c37b3ab0ac764510dafbc8bd80 src/openrouter/components/sttresponse.py: id: 2dc8eb8daaca - last_write_checksum: sha1:36aff8c075a27f036d34f3970031a26aad99f804 - pristine_git_object: 61daeb24ef51df79db5fa62329f8d15d81d729d9 + last_write_checksum: sha1:e5ccf0c70fbf8e6cf38aea6b90eee0599c533aa4 + pristine_git_object: 6ea5f83a1f12cce9cf96e67d0b0894ed5fda8a11 src/openrouter/components/sttsegment.py: id: f3439539736c last_write_checksum: sha1:9b19b8c0becf911a2939c28314d999b4e3efcf14 @@ -10234,8 +10638,8 @@ trackedFiles: pristine_git_object: 1feb5db4da1422d55744c5a4bb10eabda6c50c4f src/openrouter/components/sttword.py: id: b46ff7c5fa20 - last_write_checksum: sha1:110e24e80ce5cf5ce2fa9272904fc4c32f538110 - pristine_git_object: 4d300cd3172215697a9ec551a889135628cee676 + last_write_checksum: sha1:8d01ff3a3b758053a9b25a08c76954558afa675c + pristine_git_object: d7e59a3e40d74540194515546d14a8ae0de8898e src/openrouter/components/subagentnestedtool.py: id: 911a465973a0 last_write_checksum: sha1:6aff7a7050393855944bbf85d437800336d12215 @@ -10458,12 +10862,12 @@ trackedFiles: pristine_git_object: b4a3db2fc4c7edf92a475be2952f01b5e2070205 src/openrouter/components/videogenerationrequest.py: id: 70e3c9ff288c - last_write_checksum: sha1:27d477e569e2f024bfdbf4aa240403dfe7686555 - pristine_git_object: 639fc39c21379c39833da54ecab058953923be6e + last_write_checksum: sha1:e047589a47917706c38f786a889688625b73e6de + pristine_git_object: 978b0a0c8caab77416664842cdecacb89a719531 src/openrouter/components/videogenerationresponse.py: id: 541f1321b072 - last_write_checksum: sha1:18c3aa7845f63a9614286b1a27b6098eae1c4951 - pristine_git_object: 2b0301ba6bf8c85efd8d85145cf39e4f0d8c5bcd + last_write_checksum: sha1:945a98a9738528de20d5edde41c9dd9800d2b547 + pristine_git_object: d0227a154119eddd2bfc0ac788269252c53a10b1 src/openrouter/components/videogenerationusage.py: id: dded36eba597 last_write_checksum: sha1:a19d286bfda3ca9a373128c5118f3e6715060470 @@ -10584,6 +10988,10 @@ trackedFiles: id: 2378f80d1d6a last_write_checksum: sha1:7bc2854b9c08b1e50d69b1e94fca80859ca0a0ac pristine_git_object: 0532cef994643793368c4484b8af0d247be2692e + src/openrouter/decisions.py: + id: 811fe0f48b6e + last_write_checksum: sha1:fd25cf3e8da0a70197456f24aa7a0b754159e152 + pristine_git_object: 926e989a96f75b79492f39bd9ae3282c8c06ff9f src/openrouter/embeddings.py: id: 0374ace39067 last_write_checksum: sha1:851a42c11af6b35186c99f8a6635f9be28782786 @@ -10594,8 +11002,8 @@ trackedFiles: pristine_git_object: 5c3a48759ba31aa633627707b68885b6cc367ddf src/openrouter/errors/__init__.py: id: 366154d0d60a - last_write_checksum: sha1:b29da3d57cabf8bb0226ef684841d0f5554ab683 - pristine_git_object: f3643660f0989f4fb3641035aef9b0444f7ba4ce + last_write_checksum: sha1:3cb158b48e05b02cacc0a7570fad6433fc25a8e9 + pristine_git_object: 21a81e55c4e0f8140973d0123b894760cbb60a55 src/openrouter/errors/badgatewayresponse_error.py: id: 818c3605ce23 last_write_checksum: sha1:f0307bff4a47f950c514d7d47de5690cac871bbb @@ -10628,6 +11036,10 @@ trackedFiles: id: a5ab5c4a53a9 last_write_checksum: sha1:3ffab8fcee20916d34ac6ff5112e8721f8d30c46 pristine_git_object: e63641558c6a2f555b46a76fa0e224c9ad526b88 + src/openrouter/errors/internchaterrorresponse.py: + id: 855f6fb3466e + last_write_checksum: sha1:6711c6b63107134e8b81665ca8f5b7c462ebabf1 + pristine_git_object: 6fe3f73572a88bdcce0cd15da283b25f034186a1 src/openrouter/errors/internlifecycleerror.py: id: 8d3ad41bb70c last_write_checksum: sha1:3a5f33a12bbd90a5477c08f3a88b6967ecd88abe @@ -10710,8 +11122,8 @@ trackedFiles: pristine_git_object: 50643a126668498dd668c7cceb9f78c03d413d32 src/openrouter/interns.py: id: d18df05c5c6d - last_write_checksum: sha1:6e7dd921512308aacf37344664872b0ab93585cf - pristine_git_object: 873ba9c2773966f3fef05f6ff55a114120e9f0b6 + last_write_checksum: sha1:66adc62242abfbaadc968355e7d609abb7e2a210 + pristine_git_object: cbb66128429a9e15e1792e0ad08215323f1dd9a7 src/openrouter/models/__init__.py: id: ed73b93abb3f last_write_checksum: sha1:932a790ae66ccd7d7022b39c659bcf72a664ebea @@ -10726,8 +11138,8 @@ trackedFiles: pristine_git_object: 5b741456655ff48919d17ffd552a6410f0587966 src/openrouter/models_.py: id: 4e1ae1fe5b98 - last_write_checksum: sha1:f09eb8fefc61997135aa610cb7c751fdaab407e9 - pristine_git_object: b4576cd59564f3ea17fd4cba053913c13b8f3d70 + last_write_checksum: sha1:5fabfae94d73d2552537ab5ff4628ade1540d89c + pristine_git_object: e16291f980d3a1e19aeef0f68cf5b4998da16f82 src/openrouter/oauth.py: id: 1948ce27255b last_write_checksum: sha1:7e9fc1853f0c0a8116436bc9b850e848a661ecf8 @@ -10738,8 +11150,8 @@ trackedFiles: pristine_git_object: 8680343bbc90107ae6413bd5686012b1fd75d665 src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:5b4fd788010eb5834402e7a99fcc0af11d4a96d9 - pristine_git_object: 13b659fb87d84fbc8325fbe68a51eb23adff8dcb + last_write_checksum: sha1:62e951864d7b8805c4bca1e7564bbae1f3fe049c + pristine_git_object: ef94ad40c2d71362b962376e38cdfe7dbcb4693d src/openrouter/operations/bulkaddworkspacemembers.py: id: e0ed56117619 last_write_checksum: sha1:5c44eb0d40fdece3ac084615f6c6082be4cf1d5a @@ -10768,6 +11180,10 @@ trackedFiles: id: 79d33d578ed1 last_write_checksum: sha1:b72323ae345357ce1f4f21a7db77c7f96c2e9ad3 pristine_git_object: ea7d9a7e04d2b942a9a4c6ec6d6e8c96f41e6b79 + src/openrouter/operations/createapialphadecisions.py: + id: f685307a800b + last_write_checksum: sha1:0953b986e2fdb07315da7fe2448e04dbb4ed3032 + pristine_git_object: 5a513d1447aed7a08eae5fdc727c9894c4c094cd src/openrouter/operations/createaudiospeech.py: id: af9df6195878 last_write_checksum: sha1:5beec05ba93a68805ad27e05603265864a608dc9 @@ -10804,6 +11220,10 @@ trackedFiles: id: b5cd9ac981a1 last_write_checksum: sha1:5bdd5fb6257c05a65d0855d7bfb7e3235602ba90 pristine_git_object: 2efb94a2e159ac4c6bd32fdf6e80877b9e209d81 + src/openrouter/operations/createinternchatcompletion.py: + id: 3d0567b5533b + last_write_checksum: sha1:e9efb3542c13d8b5f450117be623ecb509440849 + pristine_git_object: 67d40aee49e2ed9c4ceb7017e0986a00edc5f18e src/openrouter/operations/createkeys.py: id: 64ad31fdaa6c last_write_checksum: sha1:92e122bf7ca252e6cc1f4200cbcd6ded9a0d35a7 @@ -10962,8 +11382,8 @@ trackedFiles: pristine_git_object: d5a47b01285b12f05d46240e253a934be63f0a00 src/openrouter/operations/getmodels.py: id: 5bd5dfcb0125 - last_write_checksum: sha1:e03b151faca3884086009a273cf1572b7269b29f - pristine_git_object: 354655a9d492e9c1c07c7bff9d5ad325ec5b0640 + last_write_checksum: sha1:d38c034f9f2fb7b8abff942487efc45a07616545 + pristine_git_object: 4daeb79f65831d3f8b55d267f6287b794e8b92ed src/openrouter/operations/getobservabilitydestination.py: id: 15b49f22aca9 last_write_checksum: sha1:351b050b646c9e2dbffaf27633cbd38b30047169 @@ -11018,8 +11438,8 @@ trackedFiles: pristine_git_object: bec5a577e95e905673b68d02fc873b0bb9a3cd8a src/openrouter/operations/listbyokkeys.py: id: b6dd42b3e05f - last_write_checksum: sha1:0be0b8ca55bba21404d1efeb3947d4d4127dd6cf - pristine_git_object: 0d9dfb02d81d5cec8dc88e42e1ba4b42122649c0 + last_write_checksum: sha1:74d3231f60cc0bfd718a8a139b22523aa3f5239a + pristine_git_object: a75b32fcaaa904cc5f0d385f5f62ec4d1c555700 src/openrouter/operations/listcontainerfiles.py: id: 7a30b9291c76 last_write_checksum: sha1:c51c428703923d69ea0fd6178d6313314e7b0ee9 @@ -11082,12 +11502,12 @@ trackedFiles: pristine_git_object: 4ccc06b53c5f45c9fa99dc29623e5b442ed39462 src/openrouter/operations/listmodelscount.py: id: d588d81b71c2 - last_write_checksum: sha1:8403d42afbd9e33acb0cbf0671cd2248b2a93fb0 - pristine_git_object: 81e2dcd96d43cd0422a05fef8669697fdeea03fd + last_write_checksum: sha1:9428a1ab510072878e6bf57ab249e14978608b85 + pristine_git_object: cdde733b97c9b409d550fd58f9d49184d1647f4d src/openrouter/operations/listmodelsuser.py: id: 16eb5946cf60 - last_write_checksum: sha1:7cdc18f6096cadeb9fe60e9eec6fdf03fc5b511b - pristine_git_object: 78a9304b8224bad72de2143aa4dd3d52e6604cc1 + last_write_checksum: sha1:8f8571521a92ee945fa3875af7390fecab790a2d + pristine_git_object: 915aa93c1b33fc37b5b38800bd40284de64b8f01 src/openrouter/operations/listoauthjwks.py: id: 329ac9d6fa76 last_write_checksum: sha1:8d6b08b6637a0ff49f88313a9f1bed03349655f1 @@ -11242,8 +11662,8 @@ trackedFiles: pristine_git_object: 1bea5be2496b283307c037f131a45a25bcca3c6c src/openrouter/sdk.py: id: ee9846c4c9c5 - last_write_checksum: sha1:bd4f83db8a3171e6191c9e41872d3b2d55aa4d09 - pristine_git_object: e1ca4315c00cd4540c25c0f85db6128f3db7edb7 + last_write_checksum: sha1:242d0703dc95b748be45817ef9c7ad376e074b76 + pristine_git_object: 0fb8d63a93c0adc8462682be6e5a0207edebe593 src/openrouter/sdkconfiguration.py: id: 55773bb98d7c last_write_checksum: sha1:c01826125c31a8b8bc99d9d679782c8758fae001 @@ -11350,8 +11770,8 @@ trackedFiles: pristine_git_object: d73bcc0f564ebee39fdd727f9d588859abd19167 src/openrouter/video_generation.py: id: d0a90c1b8efe - last_write_checksum: sha1:35ba3b4cb6107daa57b247bfab706a77266130ee - pristine_git_object: f6928811eebc63d4e958bebaa14506647a54d4f7 + last_write_checksum: sha1:3cac67a39145deab8f1dbc8cde496bf4757d0fe0 + pristine_git_object: 6186c32069bb403d19f20ab7af4bb94ac8bab563 src/openrouter/workspaces.py: id: cd6c533b1802 last_write_checksum: sha1:68bf23158fc838c1ad63e871b5d2de6080a75931 @@ -12015,7 +12435,7 @@ examples: application/json: {"model": "google/veo-3.1"} responses: "202": - application/json: {"id": "job-abc123", "polling_url": "/api/v1/videos/job-abc123", "status": "pending"} + application/json: {"id": "gen-vid-1789480874-Ab3dEf9hIjKlMnOpQrSt", "polling_url": "/api/v1/videos/gen-vid-1789480874-Ab3dEf9hIjKlMnOpQrSt", "status": "pending"} "400": application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "401": @@ -12039,7 +12459,7 @@ examples: jobId: "job-abc123" responses: "200": - application/json: {"id": "job-abc123", "polling_url": "/api/v1/videos/job-abc123", "status": "pending"} + application/json: {"id": "gen-vid-1789480874-Ab3dEf9hIjKlMnOpQrSt", "polling_url": "/api/v1/videos/gen-vid-1789480874-Ab3dEf9hIjKlMnOpQrSt", "status": "pending"} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "404": @@ -14470,4 +14890,50 @@ examples: application/json: {"error": {"code": "not_found", "message": "Intern not found"}} "500": application/json: {"error": {"code": "not_found", "message": "Intern not found"}} + createApiAlphaDecisions: + speakeasy-default-create-api-alpha-decisions: + requestBody: + application/json: {"model": "Grand Cherokee", "questions": {}, "state": {"key": "Massachusetts"}} + responses: + "200": + application/json: {"answers": {}, "model": "Element", "usage": {"input_tokens": 122097, "output_tokens": 346702}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "402": + application/json: {"error": {"code": 402, "message": "Insufficient credits. Add more using https://openrouter.ai/credits"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "413": + application/json: {"error": {"code": 413, "message": "Request payload too large"}} + "429": + application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + "502": + application/json: {"error": {"code": 502, "message": "Provider returned error"}} + "503": + application/json: {"error": {"code": 503, "message": "Service temporarily unavailable"}} + "524": + application/json: {"error": {"code": 524, "message": "Request timed out. Please try again later."}} + "529": + application/json: {"error": {"code": 529, "message": "Provider returned error"}} + createInternChatCompletion: + speakeasy-default-create-intern-chat-completion: + parameters: + path: + internId: "a11e0000-0000-4000-8000-000000000005" + requestBody: + application/json: {"messages": [{"content": "Summarize the open pull requests.", "role": "user"}], "stream": true} + responses: + "200": + application/json: {"choices": [{"delta": {}, "finish_reason": null, "index": 0}], "created": 1789537541, "id": "chatcmpl-f727571a-3bad-4e0d-8a9e-f18f8cda9750", "model": "openrouter/intern", "object": "chat.completion.chunk"} + "400": + application/json: {"error": {"code": 409, "message": "That question is no longer waiting for an answer."}} + "502": + application/json: {"error": {"code": 409, "message": "That question is no longer waiting for an answer."}} examplesVersion: 1.0.2 +releaseNotes: "## Python SDK Changes:\n* `open_router.alpha.decisions.create()`: **Added**\n* `open_router.interns.chat()`: **Added**\n* `open_router.tts.create_speech()`: \n * `request.provider.options` **Changed**\n* `open_router.stt.create_transcription()`: \n * `request.provider.options` **Changed**\n * `response` **Changed**\n* `open_router.stt.create_transcription_multipart()`: `response` **Changed**\n* `open_router.byok.list()`: \n * `request.provider` **Changed**\n * `response.data[].provider` **Changed**\n* `open_router.byok.create()`: \n * `request.provider` **Changed**\n * `response.data.provider` **Changed**\n* `open_router.byok.get()`: `response.data.provider` **Changed**\n* `open_router.byok.update()`: `response.data.provider` **Changed**\n* `open_router.chat.send()`: \n * `request.provider.ignore[].union(ProviderName)` **Changed**\n* `open_router.embeddings.generate()`: \n * `request.provider.ignore[].union(ProviderName)` **Changed**\n* `open_router.embeddings.list_models()`: `response.data[].architecture.output_modalities[].enum(decisions)` **Added**\n* `open_router.endpoints.list_zdr_endpoints()`: `response.data[].provider_name` **Changed**\n* `open_router.endpoints.list()`: `response.data` **Changed**\n* `open_router.generations.get_generation()`: `response.data` **Changed**\n* `open_router.images.generate()`: `request.provider` **Changed**\n* `open_router.images.list_models()`: `response.data[].architecture.output_modalities[].enum(decisions)` **Added**\n* `open_router.models.get()`: `response.data.architecture.output_modalities[].enum(decisions)` **Added**\n* `open_router.models.list()`: `response.data[].architecture.output_modalities[].enum(decisions)` **Added**\n* `open_router.models.list_for_user()`: `response.data[].architecture.output_modalities[].enum(decisions)` **Added**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.provider.ignore[].union(ProviderName)` **Changed**\n* `open_router.presets.create_presets_messages()`: \n * `request.provider.ignore[].union(ProviderName)` **Changed**\n* `open_router.presets.create_presets_responses()`: `request` **Changed**\n* `open_router.rerank.rerank()`: \n * `request.provider.ignore[].union(ProviderName)` **Changed**\n* `open_router.responses.send()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.beta.responses.send()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.video_generation.generate()`: `request` **Changed**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 48d9529d..994773fc 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.1.156 + version: 1.1.157 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 71f69c90..8b942258 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -374,7 +374,7 @@ components: - $ref: '#/components/schemas/InputImage' - properties: {} type: 'object' - description: 'Image input content item' + description: 'Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.' example: detail: 'auto' image_url: 'https://example.com/image.jpg' @@ -4776,6 +4776,8 @@ components: - 'tenstorrent' - 'thinkingmachines' - 'together' + - 'typesafe' + - 'unbiased' - 'upstage' - 'venice' - 'voyageai' @@ -8159,7 +8161,7 @@ components: - $ref: '#/components/schemas/InputImage' - properties: {} type: 'object' - description: 'Image input content item' + description: 'Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.' example: detail: 'auto' image_url: 'https://example.com/image.jpg' @@ -8283,6 +8285,255 @@ components: - 'debug' - 'sequence_number' type: 'object' + DecisionsChoiceAnswer: + properties: + choice: + type: 'string' + confidence: + format: 'double' + type: 'number' + probabilities: + additionalProperties: + format: 'double' + type: 'number' + type: 'object' + type: + enum: + - 'choice' + type: 'string' + required: + - 'type' + - 'choice' + type: 'object' + DecisionsChoiceQuestion: + properties: + criteria: + additionalProperties: + anyOf: + - type: 'string' + - additionalProperties: {} + type: 'object' + - items: {} + type: 'array' + - type: 'null' + description: 'A plain string, or a JSON object or array of structured guidance.' + type: 'object' + instructions: + anyOf: + - type: 'string' + - additionalProperties: {} + type: 'object' + - items: {} + type: 'array' + description: 'A plain string, or a JSON object or array of structured guidance.' + type: + enum: + - 'choice' + type: 'string' + required: + - 'type' + - 'instructions' + - 'criteria' + type: 'object' + DecisionsNoulAnswer: + properties: + noul: + format: 'double' + type: 'number' + type: + enum: + - 'noul' + type: 'string' + required: + - 'type' + - 'noul' + type: 'object' + DecisionsNoulQuestion: + properties: + criteria: + properties: + 'false': + anyOf: + - type: 'string' + - additionalProperties: {} + type: 'object' + - items: {} + type: 'array' + description: 'A plain string, or a JSON object or array of structured guidance.' + 'true': + anyOf: + - type: 'string' + - additionalProperties: {} + type: 'object' + - items: {} + type: 'array' + description: 'A plain string, or a JSON object or array of structured guidance.' + required: + - 'true' + - 'false' + type: 'object' + instructions: + anyOf: + - type: 'string' + - additionalProperties: {} + type: 'object' + - items: {} + type: 'array' + description: 'A plain string, or a JSON object or array of structured guidance.' + type: + enum: + - 'noul' + type: 'string' + required: + - 'type' + - 'instructions' + type: 'object' + DecisionsRequest: + properties: + model: + type: 'string' + provider: + allOf: + - $ref: '#/components/schemas/ProviderPreferences' + - description: 'Provider routing preferences for the request.' + questions: + additionalProperties: + description: 'A Decisions question using a boolean, choice, or ordered score evaluation.' + discriminator: + mapping: + choice: '#/components/schemas/DecisionsChoiceQuestion' + noul: '#/components/schemas/DecisionsNoulQuestion' + score: '#/components/schemas/DecisionsScoreQuestion' + propertyName: 'type' + oneOf: + - $ref: '#/components/schemas/DecisionsNoulQuestion' + - $ref: '#/components/schemas/DecisionsChoiceQuestion' + - $ref: '#/components/schemas/DecisionsScoreQuestion' + type: 'object' + 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.' + example: 'session-1234' + maxLength: 256 + type: 'string' + state: + anyOf: + - type: 'string' + - additionalProperties: {} + type: 'object' + - items: {} + type: 'array' + description: 'The content to evaluate: a plain string, or a JSON object or array of related context.' + trace: + $ref: '#/components/schemas/TraceConfig' + user: + maxLength: 256 + type: 'string' + required: + - 'model' + - 'state' + - 'questions' + type: 'object' + DecisionsResponse: + properties: + answers: + additionalProperties: + description: 'A Decisions answer using a boolean, choice, or score evaluation.' + discriminator: + mapping: + choice: '#/components/schemas/DecisionsChoiceAnswer' + noul: '#/components/schemas/DecisionsNoulAnswer' + score: '#/components/schemas/DecisionsScoreAnswer' + propertyName: 'type' + oneOf: + - $ref: '#/components/schemas/DecisionsNoulAnswer' + - $ref: '#/components/schemas/DecisionsChoiceAnswer' + - $ref: '#/components/schemas/DecisionsScoreAnswer' + type: 'object' + id: + type: 'string' + model: + type: 'string' + provider: + type: 'string' + usage: + properties: + cost: + format: 'double' + type: 'number' + input_tokens: + type: 'integer' + output_tokens: + type: 'integer' + required: + - 'input_tokens' + - 'output_tokens' + type: 'object' + required: + - 'model' + - 'answers' + - 'usage' + type: 'object' + DecisionsScoreAnswer: + properties: + confidence: + format: 'double' + type: 'number' + legend: + additionalProperties: + anyOf: + - type: 'string' + - additionalProperties: {} + type: 'object' + - items: {} + type: 'array' + description: 'A plain string, or a JSON object or array of structured guidance.' + type: 'object' + probabilities: + additionalProperties: + format: 'double' + type: 'number' + type: 'object' + score: + format: 'double' + type: 'number' + type: + enum: + - 'score' + type: 'string' + required: + - 'type' + - 'score' + type: 'object' + DecisionsScoreQuestion: + properties: + criteria: + items: + anyOf: + - type: 'string' + - additionalProperties: {} + type: 'object' + - items: {} + type: 'array' + description: 'A plain string, or a JSON object or array of structured guidance.' + minItems: 1 + type: 'array' + instructions: + anyOf: + - type: 'string' + - additionalProperties: {} + type: 'object' + - items: {} + type: 'array' + description: 'A plain string, or a JSON object or array of structured guidance.' + type: + enum: + - 'score' + type: 'string' + required: + - 'type' + - 'instructions' + - 'criteria' + type: 'object' DefaultParameters: additionalProperties: false description: 'Default parameters for this model' @@ -8431,7 +8682,7 @@ components: - $ref: '#/components/schemas/InputImage' - properties: {} type: 'object' - description: 'Image input content item' + description: 'Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.' example: detail: 'auto' image_url: 'https://example.com/image.jpg' @@ -9059,7 +9310,7 @@ components: - $ref: '#/components/schemas/InputImage' - properties: {} type: 'object' - description: 'Image input content item' + description: 'Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.' example: detail: 'auto' image_url: 'https://example.com/image.jpg' @@ -9955,6 +10206,7 @@ components: - 'stt' - 'video' - 'image' + - 'decisions' - null type: - 'string' @@ -11629,6 +11881,7 @@ components: - 'audio' - 'video' - 'rerank' + - 'decisions' - 'speech' - 'transcription' example: 'image' @@ -11830,7 +12083,7 @@ components: - 'type' type: 'object' InputImage: - description: 'Image input content item' + description: 'Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.' example: detail: 'auto' image_url: 'https://example.com/image.jpg' @@ -11844,6 +12097,10 @@ components: - 'original' type: 'string' x-speakeasy-unknown-values: allow + file_id: + type: + - 'string' + - 'null' image_url: type: - 'string' @@ -11873,7 +12130,7 @@ components: - $ref: '#/components/schemas/InputImage' - properties: {} type: 'object' - description: 'Image input content item' + description: 'Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.' example: detail: 'auto' image_url: 'https://example.com/image.jpg' @@ -12270,6 +12527,506 @@ components: - 'code' - 'message' type: 'object' + InternApprovalMode: + description: 'How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with.' + enum: + - 'manual' + - 'self-drive' + example: 'manual' + type: 'string' + x-speakeasy-unknown-values: allow + InternChatAssistantMessage: + description: 'An assistant message from an earlier response. When answering an interaction, echo the streamed `tool_calls` here before the `tool` message.' + example: + content: null + role: 'assistant' + tool_calls: + - function: + arguments: '{"kind":"permission","operation":"shell","options":["allow_once","reject_once"]}' + name: 'openrouter.provide_input' + id: '15e90ad6-5320-4a59-af4f-b371428154fa' + properties: + content: + $ref: '#/components/schemas/InternChatMessageContent' + role: + enum: + - 'assistant' + type: 'string' + tool_calls: + items: + $ref: '#/components/schemas/InternChatEchoedToolCall' + type: 'array' + required: + - 'content' + - 'role' + type: 'object' + InternChatChoice: + description: 'The single choice this endpoint streams.' + example: + delta: + content: 'Hello' + finish_reason: null + index: 0 + properties: + delta: + $ref: '#/components/schemas/InternChatDelta' + finish_reason: + description: '`null` while streaming. `stop` when the run completed, `tool_calls` when the run is waiting for the caller to answer the streamed tool call, `error` on the terminal error chunk.' + enum: + - 'error' + - 'stop' + - 'tool_calls' + - null + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow + index: + type: 'integer' + required: + - 'delta' + - 'finish_reason' + - 'index' + type: 'object' + InternChatCompletionChunk: + description: 'One `data:` line of the stream. A run streams a role chunk, content and reasoning chunks, then a finish chunk: `stop`, `tool_calls` (the run is paused for input) or `error` (with an `error` object). A final chunk with empty `choices` follows in every case, carrying `session_id` and `usage` (`null` unless the daemon reported usage, and always `null` after `tool_calls`). Every stream ends with `[DONE]`.' + example: + choices: + - delta: + content: 'Hello' + finish_reason: null + index: 0 + created: 1789537541 + id: 'chatcmpl-f727571a-3bad-4e0d-8a9e-f18f8cda9750' + model: 'openrouter/intern' + object: 'chat.completion.chunk' + properties: + choices: + description: 'One choice on content, tool-call and error chunks. Empty on the final chunk that carries `session_id`.' + items: + $ref: '#/components/schemas/InternChatChoice' + type: 'array' + created: + type: 'integer' + error: + $ref: '#/components/schemas/InternChatStreamError' + id: + description: 'The completion id, constant for the whole response.' + example: 'chatcmpl-f727571a-3bad-4e0d-8a9e-f18f8cda9750' + type: 'string' + model: + description: 'The request `model` when given, or `openrouter/intern`. The final chunk may carry the model the intern reported for the run instead.' + type: 'string' + object: + enum: + - 'chat.completion.chunk' + type: 'string' + session_id: + description: 'On the final chunk of every response, the daemon session to continue with, or `null` when the run failed before the intern reported one. Send it as `session_id` on the next request, including the `tool` reply to an interaction.' + example: 'ses_7f3c9a' + type: + - 'string' + - 'null' + usage: + $ref: '#/components/schemas/InternChatUsage' + required: + - 'choices' + - 'created' + - 'id' + - 'model' + - 'object' + type: 'object' + InternChatCompletionRequest: + description: 'An OpenAI-compatible streaming chat completion request for one intern. Other OpenAI fields such as `temperature` or `tools` are ignored. The intern owns its sampling and its tools.' + example: + approval_mode: 'manual' + messages: + - content: 'Summarize the open pull requests.' + role: 'user' + stream: true + properties: + approval_mode: + $ref: '#/components/schemas/InternApprovalMode' + messages: + description: 'The conversation. Only the last message is read. A last `user` message starts a run. A last `tool` message answers the interaction named by its `tool_call_id` and requires `session_id`.' + items: + $ref: '#/components/schemas/InternChatMessage' + minItems: 1 + type: 'array' + model: + description: 'Echoed as `model` on the streamed chunks; the final chunk may carry the model the intern reported instead. The intern chooses its own model, so this value does not change what runs.' + example: 'openrouter/intern' + maxLength: 256 + minLength: 1 + type: 'string' + session_id: + description: 'The daemon session to continue, as returned in `session_id` on the final chunk of an earlier response. Omit it to start a new session. Required when the last message has role `tool`.' + example: 'ses_7f3c9a' + maxLength: 256 + minLength: 1 + type: 'string' + stream: + const: true + description: 'Must be `true`. This endpoint only streams.' + example: true + type: 'boolean' + required: + - 'messages' + - 'stream' + type: 'object' + InternChatDelta: + description: 'The incremental content of one chunk. The first chunk carries `role`, text chunks carry `content`, reasoning chunks carry `reasoning`, and an interaction chunk carries one complete `tool_calls` entry.' + example: + content: 'Hello' + properties: + content: + type: 'string' + reasoning: + type: 'string' + role: + enum: + - 'assistant' + type: 'string' + tool_calls: + items: + $ref: '#/components/schemas/InternChatToolCall' + type: 'array' + type: 'object' + InternChatDeveloperMessage: + description: 'A developer message. Accepted for client compatibility and not forwarded.' + example: + content: 'Answer briefly.' + role: 'developer' + properties: + content: + $ref: '#/components/schemas/InternChatMessageContent' + role: + enum: + - 'developer' + type: 'string' + required: + - 'content' + - 'role' + type: 'object' + InternChatEchoedToolCall: + description: 'The `openrouter.provide_input` tool call from the previous response, echoed back unchanged. Its `id` is the interaction the following `tool` message answers.' + example: + function: + arguments: '{"kind":"permission","operation":"shell","options":["allow_once","reject_once"]}' + name: 'openrouter.provide_input' + id: '15e90ad6-5320-4a59-af4f-b371428154fa' + properties: + function: + $ref: '#/components/schemas/InternChatEchoedToolCallFunction' + id: + maxLength: 128 + minLength: 1 + type: 'string' + required: + - 'function' + - 'id' + type: 'object' + InternChatEchoedToolCallFunction: + description: 'The function name and JSON arguments string exactly as streamed.' + example: + arguments: '{"kind":"permission","operation":"shell","options":["allow_once","reject_once"]}' + name: 'openrouter.provide_input' + properties: + arguments: + type: 'string' + name: + type: 'string' + required: + - 'arguments' + - 'name' + type: 'object' + InternChatError: + description: 'The OpenAI-compatible error object. `metadata` is present on refusals from the chat route. Authentication refusals (`401`), the departed-creator `403` and the programme `404` carry only `code` and `message`.' + example: + code: 409 + message: 'That question is no longer waiting for an answer.' + metadata: + reason: 'interaction_not_pending' + properties: + code: + description: 'The HTTP status of the response.' + type: 'integer' + message: + type: 'string' + metadata: + $ref: '#/components/schemas/InternChatErrorMetadata' + required: + - 'code' + - 'message' + type: 'object' + InternChatErrorMetadata: + description: 'Machine-readable detail for the failure.' + example: + reason: 'interaction_not_pending' + properties: + reason: + description: 'A stable reason a client can branch on.' + enum: + - 'attachment_failed' + - 'bad_request' + - 'busy' + - 'client_closed_request' + - 'interaction_not_pending' + - 'interaction_unknown' + - 'intern_not_ready' + - 'intern_rejected' + - 'intern_unreachable' + - 'not_found' + - 'payload_too_large' + - 'rate_limited' + - 'run_ended' + - 'stream_severed' + - 'timeout' + - 'turn_failed' + type: 'string' + x-speakeasy-unknown-values: allow + required: + - 'reason' + type: 'object' + InternChatErrorResponse: + description: 'A refusal before the stream opens. Once the response is `200` and streaming, failures arrive as a chunk with `finish_reason: "error"` instead.' + example: + error: + code: 409 + message: 'That question is no longer waiting for an answer.' + metadata: + reason: 'interaction_not_pending' + properties: + error: + $ref: '#/components/schemas/InternChatError' + required: + - 'error' + type: 'object' + InternChatMessage: + description: 'One OpenAI-compatible chat message, discriminated by `role`.' + discriminator: + mapping: + assistant: '#/components/schemas/InternChatAssistantMessage' + developer: '#/components/schemas/InternChatDeveloperMessage' + system: '#/components/schemas/InternChatSystemMessage' + tool: '#/components/schemas/InternChatToolMessage' + user: '#/components/schemas/InternChatUserMessage' + propertyName: 'role' + example: + content: 'Summarize the open pull requests.' + role: 'user' + oneOf: + - $ref: '#/components/schemas/InternChatSystemMessage' + - $ref: '#/components/schemas/InternChatDeveloperMessage' + - $ref: '#/components/schemas/InternChatUserMessage' + - $ref: '#/components/schemas/InternChatAssistantMessage' + - $ref: '#/components/schemas/InternChatToolMessage' + InternChatMessageContent: + anyOf: + - type: 'string' + - items: + $ref: '#/components/schemas/InternChatTextPart' + type: 'array' + - type: 'null' + description: 'Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history.' + example: 'Summarize the open pull requests.' + InternChatPromptTokensDetails: + description: 'Prompt tokens served from cache, when the daemon reported them.' + example: + cached_tokens: 1024 + properties: + cached_tokens: + type: 'integer' + required: + - 'cached_tokens' + type: 'object' + InternChatStreamError: + description: 'A failure after the response headers were sent. The chunk that carries it has `finish_reason: "error"`, then the final empty-`choices` chunk and `[DONE]` follow. Reasons here are `attachment_failed`, `busy`, `client_closed_request`, `interaction_not_pending`, `interaction_unknown`, `intern_unreachable`, `run_ended`, `stream_severed`, `timeout` or `turn_failed`. `run_ended` reports an ending the intern confirmed, such as a cancellation or a deadline, while `stream_severed` reports a connection lost without that confirmation.' + example: + code: 502 + message: 'The intern could not continue this run.' + metadata: + reason: 'attachment_failed' + properties: + code: + description: 'The HTTP status this failure would have had before the stream opened.' + type: 'integer' + message: + type: 'string' + metadata: + $ref: '#/components/schemas/InternChatErrorMetadata' + required: + - 'code' + - 'message' + - 'metadata' + type: 'object' + InternChatStreamingResponse: + description: 'A server-sent event carrying one chunk. The stream ends with `data: [DONE]`.' + example: + data: + choices: + - delta: + tool_calls: + - function: + arguments: '{"fields":[{"name":"answer","options":["red","blue","Other"],"required":true,"type":"string"}],"kind":"elicitation","message":"Which colour do you prefer?"}' + name: 'openrouter.provide_input' + id: '15e90ad6-5320-4a59-af4f-b371428154fa' + index: 0 + type: 'function' + finish_reason: null + index: 0 + created: 1789537541 + id: 'chatcmpl-f727571a-3bad-4e0d-8a9e-f18f8cda9750' + model: 'openrouter/intern' + object: 'chat.completion.chunk' + properties: + data: + $ref: '#/components/schemas/InternChatCompletionChunk' + required: + - 'data' + type: 'object' + InternChatSystemMessage: + description: 'A system message. Accepted for client compatibility and not forwarded.' + example: + content: 'You are a helpful assistant.' + role: 'system' + properties: + content: + $ref: '#/components/schemas/InternChatMessageContent' + role: + enum: + - 'system' + type: 'string' + required: + - 'content' + - 'role' + type: 'object' + InternChatTextPart: + description: 'One text part of a message.' + example: + text: 'Summarize the open pull requests.' + type: 'text' + properties: + text: + type: 'string' + type: + enum: + - 'text' + type: 'string' + required: + - 'text' + - 'type' + type: 'object' + InternChatToolCall: + description: 'An `openrouter.provide_input` request. The run pauses on the daemon until a `tool` message answers it, the caller cancels it, or its interaction deadline passes.' + example: + function: + arguments: '{"fields":[{"name":"answer","options":["red","blue","Other"],"required":true,"type":"string"}],"kind":"elicitation","message":"Which colour do you prefer?"}' + name: 'openrouter.provide_input' + id: '15e90ad6-5320-4a59-af4f-b371428154fa' + index: 0 + type: 'function' + properties: + function: + $ref: '#/components/schemas/InternChatToolCallFunction' + id: + description: 'The interaction id. Send it back as `tool_call_id` on the `tool` message that answers it.' + example: '15e90ad6-5320-4a59-af4f-b371428154fa' + type: 'string' + index: + type: 'integer' + type: + enum: + - 'function' + type: 'string' + required: + - 'function' + - 'id' + - 'index' + - 'type' + type: 'object' + InternChatToolCallFunction: + description: 'The single tool this endpoint calls, asking the caller for input.' + example: + arguments: '{"fields":[{"name":"answer","options":["red","blue","Other"],"required":true,"type":"string"}],"kind":"elicitation","message":"Which colour do you prefer?"}' + name: 'openrouter.provide_input' + properties: + arguments: + description: 'A JSON object string describing the interaction. A permission request is `{"kind":"permission","operation":,"options":[]}`. A question is `{"kind":"elicitation","message":,"fields":[]}`.' + example: '{"fields":[{"name":"answer","options":["red","blue","Other"],"required":true,"type":"string"}],"kind":"elicitation","message":"Which colour do you prefer?"}' + type: 'string' + name: + enum: + - 'openrouter.provide_input' + type: 'string' + required: + - 'arguments' + - 'name' + type: 'object' + InternChatToolMessage: + description: 'The answer to an `openrouter.provide_input` tool call. `tool_call_id` is the streamed tool call id and `session_id` must name the same session. For a permission, `content` is one of the offered option kinds (`allow_once`, `allow_always`, `reject_once`, `reject_always`) or `cancel`. For a question (elicitation), `content` is a JSON object string with `action` (`accept`, `decline` or `cancel`) and, for `accept`, `content` holding the field values. The answer is delivered to the run that asked. It never starts a new run.' + example: + content: 'allow_once' + role: 'tool' + tool_call_id: '15e90ad6-5320-4a59-af4f-b371428154fa' + properties: + content: + $ref: '#/components/schemas/InternChatMessageContent' + role: + enum: + - 'tool' + type: 'string' + tool_call_id: + maxLength: 128 + minLength: 1 + type: 'string' + required: + - 'content' + - 'role' + - 'tool_call_id' + type: 'object' + InternChatUsage: + description: 'Token usage for the run as the daemon reported it, on the final chunk before `[DONE]`. `null` when the daemon reported none, and always `null` after `tool_calls` because the turn is not over.' + example: + completion_tokens: 12 + prompt_tokens: 40 + total_tokens: 52 + properties: + completion_tokens: + type: 'integer' + cost: + description: 'The cost of the run in USD, when the daemon reported one.' + format: 'double' + type: 'number' + prompt_tokens: + type: 'integer' + prompt_tokens_details: + $ref: '#/components/schemas/InternChatPromptTokensDetails' + total_tokens: + type: 'integer' + required: + - 'completion_tokens' + - 'prompt_tokens' + - 'total_tokens' + type: + - 'object' + - 'null' + InternChatUserMessage: + description: 'A user message. When it is the last message its text is the prompt for a new run, at most 32000 characters.' + example: + content: 'Summarize the open pull requests.' + role: 'user' + properties: + content: + $ref: '#/components/schemas/InternChatMessageContent' + role: + enum: + - 'user' + type: 'string' + required: + - 'content' + - 'role' + type: 'object' InternLifecycleError: additionalProperties: false description: 'Intern lifecycle request failure.' @@ -14725,6 +15482,7 @@ components: - 'Moonshot AI' - 'Morph' - 'VoyageAI by MongoDB' + - 'TypeSafe' - 'Near AI' - 'Nebius' - 'Nex AGI' @@ -14757,6 +15515,7 @@ components: - 'Tenstorrent' - 'Thinking Machines' - 'Together' + - 'Unbiased' - 'Upstage' - 'Venice' - 'Wafer' @@ -20695,6 +21454,7 @@ components: - 'audio' - 'video' - 'rerank' + - 'decisions' - 'speech' - 'transcription' example: 'text' @@ -21969,6 +22729,7 @@ components: - 'Moonshot AI' - 'Morph' - 'VoyageAI by MongoDB' + - 'TypeSafe' - 'Near AI' - 'Nebius' - 'Nex AGI' @@ -22001,6 +22762,7 @@ components: - 'Tenstorrent' - 'Thinking Machines' - 'Together' + - 'Unbiased' - 'Upstage' - 'Venice' - 'Wafer' @@ -22414,9 +23176,15 @@ components: together-lite: additionalProperties: {} type: 'object' + typesafe: + additionalProperties: {} + type: 'object' ubicloud: additionalProperties: {} type: 'object' + unbiased: + additionalProperties: {} + type: 'object' upstage: additionalProperties: {} type: 'object' @@ -22729,6 +23497,7 @@ components: - 'Moonshot AI' - 'Morph' - 'VoyageAI by MongoDB' + - 'TypeSafe' - 'Near AI' - 'Nebius' - 'Nex AGI' @@ -22761,6 +23530,7 @@ components: - 'Tenstorrent' - 'Thinking Machines' - 'Together' + - 'Unbiased' - 'Upstage' - 'Venice' - 'Wafer' @@ -25466,6 +26236,11 @@ components: seconds: 9.2 total_tokens: 113 properties: + confidence: + description: 'Provider confidence for the whole transcript from 0 to 1, present when response_format is verbose_json and the provider scores the full transcript' + example: 0.94 + format: 'double' + type: 'number' duration: description: 'Duration of the input audio in seconds, present when response_format is verbose_json' example: 9.2 @@ -25612,11 +26387,17 @@ components: STTWord: description: 'A timestamped word, returned when the provider includes word-level timestamps' example: + confidence: 0.98 end: 0.4 speaker: 0 start: 0 word: 'Hello' properties: + confidence: + description: 'Provider confidence for the word from 0 to 1, present when the provider returns per-word confidence' + example: 0.98 + format: 'double' + type: 'number' end: description: 'Word end time in seconds' example: 0.4 @@ -27748,6 +28529,11 @@ components: type: 'array' model: type: 'string' + previous_job_id: + description: '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.' + example: 'gen-vid-1789493115-a1B2c3D4e5F6g7H8i9J0' + pattern: '^gen-vid-\d+-[0-9A-Za-z]{20}$' + type: 'string' prompt: description: 'Text prompt describing the video to generate. Optional for models that support generating a video from image input alone; required by all other models.' example: 'A serene mountain landscape at sunset' @@ -27806,9 +28592,9 @@ components: type: 'object' VideoGenerationResponse: example: - generation_id: 'gen-xyz789' - id: 'job-abc123' - polling_url: '/api/v1/videos/job-abc123' + generation_id: 'gen-vid-1789480874-Ab3dEf9hIjKlMnOpQrSt' + id: 'gen-vid-1789480874-Ab3dEf9hIjKlMnOpQrSt' + polling_url: '/api/v1/videos/gen-vid-1789480874-Ab3dEf9hIjKlMnOpQrSt' status: 'pending' properties: error: @@ -27817,6 +28603,7 @@ components: description: 'The generation ID associated with this video generation job. Available once the job has been processed.' type: 'string' id: + description: 'The video job ID, in the `gen-vid--<20 alphanumerics>` generation ID format. Pass it as `previous_job_id` to continue the generation.' type: 'string' polling_url: type: 'string' @@ -29421,6 +30208,151 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /api/alpha/decisions: + post: + description: 'Submits a Decisions request to the Decisions router' + operationId: 'createApiAlphaDecisions' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DecisionsRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DecisionsResponse' + description: 'Decisions response' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '402': + content: + application/json: + example: + error: + code: 402 + message: 'Insufficient credits. Add more using https://openrouter.ai/credits' + schema: + $ref: '#/components/schemas/PaymentRequiredResponse' + description: 'Payment Required - Insufficient credits or quota to complete request' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '413': + content: + application/json: + example: + error: + code: 413 + message: 'Request payload too large' + schema: + $ref: '#/components/schemas/PayloadTooLargeResponse' + description: 'Payload Too Large - Request payload exceeds size limits' + '429': + content: + application/json: + example: + error: + code: 429 + message: 'Rate limit exceeded' + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + description: 'Too Many Requests - Rate limit exceeded' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + '502': + content: + application/json: + example: + error: + code: 502 + message: 'Provider returned error' + schema: + $ref: '#/components/schemas/BadGatewayResponse' + description: 'Bad Gateway - Provider/upstream API failure' + '503': + content: + application/json: + example: + error: + code: 503 + message: 'Service temporarily unavailable' + schema: + $ref: '#/components/schemas/ServiceUnavailableResponse' + description: 'Service Unavailable - Service temporarily unavailable' + '524': + content: + application/json: + example: + error: + code: 524 + message: 'Request timed out. Please try again later.' + schema: + $ref: '#/components/schemas/EdgeNetworkTimeoutResponse' + description: 'Infrastructure Timeout - Provider request timed out at edge network' + '529': + content: + application/json: + example: + error: + code: 529 + message: 'Provider returned error' + schema: + $ref: '#/components/schemas/ProviderOverloadedResponse' + description: 'Provider Overloaded - Provider is temporarily overloaded' + summary: 'Submit a Decisions (questions and answers) request' + tags: + - 'alpha.decisions' + x-speakeasy-name-override: 'create' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /audio/speech: post: description: 'Synthesizes audio from the input text. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm, wav).' @@ -30420,6 +31352,8 @@ paths: - 'tenstorrent' - 'thinkingmachines' - 'together' + - 'typesafe' + - 'unbiased' - 'upstage' - 'venice' - 'voyageai' @@ -35913,6 +36847,198 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /interns/{internId}/chat/completions: + post: + description: "Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: \"tool_calls\"`, and the run stays open on the intern.\n\nEvery response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk.\n\nTo answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline.\n\nClosing the connection after the `[DONE]` that follows `finish_reason: \"tool_calls\"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The disconnect is noticed when the intern next writes to the stream, which during a silent tool run can take more than one 30 second heartbeat interval.\n\nA run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: \"error\"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event.\n\nSet `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts.\n\nAvailable to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`." + operationId: 'createInternChatCompletion' + parameters: + - description: 'The intern to talk to.' + in: 'path' + name: 'internId' + required: true + schema: + description: 'The intern to talk to.' + example: 'a11e0000-0000-4000-8000-000000000005' + type: 'string' + requestBody: + content: + application/json: + example: + approval_mode: 'manual' + messages: + - content: 'Summarize the open pull requests.' + role: 'user' + stream: true + schema: + $ref: '#/components/schemas/InternChatCompletionRequest' + required: true + responses: + '200': + content: + text/event-stream: + example: + data: + choices: + - delta: + tool_calls: + - function: + arguments: '{"kind":"permission","operation":"shell","options":["allow_once","allow_always","reject_once","reject_always"]}' + name: 'openrouter.provide_input' + id: '15e90ad6-5320-4a59-af4f-b371428154fa' + index: 0 + type: 'function' + finish_reason: null + index: 0 + created: 1789537541 + id: 'chatcmpl-f727571a-3bad-4e0d-8a9e-f18f8cda9750' + model: 'openrouter/intern' + object: 'chat.completion.chunk' + schema: + $ref: '#/components/schemas/InternChatStreamingResponse' + x-speakeasy-sse-sentinel: '[DONE]' + application/json: + schema: + $ref: '#/components/schemas/InternChatCompletionChunk' + description: 'The streamed completion. Chunks carry text, then a finish chunk: `finish_reason: "stop"` when the turn is complete, `finish_reason: "tool_calls"` when the intern is waiting for an answer, or `finish_reason: "error"` for a failure after this status. A final chunk with empty `choices` follows in every case, carrying `session_id` and `usage` (`null` unless the intern reported usage, and always `null` after `tool_calls`), and the stream ends with `data: [DONE]`.' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'The intern did not accept that answer for this tool_call_id.' + metadata: + reason: 'bad_request' + schema: + $ref: '#/components/schemas/InternChatErrorResponse' + description: 'The body is not a valid request (`bad_request`), or the intern did not accept the answer for the pending question, such as a permission option it did not offer.' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Invalid or missing API key' + schema: + $ref: '#/components/schemas/InternChatErrorResponse' + description: 'No valid API key.' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'This API key''s creator is no longer a member of the organization. Ask an organization admin to reassign the key to an active member.' + schema: + $ref: '#/components/schemas/InternChatErrorResponse' + description: 'The key belongs to a member who has left the organization and holds no grant.' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'No pending question has this tool_call_id.' + metadata: + reason: 'interaction_unknown' + schema: + $ref: '#/components/schemas/InternChatErrorResponse' + description: 'The caller is outside the interns programme, the intern does not exist for this key (`not_found`), or no pending question has this `tool_call_id` in this session (`interaction_unknown`).' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'The run that asked this question has already ended.' + metadata: + reason: 'interaction_not_pending' + schema: + $ref: '#/components/schemas/InternChatErrorResponse' + description: 'The intern is not running (`intern_not_ready`), another turn is running in this session (`busy`), the question is no longer waiting (`interaction_not_pending`), or another request is already attached to the run (`attachment_failed`).' + '410': + content: + application/json: + example: + error: + code: 410 + message: 'The run produced more output than the intern retains for replay.' + metadata: + reason: 'attachment_failed' + schema: + $ref: '#/components/schemas/InternChatErrorResponse' + description: 'The run produced more output than the intern retains, so the paused stream cannot be resumed (`attachment_failed`).' + '413': + content: + application/json: + example: + error: + code: 413 + message: 'Request body exceeds 1048576 bytes' + metadata: + reason: 'payload_too_large' + schema: + $ref: '#/components/schemas/InternChatErrorResponse' + description: 'The body exceeds 1 MiB (`payload_too_large`).' + '429': + content: + application/json: + example: + error: + code: 429 + message: 'Too many intern turns. Please wait a moment.' + metadata: + reason: 'rate_limited' + schema: + $ref: '#/components/schemas/InternChatErrorResponse' + description: 'Too many turns for the user or organization this key acts as (`rate_limited`).' + '502': + content: + application/json: + example: + error: + code: 502 + message: 'The intern could not be reached.' + metadata: + reason: 'intern_unreachable' + schema: + $ref: '#/components/schemas/InternChatErrorResponse' + description: 'The intern could not be reached or rejected the request (`intern_unreachable`, `intern_rejected`), the intern refused the turn before any output (`turn_failed`), or its stream ended before the turn started (`stream_severed`).' + '503': + content: + application/json: + example: + error: + code: 503 + message: 'The intern cannot hold another run open across a question right now. Retry later.' + metadata: + reason: 'busy' + schema: + $ref: '#/components/schemas/InternChatErrorResponse' + description: 'The intern cannot hold another run open across a question right now (`busy`). Retry later.' + '504': + content: + application/json: + example: + error: + code: 504 + message: 'The intern did not answer in time.' + metadata: + reason: 'timeout' + schema: + $ref: '#/components/schemas/InternChatErrorResponse' + description: 'The intern did not answer within the request budget (`timeout`).' + security: + - apiKey: [] + summary: 'Stream a chat completion with an intern' + tags: + - 'Interns' + x-speakeasy-group: 'interns' + x-speakeasy-name-override: 'chat' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /interns/{internId}/provision: post: description: 'Starts the first boot, or resumes an intern after suspension. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.' @@ -38125,12 +39251,12 @@ paths: description: 'Filter models by supported parameter (comma-separated)' example: 'temperature' type: 'string' - - description: 'Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or "all" to include all models. Defaults to "text".' + - description: 'Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text".' in: 'query' name: 'output_modalities' required: false schema: - description: 'Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or "all" to include all models. Defaults to "text".' + description: 'Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text".' example: 'text' type: 'string' - description: 'Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.' @@ -38623,12 +39749,12 @@ paths: get: operationId: 'listModelsCount' parameters: - - description: 'Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or "all" to include all models. Defaults to "text".' + - description: 'Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text".' in: 'query' name: 'output_modalities' required: false schema: - description: 'Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or "all" to include all models. Defaults to "text".' + description: 'Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text".' example: 'text' type: 'string' responses: @@ -38708,12 +39834,12 @@ paths: maximum: 1000 minimum: 1 type: 'integer' - - description: 'Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or "all" to include all models. Defaults to "text".' + - description: 'Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text".' in: 'query' name: 'output_modalities' required: false schema: - description: 'Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or "all" to include all models. Defaults to "text".' + description: 'Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text".' example: 'text' type: 'string' responses: @@ -44967,7 +46093,7 @@ tags: name: 'Guardrails' - description: 'Images endpoints' name: 'Images' - - description: 'Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key.' + - description: 'Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key, and talk to them: the chat route streams OpenAI-compatible completions from one intern, pausing as an `openrouter.provide_input` tool call when the intern needs your permission or an answer. Available to interns programme members; other callers receive 404. See https://openrouter.ai/docs/guides/ori/intern-chat.' name: 'Interns' - description: 'Model information endpoints' name: 'Models' @@ -44999,6 +46125,8 @@ tags: name: 'Video Generation' - description: 'Workspaces endpoints' name: 'Workspaces' + - description: 'Alpha feature endpoints for Decisions (questions and answers) requests' + name: 'alpha.decisions' - name: beta.responses deprecated: true description: Deprecated alias for responses endpoints. Use responses instead. Scheduled for removal (sunset date TBD). diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index fe97478b..5192323d 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.787.0 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:3704bb69e4f9906787b89e3521b59397f94d5a43936b1ec4076ee62aa6b9c2f8 - sourceBlobDigest: sha256:d92345fc4c6e7279ac2cd1764c823fa226fdcefa83f755bd2f0347bac128705d + sourceRevisionDigest: sha256:ce976e499121fe4f917f5bb97dc4316a7a73e51924aef93d1238299e91e7a9f0 + sourceBlobDigest: sha256:33b30b3014c4ae44f119a62b8008649d9758dfac062df55da049ebe6819b33df tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:3704bb69e4f9906787b89e3521b59397f94d5a43936b1ec4076ee62aa6b9c2f8 - sourceBlobDigest: sha256:d92345fc4c6e7279ac2cd1764c823fa226fdcefa83f755bd2f0347bac128705d + sourceRevisionDigest: sha256:ce976e499121fe4f917f5bb97dc4316a7a73e51924aef93d1238299e91e7a9f0 + sourceBlobDigest: sha256:33b30b3014c4ae44f119a62b8008649d9758dfac062df55da049ebe6819b33df codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:b85c77ba01992d8a7c2575a6f250a5b60428abffdc68f4c8873722a7c33bc2c3 + codeSamplesRevisionDigest: sha256:6bead5fbac891d238584899f937a75f678e24c36fc4fc5a53c48f5ef07a6fd71 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 @@ -30,6 +30,7 @@ workflow: - location: .speakeasy/overlays/boolean-query-params.overlay.yaml - location: .speakeasy/overlays/fix-nullable-pagination.overlay.yaml - location: .speakeasy/overlays/deprecated-beta-responses-alias.overlay.yaml + - location: .speakeasy/overlays/intern-chat-json-response.overlay.yaml output: .speakeasy/out.openapi.yaml registry: location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api diff --git a/RELEASES.md b/RELEASES.md index 4a781e75..75acc2a5 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -2349,4 +2349,14 @@ Based on: ### Generated - [python v1.1.156] . ### Releases -- [PyPI v1.1.156] https://pypi.org/project/openrouter/1.1.156 - . \ No newline at end of file +- [PyPI v1.1.156] https://pypi.org/project/openrouter/1.1.156 - . + +## 2026-09-18 04:23:33 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.1.157] . +### Releases +- [PyPI v1.1.157] https://pypi.org/project/openrouter/1.1.157 - . \ No newline at end of file diff --git a/docs/components/agentmessageitemcontentinputimage.mdx b/docs/components/agentmessageitemcontentinputimage.mdx index 67e9a241..94ab47b1 100644 --- a/docs/components/agentmessageitemcontentinputimage.mdx +++ b/docs/components/agentmessageitemcontentinputimage.mdx @@ -2,7 +2,7 @@ title: "AgentMessageItemContentInputImage" --- -Image input content item +Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image. ## Fields @@ -10,5 +10,6 @@ Image input content item | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | | `detail` | [components.AgentMessageItemDetail](../components/agentmessageitemdetail.mdx) | :heavy_check_mark: | N/A | +| `file_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `image_url` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `type` | [components.AgentMessageItemTypeInputImage](../components/agentmessageitemtypeinputimage.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/answers.mdx b/docs/components/answers.mdx new file mode 100644 index 00000000..b065c94f --- /dev/null +++ b/docs/components/answers.mdx @@ -0,0 +1,27 @@ +--- +title: "Answers" +--- + +A Decisions answer using a boolean, choice, or score evaluation. + + +## Supported Types + +### `components.DecisionsChoiceAnswer` + +```python +value: components.DecisionsChoiceAnswer = /* values here */ +``` + +### `components.DecisionsNoulAnswer` + +```python +value: components.DecisionsNoulAnswer = /* values here */ +``` + +### `components.DecisionsScoreAnswer` + +```python +value: components.DecisionsScoreAnswer = /* values here */ +``` + diff --git a/docs/components/apitype.mdx b/docs/components/apitype.mdx index 185a0faa..32e8ae19 100644 --- a/docs/components/apitype.mdx +++ b/docs/components/apitype.mdx @@ -25,3 +25,4 @@ This is an open enum. Unrecognized values will not fail type checks. - `"stt"` - `"video"` - `"image"` +- `"decisions"` diff --git a/docs/components/byokproviderslug.mdx b/docs/components/byokproviderslug.mdx index 3deb822b..11af6f0e 100644 --- a/docs/components/byokproviderslug.mdx +++ b/docs/components/byokproviderslug.mdx @@ -119,6 +119,8 @@ This is an open enum. Unrecognized values will not fail type checks. - `"tenstorrent"` - `"thinkingmachines"` - `"together"` +- `"typesafe"` +- `"unbiased"` - `"upstage"` - `"venice"` - `"voyageai"` diff --git a/docs/components/criteria.mdx b/docs/components/criteria.mdx new file mode 100644 index 00000000..5751a955 --- /dev/null +++ b/docs/components/criteria.mdx @@ -0,0 +1,27 @@ +--- +title: "Criteria" +--- + +A plain string, or a JSON object or array of structured guidance. + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `Dict[str, Any]` + +```python +value: Dict[str, Any] = /* values here */ +``` + +### `List[Any]` + +```python +value: List[Any] = /* values here */ +``` + diff --git a/docs/components/criterion.mdx b/docs/components/criterion.mdx new file mode 100644 index 00000000..787ae244 --- /dev/null +++ b/docs/components/criterion.mdx @@ -0,0 +1,27 @@ +--- +title: "Criterion" +--- + +A plain string, or a JSON object or array of structured guidance. + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `Dict[str, Any]` + +```python +value: Dict[str, Any] = /* values here */ +``` + +### `List[Any]` + +```python +value: List[Any] = /* values here */ +``` + diff --git a/docs/components/customtoolcalloutputitemoutputinputimage.mdx b/docs/components/customtoolcalloutputitemoutputinputimage.mdx index ccd8f202..41ee3d26 100644 --- a/docs/components/customtoolcalloutputitemoutputinputimage.mdx +++ b/docs/components/customtoolcalloutputitemoutputinputimage.mdx @@ -2,7 +2,7 @@ title: "CustomToolCallOutputItemOutputInputImage" --- -Image input content item +Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image. ## Fields @@ -10,5 +10,6 @@ Image input content item | Field | Type | Required | Description | | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | | `detail` | [components.CustomToolCallOutputItemDetail](../components/customtoolcalloutputitemdetail.mdx) | :heavy_check_mark: | N/A | +| `file_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `image_url` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `type` | [components.CustomToolCallOutputItemOutputType](../components/customtoolcalloutputitemoutputtype.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/decisionschoiceanswer.mdx b/docs/components/decisionschoiceanswer.mdx new file mode 100644 index 00000000..a27de14a --- /dev/null +++ b/docs/components/decisionschoiceanswer.mdx @@ -0,0 +1,12 @@ +--- +title: "DecisionsChoiceAnswer" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `choice` | *str* | :heavy_check_mark: | N/A | +| `confidence` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `probabilities` | Dict[str, *float*] | :heavy_minus_sign: | N/A | +| `type` | [components.DecisionsChoiceAnswerType](../components/decisionschoiceanswertype.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/decisionschoiceanswertype.mdx b/docs/components/decisionschoiceanswertype.mdx new file mode 100644 index 00000000..9b5c4119 --- /dev/null +++ b/docs/components/decisionschoiceanswertype.mdx @@ -0,0 +1,15 @@ +--- +title: "DecisionsChoiceAnswerType" +--- + +## Example Usage + +```python +from openrouter.components import DecisionsChoiceAnswerType +value: DecisionsChoiceAnswerType = "choice" +``` + + +## Values + +- `"choice"` diff --git a/docs/components/decisionschoicequestion.mdx b/docs/components/decisionschoicequestion.mdx new file mode 100644 index 00000000..dfd098de --- /dev/null +++ b/docs/components/decisionschoicequestion.mdx @@ -0,0 +1,11 @@ +--- +title: "DecisionsChoiceQuestion" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `criteria` | Dict[str, [Nullable[components.Criteria]](../components/criteria.mdx)] | :heavy_check_mark: | N/A | +| `instructions` | [components.DecisionsChoiceQuestionInstructions](../components/decisionschoicequestioninstructions.mdx) | :heavy_check_mark: | A plain string, or a JSON object or array of structured guidance. | +| `type` | [components.DecisionsChoiceQuestionType](../components/decisionschoicequestiontype.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/decisionschoicequestioninstructions.mdx b/docs/components/decisionschoicequestioninstructions.mdx new file mode 100644 index 00000000..f61eab9a --- /dev/null +++ b/docs/components/decisionschoicequestioninstructions.mdx @@ -0,0 +1,27 @@ +--- +title: "DecisionsChoiceQuestionInstructions" +--- + +A plain string, or a JSON object or array of structured guidance. + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `Dict[str, Any]` + +```python +value: Dict[str, Any] = /* values here */ +``` + +### `List[Any]` + +```python +value: List[Any] = /* values here */ +``` + diff --git a/docs/components/decisionschoicequestiontype.mdx b/docs/components/decisionschoicequestiontype.mdx new file mode 100644 index 00000000..37788d9a --- /dev/null +++ b/docs/components/decisionschoicequestiontype.mdx @@ -0,0 +1,15 @@ +--- +title: "DecisionsChoiceQuestionType" +--- + +## Example Usage + +```python +from openrouter.components import DecisionsChoiceQuestionType +value: DecisionsChoiceQuestionType = "choice" +``` + + +## Values + +- `"choice"` diff --git a/docs/components/decisionsnoulanswer.mdx b/docs/components/decisionsnoulanswer.mdx new file mode 100644 index 00000000..d34f71c3 --- /dev/null +++ b/docs/components/decisionsnoulanswer.mdx @@ -0,0 +1,10 @@ +--- +title: "DecisionsNoulAnswer" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `noul` | *float* | :heavy_check_mark: | N/A | +| `type` | [components.DecisionsNoulAnswerType](../components/decisionsnoulanswertype.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/decisionsnoulanswertype.mdx b/docs/components/decisionsnoulanswertype.mdx new file mode 100644 index 00000000..4fdb8532 --- /dev/null +++ b/docs/components/decisionsnoulanswertype.mdx @@ -0,0 +1,15 @@ +--- +title: "DecisionsNoulAnswerType" +--- + +## Example Usage + +```python +from openrouter.components import DecisionsNoulAnswerType +value: DecisionsNoulAnswerType = "noul" +``` + + +## Values + +- `"noul"` diff --git a/docs/components/decisionsnoulquestion.mdx b/docs/components/decisionsnoulquestion.mdx new file mode 100644 index 00000000..bd0cd40b --- /dev/null +++ b/docs/components/decisionsnoulquestion.mdx @@ -0,0 +1,11 @@ +--- +title: "DecisionsNoulQuestion" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `criteria` | [Optional[components.DecisionsNoulQuestionCriteria]](../components/decisionsnoulquestioncriteria.mdx) | :heavy_minus_sign: | N/A | +| `instructions` | [components.DecisionsNoulQuestionInstructions](../components/decisionsnoulquestioninstructions.mdx) | :heavy_check_mark: | A plain string, or a JSON object or array of structured guidance. | +| `type` | [components.DecisionsNoulQuestionType](../components/decisionsnoulquestiontype.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/decisionsnoulquestioncriteria.mdx b/docs/components/decisionsnoulquestioncriteria.mdx new file mode 100644 index 00000000..eafa2e83 --- /dev/null +++ b/docs/components/decisionsnoulquestioncriteria.mdx @@ -0,0 +1,10 @@ +--- +title: "DecisionsNoulQuestionCriteria" +--- + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `false` | [components.FalseT](../components/falset.mdx) | :heavy_check_mark: | A plain string, or a JSON object or array of structured guidance. | +| `true` | [components.TrueT](../components/truet.mdx) | :heavy_check_mark: | A plain string, or a JSON object or array of structured guidance. | \ No newline at end of file diff --git a/docs/components/decisionsnoulquestioninstructions.mdx b/docs/components/decisionsnoulquestioninstructions.mdx new file mode 100644 index 00000000..1af5620d --- /dev/null +++ b/docs/components/decisionsnoulquestioninstructions.mdx @@ -0,0 +1,27 @@ +--- +title: "DecisionsNoulQuestionInstructions" +--- + +A plain string, or a JSON object or array of structured guidance. + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `Dict[str, Any]` + +```python +value: Dict[str, Any] = /* values here */ +``` + +### `List[Any]` + +```python +value: List[Any] = /* values here */ +``` + diff --git a/docs/components/decisionsnoulquestiontype.mdx b/docs/components/decisionsnoulquestiontype.mdx new file mode 100644 index 00000000..66d2e59c --- /dev/null +++ b/docs/components/decisionsnoulquestiontype.mdx @@ -0,0 +1,15 @@ +--- +title: "DecisionsNoulQuestionType" +--- + +## Example Usage + +```python +from openrouter.components import DecisionsNoulQuestionType +value: DecisionsNoulQuestionType = "noul" +``` + + +## Values + +- `"noul"` diff --git a/docs/components/decisionsrequest.mdx b/docs/components/decisionsrequest.mdx new file mode 100644 index 00000000..a5f5e91c --- /dev/null +++ b/docs/components/decisionsrequest.mdx @@ -0,0 +1,15 @@ +--- +title: "DecisionsRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `model` | *str* | :heavy_check_mark: | N/A | | +| `provider` | [OptionalNullable[components.ProviderPreferences]](../components/providerpreferences.mdx) | :heavy_minus_sign: | N/A | \{
"allow_fallbacks": true
} | +| `questions` | Dict[str, [components.Questions](../components/questions.mdx)] | :heavy_check_mark: | N/A | | +| `session_id` | *Optional[str]* | :heavy_minus_sign: | 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 | +| `state` | [components.State](../components/state.mdx) | :heavy_check_mark: | The content to evaluate: a plain string, or a JSON object or array of related context. | | +| `trace` | [Optional[components.TraceConfig]](../components/traceconfig.mdx) | :heavy_minus_sign: | 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"
} | +| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/components/decisionsresponse.mdx b/docs/components/decisionsresponse.mdx new file mode 100644 index 00000000..cdd21538 --- /dev/null +++ b/docs/components/decisionsresponse.mdx @@ -0,0 +1,13 @@ +--- +title: "DecisionsResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `answers` | Dict[str, [components.Answers](../components/answers.mdx)] | :heavy_check_mark: | N/A | +| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `model` | *str* | :heavy_check_mark: | N/A | +| `provider` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `usage` | [components.DecisionsResponseUsage](../components/decisionsresponseusage.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/decisionsresponseusage.mdx b/docs/components/decisionsresponseusage.mdx new file mode 100644 index 00000000..d89f6e71 --- /dev/null +++ b/docs/components/decisionsresponseusage.mdx @@ -0,0 +1,11 @@ +--- +title: "DecisionsResponseUsage" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `cost` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `input_tokens` | *int* | :heavy_check_mark: | N/A | +| `output_tokens` | *int* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/decisionsscoreanswer.mdx b/docs/components/decisionsscoreanswer.mdx new file mode 100644 index 00000000..4bc4bdee --- /dev/null +++ b/docs/components/decisionsscoreanswer.mdx @@ -0,0 +1,13 @@ +--- +title: "DecisionsScoreAnswer" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `confidence` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `legend` | Dict[str, [components.Legend](../components/legend.mdx)] | :heavy_minus_sign: | N/A | +| `probabilities` | Dict[str, *float*] | :heavy_minus_sign: | N/A | +| `score` | *float* | :heavy_check_mark: | N/A | +| `type` | [components.DecisionsScoreAnswerType](../components/decisionsscoreanswertype.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/decisionsscoreanswertype.mdx b/docs/components/decisionsscoreanswertype.mdx new file mode 100644 index 00000000..f3a1fc44 --- /dev/null +++ b/docs/components/decisionsscoreanswertype.mdx @@ -0,0 +1,15 @@ +--- +title: "DecisionsScoreAnswerType" +--- + +## Example Usage + +```python +from openrouter.components import DecisionsScoreAnswerType +value: DecisionsScoreAnswerType = "score" +``` + + +## Values + +- `"score"` diff --git a/docs/components/decisionsscorequestion.mdx b/docs/components/decisionsscorequestion.mdx new file mode 100644 index 00000000..c261757b --- /dev/null +++ b/docs/components/decisionsscorequestion.mdx @@ -0,0 +1,11 @@ +--- +title: "DecisionsScoreQuestion" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `criteria` | List[[components.Criterion](../components/criterion.mdx)] | :heavy_check_mark: | N/A | +| `instructions` | [components.DecisionsScoreQuestionInstructions](../components/decisionsscorequestioninstructions.mdx) | :heavy_check_mark: | A plain string, or a JSON object or array of structured guidance. | +| `type` | [components.DecisionsScoreQuestionType](../components/decisionsscorequestiontype.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/decisionsscorequestioninstructions.mdx b/docs/components/decisionsscorequestioninstructions.mdx new file mode 100644 index 00000000..5d8e218c --- /dev/null +++ b/docs/components/decisionsscorequestioninstructions.mdx @@ -0,0 +1,27 @@ +--- +title: "DecisionsScoreQuestionInstructions" +--- + +A plain string, or a JSON object or array of structured guidance. + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `Dict[str, Any]` + +```python +value: Dict[str, Any] = /* values here */ +``` + +### `List[Any]` + +```python +value: List[Any] = /* values here */ +``` + diff --git a/docs/components/decisionsscorequestiontype.mdx b/docs/components/decisionsscorequestiontype.mdx new file mode 100644 index 00000000..a805b4c8 --- /dev/null +++ b/docs/components/decisionsscorequestiontype.mdx @@ -0,0 +1,15 @@ +--- +title: "DecisionsScoreQuestionType" +--- + +## Example Usage + +```python +from openrouter.components import DecisionsScoreQuestionType +value: DecisionsScoreQuestionType = "score" +``` + + +## Values + +- `"score"` diff --git a/docs/components/easyinputmessagecontentinputimage.mdx b/docs/components/easyinputmessagecontentinputimage.mdx index 502f1182..d67f17f8 100644 --- a/docs/components/easyinputmessagecontentinputimage.mdx +++ b/docs/components/easyinputmessagecontentinputimage.mdx @@ -2,7 +2,7 @@ title: "EasyInputMessageContentInputImage" --- -Image input content item +Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image. ## Fields @@ -10,5 +10,6 @@ Image input content item | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | | `detail` | [components.EasyInputMessageDetail](../components/easyinputmessagedetail.mdx) | :heavy_check_mark: | N/A | +| `file_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `image_url` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `type` | [components.EasyInputMessageTypeInputImage](../components/easyinputmessagetypeinputimage.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/falset.mdx b/docs/components/falset.mdx new file mode 100644 index 00000000..4b6c1a19 --- /dev/null +++ b/docs/components/falset.mdx @@ -0,0 +1,27 @@ +--- +title: "FalseT" +--- + +A plain string, or a JSON object or array of structured guidance. + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `Dict[str, Any]` + +```python +value: Dict[str, Any] = /* values here */ +``` + +### `List[Any]` + +```python +value: List[Any] = /* values here */ +``` + diff --git a/docs/components/finishreason.mdx b/docs/components/finishreason.mdx new file mode 100644 index 00000000..0693755f --- /dev/null +++ b/docs/components/finishreason.mdx @@ -0,0 +1,23 @@ +--- +title: "FinishReason" +--- + +`null` while streaming. `stop` when the run completed, `tool_calls` when the run is waiting for the caller to answer the streamed tool call, `error` on the terminal error chunk. + +## Example Usage + +```python +from openrouter.components import FinishReason + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: FinishReason = "error" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"error"` +- `"stop"` +- `"tool_calls"` diff --git a/docs/components/functioncalloutputitemoutputinputimage.mdx b/docs/components/functioncalloutputitemoutputinputimage.mdx index 61b3a7cb..245498dc 100644 --- a/docs/components/functioncalloutputitemoutputinputimage.mdx +++ b/docs/components/functioncalloutputitemoutputinputimage.mdx @@ -2,7 +2,7 @@ title: "FunctionCallOutputItemOutputInputImage" --- -Image input content item +Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image. ## Fields @@ -10,5 +10,6 @@ Image input content item | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | | `detail` | [components.FunctionCallOutputItemDetail](../components/functioncalloutputitemdetail.mdx) | :heavy_check_mark: | N/A | +| `file_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `image_url` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `type` | [components.FunctionCallOutputItemOutputType](../components/functioncalloutputitemoutputtype.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/imagegenerationproviderpreferencesoptions.mdx b/docs/components/imagegenerationproviderpreferencesoptions.mdx index 6b21f978..15f8010d 100644 --- a/docs/components/imagegenerationproviderpreferencesoptions.mdx +++ b/docs/components/imagegenerationproviderpreferencesoptions.mdx @@ -140,7 +140,9 @@ Provider-specific options keyed by provider slug. Only options for the matched p | `thinkingmachines` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `together` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `together_lite` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | +| `typesafe` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `ubicloud` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | +| `unbiased` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `upstage` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `venice` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `voyageai` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | diff --git a/docs/components/imageoutputmodality.mdx b/docs/components/imageoutputmodality.mdx index 52ec9d78..23c58b01 100644 --- a/docs/components/imageoutputmodality.mdx +++ b/docs/components/imageoutputmodality.mdx @@ -22,5 +22,6 @@ This is an open enum. Unrecognized values will not fail type checks. - `"audio"` - `"video"` - `"rerank"` +- `"decisions"` - `"speech"` - `"transcription"` diff --git a/docs/components/incompletedetails.mdx b/docs/components/incompletedetails.mdx index 7c1490a5..33c9c931 100644 --- a/docs/components/incompletedetails.mdx +++ b/docs/components/incompletedetails.mdx @@ -4,6 +4,6 @@ title: "IncompleteDetails" ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | -| `reason` | [Optional[components.Reason]](../components/reason.mdx) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `reason` | [Optional[components.IncompleteDetailsReason]](../components/incompletedetailsreason.mdx) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/reason.mdx b/docs/components/incompletedetailsreason.mdx similarity index 62% rename from docs/components/reason.mdx rename to docs/components/incompletedetailsreason.mdx index 99c4a374..21d09977 100644 --- a/docs/components/reason.mdx +++ b/docs/components/incompletedetailsreason.mdx @@ -1,14 +1,14 @@ --- -title: "Reason" +title: "IncompleteDetailsReason" --- ## Example Usage ```python -from openrouter.components import Reason +from openrouter.components import IncompleteDetailsReason # Open enum: unrecognized values are captured as UnrecognizedStr -value: Reason = "max_output_tokens" +value: IncompleteDetailsReason = "max_output_tokens" ``` diff --git a/docs/components/inputimage.mdx b/docs/components/inputimage.mdx index 294eb9b5..c4b37390 100644 --- a/docs/components/inputimage.mdx +++ b/docs/components/inputimage.mdx @@ -2,7 +2,7 @@ title: "InputImage" --- -Image input content item +Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image. ## Fields @@ -10,5 +10,6 @@ Image input content item | Field | Type | Required | Description | | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | | `detail` | [components.InputImageDetail](../components/inputimagedetail.mdx) | :heavy_check_mark: | N/A | +| `file_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `image_url` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `type` | [components.InputImageType](../components/inputimagetype.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/inputmessageitemcontentinputimage.mdx b/docs/components/inputmessageitemcontentinputimage.mdx index d029dec1..6c503806 100644 --- a/docs/components/inputmessageitemcontentinputimage.mdx +++ b/docs/components/inputmessageitemcontentinputimage.mdx @@ -2,7 +2,7 @@ title: "InputMessageItemContentInputImage" --- -Image input content item +Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image. ## Fields @@ -10,5 +10,6 @@ Image input content item | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | | `detail` | [components.InputMessageItemDetail](../components/inputmessageitemdetail.mdx) | :heavy_check_mark: | N/A | +| `file_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `image_url` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `type` | [components.InputMessageItemTypeInputImage](../components/inputmessageitemtypeinputimage.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/internapprovalmode.mdx b/docs/components/internapprovalmode.mdx new file mode 100644 index 00000000..14f94bb0 --- /dev/null +++ b/docs/components/internapprovalmode.mdx @@ -0,0 +1,22 @@ +--- +title: "InternApprovalMode" +--- + +How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with. + +## Example Usage + +```python +from openrouter.components import InternApprovalMode + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: InternApprovalMode = "manual" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"manual"` +- `"self-drive"` diff --git a/docs/components/internchatassistantmessage.mdx b/docs/components/internchatassistantmessage.mdx new file mode 100644 index 00000000..c8cd00ac --- /dev/null +++ b/docs/components/internchatassistantmessage.mdx @@ -0,0 +1,14 @@ +--- +title: "InternChatAssistantMessage" +--- + +An assistant message from an earlier response. When answering an interaction, echo the streamed `tool_calls` here before the `tool` message. + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `content` | [Nullable[components.InternChatMessageContent]](../components/internchatmessagecontent.mdx) | :heavy_check_mark: | Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history. | Summarize the open pull requests. | +| `role` | [components.InternChatAssistantMessageRole](../components/internchatassistantmessagerole.mdx) | :heavy_check_mark: | N/A | | +| `tool_calls` | List[[components.InternChatEchoedToolCall](../components/internchatechoedtoolcall.mdx)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/components/internchatassistantmessagerole.mdx b/docs/components/internchatassistantmessagerole.mdx new file mode 100644 index 00000000..caef6da6 --- /dev/null +++ b/docs/components/internchatassistantmessagerole.mdx @@ -0,0 +1,15 @@ +--- +title: "InternChatAssistantMessageRole" +--- + +## Example Usage + +```python +from openrouter.components import InternChatAssistantMessageRole +value: InternChatAssistantMessageRole = "assistant" +``` + + +## Values + +- `"assistant"` diff --git a/docs/components/internchatchoice.mdx b/docs/components/internchatchoice.mdx new file mode 100644 index 00000000..78a4f7f4 --- /dev/null +++ b/docs/components/internchatchoice.mdx @@ -0,0 +1,14 @@ +--- +title: "InternChatChoice" +--- + +The single choice this endpoint streams. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `delta` | [components.InternChatDelta](../components/internchatdelta.mdx) | :heavy_check_mark: | The incremental content of one chunk. The first chunk carries `role`, text chunks carry `content`, reasoning chunks carry `reasoning`, and an interaction chunk carries one complete `tool_calls` entry. | \{
"content": "Hello"
} | +| `finish_reason` | [Nullable[components.FinishReason]](../components/finishreason.mdx) | :heavy_check_mark: | `null` while streaming. `stop` when the run completed, `tool_calls` when the run is waiting for the caller to answer the streamed tool call, `error` on the terminal error chunk. | | +| `index` | *int* | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/internchatcompletionchunk.mdx b/docs/components/internchatcompletionchunk.mdx new file mode 100644 index 00000000..8bc4eeb1 --- /dev/null +++ b/docs/components/internchatcompletionchunk.mdx @@ -0,0 +1,19 @@ +--- +title: "InternChatCompletionChunk" +--- + +One `data:` line of the stream. A run streams a role chunk, content and reasoning chunks, then a finish chunk: `stop`, `tool_calls` (the run is paused for input) or `error` (with an `error` object). A final chunk with empty `choices` follows in every case, carrying `session_id` and `usage` (`null` unless the daemon reported usage, and always `null` after `tool_calls`). Every stream ends with `[DONE]`. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `choices` | List[[components.InternChatChoice](../components/internchatchoice.mdx)] | :heavy_check_mark: | One choice on content, tool-call and error chunks. Empty on the final chunk that carries `session_id`. | | +| `created` | *int* | :heavy_check_mark: | N/A | | +| `error` | [Optional[components.InternChatStreamError]](../components/internchatstreamerror.mdx) | :heavy_minus_sign: | A failure after the response headers were sent. The chunk that carries it has `finish_reason: "error"`, then the final empty-`choices` chunk and `[DONE]` follow. Reasons here are `attachment_failed`, `busy`, `client_closed_request`, `interaction_not_pending`, `interaction_unknown`, `intern_unreachable`, `run_ended`, `stream_severed`, `timeout` or `turn_failed`. `run_ended` reports an ending the intern confirmed, such as a cancellation or a deadline, while `stream_severed` reports a connection lost without that confirmation. | \{
"code": 502,
"message": "The intern could not continue this run.",
"metadata": \{
"reason": "attachment_failed"
}
} | +| `id` | *str* | :heavy_check_mark: | The completion id, constant for the whole response. | chatcmpl-f727571a-3bad-4e0d-8a9e-f18f8cda9750 | +| `model` | *str* | :heavy_check_mark: | The request `model` when given, or `openrouter/intern`. The final chunk may carry the model the intern reported for the run instead. | | +| `object` | [components.InternChatCompletionChunkObject](../components/internchatcompletionchunkobject.mdx) | :heavy_check_mark: | N/A | | +| `session_id` | *OptionalNullable[str]* | :heavy_minus_sign: | On the final chunk of every response, the daemon session to continue with, or `null` when the run failed before the intern reported one. Send it as `session_id` on the next request, including the `tool` reply to an interaction. | ses_7f3c9a | +| `usage` | [OptionalNullable[components.InternChatUsage]](../components/internchatusage.mdx) | :heavy_minus_sign: | Token usage for the run as the daemon reported it, on the final chunk before `[DONE]`. `null` when the daemon reported none, and always `null` after `tool_calls` because the turn is not over. | \{
"completion_tokens": 12,
"prompt_tokens": 40,
"total_tokens": 52
} | \ No newline at end of file diff --git a/docs/components/internchatcompletionchunkobject.mdx b/docs/components/internchatcompletionchunkobject.mdx new file mode 100644 index 00000000..ae29bb6a --- /dev/null +++ b/docs/components/internchatcompletionchunkobject.mdx @@ -0,0 +1,15 @@ +--- +title: "InternChatCompletionChunkObject" +--- + +## Example Usage + +```python +from openrouter.components import InternChatCompletionChunkObject +value: InternChatCompletionChunkObject = "chat.completion.chunk" +``` + + +## Values + +- `"chat.completion.chunk"` diff --git a/docs/components/internchatcompletionrequest.mdx b/docs/components/internchatcompletionrequest.mdx new file mode 100644 index 00000000..4d058112 --- /dev/null +++ b/docs/components/internchatcompletionrequest.mdx @@ -0,0 +1,16 @@ +--- +title: "InternChatCompletionRequest" +--- + +An OpenAI-compatible streaming chat completion request for one intern. Other OpenAI fields such as `temperature` or `tools` are ignored. The intern owns its sampling and its tools. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `approval_mode` | [Optional[components.InternApprovalMode]](../components/internapprovalmode.mdx) | :heavy_minus_sign: | How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with. | manual | +| `messages` | List[[components.InternChatMessage](../components/internchatmessage.mdx)] | :heavy_check_mark: | The conversation. Only the last message is read. A last `user` message starts a run. A last `tool` message answers the interaction named by its `tool_call_id` and requires `session_id`. | | +| `model` | *Optional[str]* | :heavy_minus_sign: | Echoed as `model` on the streamed chunks; the final chunk may carry the model the intern reported instead. The intern chooses its own model, so this value does not change what runs. | openrouter/intern | +| `session_id` | *Optional[str]* | :heavy_minus_sign: | The daemon session to continue, as returned in `session_id` on the final chunk of an earlier response. Omit it to start a new session. Required when the last message has role `tool`. | ses_7f3c9a | +| `stream` | *Literal[True]* | :heavy_check_mark: | Must be `true`. This endpoint only streams. | true | \ No newline at end of file diff --git a/docs/components/internchatdelta.mdx b/docs/components/internchatdelta.mdx new file mode 100644 index 00000000..950f73d4 --- /dev/null +++ b/docs/components/internchatdelta.mdx @@ -0,0 +1,15 @@ +--- +title: "InternChatDelta" +--- + +The incremental content of one chunk. The first chunk carries `role`, text chunks carry `content`, reasoning chunks carry `reasoning`, and an interaction chunk carries one complete `tool_calls` entry. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `content` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `reasoning` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `role` | [Optional[components.InternChatDeltaRole]](../components/internchatdeltarole.mdx) | :heavy_minus_sign: | N/A | +| `tool_calls` | List[[components.InternChatToolCall](../components/internchattoolcall.mdx)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/internchatdeltarole.mdx b/docs/components/internchatdeltarole.mdx new file mode 100644 index 00000000..76b5ccf1 --- /dev/null +++ b/docs/components/internchatdeltarole.mdx @@ -0,0 +1,15 @@ +--- +title: "InternChatDeltaRole" +--- + +## Example Usage + +```python +from openrouter.components import InternChatDeltaRole +value: InternChatDeltaRole = "assistant" +``` + + +## Values + +- `"assistant"` diff --git a/docs/components/internchatdevelopermessage.mdx b/docs/components/internchatdevelopermessage.mdx new file mode 100644 index 00000000..0fd5f0fb --- /dev/null +++ b/docs/components/internchatdevelopermessage.mdx @@ -0,0 +1,13 @@ +--- +title: "InternChatDeveloperMessage" +--- + +A developer message. Accepted for client compatibility and not forwarded. + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `content` | [Nullable[components.InternChatMessageContent]](../components/internchatmessagecontent.mdx) | :heavy_check_mark: | Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history. | Summarize the open pull requests. | +| `role` | [components.InternChatDeveloperMessageRole](../components/internchatdevelopermessagerole.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/internchatdevelopermessagerole.mdx b/docs/components/internchatdevelopermessagerole.mdx new file mode 100644 index 00000000..c8a28fe9 --- /dev/null +++ b/docs/components/internchatdevelopermessagerole.mdx @@ -0,0 +1,15 @@ +--- +title: "InternChatDeveloperMessageRole" +--- + +## Example Usage + +```python +from openrouter.components import InternChatDeveloperMessageRole +value: InternChatDeveloperMessageRole = "developer" +``` + + +## Values + +- `"developer"` diff --git a/docs/components/internchatechoedtoolcall.mdx b/docs/components/internchatechoedtoolcall.mdx new file mode 100644 index 00000000..a869fcac --- /dev/null +++ b/docs/components/internchatechoedtoolcall.mdx @@ -0,0 +1,13 @@ +--- +title: "InternChatEchoedToolCall" +--- + +The `openrouter.provide_input` tool call from the previous response, echoed back unchanged. Its `id` is the interaction the following `tool` message answers. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `function` | [components.InternChatEchoedToolCallFunction](../components/internchatechoedtoolcallfunction.mdx) | :heavy_check_mark: | The function name and JSON arguments string exactly as streamed. | \{
"arguments": "\{\"kind\":\"permission\",\"operation\":\"shell\",\"options\":[\"allow_once\",\"reject_once\"]}",
"name": "openrouter.provide_input"
} | +| `id` | *str* | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/internchatechoedtoolcallfunction.mdx b/docs/components/internchatechoedtoolcallfunction.mdx new file mode 100644 index 00000000..7b057bd6 --- /dev/null +++ b/docs/components/internchatechoedtoolcallfunction.mdx @@ -0,0 +1,13 @@ +--- +title: "InternChatEchoedToolCallFunction" +--- + +The function name and JSON arguments string exactly as streamed. + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `arguments` | *str* | :heavy_check_mark: | N/A | +| `name` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/internchaterror.mdx b/docs/components/internchaterror.mdx new file mode 100644 index 00000000..ccdf070f --- /dev/null +++ b/docs/components/internchaterror.mdx @@ -0,0 +1,14 @@ +--- +title: "InternChatError" +--- + +The OpenAI-compatible error object. `metadata` is present on refusals from the chat route. Authentication refusals (`401`), the departed-creator `403` and the programme `404` carry only `code` and `message`. + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `code` | *int* | :heavy_check_mark: | The HTTP status of the response. | | +| `message` | *str* | :heavy_check_mark: | N/A | | +| `metadata` | [Optional[components.InternChatErrorMetadata]](../components/internchaterrormetadata.mdx) | :heavy_minus_sign: | Machine-readable detail for the failure. | \{
"reason": "interaction_not_pending"
} | \ No newline at end of file diff --git a/docs/components/internchaterrormetadata.mdx b/docs/components/internchaterrormetadata.mdx new file mode 100644 index 00000000..c9de8ffb --- /dev/null +++ b/docs/components/internchaterrormetadata.mdx @@ -0,0 +1,12 @@ +--- +title: "InternChatErrorMetadata" +--- + +Machine-readable detail for the failure. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `reason` | [components.InternChatErrorMetadataReason](../components/internchaterrormetadatareason.mdx) | :heavy_check_mark: | A stable reason a client can branch on. | \ No newline at end of file diff --git a/docs/components/internchaterrormetadatareason.mdx b/docs/components/internchaterrormetadatareason.mdx new file mode 100644 index 00000000..7b17f0e2 --- /dev/null +++ b/docs/components/internchaterrormetadatareason.mdx @@ -0,0 +1,36 @@ +--- +title: "InternChatErrorMetadataReason" +--- + +A stable reason a client can branch on. + +## Example Usage + +```python +from openrouter.components import InternChatErrorMetadataReason + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: InternChatErrorMetadataReason = "attachment_failed" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"attachment_failed"` +- `"bad_request"` +- `"busy"` +- `"client_closed_request"` +- `"interaction_not_pending"` +- `"interaction_unknown"` +- `"intern_not_ready"` +- `"intern_rejected"` +- `"intern_unreachable"` +- `"not_found"` +- `"payload_too_large"` +- `"rate_limited"` +- `"run_ended"` +- `"stream_severed"` +- `"timeout"` +- `"turn_failed"` diff --git a/docs/components/internchatmessage.mdx b/docs/components/internchatmessage.mdx new file mode 100644 index 00000000..95dcf623 --- /dev/null +++ b/docs/components/internchatmessage.mdx @@ -0,0 +1,39 @@ +--- +title: "InternChatMessage" +--- + +One OpenAI-compatible chat message, discriminated by `role`. + + +## Supported Types + +### `components.InternChatAssistantMessage` + +```python +value: components.InternChatAssistantMessage = /* values here */ +``` + +### `components.InternChatDeveloperMessage` + +```python +value: components.InternChatDeveloperMessage = /* values here */ +``` + +### `components.InternChatSystemMessage` + +```python +value: components.InternChatSystemMessage = /* values here */ +``` + +### `components.InternChatToolMessage` + +```python +value: components.InternChatToolMessage = /* values here */ +``` + +### `components.InternChatUserMessage` + +```python +value: components.InternChatUserMessage = /* values here */ +``` + diff --git a/docs/components/internchatmessagecontent.mdx b/docs/components/internchatmessagecontent.mdx new file mode 100644 index 00000000..8330e45e --- /dev/null +++ b/docs/components/internchatmessagecontent.mdx @@ -0,0 +1,21 @@ +--- +title: "InternChatMessageContent" +--- + +Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history. + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `List[components.InternChatTextPart]` + +```python +value: List[components.InternChatTextPart] = /* values here */ +``` + diff --git a/docs/components/internchatprompttokensdetails.mdx b/docs/components/internchatprompttokensdetails.mdx new file mode 100644 index 00000000..77b2e341 --- /dev/null +++ b/docs/components/internchatprompttokensdetails.mdx @@ -0,0 +1,12 @@ +--- +title: "InternChatPromptTokensDetails" +--- + +Prompt tokens served from cache, when the daemon reported them. + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `cached_tokens` | *int* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/internchatstreamerror.mdx b/docs/components/internchatstreamerror.mdx new file mode 100644 index 00000000..48f3773b --- /dev/null +++ b/docs/components/internchatstreamerror.mdx @@ -0,0 +1,14 @@ +--- +title: "InternChatStreamError" +--- + +A failure after the response headers were sent. The chunk that carries it has `finish_reason: "error"`, then the final empty-`choices` chunk and `[DONE]` follow. Reasons here are `attachment_failed`, `busy`, `client_closed_request`, `interaction_not_pending`, `interaction_unknown`, `intern_unreachable`, `run_ended`, `stream_severed`, `timeout` or `turn_failed`. `run_ended` reports an ending the intern confirmed, such as a cancellation or a deadline, while `stream_severed` reports a connection lost without that confirmation. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `code` | *int* | :heavy_check_mark: | The HTTP status this failure would have had before the stream opened. | | +| `message` | *str* | :heavy_check_mark: | N/A | | +| `metadata` | [components.InternChatErrorMetadata](../components/internchaterrormetadata.mdx) | :heavy_check_mark: | Machine-readable detail for the failure. | \{
"reason": "interaction_not_pending"
} | \ No newline at end of file diff --git a/docs/components/internchatstreamingresponse.mdx b/docs/components/internchatstreamingresponse.mdx new file mode 100644 index 00000000..04ad18b6 --- /dev/null +++ b/docs/components/internchatstreamingresponse.mdx @@ -0,0 +1,12 @@ +--- +title: "InternChatStreamingResponse" +--- + +A server-sent event carrying one chunk. The stream ends with `data: [DONE]`. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [components.InternChatCompletionChunk](../components/internchatcompletionchunk.mdx) | :heavy_check_mark: | One `data:` line of the stream. A run streams a role chunk, content and reasoning chunks, then a finish chunk: `stop`, `tool_calls` (the run is paused for input) or `error` (with an `error` object). A final chunk with empty `choices` follows in every case, carrying `session_id` and `usage` (`null` unless the daemon reported usage, and always `null` after `tool_calls`). Every stream ends with `[DONE]`. | \{
"choices": [
\{
"delta": \{
"content": "Hello"
},
"finish_reason": null,
"index": 0
}
],
"created": 1789537541,
"id": "chatcmpl-f727571a-3bad-4e0d-8a9e-f18f8cda9750",
"model": "openrouter/intern",
"object": "chat.completion.chunk"
} | \ No newline at end of file diff --git a/docs/components/internchatsystemmessage.mdx b/docs/components/internchatsystemmessage.mdx new file mode 100644 index 00000000..d4568341 --- /dev/null +++ b/docs/components/internchatsystemmessage.mdx @@ -0,0 +1,13 @@ +--- +title: "InternChatSystemMessage" +--- + +A system message. Accepted for client compatibility and not forwarded. + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `content` | [Nullable[components.InternChatMessageContent]](../components/internchatmessagecontent.mdx) | :heavy_check_mark: | Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history. | Summarize the open pull requests. | +| `role` | [components.InternChatSystemMessageRole](../components/internchatsystemmessagerole.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/internchatsystemmessagerole.mdx b/docs/components/internchatsystemmessagerole.mdx new file mode 100644 index 00000000..0a20d5dd --- /dev/null +++ b/docs/components/internchatsystemmessagerole.mdx @@ -0,0 +1,15 @@ +--- +title: "InternChatSystemMessageRole" +--- + +## Example Usage + +```python +from openrouter.components import InternChatSystemMessageRole +value: InternChatSystemMessageRole = "system" +``` + + +## Values + +- `"system"` diff --git a/docs/components/internchattextpart.mdx b/docs/components/internchattextpart.mdx new file mode 100644 index 00000000..0bd3a5dc --- /dev/null +++ b/docs/components/internchattextpart.mdx @@ -0,0 +1,13 @@ +--- +title: "InternChatTextPart" +--- + +One text part of a message. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `text` | *str* | :heavy_check_mark: | N/A | +| `type` | [components.InternChatTextPartType](../components/internchattextparttype.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/internchattextparttype.mdx b/docs/components/internchattextparttype.mdx new file mode 100644 index 00000000..9807a99c --- /dev/null +++ b/docs/components/internchattextparttype.mdx @@ -0,0 +1,15 @@ +--- +title: "InternChatTextPartType" +--- + +## Example Usage + +```python +from openrouter.components import InternChatTextPartType +value: InternChatTextPartType = "text" +``` + + +## Values + +- `"text"` diff --git a/docs/components/internchattoolcall.mdx b/docs/components/internchattoolcall.mdx new file mode 100644 index 00000000..6176afe8 --- /dev/null +++ b/docs/components/internchattoolcall.mdx @@ -0,0 +1,15 @@ +--- +title: "InternChatToolCall" +--- + +An `openrouter.provide_input` request. The run pauses on the daemon until a `tool` message answers it, the caller cancels it, or its interaction deadline passes. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `function` | [components.InternChatToolCallFunction](../components/internchattoolcallfunction.mdx) | :heavy_check_mark: | The single tool this endpoint calls, asking the caller for input. | \{
"arguments": "\{\"fields\":[\{\"name\":\"answer\",\"options\":[\"red\",\"blue\",\"Other\"],\"required\":true,\"type\":\"string\"}],\"kind\":\"elicitation\",\"message\":\"Which colour do you prefer?\"}",
"name": "openrouter.provide_input"
} | +| `id` | *str* | :heavy_check_mark: | The interaction id. Send it back as `tool_call_id` on the `tool` message that answers it. | 15e90ad6-5320-4a59-af4f-b371428154fa | +| `index` | *int* | :heavy_check_mark: | N/A | | +| `type` | [components.InternChatToolCallType](../components/internchattoolcalltype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/internchattoolcallfunction.mdx b/docs/components/internchattoolcallfunction.mdx new file mode 100644 index 00000000..918fa0b2 --- /dev/null +++ b/docs/components/internchattoolcallfunction.mdx @@ -0,0 +1,13 @@ +--- +title: "InternChatToolCallFunction" +--- + +The single tool this endpoint calls, asking the caller for input. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `arguments` | *str* | :heavy_check_mark: | A JSON object string describing the interaction. A permission request is `{"kind":"permission","operation":,"options":[]}`. A question is `{"kind":"elicitation","message":,"fields":[]}`. | \{"fields":[\{"name":"answer","options":["red","blue","Other"],"required":true,"type":"string"}],"kind":"elicitation","message":"Which colour do you prefer?"} | +| `name` | [components.InternChatToolCallFunctionName](../components/internchattoolcallfunctionname.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/internchattoolcallfunctionname.mdx b/docs/components/internchattoolcallfunctionname.mdx new file mode 100644 index 00000000..15d42c44 --- /dev/null +++ b/docs/components/internchattoolcallfunctionname.mdx @@ -0,0 +1,15 @@ +--- +title: "InternChatToolCallFunctionName" +--- + +## Example Usage + +```python +from openrouter.components import InternChatToolCallFunctionName +value: InternChatToolCallFunctionName = "openrouter.provide_input" +``` + + +## Values + +- `"openrouter.provide_input"` diff --git a/docs/components/internchattoolcalltype.mdx b/docs/components/internchattoolcalltype.mdx new file mode 100644 index 00000000..8e1145d1 --- /dev/null +++ b/docs/components/internchattoolcalltype.mdx @@ -0,0 +1,15 @@ +--- +title: "InternChatToolCallType" +--- + +## Example Usage + +```python +from openrouter.components import InternChatToolCallType +value: InternChatToolCallType = "function" +``` + + +## Values + +- `"function"` diff --git a/docs/components/internchattoolmessage.mdx b/docs/components/internchattoolmessage.mdx new file mode 100644 index 00000000..f2673d01 --- /dev/null +++ b/docs/components/internchattoolmessage.mdx @@ -0,0 +1,14 @@ +--- +title: "InternChatToolMessage" +--- + +The answer to an `openrouter.provide_input` tool call. `tool_call_id` is the streamed tool call id and `session_id` must name the same session. For a permission, `content` is one of the offered option kinds (`allow_once`, `allow_always`, `reject_once`, `reject_always`) or `cancel`. For a question (elicitation), `content` is a JSON object string with `action` (`accept`, `decline` or `cancel`) and, for `accept`, `content` holding the field values. The answer is delivered to the run that asked. It never starts a new run. + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `content` | [Nullable[components.InternChatMessageContent]](../components/internchatmessagecontent.mdx) | :heavy_check_mark: | Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history. | Summarize the open pull requests. | +| `role` | [components.InternChatToolMessageRole](../components/internchattoolmessagerole.mdx) | :heavy_check_mark: | N/A | | +| `tool_call_id` | *str* | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/internchattoolmessagerole.mdx b/docs/components/internchattoolmessagerole.mdx new file mode 100644 index 00000000..8f338c95 --- /dev/null +++ b/docs/components/internchattoolmessagerole.mdx @@ -0,0 +1,15 @@ +--- +title: "InternChatToolMessageRole" +--- + +## Example Usage + +```python +from openrouter.components import InternChatToolMessageRole +value: InternChatToolMessageRole = "tool" +``` + + +## Values + +- `"tool"` diff --git a/docs/components/internchatusage.mdx b/docs/components/internchatusage.mdx new file mode 100644 index 00000000..221095cf --- /dev/null +++ b/docs/components/internchatusage.mdx @@ -0,0 +1,16 @@ +--- +title: "InternChatUsage" +--- + +Token usage for the run as the daemon reported it, on the final chunk before `[DONE]`. `null` when the daemon reported none, and always `null` after `tool_calls` because the turn is not over. + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `completion_tokens` | *int* | :heavy_check_mark: | N/A | | +| `cost` | *Optional[float]* | :heavy_minus_sign: | The cost of the run in USD, when the daemon reported one. | | +| `prompt_tokens` | *int* | :heavy_check_mark: | N/A | | +| `prompt_tokens_details` | [Optional[components.InternChatPromptTokensDetails]](../components/internchatprompttokensdetails.mdx) | :heavy_minus_sign: | Prompt tokens served from cache, when the daemon reported them. | \{
"cached_tokens": 1024
} | +| `total_tokens` | *int* | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/internchatusermessage.mdx b/docs/components/internchatusermessage.mdx new file mode 100644 index 00000000..55aae581 --- /dev/null +++ b/docs/components/internchatusermessage.mdx @@ -0,0 +1,13 @@ +--- +title: "InternChatUserMessage" +--- + +A user message. When it is the last message its text is the prompt for a new run, at most 32000 characters. + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `content` | [Nullable[components.InternChatMessageContent]](../components/internchatmessagecontent.mdx) | :heavy_check_mark: | Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history. | Summarize the open pull requests. | +| `role` | [components.InternChatUserMessageRole](../components/internchatusermessagerole.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/internchatusermessagerole.mdx b/docs/components/internchatusermessagerole.mdx new file mode 100644 index 00000000..4a98d724 --- /dev/null +++ b/docs/components/internchatusermessagerole.mdx @@ -0,0 +1,15 @@ +--- +title: "InternChatUserMessageRole" +--- + +## Example Usage + +```python +from openrouter.components import InternChatUserMessageRole +value: InternChatUserMessageRole = "user" +``` + + +## Values + +- `"user"` diff --git a/docs/components/legend.mdx b/docs/components/legend.mdx new file mode 100644 index 00000000..84e5be99 --- /dev/null +++ b/docs/components/legend.mdx @@ -0,0 +1,27 @@ +--- +title: "Legend" +--- + +A plain string, or a JSON object or array of structured guidance. + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `Dict[str, Any]` + +```python +value: Dict[str, Any] = /* values here */ +``` + +### `List[Any]` + +```python +value: List[Any] = /* values here */ +``` + diff --git a/docs/components/outputmodality.mdx b/docs/components/outputmodality.mdx index f0528135..25bd86a3 100644 --- a/docs/components/outputmodality.mdx +++ b/docs/components/outputmodality.mdx @@ -22,5 +22,6 @@ This is an open enum. Unrecognized values will not fail type checks. - `"audio"` - `"video"` - `"rerank"` +- `"decisions"` - `"speech"` - `"transcription"` diff --git a/docs/components/providername.mdx b/docs/components/providername.mdx index 390e2937..72302da7 100644 --- a/docs/components/providername.mdx +++ b/docs/components/providername.mdx @@ -82,6 +82,7 @@ This is an open enum. Unrecognized values will not fail type checks. - `"Moonshot AI"` - `"Morph"` - `"VoyageAI by MongoDB"` +- `"TypeSafe"` - `"Near AI"` - `"Nebius"` - `"Nex AGI"` @@ -114,6 +115,7 @@ This is an open enum. Unrecognized values will not fail type checks. - `"Tenstorrent"` - `"Thinking Machines"` - `"Together"` +- `"Unbiased"` - `"Upstage"` - `"Venice"` - `"Wafer"` diff --git a/docs/components/provideroptions.mdx b/docs/components/provideroptions.mdx index f3ba3c9c..545306fe 100644 --- a/docs/components/provideroptions.mdx +++ b/docs/components/provideroptions.mdx @@ -140,7 +140,9 @@ Provider-specific options keyed by provider slug. Only options for the matched p | `thinkingmachines` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `together` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `together_lite` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | +| `typesafe` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `ubicloud` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | +| `unbiased` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `upstage` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `venice` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `voyageai` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | diff --git a/docs/components/providerpreferences.mdx b/docs/components/providerpreferences.mdx index a312c6f6..f3203a1e 100644 --- a/docs/components/providerpreferences.mdx +++ b/docs/components/providerpreferences.mdx @@ -2,7 +2,7 @@ title: "ProviderPreferences" --- -When multiple model providers are available, optionally indicate your routing preference. +Provider routing preferences for the request. ## Fields diff --git a/docs/components/providerresponseprovidername.mdx b/docs/components/providerresponseprovidername.mdx index 1e1073fb..f7452e77 100644 --- a/docs/components/providerresponseprovidername.mdx +++ b/docs/components/providerresponseprovidername.mdx @@ -112,6 +112,7 @@ This is an open enum. Unrecognized values will not fail type checks. - `"Moonshot AI"` - `"Morph"` - `"VoyageAI by MongoDB"` +- `"TypeSafe"` - `"Near AI"` - `"Nebius"` - `"Nex AGI"` @@ -144,6 +145,7 @@ This is an open enum. Unrecognized values will not fail type checks. - `"Tenstorrent"` - `"Thinking Machines"` - `"Together"` +- `"Unbiased"` - `"Upstage"` - `"Venice"` - `"Wafer"` diff --git a/docs/components/questions.mdx b/docs/components/questions.mdx new file mode 100644 index 00000000..15be03f7 --- /dev/null +++ b/docs/components/questions.mdx @@ -0,0 +1,27 @@ +--- +title: "Questions" +--- + +A Decisions question using a boolean, choice, or ordered score evaluation. + + +## Supported Types + +### `components.DecisionsChoiceQuestion` + +```python +value: components.DecisionsChoiceQuestion = /* values here */ +``` + +### `components.DecisionsNoulQuestion` + +```python +value: components.DecisionsNoulQuestion = /* values here */ +``` + +### `components.DecisionsScoreQuestion` + +```python +value: components.DecisionsScoreQuestion = /* values here */ +``` + diff --git a/docs/components/state.mdx b/docs/components/state.mdx new file mode 100644 index 00000000..00263cb8 --- /dev/null +++ b/docs/components/state.mdx @@ -0,0 +1,27 @@ +--- +title: "State" +--- + +The content to evaluate: a plain string, or a JSON object or array of related context. + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `Dict[str, Any]` + +```python +value: Dict[str, Any] = /* values here */ +``` + +### `List[Any]` + +```python +value: List[Any] = /* values here */ +``` + diff --git a/docs/components/sttresponse.mdx b/docs/components/sttresponse.mdx index 5868e50f..cc34241b 100644 --- a/docs/components/sttresponse.mdx +++ b/docs/components/sttresponse.mdx @@ -7,12 +7,13 @@ STT response containing transcribed text and optional usage statistics ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | -| `duration` | *Optional[float]* | :heavy_minus_sign: | Duration of the input audio in seconds, present when response_format is verbose_json | 9.2 | -| `language` | *Optional[str]* | :heavy_minus_sign: | Detected or forced language, present when response_format is verbose_json | english | -| `segments` | List[[components.STTSegment](../components/sttsegment.mdx)] | :heavy_minus_sign: | Timestamped transcript segments, present when response_format is verbose_json | | -| `task` | *Optional[str]* | :heavy_minus_sign: | The task performed, present when response_format is verbose_json | transcribe | -| `text` | *str* | :heavy_check_mark: | The transcribed text | Hello, this is a test of OpenAI speech-to-text transcription. The weather is sunny today and the temperature is around 72 degrees. | -| `usage` | [Optional[components.STTUsage]](../components/sttusage.mdx) | :heavy_minus_sign: | Aggregated usage statistics for the request | \{
"cost": 0.000508,
"input_tokens": 83,
"output_tokens": 30,
"seconds": 9.2,
"total_tokens": 113
} | -| `words` | List[[components.STTWord](../components/sttword.mdx)] | :heavy_minus_sign: | Timestamped words, present when the provider returns word-level timestamps | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| `confidence` | *Optional[float]* | :heavy_minus_sign: | Provider confidence for the whole transcript from 0 to 1, present when response_format is verbose_json and the provider scores the full transcript | 0.94 | +| `duration` | *Optional[float]* | :heavy_minus_sign: | Duration of the input audio in seconds, present when response_format is verbose_json | 9.2 | +| `language` | *Optional[str]* | :heavy_minus_sign: | Detected or forced language, present when response_format is verbose_json | english | +| `segments` | List[[components.STTSegment](../components/sttsegment.mdx)] | :heavy_minus_sign: | Timestamped transcript segments, present when response_format is verbose_json | | +| `task` | *Optional[str]* | :heavy_minus_sign: | The task performed, present when response_format is verbose_json | transcribe | +| `text` | *str* | :heavy_check_mark: | The transcribed text | Hello, this is a test of OpenAI speech-to-text transcription. The weather is sunny today and the temperature is around 72 degrees. | +| `usage` | [Optional[components.STTUsage]](../components/sttusage.mdx) | :heavy_minus_sign: | Aggregated usage statistics for the request | \{
"cost": 0.000508,
"input_tokens": 83,
"output_tokens": 30,
"seconds": 9.2,
"total_tokens": 113
} | +| `words` | List[[components.STTWord](../components/sttword.mdx)] | :heavy_minus_sign: | Timestamped words, present when the provider returns word-level timestamps | | \ No newline at end of file diff --git a/docs/components/sttword.mdx b/docs/components/sttword.mdx index 906d1fe7..bccae8c6 100644 --- a/docs/components/sttword.mdx +++ b/docs/components/sttword.mdx @@ -7,9 +7,10 @@ A timestamped word, returned when the provider includes word-level timestamps ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `end` | *float* | :heavy_check_mark: | Word end time in seconds | 0.4 | -| `speaker` | *Optional[int]* | :heavy_minus_sign: | Speaker index for the word, present when the provider returns diarization data | 0 | -| `start` | *float* | :heavy_check_mark: | Word start time in seconds | 0 | -| `word` | *str* | :heavy_check_mark: | The transcribed word | Hello | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| `confidence` | *Optional[float]* | :heavy_minus_sign: | Provider confidence for the word from 0 to 1, present when the provider returns per-word confidence | 0.98 | +| `end` | *float* | :heavy_check_mark: | Word end time in seconds | 0.4 | +| `speaker` | *Optional[int]* | :heavy_minus_sign: | Speaker index for the word, present when the provider returns diarization data | 0 | +| `start` | *float* | :heavy_check_mark: | Word start time in seconds | 0 | +| `word` | *str* | :heavy_check_mark: | The transcribed word | Hello | \ No newline at end of file diff --git a/docs/components/truet.mdx b/docs/components/truet.mdx new file mode 100644 index 00000000..492acaa8 --- /dev/null +++ b/docs/components/truet.mdx @@ -0,0 +1,27 @@ +--- +title: "TrueT" +--- + +A plain string, or a JSON object or array of structured guidance. + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `Dict[str, Any]` + +```python +value: Dict[str, Any] = /* values here */ +``` + +### `List[Any]` + +```python +value: List[Any] = /* values here */ +``` + diff --git a/docs/components/videogenerationrequest.mdx b/docs/components/videogenerationrequest.mdx index 7582da56..8f8569b7 100644 --- a/docs/components/videogenerationrequest.mdx +++ b/docs/components/videogenerationrequest.mdx @@ -14,6 +14,7 @@ title: "VideoGenerationRequest" | `generate_audio` | *Optional[bool]* | :heavy_minus_sign: | Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set. | true | | `input_references` | List[[components.InputReference](../components/inputreference.mdx)] | :heavy_minus_sign: | 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* | :heavy_check_mark: | N/A | | +| `previous_job_id` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | 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) | :heavy_minus_sign: | Provider-specific passthrough configuration | | | `resolution` | [Optional[components.VideoGenerationRequestResolution]](../components/videogenerationrequestresolution.mdx) | :heavy_minus_sign: | Resolution of the generated video | 720p | diff --git a/docs/components/videogenerationrequestoptions.mdx b/docs/components/videogenerationrequestoptions.mdx index 379724e3..4c2feb02 100644 --- a/docs/components/videogenerationrequestoptions.mdx +++ b/docs/components/videogenerationrequestoptions.mdx @@ -140,7 +140,9 @@ Provider-specific options keyed by provider slug. Only options for the matched p | `thinkingmachines` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `together` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `together_lite` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | +| `typesafe` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `ubicloud` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | +| `unbiased` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `upstage` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `venice` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | `voyageai` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | diff --git a/docs/components/videogenerationresponse.mdx b/docs/components/videogenerationresponse.mdx index dd365941..31fceaaa 100644 --- a/docs/components/videogenerationresponse.mdx +++ b/docs/components/videogenerationresponse.mdx @@ -4,12 +4,12 @@ title: "VideoGenerationResponse" ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | -| `error` | *Optional[str]* | :heavy_minus_sign: | N/A | | -| `generation_id` | *Optional[str]* | :heavy_minus_sign: | The generation ID associated with this video generation job. Available once the job has been processed. | | -| `id` | *str* | :heavy_check_mark: | N/A | | -| `polling_url` | *str* | :heavy_check_mark: | N/A | | -| `status` | [components.VideoGenerationResponseStatus](../components/videogenerationresponsestatus.mdx) | :heavy_check_mark: | N/A | | -| `unsigned_urls` | List[*str*] | :heavy_minus_sign: | N/A | | -| `usage` | [Optional[components.VideoGenerationUsage]](../components/videogenerationusage.mdx) | :heavy_minus_sign: | Usage and cost information for the video generation. Available once the job has completed. | \{
"cost": 0.5,
"is_byok": false
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| `error` | *Optional[str]* | :heavy_minus_sign: | N/A | | +| `generation_id` | *Optional[str]* | :heavy_minus_sign: | The generation ID associated with this video generation job. Available once the job has been processed. | | +| `id` | *str* | :heavy_check_mark: | The video job ID, in the `gen-vid--<20 alphanumerics>` generation ID format. Pass it as `previous_job_id` to continue the generation. | | +| `polling_url` | *str* | :heavy_check_mark: | N/A | | +| `status` | [components.VideoGenerationResponseStatus](../components/videogenerationresponsestatus.mdx) | :heavy_check_mark: | N/A | | +| `unsigned_urls` | List[*str*] | :heavy_minus_sign: | N/A | | +| `usage` | [Optional[components.VideoGenerationUsage]](../components/videogenerationusage.mdx) | :heavy_minus_sign: | Usage and cost information for the video generation. Available once the job has completed. | \{
"cost": 0.5,
"is_byok": false
} | \ No newline at end of file diff --git a/docs/docs.json b/docs/docs.json index 431a325c..3d453249 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -20,6 +20,7 @@ "sdks/containers/README", "sdks/credits/README", "sdks/datasets/README", + "sdks/decisions/README", "sdks/embeddings/README", "sdks/endpoints/README", "sdks/files/README", diff --git a/docs/errors/internchaterrorresponse.mdx b/docs/errors/internchaterrorresponse.mdx new file mode 100644 index 00000000..c8312437 --- /dev/null +++ b/docs/errors/internchaterrorresponse.mdx @@ -0,0 +1,12 @@ +--- +title: "InternChatErrorResponse" +--- + +A refusal before the stream opens. Once the response is `200` and streaming, failures arrive as a chunk with `finish_reason: "error"` instead. + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `error` | [components.InternChatError](../components/internchaterror.mdx) | :heavy_check_mark: | The OpenAI-compatible error object. `metadata` is present on refusals from the chat route. Authentication refusals (`401`), the departed-creator `403` and the programme `404` carry only `code` and `message`. | \{
"code": 409,
"message": "That question is no longer waiting for an answer.",
"metadata": \{
"reason": "interaction_not_pending"
}
} | \ No newline at end of file diff --git a/docs/operations/createapialphadecisionsglobals.mdx b/docs/operations/createapialphadecisionsglobals.mdx new file mode 100644 index 00000000..2fc93732 --- /dev/null +++ b/docs/operations/createapialphadecisionsglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "CreateAPIAlphaDecisionsGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/createapialphadecisionsrequest.mdx b/docs/operations/createapialphadecisionsrequest.mdx new file mode 100644 index 00000000..efdf720f --- /dev/null +++ b/docs/operations/createapialphadecisionsrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "CreateAPIAlphaDecisionsRequest" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| +| `decisions_request` | [components.DecisionsRequest](../components/decisionsrequest.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/createinternchatcompletionglobals.mdx b/docs/operations/createinternchatcompletionglobals.mdx new file mode 100644 index 00000000..561b72c4 --- /dev/null +++ b/docs/operations/createinternchatcompletionglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "CreateInternChatCompletionGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/createinternchatcompletionrequest.mdx b/docs/operations/createinternchatcompletionrequest.mdx new file mode 100644 index 00000000..a4bd48af --- /dev/null +++ b/docs/operations/createinternchatcompletionrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "CreateInternChatCompletionRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `intern_id` | *str* | :heavy_check_mark: | The intern to talk to. | a11e0000-0000-4000-8000-000000000005 | +| `intern_chat_completion_request` | [components.InternChatCompletionRequest](../components/internchatcompletionrequest.mdx) | :heavy_check_mark: | N/A | \{
"approval_mode": "manual",
"messages": [
\{
"content": "Summarize the open pull requests.",
"role": "user"
}
],
"stream": true
} | \ No newline at end of file diff --git a/docs/operations/createinternchatcompletionresponse.mdx b/docs/operations/createinternchatcompletionresponse.mdx new file mode 100644 index 00000000..2e1d5764 --- /dev/null +++ b/docs/operations/createinternchatcompletionresponse.mdx @@ -0,0 +1,18 @@ +--- +title: "CreateInternChatCompletionResponse" +--- + +## Supported Types + +### `Union[eventstreaming.EventStream[components.InternChatCompletionChunk], eventstreaming.EventStreamAsync[components.InternChatCompletionChunk]]` + +```python +value: Union[eventstreaming.EventStream[components.InternChatCompletionChunk], eventstreaming.EventStreamAsync[components.InternChatCompletionChunk]] = /* values here */ +``` + +### `components.InternChatCompletionChunk` + +```python +value: components.InternChatCompletionChunk = /* values here */ +``` + diff --git a/docs/operations/getmodelsrequest.mdx b/docs/operations/getmodelsrequest.mdx index 2b88459a..95e4b488 100644 --- a/docs/operations/getmodelsrequest.mdx +++ b/docs/operations/getmodelsrequest.mdx @@ -13,7 +13,7 @@ title: "GetModelsRequest" | `limit` | *Optional[int]* | :heavy_minus_sign: | Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned | 500 | | `category` | [Optional[operations.GetModelsCategory]](../operations/getmodelscategory.mdx) | :heavy_minus_sign: | Filter models by use case category | programming | | `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | Filter models by supported parameter (comma-separated) | temperature | -| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or "all" to include all models. Defaults to "text". | text | +| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text". | text | | `sort` | [Optional[operations.GetModelsSort]](../operations/getmodelssort.mdx) | :heavy_minus_sign: | Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. | newest | | `q` | *Optional[str]* | :heavy_minus_sign: | Free-text search by model name or slug. | gpt-4 | | `input_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by input modality. Comma-separated list of: text, image, audio, file. | text,image | diff --git a/docs/operations/listmodelscountrequest.mdx b/docs/operations/listmodelscountrequest.mdx index e97bb8af..163aa28d 100644 --- a/docs/operations/listmodelscountrequest.mdx +++ b/docs/operations/listmodelscountrequest.mdx @@ -4,9 +4,9 @@ title: "ListModelsCountRequest" ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | -| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or "all" to include all models. Defaults to "text". | text | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text". | text | \ No newline at end of file diff --git a/docs/operations/listmodelsuserrequest.mdx b/docs/operations/listmodelsuserrequest.mdx index 047eaf5a..0ad201f8 100644 --- a/docs/operations/listmodelsuserrequest.mdx +++ b/docs/operations/listmodelsuserrequest.mdx @@ -4,11 +4,11 @@ title: "ListModelsUserRequest" ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | -| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `offset` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | -| `limit` | *Optional[int]* | :heavy_minus_sign: | Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned | 500 | -| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or "all" to include all models. Defaults to "text". | text | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | +| `limit` | *Optional[int]* | :heavy_minus_sign: | Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned | 500 | +| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text". | text | \ No newline at end of file diff --git a/docs/operations/provider.mdx b/docs/operations/provider.mdx index 2762e4d9..bc2c971d 100644 --- a/docs/operations/provider.mdx +++ b/docs/operations/provider.mdx @@ -119,6 +119,8 @@ This is an open enum. Unrecognized values will not fail type checks. - `"tenstorrent"` - `"thinkingmachines"` - `"together"` +- `"typesafe"` +- `"unbiased"` - `"upstage"` - `"venice"` - `"voyageai"` diff --git a/docs/sdks/decisions/README.mdx b/docs/sdks/decisions/README.mdx new file mode 100644 index 00000000..0b2877e3 --- /dev/null +++ b/docs/sdks/decisions/README.mdx @@ -0,0 +1,79 @@ +--- +title: "Alpha.Decisions" +description: "Alpha feature endpoints for Decisions (questions and answers) requests" +--- + +## Overview + +Alpha feature endpoints for Decisions (questions and answers) requests + +### Available Operations + +* [create](#create) - Submit a Decisions (questions and answers) request + +## create + +Submits a Decisions request to the Decisions router + +### 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.alpha.decisions.create(model="Grand Cherokee", questions={ + + }, state={ + "key": "Massachusetts", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `model` | *str* | :heavy_check_mark: | N/A | | +| `questions` | Dict[str, [components.Questions](../../components/questions.mdx)] | :heavy_check_mark: | N/A | | +| `state` | [components.State](../../components/state.mdx) | :heavy_check_mark: | The content to evaluate: a plain string, or a JSON object or array of related context. | | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `provider` | [OptionalNullable[components.ProviderPreferences]](../../components/providerpreferences.mdx) | :heavy_minus_sign: | N/A | \{
"allow_fallbacks": true
} | +| `session_id` | *Optional[str]* | :heavy_minus_sign: | 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 | +| `trace` | [Optional[components.TraceConfig]](../../components/traceconfig.mdx) | :heavy_minus_sign: | 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"
} | +| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.DecisionsResponse](../../components/decisionsresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.PaymentRequiredResponseError | 402 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.PayloadTooLargeResponseError | 413 | application/json | +| errors.TooManyRequestsResponseError | 429 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.BadGatewayResponseError | 502 | application/json | +| errors.ServiceUnavailableResponseError | 503 | application/json | +| errors.EdgeNetworkTimeoutResponseError | 524 | application/json | +| errors.ProviderOverloadedResponseError | 529 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/interns/README.mdx b/docs/sdks/interns/README.mdx index 4b26b50d..57fd0d26 100644 --- a/docs/sdks/interns/README.mdx +++ b/docs/sdks/interns/README.mdx @@ -1,11 +1,11 @@ --- title: "Interns" -description: "Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key." +description: "Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key, and talk to them: the chat route streams OpenAI-compatible completions from one intern, pausing as an `openrouter.provide_input` tool call when the intern needs your permission or an answer. Available to interns programme members; other callers receive 404. See https://openrouter.ai/docs/guides/ori/intern-chat." --- ## Overview -Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key. +Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key, and talk to them: the chat route streams OpenAI-compatible completions from one intern, pausing as an `openrouter.provide_input` tool call when the intern needs your permission or an answer. Available to interns programme members; other callers receive 404. See https://openrouter.ai/docs/guides/ori/intern-chat. ### Available Operations @@ -16,6 +16,7 @@ Create, inspect, update, provision, suspend and delete OpenRouter interns throug * [update_intern](#update_intern) - Update an intern * [provision_intern](#provision_intern) - Provision an intern * [suspend_intern](#suspend_intern) - Suspend an intern +* [chat](#chat) - Stream a chat completion with an intern ## list_interns @@ -356,4 +357,74 @@ with OpenRouter( | ----------------------------- | ----------------------------- | ----------------------------- | | errors.InternLifecycleError | 401, 403, 404, 408, 409 | application/json | | errors.InternLifecycleError | 500, 502 | application/json | -| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## chat + +Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: "tool_calls"`, and the run stays open on the intern. + +Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk. + +To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline. + +Closing the connection after the `[DONE]` that follows `finish_reason: "tool_calls"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The disconnect is noticed when the intern next writes to the stream, which during a silent tool run can take more than one 30 second heartbeat interval. + +A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: "error"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event. + +Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts. + +Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`. + +### 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.interns.chat(intern_id="a11e0000-0000-4000-8000-000000000005", messages=[ + { + "content": "Summarize the open pull requests.", + "role": "user", + }, + ], approval_mode="manual") + + with res as event_stream: + for event in event_stream: + # handle event + print(event, flush=True) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `intern_id` | *str* | :heavy_check_mark: | The intern to talk to. | a11e0000-0000-4000-8000-000000000005 | +| `messages` | List[[components.InternChatMessage](../../components/internchatmessage.mdx)] | :heavy_check_mark: | The conversation. Only the last message is read. A last `user` message starts a run. A last `tool` message answers the interaction named by its `tool_call_id` and requires `session_id`. | | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `approval_mode` | [Optional[components.InternApprovalMode]](../../components/internapprovalmode.mdx) | :heavy_minus_sign: | How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with. | manual | +| `model` | *Optional[str]* | :heavy_minus_sign: | Echoed as `model` on the streamed chunks; the final chunk may carry the model the intern reported instead. The intern chooses its own model, so this value does not change what runs. | openrouter/intern | +| `session_id` | *Optional[str]* | :heavy_minus_sign: | The daemon session to continue, as returned in `session_id` on the final chunk of an earlier response. Omit it to start a new session. Required when the last message has role `tool`. | ses_7f3c9a | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[operations.CreateInternChatCompletionResponse](../../operations/createinternchatcompletionresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.InternChatErrorResponse | 400, 401, 403, 404, 409, 410, 413, 429 | application/json | +| errors.InternChatErrorResponse | 502, 503, 504 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/models/README.mdx b/docs/sdks/models/README.mdx index 704be1ed..9131aee9 100644 --- a/docs/sdks/models/README.mdx +++ b/docs/sdks/models/README.mdx @@ -101,7 +101,7 @@ with OpenRouter( | `limit` | *Optional[int]* | :heavy_minus_sign: | Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned | 500 | | `category` | [Optional[operations.GetModelsCategory]](../../operations/getmodelscategory.mdx) | :heavy_minus_sign: | Filter models by use case category | programming | | `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | Filter models by supported parameter (comma-separated) | temperature | -| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or "all" to include all models. Defaults to "text". | text | +| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text". | text | | `sort` | [Optional[operations.GetModelsSort]](../../operations/getmodelssort.mdx) | :heavy_minus_sign: | Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. | newest | | `q` | *Optional[str]* | :heavy_minus_sign: | Free-text search by model name or slug. | gpt-4 | | `input_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by input modality. Comma-separated list of: text, image, audio, file. | text,image | @@ -168,13 +168,13 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | -| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or "all" to include all models. Defaults to "text". | text | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text". | text | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -219,16 +219,16 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `security` | [operations.ListModelsUserSecurity](../../operations/listmodelsusersecurity.mdx) | :heavy_check_mark: | N/A | | -| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | -| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `offset` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | -| `limit` | *Optional[int]* | :heavy_minus_sign: | Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned | 500 | -| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or "all" to include all models. Defaults to "text". | text | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `security` | [operations.ListModelsUserSecurity](../../operations/listmodelsusersecurity.mdx) | :heavy_check_mark: | N/A | | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | +| `limit` | *Optional[int]* | :heavy_minus_sign: | Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned | 500 | +| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text". | text | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | 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 1d820c5a..f317b0a4 100644 --- a/docs/sdks/videogeneration/README.mdx +++ b/docs/sdks/videogeneration/README.mdx @@ -54,6 +54,7 @@ with OpenRouter( | `frame_images` | List[[components.FrameImage](../../components/frameimage.mdx)] | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set. | true | | `input_references` | List[[components.InputReference](../../components/inputreference.mdx)] | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | 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) | :heavy_minus_sign: | Provider-specific passthrough configuration | | | `resolution` | [Optional[components.VideoGenerationRequestResolution]](../../components/videogenerationrequestresolution.mdx) | :heavy_minus_sign: | Resolution of the generated video | 720p | diff --git a/pyproject.toml b/pyproject.toml index ab9aa030..362e403e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.1.156" +version = "1.1.157" 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 1c31f98a..54e28eba 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.1.156" +__version__: str = "1.1.157" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.1.156 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.1.157 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/alpha.py b/src/openrouter/alpha.py new file mode 100644 index 00000000..785d065a --- /dev/null +++ b/src/openrouter/alpha.py @@ -0,0 +1,21 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from .sdkconfiguration import SDKConfiguration +from openrouter.decisions import Decisions +from typing import Optional + + +class Alpha(BaseSDK): + decisions: Decisions + r"""Alpha feature endpoints for Decisions (questions and answers) requests""" + + def __init__( + self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None + ) -> None: + BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref) + self.sdk_configuration = sdk_config + self._init_sdks() + + def _init_sdks(self): + self.decisions = Decisions(self.sdk_configuration, parent_ref=self.parent_ref) diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 7f9810b0..48647085 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -983,6 +983,71 @@ Timings, TimingsTypedDict, ) + from .decisionschoiceanswer import ( + DecisionsChoiceAnswer, + DecisionsChoiceAnswerType, + DecisionsChoiceAnswerTypedDict, + ) + from .decisionschoicequestion import ( + Criteria, + CriteriaTypedDict, + DecisionsChoiceQuestion, + DecisionsChoiceQuestionInstructions, + DecisionsChoiceQuestionInstructionsTypedDict, + DecisionsChoiceQuestionType, + DecisionsChoiceQuestionTypedDict, + ) + from .decisionsnoulanswer import ( + DecisionsNoulAnswer, + DecisionsNoulAnswerType, + DecisionsNoulAnswerTypedDict, + ) + from .decisionsnoulquestion import ( + DecisionsNoulQuestion, + DecisionsNoulQuestionCriteria, + DecisionsNoulQuestionCriteriaTypedDict, + DecisionsNoulQuestionInstructions, + DecisionsNoulQuestionInstructionsTypedDict, + DecisionsNoulQuestionType, + DecisionsNoulQuestionTypedDict, + FalseT, + FalseTTypedDict, + TrueT, + TrueTTypedDict, + ) + from .decisionsrequest import ( + DecisionsRequest, + DecisionsRequestTypedDict, + Questions, + QuestionsTypedDict, + State, + StateTypedDict, + ) + from .decisionsresponse import ( + Answers, + AnswersTypedDict, + DecisionsResponse, + DecisionsResponseTypedDict, + DecisionsResponseUsage, + DecisionsResponseUsageTypedDict, + UnknownAnswers, + ) + from .decisionsscoreanswer import ( + DecisionsScoreAnswer, + DecisionsScoreAnswerType, + DecisionsScoreAnswerTypedDict, + Legend, + LegendTypedDict, + ) + from .decisionsscorequestion import ( + Criterion, + CriterionTypedDict, + DecisionsScoreQuestion, + DecisionsScoreQuestionInstructions, + DecisionsScoreQuestionInstructionsTypedDict, + DecisionsScoreQuestionType, + DecisionsScoreQuestionTypedDict, + ) from .defaultparameters import DefaultParameters, DefaultParametersTypedDict from .deletebyokkeyresponse import ( DeleteBYOKKeyResponse, @@ -1453,7 +1518,11 @@ ImageStreamingResponseTypedDict, UnknownImageStreamingResponseData, ) - from .incompletedetails import IncompleteDetails, IncompleteDetailsTypedDict, Reason + from .incompletedetails import ( + IncompleteDetails, + IncompleteDetailsReason, + IncompleteDetailsTypedDict, + ) from .inputaudio import ( FormatEnum, InputAudio, @@ -1537,6 +1606,98 @@ InternalServerResponseErrorData, InternalServerResponseErrorDataTypedDict, ) + from .internapprovalmode import InternApprovalMode + from .internchatassistantmessage import ( + InternChatAssistantMessage, + InternChatAssistantMessageRole, + InternChatAssistantMessageTypedDict, + ) + from .internchatchoice import ( + FinishReason, + InternChatChoice, + InternChatChoiceTypedDict, + ) + from .internchatcompletionchunk import ( + InternChatCompletionChunk, + InternChatCompletionChunkObject, + InternChatCompletionChunkTypedDict, + ) + from .internchatcompletionrequest import ( + InternChatCompletionRequest, + InternChatCompletionRequestTypedDict, + ) + from .internchatdelta import ( + InternChatDelta, + InternChatDeltaRole, + InternChatDeltaTypedDict, + ) + from .internchatdevelopermessage import ( + InternChatDeveloperMessage, + InternChatDeveloperMessageRole, + InternChatDeveloperMessageTypedDict, + ) + from .internchatechoedtoolcall import ( + InternChatEchoedToolCall, + InternChatEchoedToolCallTypedDict, + ) + from .internchatechoedtoolcallfunction import ( + InternChatEchoedToolCallFunction, + InternChatEchoedToolCallFunctionTypedDict, + ) + from .internchaterror import InternChatError, InternChatErrorTypedDict + from .internchaterrormetadata import ( + InternChatErrorMetadata, + InternChatErrorMetadataReason, + InternChatErrorMetadataTypedDict, + ) + from .internchatmessage import InternChatMessage, InternChatMessageTypedDict + from .internchatmessagecontent import ( + InternChatMessageContent, + InternChatMessageContentTypedDict, + ) + from .internchatprompttokensdetails import ( + InternChatPromptTokensDetails, + InternChatPromptTokensDetailsTypedDict, + ) + from .internchatstreamerror import ( + InternChatStreamError, + InternChatStreamErrorTypedDict, + ) + from .internchatstreamingresponse import ( + InternChatStreamingResponse, + InternChatStreamingResponseTypedDict, + ) + from .internchatsystemmessage import ( + InternChatSystemMessage, + InternChatSystemMessageRole, + InternChatSystemMessageTypedDict, + ) + from .internchattextpart import ( + InternChatTextPart, + InternChatTextPartType, + InternChatTextPartTypedDict, + ) + from .internchattoolcall import ( + InternChatToolCall, + InternChatToolCallType, + InternChatToolCallTypedDict, + ) + from .internchattoolcallfunction import ( + InternChatToolCallFunction, + InternChatToolCallFunctionName, + InternChatToolCallFunctionTypedDict, + ) + from .internchattoolmessage import ( + InternChatToolMessage, + InternChatToolMessageRole, + InternChatToolMessageTypedDict, + ) + from .internchatusage import InternChatUsage, InternChatUsageTypedDict + from .internchatusermessage import ( + InternChatUserMessage, + InternChatUserMessageRole, + InternChatUserMessageTypedDict, + ) from .internlifecycleerror import ( Code, CodeTypedDict, @@ -3381,6 +3542,8 @@ "AnnotationAddedEvent", "AnnotationAddedEventType", "AnnotationAddedEventTypedDict", + "Answers", + "AnswersTypedDict", "AnthropicAdvisorMessageUsageIteration", "AnthropicAdvisorMessageUsageIterationType", "AnthropicAdvisorMessageUsageIterationTypedDict", @@ -3975,6 +4138,10 @@ "CreateWorkspaceRequestTypedDict", "CreateWorkspaceResponse", "CreateWorkspaceResponseTypedDict", + "Criteria", + "CriteriaTypedDict", + "Criterion", + "CriterionTypedDict", "Crv", "CustomTool", "CustomToolCallInputDeltaEvent", @@ -4013,6 +4180,38 @@ "DebugEventType", "DebugEventTypedDict", "DebugTypedDict", + "DecisionsChoiceAnswer", + "DecisionsChoiceAnswerType", + "DecisionsChoiceAnswerTypedDict", + "DecisionsChoiceQuestion", + "DecisionsChoiceQuestionInstructions", + "DecisionsChoiceQuestionInstructionsTypedDict", + "DecisionsChoiceQuestionType", + "DecisionsChoiceQuestionTypedDict", + "DecisionsNoulAnswer", + "DecisionsNoulAnswerType", + "DecisionsNoulAnswerTypedDict", + "DecisionsNoulQuestion", + "DecisionsNoulQuestionCriteria", + "DecisionsNoulQuestionCriteriaTypedDict", + "DecisionsNoulQuestionInstructions", + "DecisionsNoulQuestionInstructionsTypedDict", + "DecisionsNoulQuestionType", + "DecisionsNoulQuestionTypedDict", + "DecisionsRequest", + "DecisionsRequestTypedDict", + "DecisionsResponse", + "DecisionsResponseTypedDict", + "DecisionsResponseUsage", + "DecisionsResponseUsageTypedDict", + "DecisionsScoreAnswer", + "DecisionsScoreAnswerType", + "DecisionsScoreAnswerTypedDict", + "DecisionsScoreQuestion", + "DecisionsScoreQuestionInstructions", + "DecisionsScoreQuestionInstructionsTypedDict", + "DecisionsScoreQuestionType", + "DecisionsScoreQuestionTypedDict", "DefaultEffort", "DefaultParameters", "DefaultParametersTypedDict", @@ -4082,6 +4281,8 @@ "FailableToolCallStatus", "FailedModel", "FailedModelTypedDict", + "FalseT", + "FalseTTypedDict", "FieldT", "FileCitation", "FileCitationType", @@ -4115,6 +4316,7 @@ "FiltersTypedDict", "FiltersUnion", "FiltersUnionTypedDict", + "FinishReason", "ForbiddenResponseErrorData", "ForbiddenResponseErrorDataTypedDict", "Format", @@ -4347,6 +4549,7 @@ "ImageStreamingResponseDataTypedDict", "ImageStreamingResponseTypedDict", "IncompleteDetails", + "IncompleteDetailsReason", "IncompleteDetailsTypedDict", "Input1", "Input1TypedDict", @@ -4428,6 +4631,62 @@ "InputsUnionTypedDict", "InstructType", "Intern", + "InternApprovalMode", + "InternChatAssistantMessage", + "InternChatAssistantMessageRole", + "InternChatAssistantMessageTypedDict", + "InternChatChoice", + "InternChatChoiceTypedDict", + "InternChatCompletionChunk", + "InternChatCompletionChunkObject", + "InternChatCompletionChunkTypedDict", + "InternChatCompletionRequest", + "InternChatCompletionRequestTypedDict", + "InternChatDelta", + "InternChatDeltaRole", + "InternChatDeltaTypedDict", + "InternChatDeveloperMessage", + "InternChatDeveloperMessageRole", + "InternChatDeveloperMessageTypedDict", + "InternChatEchoedToolCall", + "InternChatEchoedToolCallFunction", + "InternChatEchoedToolCallFunctionTypedDict", + "InternChatEchoedToolCallTypedDict", + "InternChatError", + "InternChatErrorMetadata", + "InternChatErrorMetadataReason", + "InternChatErrorMetadataTypedDict", + "InternChatErrorTypedDict", + "InternChatMessage", + "InternChatMessageContent", + "InternChatMessageContentTypedDict", + "InternChatMessageTypedDict", + "InternChatPromptTokensDetails", + "InternChatPromptTokensDetailsTypedDict", + "InternChatStreamError", + "InternChatStreamErrorTypedDict", + "InternChatStreamingResponse", + "InternChatStreamingResponseTypedDict", + "InternChatSystemMessage", + "InternChatSystemMessageRole", + "InternChatSystemMessageTypedDict", + "InternChatTextPart", + "InternChatTextPartType", + "InternChatTextPartTypedDict", + "InternChatToolCall", + "InternChatToolCallFunction", + "InternChatToolCallFunctionName", + "InternChatToolCallFunctionTypedDict", + "InternChatToolCallType", + "InternChatToolCallTypedDict", + "InternChatToolMessage", + "InternChatToolMessageRole", + "InternChatToolMessageTypedDict", + "InternChatUsage", + "InternChatUsageTypedDict", + "InternChatUserMessage", + "InternChatUserMessageRole", + "InternChatUserMessageTypedDict", "InternLifecycleErrorError", "InternLifecycleErrorErrorTypedDict", "InternListResponse", @@ -4460,6 +4719,8 @@ "LegacyWebSearchServerTool", "LegacyWebSearchServerToolType", "LegacyWebSearchServerToolTypedDict", + "Legend", + "LegendTypedDict", "Links", "LinksTypedDict", "ListBYOKKeysResponse", @@ -5142,6 +5403,8 @@ "PublicPricingTypedDict", "Purpose", "Quantization", + "Questions", + "QuestionsTypedDict", "RangeCapability", "RangeCapabilityType", "RangeCapabilityTypedDict", @@ -5155,7 +5418,6 @@ "RankingsDailyMetaVersion", "RankingsDailyResponse", "RankingsDailyResponseTypedDict", - "Reason", "ReasoningConfig", "ReasoningConfigTypedDict", "ReasoningContext", @@ -5359,6 +5621,8 @@ "Speed", "Stance", "StanceTypedDict", + "State", + "StateTypedDict", "Stop", "StopServerToolsWhenCondition", "StopServerToolsWhenConditionTypedDict", @@ -5514,6 +5778,8 @@ "TriggerInputTokens", "TriggerInputTokensTypedDict", "TriggerTypedDict", + "TrueT", + "TrueTTypedDict", "Truncation", "TurnRange", "Type", @@ -5593,6 +5859,7 @@ "Unit", "Unknown", "UnknownAction", + "UnknownAnswers", "UnknownApplyPatchCallOperation", "UnknownBaseInputsContent1", "UnknownCapabilityDescriptor", @@ -6425,6 +6692,55 @@ "Event": ".debugevent", "Timings": ".debugevent", "TimingsTypedDict": ".debugevent", + "DecisionsChoiceAnswer": ".decisionschoiceanswer", + "DecisionsChoiceAnswerType": ".decisionschoiceanswer", + "DecisionsChoiceAnswerTypedDict": ".decisionschoiceanswer", + "Criteria": ".decisionschoicequestion", + "CriteriaTypedDict": ".decisionschoicequestion", + "DecisionsChoiceQuestion": ".decisionschoicequestion", + "DecisionsChoiceQuestionInstructions": ".decisionschoicequestion", + "DecisionsChoiceQuestionInstructionsTypedDict": ".decisionschoicequestion", + "DecisionsChoiceQuestionType": ".decisionschoicequestion", + "DecisionsChoiceQuestionTypedDict": ".decisionschoicequestion", + "DecisionsNoulAnswer": ".decisionsnoulanswer", + "DecisionsNoulAnswerType": ".decisionsnoulanswer", + "DecisionsNoulAnswerTypedDict": ".decisionsnoulanswer", + "DecisionsNoulQuestion": ".decisionsnoulquestion", + "DecisionsNoulQuestionCriteria": ".decisionsnoulquestion", + "DecisionsNoulQuestionCriteriaTypedDict": ".decisionsnoulquestion", + "DecisionsNoulQuestionInstructions": ".decisionsnoulquestion", + "DecisionsNoulQuestionInstructionsTypedDict": ".decisionsnoulquestion", + "DecisionsNoulQuestionType": ".decisionsnoulquestion", + "DecisionsNoulQuestionTypedDict": ".decisionsnoulquestion", + "FalseT": ".decisionsnoulquestion", + "FalseTTypedDict": ".decisionsnoulquestion", + "TrueT": ".decisionsnoulquestion", + "TrueTTypedDict": ".decisionsnoulquestion", + "DecisionsRequest": ".decisionsrequest", + "DecisionsRequestTypedDict": ".decisionsrequest", + "Questions": ".decisionsrequest", + "QuestionsTypedDict": ".decisionsrequest", + "State": ".decisionsrequest", + "StateTypedDict": ".decisionsrequest", + "Answers": ".decisionsresponse", + "AnswersTypedDict": ".decisionsresponse", + "DecisionsResponse": ".decisionsresponse", + "DecisionsResponseTypedDict": ".decisionsresponse", + "DecisionsResponseUsage": ".decisionsresponse", + "DecisionsResponseUsageTypedDict": ".decisionsresponse", + "UnknownAnswers": ".decisionsresponse", + "DecisionsScoreAnswer": ".decisionsscoreanswer", + "DecisionsScoreAnswerType": ".decisionsscoreanswer", + "DecisionsScoreAnswerTypedDict": ".decisionsscoreanswer", + "Legend": ".decisionsscoreanswer", + "LegendTypedDict": ".decisionsscoreanswer", + "Criterion": ".decisionsscorequestion", + "CriterionTypedDict": ".decisionsscorequestion", + "DecisionsScoreQuestion": ".decisionsscorequestion", + "DecisionsScoreQuestionInstructions": ".decisionsscorequestion", + "DecisionsScoreQuestionInstructionsTypedDict": ".decisionsscorequestion", + "DecisionsScoreQuestionType": ".decisionsscorequestion", + "DecisionsScoreQuestionTypedDict": ".decisionsscorequestion", "DefaultParameters": ".defaultparameters", "DefaultParametersTypedDict": ".defaultparameters", "DeleteBYOKKeyResponse": ".deletebyokkeyresponse", @@ -6768,8 +7084,8 @@ "ImageStreamingResponseTypedDict": ".imagestreamingresponse", "UnknownImageStreamingResponseData": ".imagestreamingresponse", "IncompleteDetails": ".incompletedetails", + "IncompleteDetailsReason": ".incompletedetails", "IncompleteDetailsTypedDict": ".incompletedetails", - "Reason": ".incompletedetails", "FormatEnum": ".inputaudio", "InputAudio": ".inputaudio", "InputAudioInputAudio": ".inputaudio", @@ -6844,6 +7160,63 @@ "ProgressTypedDict": ".intern", "InternalServerResponseErrorData": ".internalserverresponseerrordata", "InternalServerResponseErrorDataTypedDict": ".internalserverresponseerrordata", + "InternApprovalMode": ".internapprovalmode", + "InternChatAssistantMessage": ".internchatassistantmessage", + "InternChatAssistantMessageRole": ".internchatassistantmessage", + "InternChatAssistantMessageTypedDict": ".internchatassistantmessage", + "FinishReason": ".internchatchoice", + "InternChatChoice": ".internchatchoice", + "InternChatChoiceTypedDict": ".internchatchoice", + "InternChatCompletionChunk": ".internchatcompletionchunk", + "InternChatCompletionChunkObject": ".internchatcompletionchunk", + "InternChatCompletionChunkTypedDict": ".internchatcompletionchunk", + "InternChatCompletionRequest": ".internchatcompletionrequest", + "InternChatCompletionRequestTypedDict": ".internchatcompletionrequest", + "InternChatDelta": ".internchatdelta", + "InternChatDeltaRole": ".internchatdelta", + "InternChatDeltaTypedDict": ".internchatdelta", + "InternChatDeveloperMessage": ".internchatdevelopermessage", + "InternChatDeveloperMessageRole": ".internchatdevelopermessage", + "InternChatDeveloperMessageTypedDict": ".internchatdevelopermessage", + "InternChatEchoedToolCall": ".internchatechoedtoolcall", + "InternChatEchoedToolCallTypedDict": ".internchatechoedtoolcall", + "InternChatEchoedToolCallFunction": ".internchatechoedtoolcallfunction", + "InternChatEchoedToolCallFunctionTypedDict": ".internchatechoedtoolcallfunction", + "InternChatError": ".internchaterror", + "InternChatErrorTypedDict": ".internchaterror", + "InternChatErrorMetadata": ".internchaterrormetadata", + "InternChatErrorMetadataReason": ".internchaterrormetadata", + "InternChatErrorMetadataTypedDict": ".internchaterrormetadata", + "InternChatMessage": ".internchatmessage", + "InternChatMessageTypedDict": ".internchatmessage", + "InternChatMessageContent": ".internchatmessagecontent", + "InternChatMessageContentTypedDict": ".internchatmessagecontent", + "InternChatPromptTokensDetails": ".internchatprompttokensdetails", + "InternChatPromptTokensDetailsTypedDict": ".internchatprompttokensdetails", + "InternChatStreamError": ".internchatstreamerror", + "InternChatStreamErrorTypedDict": ".internchatstreamerror", + "InternChatStreamingResponse": ".internchatstreamingresponse", + "InternChatStreamingResponseTypedDict": ".internchatstreamingresponse", + "InternChatSystemMessage": ".internchatsystemmessage", + "InternChatSystemMessageRole": ".internchatsystemmessage", + "InternChatSystemMessageTypedDict": ".internchatsystemmessage", + "InternChatTextPart": ".internchattextpart", + "InternChatTextPartType": ".internchattextpart", + "InternChatTextPartTypedDict": ".internchattextpart", + "InternChatToolCall": ".internchattoolcall", + "InternChatToolCallType": ".internchattoolcall", + "InternChatToolCallTypedDict": ".internchattoolcall", + "InternChatToolCallFunction": ".internchattoolcallfunction", + "InternChatToolCallFunctionName": ".internchattoolcallfunction", + "InternChatToolCallFunctionTypedDict": ".internchattoolcallfunction", + "InternChatToolMessage": ".internchattoolmessage", + "InternChatToolMessageRole": ".internchattoolmessage", + "InternChatToolMessageTypedDict": ".internchattoolmessage", + "InternChatUsage": ".internchatusage", + "InternChatUsageTypedDict": ".internchatusage", + "InternChatUserMessage": ".internchatusermessage", + "InternChatUserMessageRole": ".internchatusermessage", + "InternChatUserMessageTypedDict": ".internchatusermessage", "Code": ".internlifecycleerror", "CodeTypedDict": ".internlifecycleerror", "InternLifecycleErrorError": ".internlifecycleerror", diff --git a/src/openrouter/components/agentmessageitem.py b/src/openrouter/components/agentmessageitem.py index 87dbb8cd..a9016410 100644 --- a/src/openrouter/components/agentmessageitem.py +++ b/src/openrouter/components/agentmessageitem.py @@ -80,26 +80,29 @@ def additional_properties(self, value): class AgentMessageItemContentInputImageTypedDict(TypedDict): - r"""Image input content item""" + r"""Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.""" detail: AgentMessageItemDetail type: AgentMessageItemTypeInputImage + file_id: NotRequired[Nullable[str]] image_url: NotRequired[Nullable[str]] class AgentMessageItemContentInputImage(BaseModel): - r"""Image input content item""" + r"""Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.""" detail: AgentMessageItemDetail type: AgentMessageItemTypeInputImage + file_id: OptionalNullable[str] = UNSET + image_url: OptionalNullable[str] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["image_url"]) - nullable_fields = set(["image_url"]) + optional_fields = set(["file_id", "image_url"]) + nullable_fields = set(["file_id", "image_url"]) serialized = handler(self) m = {} @@ -126,8 +129,8 @@ def serialize_model(self, handler): "AgentMessageItemContentUnionTypedDict", Union[ InputTextTypedDict, - AgentMessageItemContentInputImageTypedDict, ContentEncryptedContentTypedDict, + AgentMessageItemContentInputImageTypedDict, ], ) diff --git a/src/openrouter/components/byokproviderslug.py b/src/openrouter/components/byokproviderslug.py index d908cdc5..184097a3 100644 --- a/src/openrouter/components/byokproviderslug.py +++ b/src/openrouter/components/byokproviderslug.py @@ -108,6 +108,8 @@ "tenstorrent", "thinkingmachines", "together", + "typesafe", + "unbiased", "upstage", "venice", "voyageai", diff --git a/src/openrouter/components/customtoolcalloutputitem.py b/src/openrouter/components/customtoolcalloutputitem.py index f6c97dc2..da292bcf 100644 --- a/src/openrouter/components/customtoolcalloutputitem.py +++ b/src/openrouter/components/customtoolcalloutputitem.py @@ -32,26 +32,29 @@ class CustomToolCallOutputItemOutputInputImageTypedDict(TypedDict): - r"""Image input content item""" + r"""Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.""" detail: CustomToolCallOutputItemDetail type: CustomToolCallOutputItemOutputType + file_id: NotRequired[Nullable[str]] image_url: NotRequired[Nullable[str]] class CustomToolCallOutputItemOutputInputImage(BaseModel): - r"""Image input content item""" + r"""Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.""" detail: CustomToolCallOutputItemDetail type: CustomToolCallOutputItemOutputType + file_id: OptionalNullable[str] = UNSET + image_url: OptionalNullable[str] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["image_url"]) - nullable_fields = set(["image_url"]) + optional_fields = set(["file_id", "image_url"]) + nullable_fields = set(["file_id", "image_url"]) serialized = handler(self) m = {} diff --git a/src/openrouter/components/decisionschoiceanswer.py b/src/openrouter/components/decisionschoiceanswer.py new file mode 100644 index 00000000..8ace0399 --- /dev/null +++ b/src/openrouter/components/decisionschoiceanswer.py @@ -0,0 +1,43 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Dict, Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +DecisionsChoiceAnswerType = Literal["choice",] + + +class DecisionsChoiceAnswerTypedDict(TypedDict): + choice: str + type: DecisionsChoiceAnswerType + confidence: NotRequired[float] + probabilities: NotRequired[Dict[str, float]] + + +class DecisionsChoiceAnswer(BaseModel): + choice: str + + type: DecisionsChoiceAnswerType + + confidence: Optional[float] = None + + probabilities: Optional[Dict[str, float]] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["confidence", "probabilities"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/decisionschoicequestion.py b/src/openrouter/components/decisionschoicequestion.py new file mode 100644 index 00000000..2bc00e58 --- /dev/null +++ b/src/openrouter/components/decisionschoicequestion.py @@ -0,0 +1,48 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, Nullable +from typing import Any, Dict, List, Literal, Union +from typing_extensions import TypeAliasType, TypedDict + + +CriteriaTypedDict = TypeAliasType( + "CriteriaTypedDict", Union[str, Dict[str, Any], List[Any]] +) +r"""A plain string, or a JSON object or array of structured guidance.""" + + +Criteria = TypeAliasType("Criteria", Union[str, Dict[str, Any], List[Any]]) +r"""A plain string, or a JSON object or array of structured guidance.""" + + +DecisionsChoiceQuestionInstructionsTypedDict = TypeAliasType( + "DecisionsChoiceQuestionInstructionsTypedDict", + Union[str, Dict[str, Any], List[Any]], +) +r"""A plain string, or a JSON object or array of structured guidance.""" + + +DecisionsChoiceQuestionInstructions = TypeAliasType( + "DecisionsChoiceQuestionInstructions", Union[str, Dict[str, Any], List[Any]] +) +r"""A plain string, or a JSON object or array of structured guidance.""" + + +DecisionsChoiceQuestionType = Literal["choice",] + + +class DecisionsChoiceQuestionTypedDict(TypedDict): + criteria: Dict[str, Nullable[CriteriaTypedDict]] + instructions: DecisionsChoiceQuestionInstructionsTypedDict + r"""A plain string, or a JSON object or array of structured guidance.""" + type: DecisionsChoiceQuestionType + + +class DecisionsChoiceQuestion(BaseModel): + criteria: Dict[str, Nullable[Criteria]] + + instructions: DecisionsChoiceQuestionInstructions + r"""A plain string, or a JSON object or array of structured guidance.""" + + type: DecisionsChoiceQuestionType diff --git a/src/openrouter/components/decisionsnoulanswer.py b/src/openrouter/components/decisionsnoulanswer.py new file mode 100644 index 00000000..144095e1 --- /dev/null +++ b/src/openrouter/components/decisionsnoulanswer.py @@ -0,0 +1,20 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +DecisionsNoulAnswerType = Literal["noul",] + + +class DecisionsNoulAnswerTypedDict(TypedDict): + noul: float + type: DecisionsNoulAnswerType + + +class DecisionsNoulAnswer(BaseModel): + noul: float + + type: DecisionsNoulAnswerType diff --git a/src/openrouter/components/decisionsnoulquestion.py b/src/openrouter/components/decisionsnoulquestion.py new file mode 100644 index 00000000..d6b2551a --- /dev/null +++ b/src/openrouter/components/decisionsnoulquestion.py @@ -0,0 +1,87 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Any, Dict, List, Literal, Optional, Union +from typing_extensions import NotRequired, TypeAliasType, TypedDict + + +FalseTTypedDict = TypeAliasType( + "FalseTTypedDict", Union[str, Dict[str, Any], List[Any]] +) +r"""A plain string, or a JSON object or array of structured guidance.""" + + +FalseT = TypeAliasType("FalseT", Union[str, Dict[str, Any], List[Any]]) +r"""A plain string, or a JSON object or array of structured guidance.""" + + +TrueTTypedDict = TypeAliasType("TrueTTypedDict", Union[str, Dict[str, Any], List[Any]]) +r"""A plain string, or a JSON object or array of structured guidance.""" + + +TrueT = TypeAliasType("TrueT", Union[str, Dict[str, Any], List[Any]]) +r"""A plain string, or a JSON object or array of structured guidance.""" + + +class DecisionsNoulQuestionCriteriaTypedDict(TypedDict): + false: FalseTTypedDict + r"""A plain string, or a JSON object or array of structured guidance.""" + true: TrueTTypedDict + r"""A plain string, or a JSON object or array of structured guidance.""" + + +class DecisionsNoulQuestionCriteria(BaseModel): + false: FalseT + r"""A plain string, or a JSON object or array of structured guidance.""" + + true: TrueT + r"""A plain string, or a JSON object or array of structured guidance.""" + + +DecisionsNoulQuestionInstructionsTypedDict = TypeAliasType( + "DecisionsNoulQuestionInstructionsTypedDict", Union[str, Dict[str, Any], List[Any]] +) +r"""A plain string, or a JSON object or array of structured guidance.""" + + +DecisionsNoulQuestionInstructions = TypeAliasType( + "DecisionsNoulQuestionInstructions", Union[str, Dict[str, Any], List[Any]] +) +r"""A plain string, or a JSON object or array of structured guidance.""" + + +DecisionsNoulQuestionType = Literal["noul",] + + +class DecisionsNoulQuestionTypedDict(TypedDict): + instructions: DecisionsNoulQuestionInstructionsTypedDict + r"""A plain string, or a JSON object or array of structured guidance.""" + type: DecisionsNoulQuestionType + criteria: NotRequired[DecisionsNoulQuestionCriteriaTypedDict] + + +class DecisionsNoulQuestion(BaseModel): + instructions: DecisionsNoulQuestionInstructions + r"""A plain string, or a JSON object or array of structured guidance.""" + + type: DecisionsNoulQuestionType + + criteria: Optional[DecisionsNoulQuestionCriteria] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["criteria"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/decisionsrequest.py b/src/openrouter/components/decisionsrequest.py new file mode 100644 index 00000000..3f40fcff --- /dev/null +++ b/src/openrouter/components/decisionsrequest.py @@ -0,0 +1,112 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .decisionschoicequestion import ( + DecisionsChoiceQuestion, + DecisionsChoiceQuestionTypedDict, +) +from .decisionsnoulquestion import DecisionsNoulQuestion, DecisionsNoulQuestionTypedDict +from .decisionsscorequestion import ( + DecisionsScoreQuestion, + DecisionsScoreQuestionTypedDict, +) +from .providerpreferences import ProviderPreferences, ProviderPreferencesTypedDict +from .traceconfig import TraceConfig, TraceConfigTypedDict +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from openrouter.utils import get_discriminator +from pydantic import Discriminator, Tag, model_serializer +from typing import Any, Dict, List, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +QuestionsTypedDict = TypeAliasType( + "QuestionsTypedDict", + Union[ + DecisionsNoulQuestionTypedDict, + DecisionsChoiceQuestionTypedDict, + DecisionsScoreQuestionTypedDict, + ], +) +r"""A Decisions question using a boolean, choice, or ordered score evaluation.""" + + +Questions = Annotated[ + Union[ + Annotated[DecisionsChoiceQuestion, Tag("choice")], + Annotated[DecisionsNoulQuestion, Tag("noul")], + Annotated[DecisionsScoreQuestion, Tag("score")], + ], + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] +r"""A Decisions question using a boolean, choice, or ordered score evaluation.""" + + +StateTypedDict = TypeAliasType("StateTypedDict", Union[str, Dict[str, Any], List[Any]]) +r"""The content to evaluate: a plain string, or a JSON object or array of related context.""" + + +State = TypeAliasType("State", Union[str, Dict[str, Any], List[Any]]) +r"""The content to evaluate: a plain string, or a JSON object or array of related context.""" + + +class DecisionsRequestTypedDict(TypedDict): + model: str + questions: Dict[str, QuestionsTypedDict] + state: StateTypedDict + r"""The content to evaluate: a plain string, or a JSON object or array of related context.""" + provider: NotRequired[Nullable[ProviderPreferencesTypedDict]] + 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.""" + trace: NotRequired[TraceConfigTypedDict] + r"""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.""" + user: NotRequired[str] + + +class DecisionsRequest(BaseModel): + model: str + + questions: Dict[str, Questions] + + state: State + r"""The content to evaluate: a plain string, or a JSON object or array of related context.""" + + provider: OptionalNullable[ProviderPreferences] = UNSET + + 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.""" + + trace: Optional[TraceConfig] = None + r"""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.""" + + user: Optional[str] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["provider", "session_id", "trace", "user"]) + nullable_fields = set(["provider"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/src/openrouter/components/decisionsresponse.py b/src/openrouter/components/decisionsresponse.py new file mode 100644 index 00000000..534bf4bf --- /dev/null +++ b/src/openrouter/components/decisionsresponse.py @@ -0,0 +1,124 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .decisionschoiceanswer import DecisionsChoiceAnswer, DecisionsChoiceAnswerTypedDict +from .decisionsnoulanswer import DecisionsNoulAnswer, DecisionsNoulAnswerTypedDict +from .decisionsscoreanswer import DecisionsScoreAnswer, DecisionsScoreAnswerTypedDict +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, Dict, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +AnswersTypedDict = TypeAliasType( + "AnswersTypedDict", + Union[ + DecisionsNoulAnswerTypedDict, + DecisionsChoiceAnswerTypedDict, + DecisionsScoreAnswerTypedDict, + ], +) +r"""A Decisions answer using a boolean, choice, or score evaluation.""" + + +class UnknownAnswers(BaseModel): + r"""A Answers 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) + + +_ANSWERS_VARIANTS: dict[str, Any] = { + "choice": DecisionsChoiceAnswer, + "noul": DecisionsNoulAnswer, + "score": DecisionsScoreAnswer, +} + + +Answers = Annotated[ + Union[ + DecisionsChoiceAnswer, DecisionsNoulAnswer, DecisionsScoreAnswer, UnknownAnswers + ], + BeforeValidator( + partial( + parse_open_union, + disc_key="type", + variants=_ANSWERS_VARIANTS, + unknown_cls=UnknownAnswers, + union_name="Answers", + ) + ), +] +r"""A Decisions answer using a boolean, choice, or score evaluation.""" + + +class DecisionsResponseUsageTypedDict(TypedDict): + input_tokens: int + output_tokens: int + cost: NotRequired[float] + + +class DecisionsResponseUsage(BaseModel): + input_tokens: int + + output_tokens: int + + cost: Optional[float] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["cost"]) + 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 DecisionsResponseTypedDict(TypedDict): + answers: Dict[str, AnswersTypedDict] + model: str + usage: DecisionsResponseUsageTypedDict + id: NotRequired[str] + provider: NotRequired[str] + + +class DecisionsResponse(BaseModel): + answers: Dict[str, Answers] + + model: str + + usage: DecisionsResponseUsage + + id: Optional[str] = None + + provider: Optional[str] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["id", "provider"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/decisionsscoreanswer.py b/src/openrouter/components/decisionsscoreanswer.py new file mode 100644 index 00000000..e06b49a8 --- /dev/null +++ b/src/openrouter/components/decisionsscoreanswer.py @@ -0,0 +1,56 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Any, Dict, List, Literal, Optional, Union +from typing_extensions import NotRequired, TypeAliasType, TypedDict + + +LegendTypedDict = TypeAliasType( + "LegendTypedDict", Union[str, Dict[str, Any], List[Any]] +) +r"""A plain string, or a JSON object or array of structured guidance.""" + + +Legend = TypeAliasType("Legend", Union[str, Dict[str, Any], List[Any]]) +r"""A plain string, or a JSON object or array of structured guidance.""" + + +DecisionsScoreAnswerType = Literal["score",] + + +class DecisionsScoreAnswerTypedDict(TypedDict): + score: float + type: DecisionsScoreAnswerType + confidence: NotRequired[float] + legend: NotRequired[Dict[str, LegendTypedDict]] + probabilities: NotRequired[Dict[str, float]] + + +class DecisionsScoreAnswer(BaseModel): + score: float + + type: DecisionsScoreAnswerType + + confidence: Optional[float] = None + + legend: Optional[Dict[str, Legend]] = None + + probabilities: Optional[Dict[str, float]] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["confidence", "legend", "probabilities"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/decisionsscorequestion.py b/src/openrouter/components/decisionsscorequestion.py new file mode 100644 index 00000000..a5abe8e6 --- /dev/null +++ b/src/openrouter/components/decisionsscorequestion.py @@ -0,0 +1,47 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Any, Dict, List, Literal, Union +from typing_extensions import TypeAliasType, TypedDict + + +CriterionTypedDict = TypeAliasType( + "CriterionTypedDict", Union[str, Dict[str, Any], List[Any]] +) +r"""A plain string, or a JSON object or array of structured guidance.""" + + +Criterion = TypeAliasType("Criterion", Union[str, Dict[str, Any], List[Any]]) +r"""A plain string, or a JSON object or array of structured guidance.""" + + +DecisionsScoreQuestionInstructionsTypedDict = TypeAliasType( + "DecisionsScoreQuestionInstructionsTypedDict", Union[str, Dict[str, Any], List[Any]] +) +r"""A plain string, or a JSON object or array of structured guidance.""" + + +DecisionsScoreQuestionInstructions = TypeAliasType( + "DecisionsScoreQuestionInstructions", Union[str, Dict[str, Any], List[Any]] +) +r"""A plain string, or a JSON object or array of structured guidance.""" + + +DecisionsScoreQuestionType = Literal["score",] + + +class DecisionsScoreQuestionTypedDict(TypedDict): + criteria: List[CriterionTypedDict] + instructions: DecisionsScoreQuestionInstructionsTypedDict + r"""A plain string, or a JSON object or array of structured guidance.""" + type: DecisionsScoreQuestionType + + +class DecisionsScoreQuestion(BaseModel): + criteria: List[Criterion] + + instructions: DecisionsScoreQuestionInstructions + r"""A plain string, or a JSON object or array of structured guidance.""" + + type: DecisionsScoreQuestionType diff --git a/src/openrouter/components/easyinputmessage.py b/src/openrouter/components/easyinputmessage.py index 33a8b190..b8b9f212 100644 --- a/src/openrouter/components/easyinputmessage.py +++ b/src/openrouter/components/easyinputmessage.py @@ -34,26 +34,29 @@ class EasyInputMessageContentInputImageTypedDict(TypedDict): - r"""Image input content item""" + r"""Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.""" detail: EasyInputMessageDetail type: EasyInputMessageTypeInputImage + file_id: NotRequired[Nullable[str]] image_url: NotRequired[Nullable[str]] class EasyInputMessageContentInputImage(BaseModel): - r"""Image input content item""" + r"""Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.""" detail: EasyInputMessageDetail type: EasyInputMessageTypeInputImage + file_id: OptionalNullable[str] = UNSET + image_url: OptionalNullable[str] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["image_url"]) - nullable_fields = set(["image_url"]) + optional_fields = set(["file_id", "image_url"]) + nullable_fields = set(["file_id", "image_url"]) serialized = handler(self) m = {} @@ -81,8 +84,8 @@ def serialize_model(self, handler): Union[ InputAudioTypedDict, InputTextTypedDict, - EasyInputMessageContentInputImageTypedDict, InputVideoTypedDict, + EasyInputMessageContentInputImageTypedDict, InputFileTypedDict, ], ) diff --git a/src/openrouter/components/functioncalloutputitem.py b/src/openrouter/components/functioncalloutputitem.py index bbae4079..19746123 100644 --- a/src/openrouter/components/functioncalloutputitem.py +++ b/src/openrouter/components/functioncalloutputitem.py @@ -33,26 +33,29 @@ class FunctionCallOutputItemOutputInputImageTypedDict(TypedDict): - r"""Image input content item""" + r"""Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.""" detail: FunctionCallOutputItemDetail type: FunctionCallOutputItemOutputType + file_id: NotRequired[Nullable[str]] image_url: NotRequired[Nullable[str]] class FunctionCallOutputItemOutputInputImage(BaseModel): - r"""Image input content item""" + r"""Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.""" detail: FunctionCallOutputItemDetail type: FunctionCallOutputItemOutputType + file_id: OptionalNullable[str] = UNSET + image_url: OptionalNullable[str] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["image_url"]) - nullable_fields = set(["image_url"]) + optional_fields = set(["file_id", "image_url"]) + nullable_fields = set(["file_id", "image_url"]) serialized = handler(self) m = {} diff --git a/src/openrouter/components/generationresponse.py b/src/openrouter/components/generationresponse.py index 87454d8c..2d84649e 100644 --- a/src/openrouter/components/generationresponse.py +++ b/src/openrouter/components/generationresponse.py @@ -24,6 +24,7 @@ "stt", "video", "image", + "decisions", ], UnrecognizedStr, ] diff --git a/src/openrouter/components/imagegenerationproviderpreferences.py b/src/openrouter/components/imagegenerationproviderpreferences.py index b5ff31ce..fb823669 100644 --- a/src/openrouter/components/imagegenerationproviderpreferences.py +++ b/src/openrouter/components/imagegenerationproviderpreferences.py @@ -171,7 +171,9 @@ class ImageGenerationProviderPreferencesOptionsTypedDict(TypedDict): thinkingmachines: NotRequired[Dict[str, Any]] together: NotRequired[Dict[str, Any]] together_lite: NotRequired[Dict[str, Any]] + typesafe: NotRequired[Dict[str, Any]] ubicloud: NotRequired[Dict[str, Any]] + unbiased: NotRequired[Dict[str, Any]] upstage: NotRequired[Dict[str, Any]] venice: NotRequired[Dict[str, Any]] voyageai: NotRequired[Dict[str, Any]] @@ -496,8 +498,12 @@ class ImageGenerationProviderPreferencesOptions(BaseModel): Optional[Dict[str, Any]], pydantic.Field(alias="together-lite") ] = None + typesafe: Optional[Dict[str, Any]] = None + ubicloud: Optional[Dict[str, Any]] = None + unbiased: Optional[Dict[str, Any]] = None + upstage: Optional[Dict[str, Any]] = None venice: Optional[Dict[str, Any]] = None @@ -653,7 +659,9 @@ def serialize_model(self, handler): "thinkingmachines", "together", "together-lite", + "typesafe", "ubicloud", + "unbiased", "upstage", "venice", "voyageai", diff --git a/src/openrouter/components/imageoutputmodality.py b/src/openrouter/components/imageoutputmodality.py index 9c5a7a43..c0686ea9 100644 --- a/src/openrouter/components/imageoutputmodality.py +++ b/src/openrouter/components/imageoutputmodality.py @@ -13,6 +13,7 @@ "audio", "video", "rerank", + "decisions", "speech", "transcription", ], diff --git a/src/openrouter/components/incompletedetails.py b/src/openrouter/components/incompletedetails.py index 313c4e71..73633e41 100644 --- a/src/openrouter/components/incompletedetails.py +++ b/src/openrouter/components/incompletedetails.py @@ -7,7 +7,7 @@ from typing_extensions import NotRequired, TypedDict -Reason = Union[ +IncompleteDetailsReason = Union[ Literal[ "max_output_tokens", "content_filter", @@ -17,11 +17,11 @@ class IncompleteDetailsTypedDict(TypedDict): - reason: NotRequired[Reason] + reason: NotRequired[IncompleteDetailsReason] class IncompleteDetails(BaseModel): - reason: Optional[Reason] = None + reason: Optional[IncompleteDetailsReason] = None @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/inputimage.py b/src/openrouter/components/inputimage.py index 0e7edf2b..c8c1ca66 100644 --- a/src/openrouter/components/inputimage.py +++ b/src/openrouter/components/inputimage.py @@ -29,26 +29,29 @@ class InputImageTypedDict(TypedDict): - r"""Image input content item""" + r"""Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.""" detail: InputImageDetail type: InputImageType + file_id: NotRequired[Nullable[str]] image_url: NotRequired[Nullable[str]] class InputImage(BaseModel): - r"""Image input content item""" + r"""Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.""" detail: InputImageDetail type: InputImageType + file_id: OptionalNullable[str] = UNSET + image_url: OptionalNullable[str] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["image_url"]) - nullable_fields = set(["image_url"]) + optional_fields = set(["file_id", "image_url"]) + nullable_fields = set(["file_id", "image_url"]) serialized = handler(self) m = {} diff --git a/src/openrouter/components/inputmessageitem.py b/src/openrouter/components/inputmessageitem.py index aa949dde..47023bf5 100644 --- a/src/openrouter/components/inputmessageitem.py +++ b/src/openrouter/components/inputmessageitem.py @@ -34,26 +34,29 @@ class InputMessageItemContentInputImageTypedDict(TypedDict): - r"""Image input content item""" + r"""Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.""" detail: InputMessageItemDetail type: InputMessageItemTypeInputImage + file_id: NotRequired[Nullable[str]] image_url: NotRequired[Nullable[str]] class InputMessageItemContentInputImage(BaseModel): - r"""Image input content item""" + r"""Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.""" detail: InputMessageItemDetail type: InputMessageItemTypeInputImage + file_id: OptionalNullable[str] = UNSET + image_url: OptionalNullable[str] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["image_url"]) - nullable_fields = set(["image_url"]) + optional_fields = set(["file_id", "image_url"]) + nullable_fields = set(["file_id", "image_url"]) serialized = handler(self) m = {} @@ -81,8 +84,8 @@ def serialize_model(self, handler): Union[ InputAudioTypedDict, InputTextTypedDict, - InputMessageItemContentInputImageTypedDict, InputVideoTypedDict, + InputMessageItemContentInputImageTypedDict, InputFileTypedDict, ], ) diff --git a/src/openrouter/components/internapprovalmode.py b/src/openrouter/components/internapprovalmode.py new file mode 100644 index 00000000..988b3a73 --- /dev/null +++ b/src/openrouter/components/internapprovalmode.py @@ -0,0 +1,15 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import UnrecognizedStr +from typing import Literal, Union + + +InternApprovalMode = Union[ + Literal[ + "manual", + "self-drive", + ], + UnrecognizedStr, +] +r"""How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with.""" diff --git a/src/openrouter/components/internchatassistantmessage.py b/src/openrouter/components/internchatassistantmessage.py new file mode 100644 index 00000000..dcace16b --- /dev/null +++ b/src/openrouter/components/internchatassistantmessage.py @@ -0,0 +1,63 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internchatechoedtoolcall import ( + InternChatEchoedToolCall, + InternChatEchoedToolCallTypedDict, +) +from .internchatmessagecontent import ( + InternChatMessageContent, + InternChatMessageContentTypedDict, +) +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +InternChatAssistantMessageRole = Literal["assistant",] + + +class InternChatAssistantMessageTypedDict(TypedDict): + r"""An assistant message from an earlier response. When answering an interaction, echo the streamed `tool_calls` here before the `tool` message.""" + + content: Nullable[InternChatMessageContentTypedDict] + r"""Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history.""" + role: InternChatAssistantMessageRole + tool_calls: NotRequired[List[InternChatEchoedToolCallTypedDict]] + + +class InternChatAssistantMessage(BaseModel): + r"""An assistant message from an earlier response. When answering an interaction, echo the streamed `tool_calls` here before the `tool` message.""" + + content: Nullable[InternChatMessageContent] + r"""Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history.""" + + role: InternChatAssistantMessageRole + + tool_calls: Optional[List[InternChatEchoedToolCall]] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["tool_calls"]) + nullable_fields = set(["content"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/src/openrouter/components/internchatchoice.py b/src/openrouter/components/internchatchoice.py new file mode 100644 index 00000000..54ccff74 --- /dev/null +++ b/src/openrouter/components/internchatchoice.py @@ -0,0 +1,55 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internchatdelta import InternChatDelta, InternChatDeltaTypedDict +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr +from pydantic import model_serializer +from typing import Literal, Union +from typing_extensions import TypedDict + + +FinishReason = Union[ + Literal[ + "error", + "stop", + "tool_calls", + ], + UnrecognizedStr, +] +r"""`null` while streaming. `stop` when the run completed, `tool_calls` when the run is waiting for the caller to answer the streamed tool call, `error` on the terminal error chunk.""" + + +class InternChatChoiceTypedDict(TypedDict): + r"""The single choice this endpoint streams.""" + + delta: InternChatDeltaTypedDict + r"""The incremental content of one chunk. The first chunk carries `role`, text chunks carry `content`, reasoning chunks carry `reasoning`, and an interaction chunk carries one complete `tool_calls` entry.""" + finish_reason: Nullable[FinishReason] + r"""`null` while streaming. `stop` when the run completed, `tool_calls` when the run is waiting for the caller to answer the streamed tool call, `error` on the terminal error chunk.""" + index: int + + +class InternChatChoice(BaseModel): + r"""The single choice this endpoint streams.""" + + delta: InternChatDelta + r"""The incremental content of one chunk. The first chunk carries `role`, text chunks carry `content`, reasoning chunks carry `reasoning`, and an interaction chunk carries one complete `tool_calls` entry.""" + + finish_reason: Nullable[FinishReason] + r"""`null` while streaming. `stop` when the run completed, `tool_calls` when the run is waiting for the caller to answer the streamed tool call, `error` on the terminal error chunk.""" + + index: 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 diff --git a/src/openrouter/components/internchatcompletionchunk.py b/src/openrouter/components/internchatcompletionchunk.py new file mode 100644 index 00000000..b573c302 --- /dev/null +++ b/src/openrouter/components/internchatcompletionchunk.py @@ -0,0 +1,89 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internchatchoice import InternChatChoice, InternChatChoiceTypedDict +from .internchatstreamerror import InternChatStreamError, InternChatStreamErrorTypedDict +from .internchatusage import InternChatUsage, InternChatUsageTypedDict +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import List, Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +InternChatCompletionChunkObject = Literal["chat.completion.chunk",] + + +class InternChatCompletionChunkTypedDict(TypedDict): + r"""One `data:` line of the stream. A run streams a role chunk, content and reasoning chunks, then a finish chunk: `stop`, `tool_calls` (the run is paused for input) or `error` (with an `error` object). A final chunk with empty `choices` follows in every case, carrying `session_id` and `usage` (`null` unless the daemon reported usage, and always `null` after `tool_calls`). Every stream ends with `[DONE]`.""" + + choices: List[InternChatChoiceTypedDict] + r"""One choice on content, tool-call and error chunks. Empty on the final chunk that carries `session_id`.""" + created: int + id: str + r"""The completion id, constant for the whole response.""" + model: str + r"""The request `model` when given, or `openrouter/intern`. The final chunk may carry the model the intern reported for the run instead.""" + object: InternChatCompletionChunkObject + error: NotRequired[InternChatStreamErrorTypedDict] + r"""A failure after the response headers were sent. The chunk that carries it has `finish_reason: \"error\"`, then the final empty-`choices` chunk and `[DONE]` follow. Reasons here are `attachment_failed`, `busy`, `client_closed_request`, `interaction_not_pending`, `interaction_unknown`, `intern_unreachable`, `run_ended`, `stream_severed`, `timeout` or `turn_failed`. `run_ended` reports an ending the intern confirmed, such as a cancellation or a deadline, while `stream_severed` reports a connection lost without that confirmation.""" + session_id: NotRequired[Nullable[str]] + r"""On the final chunk of every response, the daemon session to continue with, or `null` when the run failed before the intern reported one. Send it as `session_id` on the next request, including the `tool` reply to an interaction.""" + usage: NotRequired[Nullable[InternChatUsageTypedDict]] + r"""Token usage for the run as the daemon reported it, on the final chunk before `[DONE]`. `null` when the daemon reported none, and always `null` after `tool_calls` because the turn is not over.""" + + +class InternChatCompletionChunk(BaseModel): + r"""One `data:` line of the stream. A run streams a role chunk, content and reasoning chunks, then a finish chunk: `stop`, `tool_calls` (the run is paused for input) or `error` (with an `error` object). A final chunk with empty `choices` follows in every case, carrying `session_id` and `usage` (`null` unless the daemon reported usage, and always `null` after `tool_calls`). Every stream ends with `[DONE]`.""" + + choices: List[InternChatChoice] + r"""One choice on content, tool-call and error chunks. Empty on the final chunk that carries `session_id`.""" + + created: int + + id: str + r"""The completion id, constant for the whole response.""" + + model: str + r"""The request `model` when given, or `openrouter/intern`. The final chunk may carry the model the intern reported for the run instead.""" + + object: InternChatCompletionChunkObject + + error: Optional[InternChatStreamError] = None + r"""A failure after the response headers were sent. The chunk that carries it has `finish_reason: \"error\"`, then the final empty-`choices` chunk and `[DONE]` follow. Reasons here are `attachment_failed`, `busy`, `client_closed_request`, `interaction_not_pending`, `interaction_unknown`, `intern_unreachable`, `run_ended`, `stream_severed`, `timeout` or `turn_failed`. `run_ended` reports an ending the intern confirmed, such as a cancellation or a deadline, while `stream_severed` reports a connection lost without that confirmation.""" + + session_id: OptionalNullable[str] = UNSET + r"""On the final chunk of every response, the daemon session to continue with, or `null` when the run failed before the intern reported one. Send it as `session_id` on the next request, including the `tool` reply to an interaction.""" + + usage: OptionalNullable[InternChatUsage] = UNSET + r"""Token usage for the run as the daemon reported it, on the final chunk before `[DONE]`. `null` when the daemon reported none, and always `null` after `tool_calls` because the turn is not over.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["error", "session_id", "usage"]) + nullable_fields = set(["session_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)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/src/openrouter/components/internchatcompletionrequest.py b/src/openrouter/components/internchatcompletionrequest.py new file mode 100644 index 00000000..740d3f28 --- /dev/null +++ b/src/openrouter/components/internchatcompletionrequest.py @@ -0,0 +1,71 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internapprovalmode import InternApprovalMode +from .internchatmessage import InternChatMessage, InternChatMessageTypedDict +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 List, Literal, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class InternChatCompletionRequestTypedDict(TypedDict): + r"""An OpenAI-compatible streaming chat completion request for one intern. Other OpenAI fields such as `temperature` or `tools` are ignored. The intern owns its sampling and its tools.""" + + messages: List[InternChatMessageTypedDict] + r"""The conversation. Only the last message is read. A last `user` message starts a run. A last `tool` message answers the interaction named by its `tool_call_id` and requires `session_id`.""" + approval_mode: NotRequired[InternApprovalMode] + r"""How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with.""" + model: NotRequired[str] + r"""Echoed as `model` on the streamed chunks; the final chunk may carry the model the intern reported instead. The intern chooses its own model, so this value does not change what runs.""" + session_id: NotRequired[str] + r"""The daemon session to continue, as returned in `session_id` on the final chunk of an earlier response. Omit it to start a new session. Required when the last message has role `tool`.""" + stream: Literal[True] + r"""Must be `true`. This endpoint only streams.""" + + +class InternChatCompletionRequest(BaseModel): + r"""An OpenAI-compatible streaming chat completion request for one intern. Other OpenAI fields such as `temperature` or `tools` are ignored. The intern owns its sampling and its tools.""" + + messages: List[InternChatMessage] + r"""The conversation. Only the last message is read. A last `user` message starts a run. A last `tool` message answers the interaction named by its `tool_call_id` and requires `session_id`.""" + + approval_mode: Optional[InternApprovalMode] = None + r"""How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with.""" + + model: Optional[str] = None + r"""Echoed as `model` on the streamed chunks; the final chunk may carry the model the intern reported instead. The intern chooses its own model, so this value does not change what runs.""" + + session_id: Optional[str] = None + r"""The daemon session to continue, as returned in `session_id` on the final chunk of an earlier response. Omit it to start a new session. Required when the last message has role `tool`.""" + + STREAM: Annotated[ + Annotated[Literal[True], AfterValidator(validate_const(True))], + pydantic.Field(alias="stream"), + ] = True + r"""Must be `true`. This endpoint only streams.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["approval_mode", "model", "session_id"]) + 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 + + +try: + InternChatCompletionRequest.model_rebuild() +except NameError: + pass diff --git a/src/openrouter/components/internchatdelta.py b/src/openrouter/components/internchatdelta.py new file mode 100644 index 00000000..1ce01a22 --- /dev/null +++ b/src/openrouter/components/internchatdelta.py @@ -0,0 +1,48 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internchattoolcall import InternChatToolCall, InternChatToolCallTypedDict +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +InternChatDeltaRole = Literal["assistant",] + + +class InternChatDeltaTypedDict(TypedDict): + r"""The incremental content of one chunk. The first chunk carries `role`, text chunks carry `content`, reasoning chunks carry `reasoning`, and an interaction chunk carries one complete `tool_calls` entry.""" + + content: NotRequired[str] + reasoning: NotRequired[str] + role: NotRequired[InternChatDeltaRole] + tool_calls: NotRequired[List[InternChatToolCallTypedDict]] + + +class InternChatDelta(BaseModel): + r"""The incremental content of one chunk. The first chunk carries `role`, text chunks carry `content`, reasoning chunks carry `reasoning`, and an interaction chunk carries one complete `tool_calls` entry.""" + + content: Optional[str] = None + + reasoning: Optional[str] = None + + role: Optional[InternChatDeltaRole] = None + + tool_calls: Optional[List[InternChatToolCall]] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["content", "reasoning", "role", "tool_calls"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/internchatdevelopermessage.py b/src/openrouter/components/internchatdevelopermessage.py new file mode 100644 index 00000000..92b3981e --- /dev/null +++ b/src/openrouter/components/internchatdevelopermessage.py @@ -0,0 +1,45 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internchatmessagecontent import ( + InternChatMessageContent, + InternChatMessageContentTypedDict, +) +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Literal +from typing_extensions import TypedDict + + +InternChatDeveloperMessageRole = Literal["developer",] + + +class InternChatDeveloperMessageTypedDict(TypedDict): + r"""A developer message. Accepted for client compatibility and not forwarded.""" + + content: Nullable[InternChatMessageContentTypedDict] + r"""Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history.""" + role: InternChatDeveloperMessageRole + + +class InternChatDeveloperMessage(BaseModel): + r"""A developer message. Accepted for client compatibility and not forwarded.""" + + content: Nullable[InternChatMessageContent] + r"""Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history.""" + + role: InternChatDeveloperMessageRole + + @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/internchatechoedtoolcall.py b/src/openrouter/components/internchatechoedtoolcall.py new file mode 100644 index 00000000..36ce2369 --- /dev/null +++ b/src/openrouter/components/internchatechoedtoolcall.py @@ -0,0 +1,26 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internchatechoedtoolcallfunction import ( + InternChatEchoedToolCallFunction, + InternChatEchoedToolCallFunctionTypedDict, +) +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class InternChatEchoedToolCallTypedDict(TypedDict): + r"""The `openrouter.provide_input` tool call from the previous response, echoed back unchanged. Its `id` is the interaction the following `tool` message answers.""" + + function: InternChatEchoedToolCallFunctionTypedDict + r"""The function name and JSON arguments string exactly as streamed.""" + id: str + + +class InternChatEchoedToolCall(BaseModel): + r"""The `openrouter.provide_input` tool call from the previous response, echoed back unchanged. Its `id` is the interaction the following `tool` message answers.""" + + function: InternChatEchoedToolCallFunction + r"""The function name and JSON arguments string exactly as streamed.""" + + id: str diff --git a/src/openrouter/components/internchatechoedtoolcallfunction.py b/src/openrouter/components/internchatechoedtoolcallfunction.py new file mode 100644 index 00000000..e3ed05c3 --- /dev/null +++ b/src/openrouter/components/internchatechoedtoolcallfunction.py @@ -0,0 +1,20 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class InternChatEchoedToolCallFunctionTypedDict(TypedDict): + r"""The function name and JSON arguments string exactly as streamed.""" + + arguments: str + name: str + + +class InternChatEchoedToolCallFunction(BaseModel): + r"""The function name and JSON arguments string exactly as streamed.""" + + arguments: str + + name: str diff --git a/src/openrouter/components/internchaterror.py b/src/openrouter/components/internchaterror.py new file mode 100644 index 00000000..6ddb8c0c --- /dev/null +++ b/src/openrouter/components/internchaterror.py @@ -0,0 +1,49 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internchaterrormetadata import ( + InternChatErrorMetadata, + InternChatErrorMetadataTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class InternChatErrorTypedDict(TypedDict): + r"""The OpenAI-compatible error object. `metadata` is present on refusals from the chat route. Authentication refusals (`401`), the departed-creator `403` and the programme `404` carry only `code` and `message`.""" + + code: int + r"""The HTTP status of the response.""" + message: str + metadata: NotRequired[InternChatErrorMetadataTypedDict] + r"""Machine-readable detail for the failure.""" + + +class InternChatError(BaseModel): + r"""The OpenAI-compatible error object. `metadata` is present on refusals from the chat route. Authentication refusals (`401`), the departed-creator `403` and the programme `404` carry only `code` and `message`.""" + + code: int + r"""The HTTP status of the response.""" + + message: str + + metadata: Optional[InternChatErrorMetadata] = None + r"""Machine-readable detail for the failure.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["metadata"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/internchaterrormetadata.py b/src/openrouter/components/internchaterrormetadata.py new file mode 100644 index 00000000..ef32d56c --- /dev/null +++ b/src/openrouter/components/internchaterrormetadata.py @@ -0,0 +1,44 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UnrecognizedStr +from typing import Literal, Union +from typing_extensions import TypedDict + + +InternChatErrorMetadataReason = Union[ + Literal[ + "attachment_failed", + "bad_request", + "busy", + "client_closed_request", + "interaction_not_pending", + "interaction_unknown", + "intern_not_ready", + "intern_rejected", + "intern_unreachable", + "not_found", + "payload_too_large", + "rate_limited", + "run_ended", + "stream_severed", + "timeout", + "turn_failed", + ], + UnrecognizedStr, +] +r"""A stable reason a client can branch on.""" + + +class InternChatErrorMetadataTypedDict(TypedDict): + r"""Machine-readable detail for the failure.""" + + reason: InternChatErrorMetadataReason + r"""A stable reason a client can branch on.""" + + +class InternChatErrorMetadata(BaseModel): + r"""Machine-readable detail for the failure.""" + + reason: InternChatErrorMetadataReason + r"""A stable reason a client can branch on.""" diff --git a/src/openrouter/components/internchatmessage.py b/src/openrouter/components/internchatmessage.py new file mode 100644 index 00000000..c880eb7b --- /dev/null +++ b/src/openrouter/components/internchatmessage.py @@ -0,0 +1,47 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internchatassistantmessage import ( + InternChatAssistantMessage, + InternChatAssistantMessageTypedDict, +) +from .internchatdevelopermessage import ( + InternChatDeveloperMessage, + InternChatDeveloperMessageTypedDict, +) +from .internchatsystemmessage import ( + InternChatSystemMessage, + InternChatSystemMessageTypedDict, +) +from .internchattoolmessage import InternChatToolMessage, InternChatToolMessageTypedDict +from .internchatusermessage import InternChatUserMessage, InternChatUserMessageTypedDict +from openrouter.utils import get_discriminator +from pydantic import Discriminator, Tag +from typing import Union +from typing_extensions import Annotated, TypeAliasType + + +InternChatMessageTypedDict = TypeAliasType( + "InternChatMessageTypedDict", + Union[ + InternChatSystemMessageTypedDict, + InternChatDeveloperMessageTypedDict, + InternChatUserMessageTypedDict, + InternChatAssistantMessageTypedDict, + InternChatToolMessageTypedDict, + ], +) +r"""One OpenAI-compatible chat message, discriminated by `role`.""" + + +InternChatMessage = Annotated[ + Union[ + Annotated[InternChatAssistantMessage, Tag("assistant")], + Annotated[InternChatDeveloperMessage, Tag("developer")], + Annotated[InternChatSystemMessage, Tag("system")], + Annotated[InternChatToolMessage, Tag("tool")], + Annotated[InternChatUserMessage, Tag("user")], + ], + Discriminator(lambda m: get_discriminator(m, "role", "role")), +] +r"""One OpenAI-compatible chat message, discriminated by `role`.""" diff --git a/src/openrouter/components/internchatmessagecontent.py b/src/openrouter/components/internchatmessagecontent.py new file mode 100644 index 00000000..15127e20 --- /dev/null +++ b/src/openrouter/components/internchatmessagecontent.py @@ -0,0 +1,18 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internchattextpart import InternChatTextPart, InternChatTextPartTypedDict +from typing import List, Union +from typing_extensions import TypeAliasType + + +InternChatMessageContentTypedDict = TypeAliasType( + "InternChatMessageContentTypedDict", Union[str, List[InternChatTextPartTypedDict]] +) +r"""Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history.""" + + +InternChatMessageContent = TypeAliasType( + "InternChatMessageContent", Union[str, List[InternChatTextPart]] +) +r"""Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history.""" diff --git a/src/openrouter/components/internchatprompttokensdetails.py b/src/openrouter/components/internchatprompttokensdetails.py new file mode 100644 index 00000000..592244a0 --- /dev/null +++ b/src/openrouter/components/internchatprompttokensdetails.py @@ -0,0 +1,17 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class InternChatPromptTokensDetailsTypedDict(TypedDict): + r"""Prompt tokens served from cache, when the daemon reported them.""" + + cached_tokens: int + + +class InternChatPromptTokensDetails(BaseModel): + r"""Prompt tokens served from cache, when the daemon reported them.""" + + cached_tokens: int diff --git a/src/openrouter/components/internchatstreamerror.py b/src/openrouter/components/internchatstreamerror.py new file mode 100644 index 00000000..e862c745 --- /dev/null +++ b/src/openrouter/components/internchatstreamerror.py @@ -0,0 +1,31 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internchaterrormetadata import ( + InternChatErrorMetadata, + InternChatErrorMetadataTypedDict, +) +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class InternChatStreamErrorTypedDict(TypedDict): + r"""A failure after the response headers were sent. The chunk that carries it has `finish_reason: \"error\"`, then the final empty-`choices` chunk and `[DONE]` follow. Reasons here are `attachment_failed`, `busy`, `client_closed_request`, `interaction_not_pending`, `interaction_unknown`, `intern_unreachable`, `run_ended`, `stream_severed`, `timeout` or `turn_failed`. `run_ended` reports an ending the intern confirmed, such as a cancellation or a deadline, while `stream_severed` reports a connection lost without that confirmation.""" + + code: int + r"""The HTTP status this failure would have had before the stream opened.""" + message: str + metadata: InternChatErrorMetadataTypedDict + r"""Machine-readable detail for the failure.""" + + +class InternChatStreamError(BaseModel): + r"""A failure after the response headers were sent. The chunk that carries it has `finish_reason: \"error\"`, then the final empty-`choices` chunk and `[DONE]` follow. Reasons here are `attachment_failed`, `busy`, `client_closed_request`, `interaction_not_pending`, `interaction_unknown`, `intern_unreachable`, `run_ended`, `stream_severed`, `timeout` or `turn_failed`. `run_ended` reports an ending the intern confirmed, such as a cancellation or a deadline, while `stream_severed` reports a connection lost without that confirmation.""" + + code: int + r"""The HTTP status this failure would have had before the stream opened.""" + + message: str + + metadata: InternChatErrorMetadata + r"""Machine-readable detail for the failure.""" diff --git a/src/openrouter/components/internchatstreamingresponse.py b/src/openrouter/components/internchatstreamingresponse.py new file mode 100644 index 00000000..3a5dcf60 --- /dev/null +++ b/src/openrouter/components/internchatstreamingresponse.py @@ -0,0 +1,23 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internchatcompletionchunk import ( + InternChatCompletionChunk, + InternChatCompletionChunkTypedDict, +) +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class InternChatStreamingResponseTypedDict(TypedDict): + r"""A server-sent event carrying one chunk. The stream ends with `data: [DONE]`.""" + + data: InternChatCompletionChunkTypedDict + r"""One `data:` line of the stream. A run streams a role chunk, content and reasoning chunks, then a finish chunk: `stop`, `tool_calls` (the run is paused for input) or `error` (with an `error` object). A final chunk with empty `choices` follows in every case, carrying `session_id` and `usage` (`null` unless the daemon reported usage, and always `null` after `tool_calls`). Every stream ends with `[DONE]`.""" + + +class InternChatStreamingResponse(BaseModel): + r"""A server-sent event carrying one chunk. The stream ends with `data: [DONE]`.""" + + data: InternChatCompletionChunk + r"""One `data:` line of the stream. A run streams a role chunk, content and reasoning chunks, then a finish chunk: `stop`, `tool_calls` (the run is paused for input) or `error` (with an `error` object). A final chunk with empty `choices` follows in every case, carrying `session_id` and `usage` (`null` unless the daemon reported usage, and always `null` after `tool_calls`). Every stream ends with `[DONE]`.""" diff --git a/src/openrouter/components/internchatsystemmessage.py b/src/openrouter/components/internchatsystemmessage.py new file mode 100644 index 00000000..b4d9ed2a --- /dev/null +++ b/src/openrouter/components/internchatsystemmessage.py @@ -0,0 +1,45 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internchatmessagecontent import ( + InternChatMessageContent, + InternChatMessageContentTypedDict, +) +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Literal +from typing_extensions import TypedDict + + +InternChatSystemMessageRole = Literal["system",] + + +class InternChatSystemMessageTypedDict(TypedDict): + r"""A system message. Accepted for client compatibility and not forwarded.""" + + content: Nullable[InternChatMessageContentTypedDict] + r"""Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history.""" + role: InternChatSystemMessageRole + + +class InternChatSystemMessage(BaseModel): + r"""A system message. Accepted for client compatibility and not forwarded.""" + + content: Nullable[InternChatMessageContent] + r"""Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history.""" + + role: InternChatSystemMessageRole + + @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/internchattextpart.py b/src/openrouter/components/internchattextpart.py new file mode 100644 index 00000000..32223695 --- /dev/null +++ b/src/openrouter/components/internchattextpart.py @@ -0,0 +1,24 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +InternChatTextPartType = Literal["text",] + + +class InternChatTextPartTypedDict(TypedDict): + r"""One text part of a message.""" + + text: str + type: InternChatTextPartType + + +class InternChatTextPart(BaseModel): + r"""One text part of a message.""" + + text: str + + type: InternChatTextPartType diff --git a/src/openrouter/components/internchattoolcall.py b/src/openrouter/components/internchattoolcall.py new file mode 100644 index 00000000..ceb01c94 --- /dev/null +++ b/src/openrouter/components/internchattoolcall.py @@ -0,0 +1,38 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internchattoolcallfunction import ( + InternChatToolCallFunction, + InternChatToolCallFunctionTypedDict, +) +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +InternChatToolCallType = Literal["function",] + + +class InternChatToolCallTypedDict(TypedDict): + r"""An `openrouter.provide_input` request. The run pauses on the daemon until a `tool` message answers it, the caller cancels it, or its interaction deadline passes.""" + + function: InternChatToolCallFunctionTypedDict + r"""The single tool this endpoint calls, asking the caller for input.""" + id: str + r"""The interaction id. Send it back as `tool_call_id` on the `tool` message that answers it.""" + index: int + type: InternChatToolCallType + + +class InternChatToolCall(BaseModel): + r"""An `openrouter.provide_input` request. The run pauses on the daemon until a `tool` message answers it, the caller cancels it, or its interaction deadline passes.""" + + function: InternChatToolCallFunction + r"""The single tool this endpoint calls, asking the caller for input.""" + + id: str + r"""The interaction id. Send it back as `tool_call_id` on the `tool` message that answers it.""" + + index: int + + type: InternChatToolCallType diff --git a/src/openrouter/components/internchattoolcallfunction.py b/src/openrouter/components/internchattoolcallfunction.py new file mode 100644 index 00000000..b723d3ea --- /dev/null +++ b/src/openrouter/components/internchattoolcallfunction.py @@ -0,0 +1,26 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +InternChatToolCallFunctionName = Literal["openrouter.provide_input",] + + +class InternChatToolCallFunctionTypedDict(TypedDict): + r"""The single tool this endpoint calls, asking the caller for input.""" + + arguments: str + r"""A JSON object string describing the interaction. A permission request is `{\"kind\":\"permission\",\"operation\":,\"options\":[]}`. A question is `{\"kind\":\"elicitation\",\"message\":,\"fields\":[]}`.""" + name: InternChatToolCallFunctionName + + +class InternChatToolCallFunction(BaseModel): + r"""The single tool this endpoint calls, asking the caller for input.""" + + arguments: str + r"""A JSON object string describing the interaction. A permission request is `{\"kind\":\"permission\",\"operation\":,\"options\":[]}`. A question is `{\"kind\":\"elicitation\",\"message\":,\"fields\":[]}`.""" + + name: InternChatToolCallFunctionName diff --git a/src/openrouter/components/internchattoolmessage.py b/src/openrouter/components/internchattoolmessage.py new file mode 100644 index 00000000..af736a62 --- /dev/null +++ b/src/openrouter/components/internchattoolmessage.py @@ -0,0 +1,48 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internchatmessagecontent import ( + InternChatMessageContent, + InternChatMessageContentTypedDict, +) +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Literal +from typing_extensions import TypedDict + + +InternChatToolMessageRole = Literal["tool",] + + +class InternChatToolMessageTypedDict(TypedDict): + r"""The answer to an `openrouter.provide_input` tool call. `tool_call_id` is the streamed tool call id and `session_id` must name the same session. For a permission, `content` is one of the offered option kinds (`allow_once`, `allow_always`, `reject_once`, `reject_always`) or `cancel`. For a question (elicitation), `content` is a JSON object string with `action` (`accept`, `decline` or `cancel`) and, for `accept`, `content` holding the field values. The answer is delivered to the run that asked. It never starts a new run.""" + + content: Nullable[InternChatMessageContentTypedDict] + r"""Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history.""" + role: InternChatToolMessageRole + tool_call_id: str + + +class InternChatToolMessage(BaseModel): + r"""The answer to an `openrouter.provide_input` tool call. `tool_call_id` is the streamed tool call id and `session_id` must name the same session. For a permission, `content` is one of the offered option kinds (`allow_once`, `allow_always`, `reject_once`, `reject_always`) or `cancel`. For a question (elicitation), `content` is a JSON object string with `action` (`accept`, `decline` or `cancel`) and, for `accept`, `content` holding the field values. The answer is delivered to the run that asked. It never starts a new run.""" + + content: Nullable[InternChatMessageContent] + r"""Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history.""" + + role: InternChatToolMessageRole + + tool_call_id: 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 diff --git a/src/openrouter/components/internchatusage.py b/src/openrouter/components/internchatusage.py new file mode 100644 index 00000000..439af871 --- /dev/null +++ b/src/openrouter/components/internchatusage.py @@ -0,0 +1,55 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internchatprompttokensdetails import ( + InternChatPromptTokensDetails, + InternChatPromptTokensDetailsTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class InternChatUsageTypedDict(TypedDict): + r"""Token usage for the run as the daemon reported it, on the final chunk before `[DONE]`. `null` when the daemon reported none, and always `null` after `tool_calls` because the turn is not over.""" + + completion_tokens: int + prompt_tokens: int + total_tokens: int + cost: NotRequired[float] + r"""The cost of the run in USD, when the daemon reported one.""" + prompt_tokens_details: NotRequired[InternChatPromptTokensDetailsTypedDict] + r"""Prompt tokens served from cache, when the daemon reported them.""" + + +class InternChatUsage(BaseModel): + r"""Token usage for the run as the daemon reported it, on the final chunk before `[DONE]`. `null` when the daemon reported none, and always `null` after `tool_calls` because the turn is not over.""" + + completion_tokens: int + + prompt_tokens: int + + total_tokens: int + + cost: Optional[float] = None + r"""The cost of the run in USD, when the daemon reported one.""" + + prompt_tokens_details: Optional[InternChatPromptTokensDetails] = None + r"""Prompt tokens served from cache, when the daemon reported them.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["cost", "prompt_tokens_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)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/internchatusermessage.py b/src/openrouter/components/internchatusermessage.py new file mode 100644 index 00000000..a87aacc5 --- /dev/null +++ b/src/openrouter/components/internchatusermessage.py @@ -0,0 +1,45 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .internchatmessagecontent import ( + InternChatMessageContent, + InternChatMessageContentTypedDict, +) +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Literal +from typing_extensions import TypedDict + + +InternChatUserMessageRole = Literal["user",] + + +class InternChatUserMessageTypedDict(TypedDict): + r"""A user message. When it is the last message its text is the prompt for a new run, at most 32000 characters.""" + + content: Nullable[InternChatMessageContentTypedDict] + r"""Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history.""" + role: InternChatUserMessageRole + + +class InternChatUserMessage(BaseModel): + r"""A user message. When it is the last message its text is the prompt for a new run, at most 32000 characters.""" + + content: Nullable[InternChatMessageContent] + r"""Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history.""" + + role: InternChatUserMessageRole + + @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/outputmodality.py b/src/openrouter/components/outputmodality.py index 08bfb228..0aaa500a 100644 --- a/src/openrouter/components/outputmodality.py +++ b/src/openrouter/components/outputmodality.py @@ -13,6 +13,7 @@ "audio", "video", "rerank", + "decisions", "speech", "transcription", ], diff --git a/src/openrouter/components/providername.py b/src/openrouter/components/providername.py index cd0eb182..e54927ab 100644 --- a/src/openrouter/components/providername.py +++ b/src/openrouter/components/providername.py @@ -73,6 +73,7 @@ "Moonshot AI", "Morph", "VoyageAI by MongoDB", + "TypeSafe", "Near AI", "Nebius", "Nex AGI", @@ -105,6 +106,7 @@ "Tenstorrent", "Thinking Machines", "Together", + "Unbiased", "Upstage", "Venice", "Wafer", diff --git a/src/openrouter/components/provideroptions.py b/src/openrouter/components/provideroptions.py index b286e287..3d4d89c1 100644 --- a/src/openrouter/components/provideroptions.py +++ b/src/openrouter/components/provideroptions.py @@ -142,7 +142,9 @@ class ProviderOptionsTypedDict(TypedDict): thinkingmachines: NotRequired[Dict[str, Any]] together: NotRequired[Dict[str, Any]] together_lite: NotRequired[Dict[str, Any]] + typesafe: NotRequired[Dict[str, Any]] ubicloud: NotRequired[Dict[str, Any]] + unbiased: NotRequired[Dict[str, Any]] upstage: NotRequired[Dict[str, Any]] venice: NotRequired[Dict[str, Any]] voyageai: NotRequired[Dict[str, Any]] @@ -467,8 +469,12 @@ class ProviderOptions(BaseModel): Optional[Dict[str, Any]], pydantic.Field(alias="together-lite") ] = None + typesafe: Optional[Dict[str, Any]] = None + ubicloud: Optional[Dict[str, Any]] = None + unbiased: Optional[Dict[str, Any]] = None + upstage: Optional[Dict[str, Any]] = None venice: Optional[Dict[str, Any]] = None @@ -624,7 +630,9 @@ def serialize_model(self, handler): "thinkingmachines", "together", "together-lite", + "typesafe", "ubicloud", + "unbiased", "upstage", "venice", "voyageai", diff --git a/src/openrouter/components/providerpreferences.py b/src/openrouter/components/providerpreferences.py index 54ef6ce9..aa6879d3 100644 --- a/src/openrouter/components/providerpreferences.py +++ b/src/openrouter/components/providerpreferences.py @@ -130,7 +130,7 @@ def serialize_model(self, handler): class ProviderPreferencesTypedDict(TypedDict): - r"""When multiple model providers are available, optionally indicate your routing preference.""" + r"""Provider routing preferences for the request.""" allow_fallbacks: NotRequired[Nullable[bool]] r"""Whether to allow backup providers to serve requests @@ -169,7 +169,7 @@ class ProviderPreferencesTypedDict(TypedDict): class ProviderPreferences(BaseModel): - r"""When multiple model providers are available, optionally indicate your routing preference.""" + r"""Provider routing preferences for the request.""" allow_fallbacks: OptionalNullable[bool] = UNSET r"""Whether to allow backup providers to serve requests diff --git a/src/openrouter/components/providerresponse.py b/src/openrouter/components/providerresponse.py index abbdc8ac..ad814563 100644 --- a/src/openrouter/components/providerresponse.py +++ b/src/openrouter/components/providerresponse.py @@ -103,6 +103,7 @@ "Moonshot AI", "Morph", "VoyageAI by MongoDB", + "TypeSafe", "Near AI", "Nebius", "Nex AGI", @@ -135,6 +136,7 @@ "Tenstorrent", "Thinking Machines", "Together", + "Unbiased", "Upstage", "Venice", "Wafer", diff --git a/src/openrouter/components/sttresponse.py b/src/openrouter/components/sttresponse.py index 61daeb24..6ea5f83a 100644 --- a/src/openrouter/components/sttresponse.py +++ b/src/openrouter/components/sttresponse.py @@ -15,6 +15,8 @@ class STTResponseTypedDict(TypedDict): text: str r"""The transcribed text""" + confidence: NotRequired[float] + r"""Provider confidence for the whole transcript from 0 to 1, present when response_format is verbose_json and the provider scores the full transcript""" duration: NotRequired[float] r"""Duration of the input audio in seconds, present when response_format is verbose_json""" language: NotRequired[str] @@ -35,6 +37,9 @@ class STTResponse(BaseModel): text: str r"""The transcribed text""" + confidence: Optional[float] = None + r"""Provider confidence for the whole transcript from 0 to 1, present when response_format is verbose_json and the provider scores the full transcript""" + duration: Optional[float] = None r"""Duration of the input audio in seconds, present when response_format is verbose_json""" @@ -56,7 +61,7 @@ class STTResponse(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["duration", "language", "segments", "task", "usage", "words"] + ["confidence", "duration", "language", "segments", "task", "usage", "words"] ) serialized = handler(self) m = {} diff --git a/src/openrouter/components/sttword.py b/src/openrouter/components/sttword.py index 4d300cd3..d7e59a3e 100644 --- a/src/openrouter/components/sttword.py +++ b/src/openrouter/components/sttword.py @@ -16,6 +16,8 @@ class STTWordTypedDict(TypedDict): r"""Word start time in seconds""" word: str r"""The transcribed word""" + confidence: NotRequired[float] + r"""Provider confidence for the word from 0 to 1, present when the provider returns per-word confidence""" speaker: NotRequired[int] r"""Speaker index for the word, present when the provider returns diarization data""" @@ -32,12 +34,15 @@ class STTWord(BaseModel): word: str r"""The transcribed word""" + confidence: Optional[float] = None + r"""Provider confidence for the word from 0 to 1, present when the provider returns per-word confidence""" + speaker: Optional[int] = None r"""Speaker index for the word, present when the provider returns diarization data""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["speaker"]) + optional_fields = set(["confidence", "speaker"]) serialized = handler(self) m = {} diff --git a/src/openrouter/components/videogenerationrequest.py b/src/openrouter/components/videogenerationrequest.py index 639fc39c..978b0a0c 100644 --- a/src/openrouter/components/videogenerationrequest.py +++ b/src/openrouter/components/videogenerationrequest.py @@ -162,7 +162,9 @@ class VideoGenerationRequestOptionsTypedDict(TypedDict): thinkingmachines: NotRequired[Dict[str, Any]] together: NotRequired[Dict[str, Any]] together_lite: NotRequired[Dict[str, Any]] + typesafe: NotRequired[Dict[str, Any]] ubicloud: NotRequired[Dict[str, Any]] + unbiased: NotRequired[Dict[str, Any]] upstage: NotRequired[Dict[str, Any]] venice: NotRequired[Dict[str, Any]] voyageai: NotRequired[Dict[str, Any]] @@ -487,8 +489,12 @@ class VideoGenerationRequestOptions(BaseModel): Optional[Dict[str, Any]], pydantic.Field(alias="together-lite") ] = None + typesafe: Optional[Dict[str, Any]] = None + ubicloud: Optional[Dict[str, Any]] = None + unbiased: Optional[Dict[str, Any]] = None + upstage: Optional[Dict[str, Any]] = None venice: Optional[Dict[str, Any]] = None @@ -644,7 +650,9 @@ def serialize_model(self, handler): "thinkingmachines", "together", "together-lite", + "typesafe", "ubicloud", + "unbiased", "upstage", "venice", "voyageai", @@ -729,6 +737,8 @@ class VideoGenerationRequestTypedDict(TypedDict): r"""Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set.""" 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.""" + 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] @@ -773,6 +783,9 @@ class VideoGenerationRequest(BaseModel): 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.""" + 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.""" + prompt: Optional[str] = None 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.""" @@ -811,6 +824,7 @@ def serialize_model(self, handler): "frame_images", "generate_audio", "input_references", + "previous_job_id", "prompt", "provider", "resolution", diff --git a/src/openrouter/components/videogenerationresponse.py b/src/openrouter/components/videogenerationresponse.py index 2b0301ba..d0227a15 100644 --- a/src/openrouter/components/videogenerationresponse.py +++ b/src/openrouter/components/videogenerationresponse.py @@ -23,6 +23,7 @@ class VideoGenerationResponseTypedDict(TypedDict): id: str + r"""The video job ID, in the `gen-vid--<20 alphanumerics>` generation ID format. Pass it as `previous_job_id` to continue the generation.""" polling_url: str status: VideoGenerationResponseStatus error: NotRequired[str] @@ -35,6 +36,7 @@ class VideoGenerationResponseTypedDict(TypedDict): class VideoGenerationResponse(BaseModel): id: str + r"""The video job ID, in the `gen-vid--<20 alphanumerics>` generation ID format. Pass it as `previous_job_id` to continue the generation.""" polling_url: str diff --git a/src/openrouter/decisions.py b/src/openrouter/decisions.py new file mode 100644 index 00000000..926e989a --- /dev/null +++ b/src/openrouter/decisions.py @@ -0,0 +1,439 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from openrouter import components, errors, operations, utils +from openrouter._hooks import HookContext +from openrouter.types import OptionalNullable, UNSET +from openrouter.utils import get_security_from_env +from openrouter.utils.unmarshal_json_response import unmarshal_json_response +from typing import Any, Dict, Mapping, Optional, Union + + +class Decisions(BaseSDK): + r"""Alpha feature endpoints for Decisions (questions and answers) requests""" + + def create( + self, + *, + model: str, + questions: Union[ + Mapping[str, components.Questions], + Mapping[str, components.QuestionsTypedDict], + ], + state: Union[components.State, components.StateTypedDict], + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + provider: OptionalNullable[ + Union[ + components.ProviderPreferences, components.ProviderPreferencesTypedDict + ] + ] = UNSET, + session_id: Optional[str] = None, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, + user: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.DecisionsResponse: + r"""Submit a Decisions (questions and answers) request + + Submits a Decisions request to the Decisions router + + :param model: + :param questions: + :param state: The content to evaluate: a plain string, or a JSON object or array of related context. + :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 provider: + :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 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. + :param user: + :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.CreateAPIAlphaDecisionsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + decisions_request=components.DecisionsRequest( + model=model, + provider=utils.get_pydantic_model( + provider, OptionalNullable[components.ProviderPreferences] + ), + questions=utils.get_pydantic_model( + questions, Dict[str, components.Questions] + ), + session_id=session_id, + state=utils.unmarshal(state, components.State), + trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), + user=user, + ), + ) + + req = self._build_request( + method="POST", + path="/api/alpha/decisions", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.CreateAPIAlphaDecisionsGlobals( + 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, + get_serialized_body=lambda: utils.serialize_request_body( + request.decisions_request, + False, + False, + "json", + components.DecisionsRequest, + ), + 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="createApiAlphaDecisions", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["alpha.decisions"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.DecisionsResponse, http_res) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "402", "application/json"): + response_data = unmarshal_json_response( + errors.PaymentRequiredResponseErrorData, http_res + ) + raise errors.PaymentRequiredResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "413", "application/json"): + response_data = unmarshal_json_response( + errors.PayloadTooLargeResponseErrorData, http_res + ) + raise errors.PayloadTooLargeResponseError(response_data, http_res) + if utils.match_response(http_res, "429", "application/json"): + response_data = unmarshal_json_response( + errors.TooManyRequestsResponseErrorData, http_res + ) + raise errors.TooManyRequestsResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "502", "application/json"): + response_data = unmarshal_json_response( + errors.BadGatewayResponseErrorData, http_res + ) + raise errors.BadGatewayResponseError(response_data, http_res) + if utils.match_response(http_res, "503", "application/json"): + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res + ) + raise errors.ServiceUnavailableResponseError(response_data, http_res) + if utils.match_response(http_res, "524", "application/json"): + response_data = unmarshal_json_response( + errors.EdgeNetworkTimeoutResponseErrorData, http_res + ) + raise errors.EdgeNetworkTimeoutResponseError(response_data, http_res) + if utils.match_response(http_res, "529", "application/json"): + response_data = unmarshal_json_response( + errors.ProviderOverloadedResponseErrorData, http_res + ) + raise errors.ProviderOverloadedResponseError(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 create_async( + self, + *, + model: str, + questions: Union[ + Mapping[str, components.Questions], + Mapping[str, components.QuestionsTypedDict], + ], + state: Union[components.State, components.StateTypedDict], + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + provider: OptionalNullable[ + Union[ + components.ProviderPreferences, components.ProviderPreferencesTypedDict + ] + ] = UNSET, + session_id: Optional[str] = None, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, + user: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.DecisionsResponse: + r"""Submit a Decisions (questions and answers) request + + Submits a Decisions request to the Decisions router + + :param model: + :param questions: + :param state: The content to evaluate: a plain string, or a JSON object or array of related context. + :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 provider: + :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 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. + :param user: + :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.CreateAPIAlphaDecisionsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + decisions_request=components.DecisionsRequest( + model=model, + provider=utils.get_pydantic_model( + provider, OptionalNullable[components.ProviderPreferences] + ), + questions=utils.get_pydantic_model( + questions, Dict[str, components.Questions] + ), + session_id=session_id, + state=utils.unmarshal(state, components.State), + trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), + user=user, + ), + ) + + req = self._build_request_async( + method="POST", + path="/api/alpha/decisions", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.CreateAPIAlphaDecisionsGlobals( + 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, + get_serialized_body=lambda: utils.serialize_request_body( + request.decisions_request, + False, + False, + "json", + components.DecisionsRequest, + ), + 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="createApiAlphaDecisions", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["alpha.decisions"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.DecisionsResponse, http_res) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "402", "application/json"): + response_data = unmarshal_json_response( + errors.PaymentRequiredResponseErrorData, http_res + ) + raise errors.PaymentRequiredResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "413", "application/json"): + response_data = unmarshal_json_response( + errors.PayloadTooLargeResponseErrorData, http_res + ) + raise errors.PayloadTooLargeResponseError(response_data, http_res) + if utils.match_response(http_res, "429", "application/json"): + response_data = unmarshal_json_response( + errors.TooManyRequestsResponseErrorData, http_res + ) + raise errors.TooManyRequestsResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "502", "application/json"): + response_data = unmarshal_json_response( + errors.BadGatewayResponseErrorData, http_res + ) + raise errors.BadGatewayResponseError(response_data, http_res) + if utils.match_response(http_res, "503", "application/json"): + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res + ) + raise errors.ServiceUnavailableResponseError(response_data, http_res) + if utils.match_response(http_res, "524", "application/json"): + response_data = unmarshal_json_response( + errors.EdgeNetworkTimeoutResponseErrorData, http_res + ) + raise errors.EdgeNetworkTimeoutResponseError(response_data, http_res) + if utils.match_response(http_res, "529", "application/json"): + response_data = unmarshal_json_response( + errors.ProviderOverloadedResponseErrorData, http_res + ) + raise errors.ProviderOverloadedResponseError(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/errors/__init__.py b/src/openrouter/errors/__init__.py index f3643660..21a81e55 100644 --- a/src/openrouter/errors/__init__.py +++ b/src/openrouter/errors/__init__.py @@ -32,6 +32,10 @@ InternalServerResponseError, InternalServerResponseErrorData, ) + from .internchaterrorresponse import ( + InternChatErrorResponse, + InternChatErrorResponseData, + ) from .internlifecycleerror import InternLifecycleError, InternLifecycleErrorData from .no_response_error import NoResponseError from .notfoundresponse_error import NotFoundResponseError, NotFoundResponseErrorData @@ -86,6 +90,8 @@ "GatewayTimeoutResponseErrorData", "GoneResponseError", "GoneResponseErrorData", + "InternChatErrorResponse", + "InternChatErrorResponseData", "InternLifecycleError", "InternLifecycleErrorData", "InternalServerResponseError", @@ -133,6 +139,8 @@ "GoneResponseErrorData": ".goneresponse_error", "InternalServerResponseError": ".internalserverresponse_error", "InternalServerResponseErrorData": ".internalserverresponse_error", + "InternChatErrorResponse": ".internchaterrorresponse", + "InternChatErrorResponseData": ".internchaterrorresponse", "InternLifecycleError": ".internlifecycleerror", "InternLifecycleErrorData": ".internlifecycleerror", "NoResponseError": ".no_response_error", diff --git a/src/openrouter/errors/internchaterrorresponse.py b/src/openrouter/errors/internchaterrorresponse.py new file mode 100644 index 00000000..6fe3f735 --- /dev/null +++ b/src/openrouter/errors/internchaterrorresponse.py @@ -0,0 +1,32 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from dataclasses import dataclass, field +import httpx +from openrouter.components import internchaterror as components_internchaterror +from openrouter.errors import OpenRouterError +from openrouter.types import BaseModel +from typing import Optional + + +class InternChatErrorResponseData(BaseModel): + error: components_internchaterror.InternChatError + r"""The OpenAI-compatible error object. `metadata` is present on refusals from the chat route. Authentication refusals (`401`), the departed-creator `403` and the programme `404` carry only `code` and `message`.""" + + +@dataclass(unsafe_hash=True) +class InternChatErrorResponse(OpenRouterError): + r"""A refusal before the stream opens. Once the response is `200` and streaming, failures arrive as a chunk with `finish_reason: \"error\"` instead.""" + + data: InternChatErrorResponseData = field(hash=False) + + def __init__( + self, + data: InternChatErrorResponseData, + raw_response: httpx.Response, + body: Optional[str] = None, + ): + fallback = body or raw_response.text + message = str(data.error.message) or fallback + super().__init__(message, raw_response, body) + object.__setattr__(self, "data", data) diff --git a/src/openrouter/interns.py b/src/openrouter/interns.py index 873ba9c2..cbb66128 100644 --- a/src/openrouter/interns.py +++ b/src/openrouter/interns.py @@ -4,13 +4,13 @@ from openrouter import components, errors, operations, utils from openrouter._hooks import HookContext from openrouter.types import OptionalNullable, UNSET -from openrouter.utils import get_security_from_env +from openrouter.utils import eventstreaming, get_security_from_env from openrouter.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Iterable, List, Mapping, Optional +from typing import Any, Iterable, List, Mapping, Optional, Union class Interns(BaseSDK): - r"""Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key.""" + r"""Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key, and talk to them: the chat route streams OpenAI-compatible completions from one intern, pausing as an `openrouter.provide_input` tool call when the intern needs your permission or an answer. Available to interns programme members; other callers receive 404. See https://openrouter.ai/docs/guides/ori/intern-chat.""" def list_interns( self, @@ -1915,3 +1915,385 @@ async def suspend_intern_async( ) raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def chat( + self, + *, + intern_id: str, + messages: Union[ + Iterable[components.InternChatMessage], + Iterable[components.InternChatMessageTypedDict], + ], + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + approval_mode: Optional[components.InternApprovalMode] = None, + model: Optional[str] = None, + session_id: 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, + ) -> Union[ + components.InternChatCompletionChunk, + eventstreaming.EventStream[components.InternChatCompletionChunk], + ]: + r"""Stream a chat completion with an intern + + Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: \"tool_calls\"`, and the run stays open on the intern. + + Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk. + + To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline. + + Closing the connection after the `[DONE]` that follows `finish_reason: \"tool_calls\"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The disconnect is noticed when the intern next writes to the stream, which during a silent tool run can take more than one 30 second heartbeat interval. + + A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: \"error\"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event. + + Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts. + + Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`. + + If set, this operation will use `api_key` from the global security. + + :param intern_id: The intern to talk to. + :param messages: The conversation. Only the last message is read. A last `user` message starts a run. A last `tool` message answers the interaction named by its `tool_call_id` and requires `session_id`. + :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 approval_mode: How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with. + :param model: Echoed as `model` on the streamed chunks; the final chunk may carry the model the intern reported instead. The intern chooses its own model, so this value does not change what runs. + :param session_id: The daemon session to continue, as returned in `session_id` on the final chunk of an earlier response. Omit it to start a new session. Required when the last message has role `tool`. + :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.CreateInternChatCompletionRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + intern_id=intern_id, + intern_chat_completion_request=components.InternChatCompletionRequest( + approval_mode=approval_mode, + messages=utils.get_pydantic_model( + messages, List[components.InternChatMessage] + ), + model=model, + session_id=session_id, + ), + ) + + req = self._build_request( + method="POST", + path="/interns/{internId}/chat/completions", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="text/event-stream" + if getattr(request, "stream", False) is True + else "application/json", + http_headers=http_headers, + _globals=operations.CreateInternChatCompletionGlobals( + 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, + get_serialized_body=lambda: utils.serialize_request_body( + request.intern_chat_completion_request, + False, + False, + "json", + components.InternChatCompletionRequest, + ), + allow_empty_value=None, + allowed_fields=["api_key"], + 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="createInternChatCompletion", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Interns"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + stream=getattr(request, "stream", False) is True, + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "text/event-stream"): + return eventstreaming.EventStream( + http_res, + lambda raw: unmarshal_json_response( + components.InternChatStreamingResponse, http_res, raw + ).data, + sentinel="[DONE]", + client_ref=self, + ) + if utils.match_response(http_res, "200", "application/json"): + http_res_text = utils.stream_to_text(http_res) + return unmarshal_json_response( + components.InternChatCompletionChunk, http_res, http_res_text + ) + if utils.match_response( + http_res, + ["400", "401", "403", "404", "409", "410", "413", "429"], + "application/json", + ): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.InternChatErrorResponseData, http_res, http_res_text + ) + raise errors.InternChatErrorResponse(response_data, http_res, http_res_text) + if utils.match_response(http_res, ["502", "503", "504"], "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.InternChatErrorResponseData, http_res, http_res_text + ) + raise errors.InternChatErrorResponse(response_data, http_res, http_res_text) + 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 + ) + + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "Unexpected response received", http_res, http_res_text + ) + + async def chat_async( + self, + *, + intern_id: str, + messages: Union[ + Iterable[components.InternChatMessage], + Iterable[components.InternChatMessageTypedDict], + ], + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + approval_mode: Optional[components.InternApprovalMode] = None, + model: Optional[str] = None, + session_id: 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, + ) -> Union[ + components.InternChatCompletionChunk, + eventstreaming.EventStreamAsync[components.InternChatCompletionChunk], + ]: + r"""Stream a chat completion with an intern + + Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: \"tool_calls\"`, and the run stays open on the intern. + + Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk. + + To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline. + + Closing the connection after the `[DONE]` that follows `finish_reason: \"tool_calls\"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The disconnect is noticed when the intern next writes to the stream, which during a silent tool run can take more than one 30 second heartbeat interval. + + A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: \"error\"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event. + + Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts. + + Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`. + + If set, this operation will use `api_key` from the global security. + + :param intern_id: The intern to talk to. + :param messages: The conversation. Only the last message is read. A last `user` message starts a run. A last `tool` message answers the interaction named by its `tool_call_id` and requires `session_id`. + :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 approval_mode: How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with. + :param model: Echoed as `model` on the streamed chunks; the final chunk may carry the model the intern reported instead. The intern chooses its own model, so this value does not change what runs. + :param session_id: The daemon session to continue, as returned in `session_id` on the final chunk of an earlier response. Omit it to start a new session. Required when the last message has role `tool`. + :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.CreateInternChatCompletionRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + intern_id=intern_id, + intern_chat_completion_request=components.InternChatCompletionRequest( + approval_mode=approval_mode, + messages=utils.get_pydantic_model( + messages, List[components.InternChatMessage] + ), + model=model, + session_id=session_id, + ), + ) + + req = self._build_request_async( + method="POST", + path="/interns/{internId}/chat/completions", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="text/event-stream" + if getattr(request, "stream", False) is True + else "application/json", + http_headers=http_headers, + _globals=operations.CreateInternChatCompletionGlobals( + 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, + get_serialized_body=lambda: utils.serialize_request_body( + request.intern_chat_completion_request, + False, + False, + "json", + components.InternChatCompletionRequest, + ), + allow_empty_value=None, + allowed_fields=["api_key"], + 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="createInternChatCompletion", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Interns"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + stream=getattr(request, "stream", False) is True, + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "text/event-stream"): + return eventstreaming.EventStreamAsync( + http_res, + lambda raw: unmarshal_json_response( + components.InternChatStreamingResponse, http_res, raw + ).data, + sentinel="[DONE]", + client_ref=self, + ) + if utils.match_response(http_res, "200", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + return unmarshal_json_response( + components.InternChatCompletionChunk, http_res, http_res_text + ) + if utils.match_response( + http_res, + ["400", "401", "403", "404", "409", "410", "413", "429"], + "application/json", + ): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.InternChatErrorResponseData, http_res, http_res_text + ) + raise errors.InternChatErrorResponse(response_data, http_res, http_res_text) + if utils.match_response(http_res, ["502", "503", "504"], "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.InternChatErrorResponseData, http_res, http_res_text + ) + raise errors.InternChatErrorResponse(response_data, http_res, http_res_text) + 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 + ) + + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "Unexpected response received", http_res, http_res_text + ) diff --git a/src/openrouter/models_.py b/src/openrouter/models_.py index b4576cd5..e16291f9 100644 --- a/src/openrouter/models_.py +++ b/src/openrouter/models_.py @@ -328,7 +328,7 @@ def list( :param limit: Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned :param category: Filter models by use case category :param supported_parameters: Filter models by supported parameter (comma-separated) - :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or \"all\" to include all models. Defaults to \"text\". + :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or \"all\" to include all models. Defaults to \"text\". :param sort: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. :param q: Free-text search by model name or slug. :param input_modalities: Filter models by input modality. Comma-separated list of: text, image, audio, file. @@ -595,7 +595,7 @@ async def list_async( :param limit: Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned :param category: Filter models by use case category :param supported_parameters: Filter models by supported parameter (comma-separated) - :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or \"all\" to include all models. Defaults to \"text\". + :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or \"all\" to include all models. Defaults to \"text\". :param sort: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. :param q: Free-text search by model name or slug. :param input_modalities: Filter models by input modality. Comma-separated list of: text, image, audio, file. @@ -833,7 +833,7 @@ def count( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. - :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or \"all\" to include all models. Defaults to \"text\". + :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or \"all\" to include all models. Defaults to \"text\". :param 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 @@ -959,7 +959,7 @@ async def count_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. - :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or \"all\" to include all models. Defaults to \"text\". + :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or \"all\" to include all models. Defaults to \"text\". :param 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 @@ -1096,7 +1096,7 @@ def list_for_user( :param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned :param limit: Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned - :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or \"all\" to include all models. Defaults to \"text\". + :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or \"all\" to include all models. Defaults to \"text\". :param 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 @@ -1272,7 +1272,7 @@ async def list_for_user_async( :param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned :param limit: Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned - :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or \"all\" to include all models. Defaults to \"text\". + :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or \"all\" to include all models. Defaults to \"text\". :param 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 diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 13b659fb..ef94ad40 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -47,6 +47,12 @@ CopyVaultSecretsToInternRequest, CopyVaultSecretsToInternRequestTypedDict, ) + from .createapialphadecisions import ( + CreateAPIAlphaDecisionsGlobals, + CreateAPIAlphaDecisionsGlobalsTypedDict, + CreateAPIAlphaDecisionsRequest, + CreateAPIAlphaDecisionsRequestTypedDict, + ) from .createaudiospeech import ( CreateAudioSpeechGlobals, CreateAudioSpeechGlobalsTypedDict, @@ -148,6 +154,14 @@ CreateInternRequest, CreateInternRequestTypedDict, ) + from .createinternchatcompletion import ( + CreateInternChatCompletionGlobals, + CreateInternChatCompletionGlobalsTypedDict, + CreateInternChatCompletionRequest, + CreateInternChatCompletionRequestTypedDict, + CreateInternChatCompletionResponse, + CreateInternChatCompletionResponseTypedDict, + ) from .createkeys import ( CreateKeysData, CreateKeysDataTypedDict, @@ -1007,6 +1021,10 @@ "CopyVaultSecretsToInternGlobalsTypedDict", "CopyVaultSecretsToInternRequest", "CopyVaultSecretsToInternRequestTypedDict", + "CreateAPIAlphaDecisionsGlobals", + "CreateAPIAlphaDecisionsGlobalsTypedDict", + "CreateAPIAlphaDecisionsRequest", + "CreateAPIAlphaDecisionsRequestTypedDict", "CreateAudioSpeechGlobals", "CreateAudioSpeechGlobalsTypedDict", "CreateAudioSpeechRequest", @@ -1062,6 +1080,12 @@ "CreateImagesRequestTypedDict", "CreateImagesResponse", "CreateImagesResponseTypedDict", + "CreateInternChatCompletionGlobals", + "CreateInternChatCompletionGlobalsTypedDict", + "CreateInternChatCompletionRequest", + "CreateInternChatCompletionRequestTypedDict", + "CreateInternChatCompletionResponse", + "CreateInternChatCompletionResponseTypedDict", "CreateInternGlobals", "CreateInternGlobalsTypedDict", "CreateInternRequest", @@ -1710,6 +1734,10 @@ "CopyVaultSecretsToInternGlobalsTypedDict": ".copyvaultsecretstointern", "CopyVaultSecretsToInternRequest": ".copyvaultsecretstointern", "CopyVaultSecretsToInternRequestTypedDict": ".copyvaultsecretstointern", + "CreateAPIAlphaDecisionsGlobals": ".createapialphadecisions", + "CreateAPIAlphaDecisionsGlobalsTypedDict": ".createapialphadecisions", + "CreateAPIAlphaDecisionsRequest": ".createapialphadecisions", + "CreateAPIAlphaDecisionsRequestTypedDict": ".createapialphadecisions", "CreateAudioSpeechGlobals": ".createaudiospeech", "CreateAudioSpeechGlobalsTypedDict": ".createaudiospeech", "CreateAudioSpeechRequest": ".createaudiospeech", @@ -1793,6 +1821,12 @@ "CreateInternGlobalsTypedDict": ".createintern", "CreateInternRequest": ".createintern", "CreateInternRequestTypedDict": ".createintern", + "CreateInternChatCompletionGlobals": ".createinternchatcompletion", + "CreateInternChatCompletionGlobalsTypedDict": ".createinternchatcompletion", + "CreateInternChatCompletionRequest": ".createinternchatcompletion", + "CreateInternChatCompletionRequestTypedDict": ".createinternchatcompletion", + "CreateInternChatCompletionResponse": ".createinternchatcompletion", + "CreateInternChatCompletionResponseTypedDict": ".createinternchatcompletion", "CreateKeysData": ".createkeys", "CreateKeysDataTypedDict": ".createkeys", "CreateKeysGlobals": ".createkeys", diff --git a/src/openrouter/operations/createapialphadecisions.py b/src/openrouter/operations/createapialphadecisions.py new file mode 100644 index 00000000..5a513d14 --- /dev/null +++ b/src/openrouter/operations/createapialphadecisions.py @@ -0,0 +1,144 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import decisionsrequest as components_decisionsrequest +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, RequestMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateAPIAlphaDecisionsGlobalsTypedDict(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 CreateAPIAlphaDecisionsGlobals(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 CreateAPIAlphaDecisionsRequestTypedDict(TypedDict): + decisions_request: components_decisionsrequest.DecisionsRequestTypedDict + 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 CreateAPIAlphaDecisionsRequest(BaseModel): + decisions_request: Annotated[ + components_decisionsrequest.DecisionsRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/createinternchatcompletion.py b/src/openrouter/operations/createinternchatcompletion.py new file mode 100644 index 00000000..67d40aee --- /dev/null +++ b/src/openrouter/operations/createinternchatcompletion.py @@ -0,0 +1,196 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + internchatcompletionchunk as components_internchatcompletionchunk, + internchatcompletionrequest as components_internchatcompletionrequest, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, + eventstreaming, +) +import pydantic +from pydantic import model_serializer +from typing import Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class CreateInternChatCompletionGlobalsTypedDict(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 CreateInternChatCompletionGlobals(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 CreateInternChatCompletionRequestTypedDict(TypedDict): + intern_id: str + r"""The intern to talk to.""" + intern_chat_completion_request: ( + components_internchatcompletionrequest.InternChatCompletionRequestTypedDict + ) + 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 CreateInternChatCompletionRequest(BaseModel): + intern_id: Annotated[ + str, + pydantic.Field(alias="internId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""The intern to talk to.""" + + intern_chat_completion_request: Annotated[ + components_internchatcompletionrequest.InternChatCompletionRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + 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 + + +CreateInternChatCompletionResponseTypedDict = TypeAliasType( + "CreateInternChatCompletionResponseTypedDict", + Union[ + components_internchatcompletionchunk.InternChatCompletionChunkTypedDict, + Union[ + eventstreaming.EventStream[ + components_internchatcompletionchunk.InternChatCompletionChunkTypedDict + ], + eventstreaming.EventStreamAsync[ + components_internchatcompletionchunk.InternChatCompletionChunkTypedDict + ], + ], + ], +) + + +CreateInternChatCompletionResponse = TypeAliasType( + "CreateInternChatCompletionResponse", + Union[ + components_internchatcompletionchunk.InternChatCompletionChunk, + Union[ + eventstreaming.EventStream[ + components_internchatcompletionchunk.InternChatCompletionChunk + ], + eventstreaming.EventStreamAsync[ + components_internchatcompletionchunk.InternChatCompletionChunk + ], + ], + ], +) diff --git a/src/openrouter/operations/getmodels.py b/src/openrouter/operations/getmodels.py index 354655a9..4daeb79f 100644 --- a/src/openrouter/operations/getmodels.py +++ b/src/openrouter/operations/getmodels.py @@ -168,7 +168,7 @@ class GetModelsRequestTypedDict(TypedDict): supported_parameters: NotRequired[str] r"""Filter models by supported parameter (comma-separated)""" output_modalities: NotRequired[str] - r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or \"all\" to include all models. Defaults to \"text\".""" + r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or \"all\" to include all models. Defaults to \"text\".""" sort: NotRequired[GetModelsSort] r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.""" q: NotRequired[str] @@ -276,7 +276,7 @@ class GetModelsRequest(BaseModel): Optional[str], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), ] = None - r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or \"all\" to include all models. Defaults to \"text\".""" + r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or \"all\" to include all models. Defaults to \"text\".""" sort: Annotated[ Optional[GetModelsSort], diff --git a/src/openrouter/operations/listbyokkeys.py b/src/openrouter/operations/listbyokkeys.py index 0d9dfb02..a75b32fc 100644 --- a/src/openrouter/operations/listbyokkeys.py +++ b/src/openrouter/operations/listbyokkeys.py @@ -185,6 +185,8 @@ def serialize_model(self, handler): "tenstorrent", "thinkingmachines", "together", + "typesafe", + "unbiased", "upstage", "venice", "voyageai", diff --git a/src/openrouter/operations/listmodelscount.py b/src/openrouter/operations/listmodelscount.py index 81e2dcd9..cdde733b 100644 --- a/src/openrouter/operations/listmodelscount.py +++ b/src/openrouter/operations/listmodelscount.py @@ -88,7 +88,7 @@ class ListModelsCountRequestTypedDict(TypedDict): """ output_modalities: NotRequired[str] - r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or \"all\" to include all models. Defaults to \"text\".""" + r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or \"all\" to include all models. Defaults to \"text\".""" class ListModelsCountRequest(BaseModel): @@ -124,7 +124,7 @@ class ListModelsCountRequest(BaseModel): Optional[str], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), ] = None - r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or \"all\" to include all models. Defaults to \"text\".""" + r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or \"all\" to include all models. Defaults to \"text\".""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/operations/listmodelsuser.py b/src/openrouter/operations/listmodelsuser.py index 78a9304b..915aa93c 100644 --- a/src/openrouter/operations/listmodelsuser.py +++ b/src/openrouter/operations/listmodelsuser.py @@ -116,7 +116,7 @@ class ListModelsUserRequestTypedDict(TypedDict): limit: NotRequired[int] r"""Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned""" output_modalities: NotRequired[str] - r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or \"all\" to include all models. Defaults to \"text\".""" + r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or \"all\" to include all models. Defaults to \"text\".""" class ListModelsUserRequest(BaseModel): @@ -164,7 +164,7 @@ class ListModelsUserRequest(BaseModel): Optional[str], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), ] = None - r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or \"all\" to include all models. Defaults to \"text\".""" + r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or \"all\" to include all models. Defaults to \"text\".""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/sdk.py b/src/openrouter/sdk.py index e1ca4315..0fb8d63a 100644 --- a/src/openrouter/sdk.py +++ b/src/openrouter/sdk.py @@ -16,6 +16,7 @@ import weakref if TYPE_CHECKING: + from openrouter.alpha import Alpha from openrouter.analytics import Analytics from openrouter.api_keys import APIKeys from openrouter.benchmarks import Benchmarks @@ -56,6 +57,7 @@ class OpenRouter(BaseSDK): analytics: "Analytics" r"""Analytics and usage endpoints""" + alpha: "Alpha" tts: "TTS" r"""Text-to-speech endpoints""" stt: "STT" @@ -88,7 +90,7 @@ class OpenRouter(BaseSDK): images: "Images" r"""Images endpoints""" interns: "Interns" - r"""Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key.""" + r"""Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key, and talk to them: the chat route streams OpenAI-compatible completions from one intern, pausing as an `openrouter.provide_input` tool call when the intern needs your permission or an answer. Available to interns programme members; other callers receive 404. See https://openrouter.ai/docs/guides/ori/intern-chat.""" api_keys: "APIKeys" r"""API key management endpoints""" models: "Models" @@ -116,6 +118,7 @@ class OpenRouter(BaseSDK): r"""Workspaces endpoints""" _sub_sdk_map = { "analytics": ("openrouter.analytics", "Analytics"), + "alpha": ("openrouter.alpha", "Alpha"), "tts": ("openrouter.tts", "TTS"), "stt": ("openrouter.stt", "STT"), "o_auth": ("openrouter.oauth", "OAuth"), diff --git a/src/openrouter/video_generation.py b/src/openrouter/video_generation.py index f6928811..6186c320 100644 --- a/src/openrouter/video_generation.py +++ b/src/openrouter/video_generation.py @@ -37,6 +37,7 @@ def generate( Iterable[components.InputReferenceTypedDict], ] ] = None, + previous_job_id: Optional[str] = None, prompt: Optional[str] = None, provider: Optional[ Union[ @@ -77,6 +78,7 @@ def generate( :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. :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 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-specific passthrough configuration :param resolution: Resolution of the generated video @@ -118,6 +120,7 @@ def generate( input_references, Optional[List[components.InputReference]] ), model=model, + previous_job_id=previous_job_id, prompt=prompt, provider=utils.get_pydantic_model( provider, Optional[components.VideoGenerationRequestProvider] @@ -270,6 +273,7 @@ async def generate_async( Iterable[components.InputReferenceTypedDict], ] ] = None, + previous_job_id: Optional[str] = None, prompt: Optional[str] = None, provider: Optional[ Union[ @@ -310,6 +314,7 @@ async def generate_async( :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. :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 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-specific passthrough configuration :param resolution: Resolution of the generated video @@ -351,6 +356,7 @@ async def generate_async( input_references, Optional[List[components.InputReference]] ), model=model, + previous_job_id=previous_job_id, prompt=prompt, provider=utils.get_pydantic_model( provider, Optional[components.VideoGenerationRequestProvider] diff --git a/uv.lock b/uv.lock index 11d14866..7896ec04 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.1.156" +version = "1.1.157" source = { editable = "." } dependencies = [ { name = "httpcore" },