From b9e32dafd69df1af5391147edd9afedc5b8107ec Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Thu, 17 Sep 2026 03:34:37 +0000 Subject: [PATCH 1/3] ## Python SDK Changes: * `open_router.interns.list_interns()`: **Added** * `open_router.interns.create_intern()`: **Added** * `open_router.interns.delete_intern()`: **Added** * `open_router.interns.get_intern()`: **Added** * `open_router.interns.update_intern()`: **Added** * `open_router.interns.provision_intern()`: **Added** * `open_router.interns.suspend_intern()`: **Added** --- .speakeasy/gen.lock | 320 ++- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 1092 ++++++++++ .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/components/code.mdx | 38 +- docs/components/codeenum.mdx | 40 + docs/components/createinternrequest.mdx | 17 + docs/components/deleteinternresponse.mdx | 9 + docs/components/intern.mdx | 25 + docs/components/internlifecycleerrorerror.mdx | 10 + docs/components/internlistresponse.mdx | 13 + docs/components/internstatus.mdx | 28 + docs/components/progress.mdx | 14 + docs/components/provisioninternresponse.mdx | 9 + docs/components/responseserrorfield.mdx | 8 +- docs/components/suspendinternresponse.mdx | 9 + docs/components/updateinternrequest.mdx | 15 + docs/errors/internlifecycleerror.mdx | 12 + docs/operations/createinternglobals.mdx | 11 + docs/operations/createinternrequest.mdx | 13 + docs/operations/deleteinternglobals.mdx | 11 + docs/operations/deleteinternrequest.mdx | 12 + docs/operations/getinternglobals.mdx | 11 + docs/operations/getinternrequest.mdx | 12 + docs/operations/listinternsglobals.mdx | 11 + docs/operations/listinternsrequest.mdx | 14 + docs/operations/provisioninternglobals.mdx | 11 + docs/operations/provisioninternrequest.mdx | 12 + docs/operations/status.mdx | 26 + docs/operations/suspendinternglobals.mdx | 11 + docs/operations/suspendinternrequest.mdx | 12 + docs/operations/updateinternglobals.mdx | 11 + docs/operations/updateinternrequest.mdx | 13 + docs/sdks/interns/README.mdx | 359 +++ pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 74 +- .../components/createinternrequest.py | 77 + .../components/deleteinternresponse.py | 26 + src/openrouter/components/intern.py | 153 ++ .../components/internlifecycleerror.py | 23 + .../components/internlistresponse.py | 24 + .../components/provisioninternresponse.py | 26 + .../components/responseserrorfield.py | 6 +- .../components/suspendinternresponse.py | 26 + .../components/updateinternrequest.py | 67 + src/openrouter/errors/__init__.py | 5 + src/openrouter/errors/internlifecycleerror.py | 33 + src/openrouter/interns.py | 1917 +++++++++++++++++ src/openrouter/operations/__init__.py | 101 + src/openrouter/operations/createintern.py | 158 ++ src/openrouter/operations/deleteintern.py | 146 ++ src/openrouter/operations/getintern.py | 146 ++ src/openrouter/operations/listinterns.py | 183 ++ src/openrouter/operations/provisionintern.py | 146 ++ src/openrouter/operations/suspendintern.py | 146 ++ src/openrouter/operations/updateintern.py | 158 ++ src/openrouter/sdk.py | 4 + uv.lock | 2 +- 60 files changed, 5811 insertions(+), 75 deletions(-) create mode 100644 docs/components/codeenum.mdx create mode 100644 docs/components/createinternrequest.mdx create mode 100644 docs/components/deleteinternresponse.mdx create mode 100644 docs/components/intern.mdx create mode 100644 docs/components/internlifecycleerrorerror.mdx create mode 100644 docs/components/internlistresponse.mdx create mode 100644 docs/components/internstatus.mdx create mode 100644 docs/components/progress.mdx create mode 100644 docs/components/provisioninternresponse.mdx create mode 100644 docs/components/suspendinternresponse.mdx create mode 100644 docs/components/updateinternrequest.mdx create mode 100644 docs/errors/internlifecycleerror.mdx create mode 100644 docs/operations/createinternglobals.mdx create mode 100644 docs/operations/createinternrequest.mdx create mode 100644 docs/operations/deleteinternglobals.mdx create mode 100644 docs/operations/deleteinternrequest.mdx create mode 100644 docs/operations/getinternglobals.mdx create mode 100644 docs/operations/getinternrequest.mdx create mode 100644 docs/operations/listinternsglobals.mdx create mode 100644 docs/operations/listinternsrequest.mdx create mode 100644 docs/operations/provisioninternglobals.mdx create mode 100644 docs/operations/provisioninternrequest.mdx create mode 100644 docs/operations/status.mdx create mode 100644 docs/operations/suspendinternglobals.mdx create mode 100644 docs/operations/suspendinternrequest.mdx create mode 100644 docs/operations/updateinternglobals.mdx create mode 100644 docs/operations/updateinternrequest.mdx create mode 100644 docs/sdks/interns/README.mdx create mode 100644 src/openrouter/components/createinternrequest.py create mode 100644 src/openrouter/components/deleteinternresponse.py create mode 100644 src/openrouter/components/intern.py create mode 100644 src/openrouter/components/internlifecycleerror.py create mode 100644 src/openrouter/components/internlistresponse.py create mode 100644 src/openrouter/components/provisioninternresponse.py create mode 100644 src/openrouter/components/suspendinternresponse.py create mode 100644 src/openrouter/components/updateinternrequest.py create mode 100644 src/openrouter/errors/internlifecycleerror.py create mode 100644 src/openrouter/interns.py create mode 100644 src/openrouter/operations/createintern.py create mode 100644 src/openrouter/operations/deleteintern.py create mode 100644 src/openrouter/operations/getintern.py create mode 100644 src/openrouter/operations/listinterns.py create mode 100644 src/openrouter/operations/provisionintern.py create mode 100644 src/openrouter/operations/suspendintern.py create mode 100644 src/openrouter/operations/updateintern.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 42f5515f..7112f392 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: 658f38aca7602f6f6a2560c5f87359a4 + docChecksum: 25847ffa971a9e8d114afce29b7764b7 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.1.154 - configChecksum: 7f90f6c142a4c96321b2e4e19e6c7468 + releaseVersion: 1.1.155 + configChecksum: cf4350f470ec772a52ab95921b521f2f repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 2de73e06-133c-4851-b00f-33203f9c0341 - pristine_commit_hash: 9894bc0e00e3c76649b7639f4d085eebc238d9fc - pristine_tree_hash: 955ab838ee178e94808251ee73fab53c4305df9a + generation_id: 233a8623-f91f-4692-8456-e2275a374225 + pristine_commit_hash: 426e4f85cc5a18a466e0588de1a733285ba45286 + pristine_tree_hash: 6ff1b1ae5d6424f700af349f844d7a5a13fbb0b6 features: python: acceptHeaders: 3.0.0 @@ -1266,8 +1266,12 @@ trackedFiles: pristine_git_object: db3b60d9a6c046173b1cadf19eab51f3f3c1e11e docs/components/code.mdx: id: 1cc125f1dfa9 - last_write_checksum: sha1:05209e9aede02db986168b2c8c137f6e34f2eeec - pristine_git_object: 99c02099c21e679c3f131c44db0e07a8041a1635 + last_write_checksum: sha1:90126ec33b82bbdfbce812b79d6241da3d5f220e + pristine_git_object: f4cb5da6450105978064f99a92065478c247270d + docs/components/codeenum.mdx: + id: 9b9b999fccff + last_write_checksum: sha1:9b27a6a9b4052a497a81efd40e7817e1e0cb4ba4 + pristine_git_object: 7cbab1b33935fb96989fdfe3ce93498585845af9 docs/components/codeinterpretercallcodedeltaevent.mdx: id: 49bd6f63fc7b last_write_checksum: sha1:7680a9c4beaab8a216ba869a03777a6639fa1843 @@ -1648,6 +1652,10 @@ trackedFiles: id: 1477eebdf505 last_write_checksum: sha1:76bb1fcafda689e9823bb21541c84e7d0bdb991d pristine_git_object: 63cc820d2e3f4ddaa6d42dfef4c80006f7810cb2 + docs/components/createinternrequest.mdx: + id: 31228037ef68 + last_write_checksum: sha1:adb8b817fb517aae23e9417988c9e6231ef493fd + pristine_git_object: a14e0eafcb0825429ad47197f7036617870488a7 docs/components/createobservabilitydestinationrequest.mdx: id: 8d942a601a6e last_write_checksum: sha1:a266eb148b179de43a1b08282d7cadd013e5eaa1 @@ -1804,6 +1812,10 @@ trackedFiles: id: 4b5aa42babb9 last_write_checksum: sha1:85c65956be5b333b233ada31f980a73eb580f9b8 pristine_git_object: 36069a9639aef5294e8ef81b5e96d169b01e5b07 + docs/components/deleteinternresponse.mdx: + id: 80308aeb681f + last_write_checksum: sha1:b9f46d98fd3d91f0f1398bfbdd0d1dd2141ce4eb + pristine_git_object: dcf556fcd919cf9853c4a3e74783a20147f15dd9 docs/components/deleteobservabilitydestinationresponse.mdx: id: 0f606ad36822 last_write_checksum: sha1:99269cd4a1958da8aa09cb828709ca8a734541ff @@ -2820,10 +2832,26 @@ trackedFiles: id: 4e1ceba5a654 last_write_checksum: sha1:2efe0463c8d0ed63159bbcc8cb8c21743800b88e pristine_git_object: e3e71d16be9294f68ca671f76dbcc8b6d8ecc749 + docs/components/intern.mdx: + id: 95d0e0ffc539 + last_write_checksum: sha1:13508092e8edb3ecd4d7aed06dc722965823d4b3 + pristine_git_object: 71f5da0f992ab9ff76f92b2239cd8300d4a8b74f docs/components/internalserverresponseerrordata.mdx: id: 9a443dea63c5 last_write_checksum: sha1:39c41704820f6cde2d67ec3b9f1bcac7bc1a81d0 pristine_git_object: 8ddf14e86902b5d1b69fd15b7098e489c741b993 + docs/components/internlifecycleerrorerror.mdx: + id: 501146f0d87d + last_write_checksum: sha1:1b49f19b35c20245a088fc58825a9ee97d27c300 + pristine_git_object: c9eacd7d34fe43fbad032729e0dc9d130684ed72 + docs/components/internlistresponse.mdx: + id: 4c41e6189730 + last_write_checksum: sha1:b1bde1e620cf0cfc5533114aa7a6e8ca674527ba + pristine_git_object: c3d3d07cf0e16e5475f5e61816ac383c87ec42c8 + docs/components/internstatus.mdx: + id: c90242af9f30 + last_write_checksum: sha1:23f8d62521ceaa0468c43d9355dba84a260058a3 + pristine_git_object: b0753ab065074bd8988bc23026b69162d9b3910d docs/components/issuedtokentype.mdx: id: b5c747e2aaf8 last_write_checksum: sha1:33d9e8b021a11c7168f66a288dd5d7ed3aa0a78e @@ -4524,6 +4552,10 @@ trackedFiles: id: c6ec097bacaf last_write_checksum: sha1:fc7d89ac02ff585424b5bc8cc9b0ac82338c7b6f pristine_git_object: 6a99a2737d18a3c227bf7fcabf58b481d3c7d94b + docs/components/progress.mdx: + id: 0b8df88cc38e + last_write_checksum: sha1:f7aa4681aa80d62f2a7c69b809b002f6758fe7fc + pristine_git_object: 1c5f4b732e434daa29af2f811fe949fcfa99344b docs/components/promptcachebreakpoint.mdx: id: c135956dc623 last_write_checksum: sha1:6df345ea99da1fdcae22895faa2ee36339ba7332 @@ -4592,6 +4624,10 @@ trackedFiles: id: 9ca776e56c1b last_write_checksum: sha1:6e4c1559eef9ee1369886cca6708b01b93d685bc pristine_git_object: 5aa8e90a6761d61aa63204bc3aa73f4481449d3e + docs/components/provisioninternresponse.mdx: + id: 23160e47706d + last_write_checksum: sha1:acf8dada13882840c6f666af22913959ce99917f + pristine_git_object: be1e5af9301ba917704f25fdafed31c152485abf docs/components/publicendpoint.mdx: id: ec4843ef5d86 last_write_checksum: sha1:23aab4f17e54311ce27a585548fef94c997def7c @@ -4878,8 +4914,8 @@ trackedFiles: pristine_git_object: aa7c89233d761c71c471d4f9ee808e648e683fcf docs/components/responseserrorfield.mdx: id: b6154c03e4c4 - last_write_checksum: sha1:1226c11459e0aab4601c395235bb4aed55c9c602 - pristine_git_object: 996cffee821435729436d7f29bce4333f4900382 + last_write_checksum: sha1:fc2809fc49f6610f53613085145fb7065fbcefb9 + pristine_git_object: c5eb0598512c67cb4dcb72b9ef93c9a027a1a989 docs/components/responsesrequest.mdx: id: 0dbcef40a4b1 last_write_checksum: sha1:8169a9f78f1a62b764d0d2becc9560b871bd5a15 @@ -5324,6 +5360,10 @@ trackedFiles: id: c38f709222bb last_write_checksum: sha1:6cb4221a4756877c0ce27330b7afa0dcb13dac84 pristine_git_object: f5c99148f84a2bb1cced013334248242f553cbad + docs/components/suspendinternresponse.mdx: + id: 958bfa1f41a0 + last_write_checksum: sha1:6b0cc6e6dc961257ddf8dca2bb94b2db66b254e9 + pristine_git_object: 7a513bd20c993f110b1fb306d9817cf049df27e4 docs/components/syntax.mdx: id: 0e7a97e89dd7 last_write_checksum: sha1:f3317e2b7efd9ed8d3317626429b481c39bd56f8 @@ -5796,6 +5836,10 @@ trackedFiles: id: e00dc0a0c6e0 last_write_checksum: sha1:1be70185072640936151f861913c2b89a09d4bab pristine_git_object: 510bac097152bc64d1eccad4f2a498db9bd8a86c + docs/components/updateinternrequest.mdx: + id: fbc072e9b00d + last_write_checksum: sha1:c888d986e5372b3f938c12f836d6c1bb47616020 + pristine_git_object: 49d486efd355e22cb1bf8954d6b520aebdf2241e docs/components/updateobservabilitydestinationrequest.mdx: id: b54091567003 last_write_checksum: sha1:d878d301eca619ed7a9820c612e2e2251feaef0a @@ -6124,6 +6168,10 @@ trackedFiles: id: e3cb72f51ee2 last_write_checksum: sha1:144494af097e80aa9fdb921d094b2473bc598165 pristine_git_object: 2a892b08d47733e805a94c47c7f87252f262f753 + docs/errors/internlifecycleerror.mdx: + id: 628a6023e104 + last_write_checksum: sha1:bf1a5dd26e7c994c2bef5eef51e3a70dbccd2ceb + pristine_git_object: 9de3964c049fda5bbb0bd5d37b845f2fdc572bb4 docs/errors/notfoundresponseerror.mdx: id: a387a1eb646c last_write_checksum: sha1:c31fd704f361e6d1d568d734c469fa9c37095f9f @@ -6384,6 +6432,14 @@ trackedFiles: id: 852027a00620 last_write_checksum: sha1:f65739779d5b4cd6cbacf59817765623554abef6 pristine_git_object: 77636052b24b9c8973895543fc9bacebe8459844 + docs/operations/createinternglobals.mdx: + id: 45b4d0de1076 + last_write_checksum: sha1:d9bae324793bf0ceed41e23e92bf267574cd7834 + pristine_git_object: 8eb5e1fc3969fddf5f3706423354192dcaa725e6 + docs/operations/createinternrequest.mdx: + id: 775d728f4c95 + last_write_checksum: sha1:071295f8ffaee68807950f2fc1554c9c288509ec + pristine_git_object: 0806040f7e5aebcded7d4309baa80a0e6a0d3ffb docs/operations/createkeysdata.mdx: id: bf8133a06827 last_write_checksum: sha1:315420c8bb79b06c579bf9473d1f94a26b2aa626 @@ -6548,6 +6604,14 @@ trackedFiles: id: a7b7e64c7fb1 last_write_checksum: sha1:e993d4511c68b02e368f21a0b319b2068c6180b4 pristine_git_object: ba80054b8619991e06ee23b1ce40a97692b15c77 + docs/operations/deleteinternglobals.mdx: + id: aa95d8a4b14b + last_write_checksum: sha1:42a9591a7e628d3844d68cd65a1a40e9dd7269be + pristine_git_object: fd39b2b5196d8737e978e97a8d47469940b33679 + docs/operations/deleteinternrequest.mdx: + id: f8055480b92d + last_write_checksum: sha1:61574e7bc4d9bd56398b383a8dc13dd5270343db + pristine_git_object: b655daea6c01537c473922e0fb1ecc66f615d086 docs/operations/deleteinternvaultsecretglobals.mdx: id: 6bab12e48fb6 last_write_checksum: sha1:31611313c0d6ef1067af551a8433b2eee40dcdcd @@ -6804,6 +6868,14 @@ trackedFiles: id: 1e6b86bd352e last_write_checksum: sha1:61e6cae3e157e329be3ea0f60ed28408f55b58da pristine_git_object: 15bebf62bb77b99ccfbb68dd33a2b38d42d12b85 + docs/operations/getinternglobals.mdx: + id: 9bfe3e0e8a6f + last_write_checksum: sha1:7f2d43fe0f91149b2982edebe432faed9bfb3bea + pristine_git_object: 118bb0d2fe8033480475600b890910226a389d65 + docs/operations/getinternrequest.mdx: + id: 6e44684f038a + last_write_checksum: sha1:e3b38672e96405461ef3069043f981eb45730bc1 + pristine_git_object: cd83fdf513f2e3581b526d6fd2bee78841dfd8c6 docs/operations/getkeydata.mdx: id: 6e826a999e6b last_write_checksum: sha1:8b5426689eaf7f90b5f12991eeb52cf3780d95f4 @@ -7128,6 +7200,14 @@ trackedFiles: id: e829f52a26d3 last_write_checksum: sha1:cb8b441a4e0138861a6cf660367f674093844590 pristine_git_object: 590e46d83ce8a470b44499464e1343584fc66805 + docs/operations/listinternsglobals.mdx: + id: 6a0fb4e1a618 + last_write_checksum: sha1:b257bc2c67a98c98cebc8bb1046b170d8a6757bb + pristine_git_object: 3a55ed59f02347866993fd5891898cec46a62c28 + docs/operations/listinternsrequest.mdx: + id: e6de03b26b5e + last_write_checksum: sha1:92926b5c50d73c315b37598d5b855a4235981196 + pristine_git_object: d1a3e4c68ed6ae8a16872fcf0226cad2130e1cb4 docs/operations/listinternvaultsecretsglobals.mdx: id: 83e0c9cb95c6 last_write_checksum: sha1:4def94f91a2e27836d1e4d8d313ad5bc31154d01 @@ -7408,6 +7488,14 @@ trackedFiles: id: c75b3bbeeaa0 last_write_checksum: sha1:86dc3e01802bb3a4e1477979535bbf2c2550bbcc pristine_git_object: 2762e4d9f70f31b75cb43286c33064707461b129 + docs/operations/provisioninternglobals.mdx: + id: 5e34eb9c579a + last_write_checksum: sha1:e5ddc9680dd8f7c0bbec6bb900f0754c8d8da955 + pristine_git_object: 5e790162a8ce632cda6238c8c2687bee9bf8ec5a + docs/operations/provisioninternrequest.mdx: + id: 074aa151686e + last_write_checksum: sha1:250fea07fb32beb5c38dfa2e1d34876da453ad43 + pristine_git_object: 5c14eb74f07f1ece813b29d707e2820635926196 docs/operations/queryanalyticsdata1.mdx: id: 0e41beea77d0 last_write_checksum: sha1:f9a349b4fee07f786180e94b45f92002bfae0e56 @@ -7472,6 +7560,10 @@ trackedFiles: id: 53486739ebf2 last_write_checksum: sha1:ed574764fc3d9c85d55705aee27616e3de0c8fcc pristine_git_object: 85b44c9e7e9fd56b3a5a0bded755877840cc31b2 + docs/operations/status.mdx: + id: 46242b22ddfe + last_write_checksum: sha1:c0082216aef9dda39994012af2210095c86aaada + pristine_git_object: afe17b53bb6976e38f7f264c5e8a906c2bd1cc42 docs/operations/storeinternvaultsecretglobals.mdx: id: cee17ad4252e last_write_checksum: sha1:dcf11780c44a028cefc5ccc3e96d53536f3af2e7 @@ -7500,6 +7592,14 @@ trackedFiles: id: f159f51b36f7 last_write_checksum: sha1:1d16f944195d66950cba4bfc2f96255286cf33c0 pristine_git_object: 18f5cc3e2fe30014037f8f68d5513a4981d513b9 + docs/operations/suspendinternglobals.mdx: + id: 36617646a835 + last_write_checksum: sha1:135089b28d6874eaffede59ab8a432cce1b8cde5 + pristine_git_object: 3837a6174815dc473a017550b4fcb987e5824e79 + docs/operations/suspendinternrequest.mdx: + id: 035d45ab50f2 + last_write_checksum: sha1:3a932cde1ec1f21b0fc1463f98ce22507272f3b5 + pristine_git_object: d039292f15a1c3ceebb99662f9a8274172b65e0b docs/operations/tasktype.mdx: id: d3da8106d2d1 last_write_checksum: sha1:0955731aba6ddddeeaee3b34ca7e353dc2dd9700 @@ -7540,6 +7640,14 @@ trackedFiles: id: b3a26bb527db last_write_checksum: sha1:61d23143ea26684dacce468f671014cdfa4ab811 pristine_git_object: b89a6072a0e463fdc6e8cf72fb69947c72771768 + docs/operations/updateinternglobals.mdx: + id: 456485694b42 + last_write_checksum: sha1:23ba19d29f64e3268d05edf019d5d2b14b96da57 + pristine_git_object: ef2e1631549eabe9a96b7468bce3b4492fa53489 + docs/operations/updateinternrequest.mdx: + id: 4b345c88804b + last_write_checksum: sha1:acef7242c09041659cb616a6e977e133fa9ffa50 + pristine_git_object: 059a2165b5a09252162e7d21d25de48eb631e29d docs/operations/updatekeysdata.mdx: id: d398ba596e27 last_write_checksum: sha1:f028821be32f7627428ead62d856899c3d1d0fde @@ -7704,6 +7812,10 @@ trackedFiles: id: 534a6c102c4f last_write_checksum: sha1:82a8bd22fb399fe419076afe29b9234950baf9f9 pristine_git_object: 08c687694efbecf50406ae7929029d39fb121295 + docs/sdks/interns/README.mdx: + id: 2f8a053ffe78 + last_write_checksum: sha1:7bef8123763db516f82d5dccd4741f781ef67f2e + pristine_git_object: 4b26b50dbae23ee5b463344e845537f0898f91dc docs/sdks/models/README.mdx: id: 58f1ca464e0b last_write_checksum: sha1:e52eb8f94799aec2499f70e99ca46acedfe17ec9 @@ -7766,8 +7878,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:aebd4b8e9b3bd01b7732d031ea406bff7b52b1d4 - pristine_git_object: fed68690d305ed6cbf73ec1aa130d466b72cb7e7 + last_write_checksum: sha1:cb12e064674d7fec04e2e6539dfa8fd4ee676da5 + pristine_git_object: 064099c56177379e40658b00dd72c940a589e4e2 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -7794,8 +7906,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:c1b3bb26c47b1021d8365a7d31f21be3d2d5f6c3 - pristine_git_object: e2deff10977f39b591781c92c5f635972cd61f47 + last_write_checksum: sha1:3e504bc6365fa0f8fa750b7da0e8c8d9d19aedb8 + pristine_git_object: dd5994a836b83a74bbdf39015eeacddbf60e7b43 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:1e0004d8d1d5d797e2b54cd1cabeb7f9489d08e9 @@ -7834,8 +7946,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:17395d06856ed4c18e60c58dc737dbf31708f73b - pristine_git_object: e1c0f7fe7a911a43a640fe7cd4b61f4ca101b7f4 + last_write_checksum: sha1:51f930611b2ea502afe28911bdef17d74960a6ff + pristine_git_object: 7f9810b0cb23bfc7225e1c408aba447e3c7c05c5 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -8564,6 +8676,10 @@ trackedFiles: id: b4e1bdf1de5b last_write_checksum: sha1:ae20a5e7425510c240e5697d847b1cae65940bd6 pristine_git_object: d6c4a4dc73222668daddc2a1788d314ff30e8fe6 + src/openrouter/components/createinternrequest.py: + id: 5722cff28787 + last_write_checksum: sha1:304835f2ff0852585a88d22e902f5ba63b0a749c + pristine_git_object: f8da7513209307490563f91eeff184cd46c745a5 src/openrouter/components/createobservabilitydestinationrequest.py: id: 58587fb98a32 last_write_checksum: sha1:e0acb6b3d5dda9f6101b69ab9048dfea1492bb73 @@ -8644,6 +8760,10 @@ trackedFiles: id: c3ac908331ef last_write_checksum: sha1:6a5ca367dfad148ce7f01d14044efbef37b36d2b pristine_git_object: 0c4b2ec66b592fb5be3ac587a5c6d60c84069384 + src/openrouter/components/deleteinternresponse.py: + id: ac5a1edfacb6 + last_write_checksum: sha1:f00bb81495e80b7c1054160dbc698cbdbe331875 + pristine_git_object: 8be686f460cf8a3fd9e1f56831c5e23ee832f8e6 src/openrouter/components/deleteobservabilitydestinationresponse.py: id: daf99e240820 last_write_checksum: sha1:485d3e763c2edd7ccd69926e2ea872eb6d031fdc @@ -9060,10 +9180,22 @@ trackedFiles: id: 411acdbfeb84 last_write_checksum: sha1:6cc1744db62a53dfa1425c8cab508f5538cd3d50 pristine_git_object: 4a58daf7d055e111ebf204b18ee413203f06b745 + src/openrouter/components/intern.py: + id: eed59a44b44f + last_write_checksum: sha1:38c4c739a2889d67367835d6220c6cc6dd3e7086 + pristine_git_object: 0613b4b54b15c875731348e9607cebeeabf8d8fe src/openrouter/components/internalserverresponseerrordata.py: id: 91397805fa13 last_write_checksum: sha1:6307236e36dc876dbfae76cfcc29ad49461b5b5d pristine_git_object: c3e202d3c93225aba92c8ed9b83633c98f25fb4c + src/openrouter/components/internlifecycleerror.py: + id: 2b89c094850e + last_write_checksum: sha1:952dc08e0ed7a08c0ca8cde1798916305f16edba + pristine_git_object: 589fcd031d428922ff76b506ea068fc746425a1c + src/openrouter/components/internlistresponse.py: + id: 1d6ce743dbed + last_write_checksum: sha1:51cf92ca51b0d90a127bf9fd8a150b4063a4ad70 + pristine_git_object: 941c3861bb2d78e8b696b1d7d3632e9baf96c343 src/openrouter/components/itemreferenceitem.py: id: d3c42b5f11fb last_write_checksum: sha1:25fd74f1c34307a97931e1d2c138a1db347218ad @@ -9752,6 +9884,10 @@ trackedFiles: id: 02719ff8dcd5 last_write_checksum: sha1:d45c5195b22199a5f03a1a749a861f110c8a3a13 pristine_git_object: 1798ae9dd8c2e4b629bb99cc5c643827895e8231 + src/openrouter/components/provisioninternresponse.py: + id: bb3ef5f9a913 + last_write_checksum: sha1:670fe98feb4572efa1000f2d2dcb9795c99374a1 + pristine_git_object: 5f4a4186a9c98767217546b6b87d238fbc0155f3 src/openrouter/components/publicendpoint.py: id: 848aa2ef9129 last_write_checksum: sha1:859e0d6fb0db27400d0ce70949dfb1b08ac47bed @@ -9882,8 +10018,8 @@ trackedFiles: pristine_git_object: 900bf08ec940565a8cbf55712a437775db00ca46 src/openrouter/components/responseserrorfield.py: id: 565a88fd70a1 - last_write_checksum: sha1:f5cfff730f56ba22d53f5ac06bc6e47afd01f7ef - pristine_git_object: ac617a44216e453d08d4cb75c5fd626496cebb82 + last_write_checksum: sha1:2ea7b46db823bdb4f7f52dc7c733f5470240d9a7 + pristine_git_object: 1364b9bd6384600f0f59afbe181eb0e940f686eb src/openrouter/components/responsesrequest.py: id: 8c850080ec5d last_write_checksum: sha1:8715ac1040d2289c3ad9cfbc40de9cc086c50209 @@ -10124,6 +10260,10 @@ trackedFiles: id: 1e1463bcfd03 last_write_checksum: sha1:d7ba55af6eca473c91a3cd09a73068bb8a75ad22 pristine_git_object: 139b0fc5a600fee17eafff1d36df72754c90b2fe + src/openrouter/components/suspendinternresponse.py: + id: 0e696fa5051f + last_write_checksum: sha1:9f511d4136c3ee36cdebd2fe135375d571a9b094 + pristine_git_object: 703bf7deed21138fa64db63e6648be4cd2f3d09d src/openrouter/components/taskclassificationitem.py: id: 86d4bab5ebf3 last_write_checksum: sha1:16176fda0ccd16b0be59bb5c4b74db78eae02f36 @@ -10252,6 +10392,10 @@ trackedFiles: id: 7b068d26ce31 last_write_checksum: sha1:2b63cbb90747f07f775d9a22e80f74c67221fea8 pristine_git_object: df833960211cc7ed2a2a42fddbeafda0092e1c0c + src/openrouter/components/updateinternrequest.py: + id: 41df64f43394 + last_write_checksum: sha1:abfd6b26d1b0548a6d0a68bd508f215ac19e73ea + pristine_git_object: ceef4fe4b1006b11ddb31a6363c10417c01ca3c1 src/openrouter/components/updateobservabilitydestinationrequest.py: id: d7a39fe04386 last_write_checksum: sha1:47d6d5c3b92103b9544a97475598b400afc6a6a7 @@ -10450,8 +10594,8 @@ trackedFiles: pristine_git_object: 5c3a48759ba31aa633627707b68885b6cc367ddf src/openrouter/errors/__init__.py: id: 366154d0d60a - last_write_checksum: sha1:6e844e1119536e2b8905422028d54851ffd96465 - pristine_git_object: 90591064ba313afd447f6b4688ba8cd0f2ea9f9f + last_write_checksum: sha1:b29da3d57cabf8bb0226ef684841d0f5554ab683 + pristine_git_object: f3643660f0989f4fb3641035aef9b0444f7ba4ce src/openrouter/errors/badgatewayresponse_error.py: id: 818c3605ce23 last_write_checksum: sha1:f0307bff4a47f950c514d7d47de5690cac871bbb @@ -10484,6 +10628,10 @@ trackedFiles: id: a5ab5c4a53a9 last_write_checksum: sha1:3ffab8fcee20916d34ac6ff5112e8721f8d30c46 pristine_git_object: e63641558c6a2f555b46a76fa0e224c9ad526b88 + src/openrouter/errors/internlifecycleerror.py: + id: 8d3ad41bb70c + last_write_checksum: sha1:3a5f33a12bbd90a5477c08f3a88b6967ecd88abe + pristine_git_object: 8a93352420aca779ccb028d51c9d869696f838b3 src/openrouter/errors/no_response_error.py: id: b8b987b5e306 last_write_checksum: sha1:7f326424a7d5ae1bcd5c89a0d6b3dbda9138942f @@ -10560,6 +10708,10 @@ trackedFiles: id: c4d7adf63ae0 last_write_checksum: sha1:adc4c03f5bbc670f202c475721c524d8c651c3f3 pristine_git_object: 50643a126668498dd668c7cceb9f78c03d413d32 + src/openrouter/interns.py: + id: d18df05c5c6d + last_write_checksum: sha1:6e7dd921512308aacf37344664872b0ab93585cf + pristine_git_object: 873ba9c2773966f3fef05f6ff55a114120e9f0b6 src/openrouter/models/__init__.py: id: ed73b93abb3f last_write_checksum: sha1:932a790ae66ccd7d7022b39c659bcf72a664ebea @@ -10586,8 +10738,8 @@ trackedFiles: pristine_git_object: 8680343bbc90107ae6413bd5686012b1fd75d665 src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:5e76725bba9755997befe0ccfa9dea8d455c58c7 - pristine_git_object: 4c2089b3de647036bdf11ef5786f1162714a4188 + last_write_checksum: sha1:5b4fd788010eb5834402e7a99fcc0af11d4a96d9 + pristine_git_object: 13b659fb87d84fbc8325fbe68a51eb23adff8dcb src/openrouter/operations/bulkaddworkspacemembers.py: id: e0ed56117619 last_write_checksum: sha1:5c44eb0d40fdece3ac084615f6c6082be4cf1d5a @@ -10648,6 +10800,10 @@ trackedFiles: id: ef9b8b32ed45 last_write_checksum: sha1:a1a8152a7c5a29004c17a9eed5b796a69dbe9db6 pristine_git_object: 8216a656ec1412a034878e257bd9de9e94fa8da1 + src/openrouter/operations/createintern.py: + id: b5cd9ac981a1 + last_write_checksum: sha1:5bdd5fb6257c05a65d0855d7bfb7e3235602ba90 + pristine_git_object: 2efb94a2e159ac4c6bd32fdf6e80877b9e209d81 src/openrouter/operations/createkeys.py: id: 64ad31fdaa6c last_write_checksum: sha1:92e122bf7ca252e6cc1f4200cbcd6ded9a0d35a7 @@ -10708,6 +10864,10 @@ trackedFiles: id: 1fbdb98bbb85 last_write_checksum: sha1:9205bdbe64c2902d51ac7c6bddc8677af5b14ed7 pristine_git_object: a8c58e7fa8dd7e781d70c87ecc427f3fdff59ce9 + src/openrouter/operations/deleteintern.py: + id: daeef9c6710e + last_write_checksum: sha1:5847299fc02c61d74dbb79282817f7e310b25b3f + pristine_git_object: a1e8d0c9b2f873282dccf4ea2a74a63dba3f4ba2 src/openrouter/operations/deleteinternvaultsecret.py: id: ffac57160027 last_write_checksum: sha1:bc0d5957e085421f3a82cddc86d2bb6139a3d0f9 @@ -10788,6 +10948,10 @@ trackedFiles: id: 9b3309b59c64 last_write_checksum: sha1:76d3d0f15b487afef177e4b5148bddb814795b0f pristine_git_object: 3d69c1678d900400234631c4ace61a9f8354efc2 + src/openrouter/operations/getintern.py: + id: 9169bcde1477 + last_write_checksum: sha1:b0efb3c2205f580b8bad328ccca792dfa8eb18aa + pristine_git_object: 137abb8f6a48c3a7a0463370d6a254d6af406cad src/openrouter/operations/getkey.py: id: d9769da90865 last_write_checksum: sha1:0a73a314d782011063d9879302dbb7b829d759e3 @@ -10900,6 +11064,10 @@ trackedFiles: id: ad2131e4aa6c last_write_checksum: sha1:b5bbcbd02ce54cdc8bb1a2a3a424ca93c73f90bc pristine_git_object: 01655ae02036acf433ec5f54fd1d9323a55f0684 + src/openrouter/operations/listinterns.py: + id: 89bc4fa38c9f + last_write_checksum: sha1:4cafb99a7020b6199c7f57c36f111508ab18da49 + pristine_git_object: 003e212711b2436ee4af5efe3905932ea1e59371 src/openrouter/operations/listinternvaultsecrets.py: id: d9f9db46871d last_write_checksum: sha1:31bd0f67cb4e7dffe16c4a4af5d27a08920d355c @@ -10980,6 +11148,10 @@ trackedFiles: id: 4303a549823d last_write_checksum: sha1:b38c12973abf643632ac5fd2293bff383c20c0a2 pristine_git_object: 6ab264885a9454b195955adba4b65e01f2abf223 + src/openrouter/operations/provisionintern.py: + id: 3e316cf3dd88 + last_write_checksum: sha1:5786bd713d8d4a84fc4bac072f624b59527ff0b1 + pristine_git_object: 2efbcc03b9385327bbe4d64652bb6f0881f46169 src/openrouter/operations/queryanalytics.py: id: d76c63ff66f6 last_write_checksum: sha1:d166f291e1b720de07ceb8f684bd1d876213843e @@ -11000,6 +11172,10 @@ trackedFiles: id: a1f4458f5e75 last_write_checksum: sha1:634750972ca2bf7d76b1530f19f0d5401a44c3d8 pristine_git_object: 878e3ec2224f81c003c35efa326d2ba53ee595c0 + src/openrouter/operations/suspendintern.py: + id: 935964c35b42 + last_write_checksum: sha1:e51f9036765222c8f52c9e25398286e446ec11e3 + pristine_git_object: 7fff4cf03fee3d60909e5efe3710ab796572cf99 src/openrouter/operations/updatebyokkey.py: id: 486f4ea60120 last_write_checksum: sha1:a170382e38c66128bddbe8ea18c034d1350910da @@ -11008,6 +11184,10 @@ trackedFiles: id: 6cfb33d7d40c last_write_checksum: sha1:bf4f6b9899c176fa012acc607556a66d6e85a51b pristine_git_object: 3787f0ce396fca69bdd7bce99d8054fec4dd23d6 + src/openrouter/operations/updateintern.py: + id: b69b4ae29277 + last_write_checksum: sha1:c26fb7bce5047b277a028d786a12f99db9262531 + pristine_git_object: d87519cfb18258224c2958076dedb16ff4abe208 src/openrouter/operations/updatekeys.py: id: 56fb213253a8 last_write_checksum: sha1:143e7df66832596b325cc9f86aad485ba57d6cb8 @@ -11062,8 +11242,8 @@ trackedFiles: pristine_git_object: 1bea5be2496b283307c037f131a45a25bcca3c6c src/openrouter/sdk.py: id: ee9846c4c9c5 - last_write_checksum: sha1:2f1264417c334224f12a37efb67a49dcf37b6ae4 - pristine_git_object: 488042f09d81179234cf4d43665d47cd5d5c0379 + last_write_checksum: sha1:bd4f83db8a3171e6191c9e41872d3b2d55aa4d09 + pristine_git_object: e1ca4315c00cd4540c25c0f85db6128f3db7edb7 src/openrouter/sdkconfiguration.py: id: 55773bb98d7c last_write_checksum: sha1:c01826125c31a8b8bc99d9d679782c8758fae001 @@ -14208,5 +14388,95 @@ examples: responses: "504": application/json: {"error": {"code": 504, "message": "Vault request timed out"}} + listInterns: + speakeasy-default-list-interns: + responses: + "200": + application/json: {"data": [{"attached_vault_id": null, "createdAt": "2026-09-16T08:30:00.000Z", "description": "Researches customer questions", "hostname": "research-assistant.openrouter.ai", "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7", "instructions": null, "lastFailureMessage": null, "model": "openai/gpt-5.4", "name": "research-assistant", "progress": null, "status": "running", "updatedAt": "2026-09-16T08:45:00.000Z", "vault_id": "b431c59d-6eed-41ac-bc89-9a89be79a121", "workspaceId": "89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb"}], "has_more": false} + "400": + application/json: {"error": {"code": "not_found", "message": "Intern not found"}} + "500": + application/json: {"error": {"code": "not_found", "message": "Intern not found"}} + createIntern: + speakeasy-default-create-intern: + requestBody: + application/json: {"name": "research-assistant", "provision": true, "workspace_id": "89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb"} + responses: + "200": + application/json: {"attached_vault_id": null, "createdAt": "2026-09-16T08:30:00.000Z", "description": "Researches customer questions", "hostname": "research-assistant.openrouter.ai", "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7", "instructions": null, "lastFailureMessage": null, "model": "openai/gpt-5.4", "name": "research-assistant", "progress": null, "status": "running", "updatedAt": "2026-09-16T08:45:00.000Z", "vault_id": "b431c59d-6eed-41ac-bc89-9a89be79a121", "workspaceId": "89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb"} + "400": + application/json: {"error": {"code": "not_found", "message": "Intern not found"}} + "500": + application/json: {"error": {"code": "not_found", "message": "Intern not found"}} + deleteIntern: + speakeasy-default-delete-intern: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "202": + application/json: {"deleting": true} + "401": + application/json: {"error": {"code": "not_found", "message": "Intern not found"}} + "500": + application/json: {"error": {"code": "not_found", "message": "Intern not found"}} + getIntern: + speakeasy-default-get-intern: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "200": + application/json: {"attached_vault_id": null, "createdAt": "2026-09-16T08:30:00.000Z", "description": "Researches customer questions", "hostname": "research-assistant.openrouter.ai", "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7", "instructions": null, "lastFailureMessage": null, "model": "openai/gpt-5.4", "name": "research-assistant", "progress": null, "status": "running", "updatedAt": "2026-09-16T08:45:00.000Z", "vault_id": "b431c59d-6eed-41ac-bc89-9a89be79a121", "workspaceId": "89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb"} + "401": + application/json: {"error": {"code": "not_found", "message": "Intern not found"}} + "500": + application/json: {"error": {"code": "not_found", "message": "Intern not found"}} + updateIntern: + speakeasy-default-update-intern: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + requestBody: + application/json: {} + responses: + "200": + application/json: {"attached_vault_id": null, "createdAt": "2026-09-16T08:30:00.000Z", "description": "Researches customer questions", "hostname": "research-assistant.openrouter.ai", "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7", "instructions": null, "lastFailureMessage": null, "model": "openai/gpt-5.4", "name": "research-assistant", "progress": null, "status": "running", "updatedAt": "2026-09-16T08:45:00.000Z", "vault_id": "b431c59d-6eed-41ac-bc89-9a89be79a121", "workspaceId": "89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb"} + "400": + application/json: {"error": {"code": "not_found", "message": "Intern not found"}} + "500": + application/json: {"error": {"code": "not_found", "message": "Intern not found"}} + provisionIntern: + speakeasy-default-provision-intern: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "202": + application/json: {"provisioning": true} + "401": + application/json: {"error": {"code": "not_found", "message": "Intern not found"}} + "500": + application/json: {"error": {"code": "not_found", "message": "Intern not found"}} + suspendIntern: + speakeasy-default-suspend-intern: + parameters: + path: + internId: "7c9e6679-7425-40de-944b-e07fc1f90ae7" + responses: + "200": + application/json: {"suspended": true} + "401": + application/json: {"error": {"code": "not_found", "message": "Intern not found"}} + "500": + application/json: {"error": {"code": "not_found", "message": "Intern not found"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.presets.create_presets_messages()`: \n * `request.messages[].content.union(Array<>)[].union(document).source.union(content).content.union(Array<>)[].union(image).source.union(file)` **Added**\n" +releaseNotes: | + ## Python SDK Changes: + * `open_router.interns.list_interns()`: **Added** + * `open_router.interns.create_intern()`: **Added** + * `open_router.interns.delete_intern()`: **Added** + * `open_router.interns.get_intern()`: **Added** + * `open_router.interns.update_intern()`: **Added** + * `open_router.interns.provision_intern()`: **Added** + * `open_router.interns.suspend_intern()`: **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 75d791bc..26db9769 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.1.154 + version: 1.1.155 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 2cda2874..bdc63cc5 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -7709,6 +7709,48 @@ components: required: - 'data' type: 'object' + CreateInternRequest: + additionalProperties: false + description: 'Settings for a new intern in an explicit workspace.' + example: + name: 'research-assistant' + provision: true + workspace_id: '89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb' + properties: + description: + description: 'Free-form description, or null.' + maxLength: 2000 + type: + - 'string' + - 'null' + instructions: + description: 'Standing instructions the intern boots with, or null.' + maxLength: 100000 + type: + - 'string' + - 'null' + name: + description: 'Intern name, unique per creator within the workspace.' + maxLength: 17 + minLength: 2 + pattern: '^[a-z][a-z0-9]*(-[a-z0-9]+)*$' + type: 'string' + provision: + default: false + description: 'Start provisioning during this create operation. Defaults to false.' + type: 'boolean' + vault_id: + description: 'Vault owned by another intern in this workspace to attach as a borrowed vault.' + format: 'uuid' + type: 'string' + workspace_id: + description: 'Workspace that will own the intern. It must match the API key workspace.' + format: 'uuid' + type: 'string' + required: + - 'name' + - 'workspace_id' + type: 'object' CreateObservabilityDestinationRequest: example: config: @@ -8307,6 +8349,15 @@ components: required: - 'deleted' type: 'object' + DeleteInternResponse: + additionalProperties: false + properties: + deleting: + const: true + type: 'boolean' + required: + - 'deleting' + type: 'object' DeleteObservabilityDestinationResponse: example: deleted: true @@ -12062,6 +12113,122 @@ components: - 'string' - 'null' x-speakeasy-unknown-values: allow + Intern: + description: 'Public lifecycle state and settings for one intern.' + example: + attached_vault_id: null + createdAt: '2026-09-16T08:30:00.000Z' + description: 'Researches customer questions' + hostname: 'research-assistant.openrouter.ai' + id: '7c9e6679-7425-40de-944b-e07fc1f90ae7' + instructions: null + lastFailureMessage: null + model: 'openai/gpt-5.4' + name: 'research-assistant' + progress: null + status: 'running' + updatedAt: '2026-09-16T08:45:00.000Z' + vault_id: 'b431c59d-6eed-41ac-bc89-9a89be79a121' + workspaceId: '89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb' + properties: + attached_vault_id: + description: 'Vault the intern borrows from another intern, or null when it borrows none.' + type: + - 'string' + - 'null' + createdAt: + description: 'ISO 8601 creation time.' + type: 'string' + description: + description: 'Free-form description.' + type: + - 'string' + - 'null' + hostname: + description: 'Public hostname the intern is reachable at, or null until provisioning has assigned one.' + type: + - 'string' + - 'null' + id: + description: 'Intern id.' + type: 'string' + instructions: + description: 'Standing instructions the intern boots with.' + type: + - 'string' + - 'null' + lastFailureMessage: + description: 'Why the last provisioning attempt failed, when status is failed.' + type: + - 'string' + - 'null' + model: + description: 'OpenRouter model slug the intern runs, or null for the workspace default.' + type: + - 'string' + - 'null' + name: + description: 'Intern name, unique per creator within a workspace.' + type: 'string' + progress: + description: 'Active provisioning step, or null once provisioning has settled.' + properties: + stepLabel: + description: 'Human-readable label of the active provisioning step.' + type: 'string' + stepNumber: + description: 'One-based index of the active step.' + type: 'integer' + totalSteps: + description: 'Number of provisioning steps.' + type: 'integer' + required: + - 'stepLabel' + - 'stepNumber' + - 'totalSteps' + type: + - 'object' + - 'null' + status: + description: 'Lifecycle status.' + enum: + - 'awaiting_slack_install' + - 'queued' + - 'provisioning' + - 'running' + - 'failed' + - 'stopped' + - 'destroying' + - 'destroy_failed' + type: 'string' + x-speakeasy-unknown-values: allow + updatedAt: + description: 'ISO 8601 last update time.' + type: 'string' + vault_id: + description: 'Vault the intern owns, or null before it has been created.' + type: + - 'string' + - 'null' + workspaceId: + description: 'Workspace that owns the intern and scopes its secrets.' + type: 'string' + required: + - 'id' + - 'name' + - 'description' + - 'instructions' + - 'model' + - 'status' + - 'lastFailureMessage' + - 'progress' + - 'hostname' + - 'workspaceId' + - 'vault_id' + - 'attached_vault_id' + - 'createdAt' + - 'updatedAt' + type: 'object' InternalServerResponse: description: 'Internal Server Error - Unexpected server error' example: @@ -12102,6 +12269,62 @@ components: - 'code' - 'message' type: 'object' + InternLifecycleError: + additionalProperties: false + description: 'Intern lifecycle request failure.' + example: + error: + code: 'not_found' + message: 'Intern not found' + properties: + error: + additionalProperties: false + properties: + code: + anyOf: + - type: 'string' + - type: 'integer' + message: + type: 'string' + required: + - 'code' + - 'message' + type: 'object' + required: + - 'error' + type: 'object' + InternListResponse: + additionalProperties: false + description: 'Interns visible to the authenticated API key.' + example: + data: + - attached_vault_id: null + createdAt: '2026-09-16T08:30:00.000Z' + description: 'Researches customer questions' + hostname: 'research-assistant.openrouter.ai' + id: '7c9e6679-7425-40de-944b-e07fc1f90ae7' + instructions: null + lastFailureMessage: null + model: 'openai/gpt-5.4' + name: 'research-assistant' + progress: null + status: 'running' + updatedAt: '2026-09-16T08:45:00.000Z' + vault_id: 'b431c59d-6eed-41ac-bc89-9a89be79a121' + workspaceId: '89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb' + has_more: false + properties: + data: + items: + $ref: '#/components/schemas/Intern' + type: 'array' + has_more: + description: 'True when more interns match the current filters.' + type: 'boolean' + required: + - 'data' + - 'has_more' + type: 'object' ItemReferenceItem: description: 'A reference to a previous response item by ID' example: @@ -22609,6 +22832,15 @@ components: - 'null' x-speakeasy-unknown-values: allow type: 'object' + ProvisionInternResponse: + additionalProperties: false + properties: + provisioning: + const: true + type: 'boolean' + required: + - 'provisioning' + type: 'object' PublicEndpoint: description: 'Information about a specific model endpoint' example: @@ -25585,6 +25817,15 @@ components: seed: type: 'boolean' type: 'object' + SuspendInternResponse: + additionalProperties: false + properties: + suspended: + const: true + type: 'boolean' + required: + - 'suspended' + type: 'object' TaskClassificationItem: example: category_token_share: 0.48 @@ -26941,6 +27182,38 @@ components: required: - 'data' type: 'object' + UpdateInternRequest: + additionalProperties: false + description: 'Lifecycle settings to change. Omitted fields stay unchanged and null clears a field.' + example: + description: 'Researches customer questions' + model: 'openai/gpt-5.4' + properties: + description: + description: 'New free-form description. Null clears it.' + maxLength: 2000 + type: + - 'string' + - 'null' + instructions: + description: 'New standing instructions. Null clears them.' + maxLength: 100000 + type: + - 'string' + - 'null' + model: + description: 'New OpenRouter model slug. Null restores the workspace default.' + maxLength: 200 + type: + - 'string' + - 'null' + name: + description: 'New intern name, unique per creator within the workspace.' + maxLength: 17 + minLength: 2 + pattern: '^[a-z][a-z0-9]*(-[a-z0-9]+)*$' + type: 'string' + type: 'object' UpdateObservabilityDestinationRequest: example: enabled: false @@ -35026,6 +35299,823 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /interns: + get: + description: 'Lists interns visible to the authenticated key, newest first. Filter by workspace and one or more lifecycle statuses. 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.' + operationId: 'listInterns' + parameters: + - description: 'Maximum number of interns to return, from 1 through 500.' + in: 'query' + name: 'limit' + required: false + schema: + description: 'Maximum number of interns to return, from 1 through 500.' + example: 50 + maximum: 500 + minimum: 1 + type: 'integer' + - description: 'Comma-separated lifecycle statuses to include.' + explode: false + in: 'query' + name: 'status' + required: false + schema: + description: 'Comma-separated lifecycle statuses to include.' + example: + - 'queued' + - 'running' + items: + enum: + - 'awaiting_slack_install' + - 'queued' + - 'provisioning' + - 'running' + - 'failed' + - 'stopped' + - 'destroying' + - 'destroy_failed' + type: 'string' + x-speakeasy-unknown-values: allow + type: 'array' + style: 'form' + - description: 'Only return interns in this workspace. It must match the API key workspace.' + in: 'query' + name: 'workspace_id' + required: false + schema: + description: 'Only return interns in this workspace. It must match the API key workspace.' + example: '89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb' + format: 'uuid' + type: 'string' + responses: + '200': + content: + application/json: + example: + data: + - attached_vault_id: null + createdAt: '2026-09-16T08:30:00.000Z' + description: 'Researches customer questions' + hostname: 'research-assistant.openrouter.ai' + id: '7c9e6679-7425-40de-944b-e07fc1f90ae7' + instructions: null + lastFailureMessage: null + model: 'openai/gpt-5.4' + name: 'research-assistant' + progress: null + status: 'running' + updatedAt: '2026-09-16T08:45:00.000Z' + vault_id: 'b431c59d-6eed-41ac-bc89-9a89be79a121' + workspaceId: '89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb' + has_more: false + schema: + $ref: '#/components/schemas/InternListResponse' + description: 'Interns matching the filters.' + '400': + content: + application/json: + example: + error: + code: 'invalid_body' + message: 'Invalid list query' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The list filters are invalid.' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Invalid or missing API key' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'Missing, unknown or provisioning API key.' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Forbidden' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The key owner no longer has access, or the request used a regional hostname.' + '404': + content: + application/json: + example: + error: + code: 'not_found' + message: 'Intern not found' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + '408': + content: + application/json: + example: + error: + code: 408 + message: 'Request timed out' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request exceeded its route deadline.' + '500': + content: + application/json: + example: + error: + code: 'internal_error' + message: 'The request could not be completed' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request could not be completed.' + security: + - apiKey: [] + summary: 'List interns' + tags: + - 'Interns' + post: + description: 'Creates an intern in an explicit workspace. The operation also creates its private vault. It can start provisioning immediately or wait for a later provision call. A retry with the same idempotency key and body resumes unfinished work. The request body is capped at 1048576 bytes and a larger body is refused with 413. 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.' + operationId: 'createIntern' + parameters: + - description: 'Key that makes retries resume the same create operation. Without one, the server derives a stable key from the request body.' + in: 'header' + name: 'Idempotency-Key' + required: false + schema: + description: 'Key that makes retries resume the same create operation. Without one, the server derives a stable key from the request body.' + example: 'create-research-assistant-2026-09-16' + minLength: 1 + type: 'string' + requestBody: + content: + application/json: + example: + name: 'research-assistant' + provision: true + workspace_id: '89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb' + schema: + $ref: '#/components/schemas/CreateInternRequest' + required: true + responses: + '200': + content: + application/json: + example: + attached_vault_id: null + createdAt: '2026-09-16T08:30:00.000Z' + description: 'Researches customer questions' + hostname: 'research-assistant.openrouter.ai' + id: '7c9e6679-7425-40de-944b-e07fc1f90ae7' + instructions: null + lastFailureMessage: null + model: 'openai/gpt-5.4' + name: 'research-assistant' + progress: null + status: 'running' + updatedAt: '2026-09-16T08:45:00.000Z' + vault_id: 'b431c59d-6eed-41ac-bc89-9a89be79a121' + workspaceId: '89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb' + schema: + $ref: '#/components/schemas/Intern' + description: 'A completed create operation was replayed.' + '201': + content: + application/json: + example: + attached_vault_id: null + createdAt: '2026-09-16T08:30:00.000Z' + description: 'Researches customer questions' + hostname: 'research-assistant.openrouter.ai' + id: '7c9e6679-7425-40de-944b-e07fc1f90ae7' + instructions: null + lastFailureMessage: null + model: 'openai/gpt-5.4' + name: 'research-assistant' + progress: null + status: 'running' + updatedAt: '2026-09-16T08:45:00.000Z' + vault_id: 'b431c59d-6eed-41ac-bc89-9a89be79a121' + workspaceId: '89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb' + schema: + $ref: '#/components/schemas/Intern' + description: 'Intern created.' + '400': + content: + application/json: + example: + error: + code: 'invalid_body' + message: 'Invalid request body' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request body is invalid.' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Invalid or missing API key' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'Missing, unknown or provisioning API key.' + '403': + content: + application/json: + example: + error: + code: 'no_acting_user' + message: 'This key acts as the organization and has no member to own a new intern' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The key acts as an organization and has no member who can own the intern, or regional access is refused.' + '404': + content: + application/json: + example: + error: + code: 'not_found' + message: 'Intern not found' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + '408': + content: + application/json: + example: + error: + code: 408 + message: 'Request timed out' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request exceeded its route deadline.' + '409': + content: + application/json: + example: + error: + code: 'idempotency_key_reused' + message: 'This Idempotency-Key was already used with a different request' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The idempotency key was reused, the member reached the intern limit, or the requested vault cannot be attached.' + '413': + content: + application/json: + example: + error: + code: 'payload_too_large' + message: 'Request body exceeds 1048576 bytes' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request body is larger than 1048576 bytes.' + '500': + content: + application/json: + example: + error: + code: 'internal_error' + message: 'The request could not be completed' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request could not be completed.' + '502': + content: + application/json: + example: + error: + code: 'upstream_unavailable' + message: 'The intern was created but setup is not ready yet, retry the request' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The vault or provisioner did not complete a recoverable create step. Retry the same request.' + security: + - apiKey: [] + summary: 'Create an intern' + tags: + - 'Interns' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /interns/{internId}: + delete: + description: 'Starts safe teardown of the intern, its runtime and its private vault. 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.' + operationId: 'deleteIntern' + parameters: + - description: 'ID of an intern visible to the authenticated API key.' + in: 'path' + name: 'internId' + required: true + schema: + description: 'ID of an intern visible to the authenticated API key.' + example: '7c9e6679-7425-40de-944b-e07fc1f90ae7' + minLength: 1 + type: 'string' + responses: + '202': + content: + application/json: + example: + deleting: true + schema: + $ref: '#/components/schemas/DeleteInternResponse' + description: 'The operation was accepted.' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Invalid or missing API key' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'Missing, unknown or provisioning API key.' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Forbidden' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The key owner no longer has access, or the request used a regional hostname.' + '404': + content: + application/json: + example: + error: + code: 'not_found' + message: 'Intern not found' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + '408': + content: + application/json: + example: + error: + code: 408 + message: 'Request timed out' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request exceeded its route deadline.' + '409': + content: + application/json: + example: + error: + code: 'intern_busy' + message: 'The intern is not in a state that allows this operation' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The intern is not in a state that allows this operation.' + '500': + content: + application/json: + example: + error: + code: 'internal_error' + message: 'The request could not be completed' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request could not be completed.' + '502': + content: + application/json: + example: + error: + code: 'upstream_unavailable' + message: 'The intern service could not be reached, retry the request' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The intern service could not accept the operation.' + security: + - apiKey: [] + summary: 'Delete an intern' + tags: + - 'Interns' + get: + description: 'Returns the public lifecycle state and settings for one visible intern. 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.' + operationId: 'getIntern' + parameters: + - description: 'ID of an intern visible to the authenticated API key.' + in: 'path' + name: 'internId' + required: true + schema: + description: 'ID of an intern visible to the authenticated API key.' + example: '7c9e6679-7425-40de-944b-e07fc1f90ae7' + minLength: 1 + type: 'string' + responses: + '200': + content: + application/json: + example: + attached_vault_id: null + createdAt: '2026-09-16T08:30:00.000Z' + description: 'Researches customer questions' + hostname: 'research-assistant.openrouter.ai' + id: '7c9e6679-7425-40de-944b-e07fc1f90ae7' + instructions: null + lastFailureMessage: null + model: 'openai/gpt-5.4' + name: 'research-assistant' + progress: null + status: 'running' + updatedAt: '2026-09-16T08:45:00.000Z' + vault_id: 'b431c59d-6eed-41ac-bc89-9a89be79a121' + workspaceId: '89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb' + schema: + $ref: '#/components/schemas/Intern' + description: 'Intern lifecycle state and settings.' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Invalid or missing API key' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'Missing, unknown or provisioning API key.' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Forbidden' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The key owner no longer has access, or the request used a regional hostname.' + '404': + content: + application/json: + example: + error: + code: 'not_found' + message: 'Intern not found' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + '408': + content: + application/json: + example: + error: + code: 408 + message: 'Request timed out' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request exceeded its route deadline.' + '500': + content: + application/json: + example: + error: + code: 'internal_error' + message: 'The request could not be completed' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request could not be completed.' + security: + - apiKey: [] + summary: 'Get an intern' + tags: + - 'Interns' + patch: + description: 'Changes the intern name, description, instructions or model. Omitted fields stay unchanged. The request body is capped at 1048576 bytes and a larger body is refused with 413. 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.' + operationId: 'updateIntern' + parameters: + - description: 'ID of an intern visible to the authenticated API key.' + in: 'path' + name: 'internId' + required: true + schema: + description: 'ID of an intern visible to the authenticated API key.' + example: '7c9e6679-7425-40de-944b-e07fc1f90ae7' + minLength: 1 + type: 'string' + requestBody: + content: + application/json: + example: + description: 'Researches customer questions' + model: 'openai/gpt-5.4' + schema: + $ref: '#/components/schemas/UpdateInternRequest' + required: true + responses: + '200': + content: + application/json: + example: + attached_vault_id: null + createdAt: '2026-09-16T08:30:00.000Z' + description: 'Researches customer questions' + hostname: 'research-assistant.openrouter.ai' + id: '7c9e6679-7425-40de-944b-e07fc1f90ae7' + instructions: null + lastFailureMessage: null + model: 'openai/gpt-5.4' + name: 'research-assistant' + progress: null + status: 'running' + updatedAt: '2026-09-16T08:45:00.000Z' + vault_id: 'b431c59d-6eed-41ac-bc89-9a89be79a121' + workspaceId: '89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb' + schema: + $ref: '#/components/schemas/Intern' + description: 'Updated intern.' + '400': + content: + application/json: + example: + error: + code: 'invalid_body' + message: 'Invalid request body' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request body is invalid.' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Invalid or missing API key' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'Missing, unknown or provisioning API key.' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Forbidden' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The key owner no longer has access, or the request used a regional hostname.' + '404': + content: + application/json: + example: + error: + code: 'not_found' + message: 'Intern not found' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + '408': + content: + application/json: + example: + error: + code: 408 + message: 'Request timed out' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request exceeded its route deadline.' + '413': + content: + application/json: + example: + error: + code: 'payload_too_large' + message: 'Request body exceeds 1048576 bytes' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request body is larger than 1048576 bytes.' + '500': + content: + application/json: + example: + error: + code: 'internal_error' + message: 'The request could not be completed' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request could not be completed.' + security: + - apiKey: [] + summary: 'Update an intern' + tags: + - 'Interns' + 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.' + operationId: 'provisionIntern' + parameters: + - description: 'ID of an intern visible to the authenticated API key.' + in: 'path' + name: 'internId' + required: true + schema: + description: 'ID of an intern visible to the authenticated API key.' + example: '7c9e6679-7425-40de-944b-e07fc1f90ae7' + minLength: 1 + type: 'string' + responses: + '202': + content: + application/json: + example: + provisioning: true + schema: + $ref: '#/components/schemas/ProvisionInternResponse' + description: 'The operation was accepted.' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Invalid or missing API key' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'Missing, unknown or provisioning API key.' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Forbidden' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The key owner no longer has access, or the request used a regional hostname.' + '404': + content: + application/json: + example: + error: + code: 'not_found' + message: 'Intern not found' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + '408': + content: + application/json: + example: + error: + code: 408 + message: 'Request timed out' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request exceeded its route deadline.' + '409': + content: + application/json: + example: + error: + code: 'intern_busy' + message: 'The intern is not in a state that allows this operation' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The intern is not in a state that allows this operation.' + '500': + content: + application/json: + example: + error: + code: 'internal_error' + message: 'The request could not be completed' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request could not be completed.' + '502': + content: + application/json: + example: + error: + code: 'upstream_unavailable' + message: 'The intern service could not be reached, retry the request' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The intern service could not accept the operation.' + security: + - apiKey: [] + summary: 'Provision an intern' + tags: + - 'Interns' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /interns/{internId}/suspend: + post: + description: 'Stops the intern runtime while keeping its disk and configuration for a later provision call. 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.' + operationId: 'suspendIntern' + parameters: + - description: 'ID of an intern visible to the authenticated API key.' + in: 'path' + name: 'internId' + required: true + schema: + description: 'ID of an intern visible to the authenticated API key.' + example: '7c9e6679-7425-40de-944b-e07fc1f90ae7' + minLength: 1 + type: 'string' + responses: + '200': + content: + application/json: + example: + suspended: true + schema: + $ref: '#/components/schemas/SuspendInternResponse' + description: 'Intern suspended.' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Invalid or missing API key' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'Missing, unknown or provisioning API key.' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Forbidden' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The key owner no longer has access, or the request used a regional hostname.' + '404': + content: + application/json: + example: + error: + code: 'not_found' + message: 'Intern not found' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The caller is outside the Intern API programme, the intern is hidden, or lifecycle writes are disabled.' + '408': + content: + application/json: + example: + error: + code: 408 + message: 'Request timed out' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request exceeded its route deadline.' + '409': + content: + application/json: + example: + error: + code: 'intern_busy' + message: 'The intern is not in a state that allows this operation' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The intern is not in a state that allows this operation.' + '500': + content: + application/json: + example: + error: + code: 'internal_error' + message: 'The request could not be completed' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The request could not be completed.' + '502': + content: + application/json: + example: + error: + code: 'upstream_unavailable' + message: 'The intern service could not be reached, retry the request' + schema: + $ref: '#/components/schemas/InternLifecycleError' + description: 'The intern service could not accept the operation.' + security: + - apiKey: [] + summary: 'Suspend an intern' + tags: + - 'Interns' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /key: get: description: 'Get information on the API key associated with the current authentication session' @@ -43876,6 +44966,8 @@ tags: name: 'Guardrails' - description: 'Images endpoints' name: 'Images' + - description: 'Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key.' + name: 'Interns' - description: 'Model information endpoints' name: 'Models' - description: 'OAuth authentication endpoints' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index d5d5154a..ec177835 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:bc35b2d65e540fa3589a73ca766be826d2fcb377141701fe8efa306648b94fe5 - sourceBlobDigest: sha256:dc406f512b95bc8dac7c348d8fbc5679ae2fc4226f912c018b679710527beb0b + sourceRevisionDigest: sha256:443b98834f174f76dc0b311d693eb12c9c7e768592737d617dfac2fa9dbe058d + sourceBlobDigest: sha256:01745a8db357ebaa81203b5761358ae23ebd01ad128b0c147c51c83acc2b96cc tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:bc35b2d65e540fa3589a73ca766be826d2fcb377141701fe8efa306648b94fe5 - sourceBlobDigest: sha256:dc406f512b95bc8dac7c348d8fbc5679ae2fc4226f912c018b679710527beb0b + sourceRevisionDigest: sha256:443b98834f174f76dc0b311d693eb12c9c7e768592737d617dfac2fa9dbe058d + sourceBlobDigest: sha256:01745a8db357ebaa81203b5761358ae23ebd01ad128b0c147c51c83acc2b96cc codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:fe97af64d72e14c90c2ddaa561854d5a438e4ad1ea6439f23921db822feb52dd + codeSamplesRevisionDigest: sha256:b54d35d212ee1b19496e9f49f44f4d7d0913050f2c47a0204913dc0e9d52992d workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index c4cc5d09..f162e02c 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -2329,4 +2329,14 @@ Based on: ### Generated - [python v1.1.154] . ### Releases -- [PyPI v1.1.154] https://pypi.org/project/openrouter/1.1.154 - . \ No newline at end of file +- [PyPI v1.1.154] https://pypi.org/project/openrouter/1.1.154 - . + +## 2026-09-17 03:32:14 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.1.155] . +### Releases +- [PyPI v1.1.155] https://pypi.org/project/openrouter/1.1.155 - . \ No newline at end of file diff --git a/docs/components/code.mdx b/docs/components/code.mdx index 99c02099..f4cb5da6 100644 --- a/docs/components/code.mdx +++ b/docs/components/code.mdx @@ -2,39 +2,17 @@ title: "Code" --- -## Example Usage +## Supported Types -```python -from openrouter.components import Code +### `str` -# Open enum: unrecognized values are captured as UnrecognizedStr -value: Code = "server_error" +```python +value: str = /* values here */ ``` +### `int` -## Values - -This is an open enum. Unrecognized values will not fail type checks. +```python +value: int = /* values here */ +``` -- `"server_error"` -- `"rate_limit_exceeded"` -- `"invalid_prompt"` -- `"vector_store_timeout"` -- `"invalid_image"` -- `"invalid_image_format"` -- `"invalid_base64_image"` -- `"invalid_image_url"` -- `"image_too_large"` -- `"image_too_small"` -- `"image_parse_error"` -- `"image_content_policy_violation"` -- `"invalid_image_mode"` -- `"image_file_too_large"` -- `"unsupported_image_media_type"` -- `"empty_image_file"` -- `"failed_to_download_image"` -- `"image_file_not_found"` -- `"bio_policy"` -- `"cyber_policy"` -- `"misalignment_policy_violation"` -- `"data_residency_mismatch"` diff --git a/docs/components/codeenum.mdx b/docs/components/codeenum.mdx new file mode 100644 index 00000000..7cbab1b3 --- /dev/null +++ b/docs/components/codeenum.mdx @@ -0,0 +1,40 @@ +--- +title: "CodeEnum" +--- + +## Example Usage + +```python +from openrouter.components import CodeEnum + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: CodeEnum = "server_error" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"server_error"` +- `"rate_limit_exceeded"` +- `"invalid_prompt"` +- `"vector_store_timeout"` +- `"invalid_image"` +- `"invalid_image_format"` +- `"invalid_base64_image"` +- `"invalid_image_url"` +- `"image_too_large"` +- `"image_too_small"` +- `"image_parse_error"` +- `"image_content_policy_violation"` +- `"invalid_image_mode"` +- `"image_file_too_large"` +- `"unsupported_image_media_type"` +- `"empty_image_file"` +- `"failed_to_download_image"` +- `"image_file_not_found"` +- `"bio_policy"` +- `"cyber_policy"` +- `"misalignment_policy_violation"` +- `"data_residency_mismatch"` diff --git a/docs/components/createinternrequest.mdx b/docs/components/createinternrequest.mdx new file mode 100644 index 00000000..a14e0eaf --- /dev/null +++ b/docs/components/createinternrequest.mdx @@ -0,0 +1,17 @@ +--- +title: "CreateInternRequest" +--- + +Settings for a new intern in an explicit workspace. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Free-form description, or null. | +| `instructions` | *OptionalNullable[str]* | :heavy_minus_sign: | Standing instructions the intern boots with, or null. | +| `name` | *str* | :heavy_check_mark: | Intern name, unique per creator within the workspace. | +| `provision` | *Optional[bool]* | :heavy_minus_sign: | Start provisioning during this create operation. Defaults to false. | +| `vault_id` | *Optional[str]* | :heavy_minus_sign: | Vault owned by another intern in this workspace to attach as a borrowed vault. | +| `workspace_id` | *str* | :heavy_check_mark: | Workspace that will own the intern. It must match the API key workspace. | \ No newline at end of file diff --git a/docs/components/deleteinternresponse.mdx b/docs/components/deleteinternresponse.mdx new file mode 100644 index 00000000..dcf556fc --- /dev/null +++ b/docs/components/deleteinternresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "DeleteInternResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `deleting` | *Literal[True]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/intern.mdx b/docs/components/intern.mdx new file mode 100644 index 00000000..71f5da0f --- /dev/null +++ b/docs/components/intern.mdx @@ -0,0 +1,25 @@ +--- +title: "Intern" +--- + +Public lifecycle state and settings for one intern. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `attached_vault_id` | *Nullable[str]* | :heavy_check_mark: | Vault the intern borrows from another intern, or null when it borrows none. | +| `created_at` | *str* | :heavy_check_mark: | ISO 8601 creation time. | +| `description` | *Nullable[str]* | :heavy_check_mark: | Free-form description. | +| `hostname` | *Nullable[str]* | :heavy_check_mark: | Public hostname the intern is reachable at, or null until provisioning has assigned one. | +| `id` | *str* | :heavy_check_mark: | Intern id. | +| `instructions` | *Nullable[str]* | :heavy_check_mark: | Standing instructions the intern boots with. | +| `last_failure_message` | *Nullable[str]* | :heavy_check_mark: | Why the last provisioning attempt failed, when status is failed. | +| `model` | *Nullable[str]* | :heavy_check_mark: | OpenRouter model slug the intern runs, or null for the workspace default. | +| `name` | *str* | :heavy_check_mark: | Intern name, unique per creator within a workspace. | +| `progress` | [Nullable[components.Progress]](../components/progress.mdx) | :heavy_check_mark: | Active provisioning step, or null once provisioning has settled. | +| `status` | [components.InternStatus](../components/internstatus.mdx) | :heavy_check_mark: | Lifecycle status. | +| `updated_at` | *str* | :heavy_check_mark: | ISO 8601 last update time. | +| `vault_id` | *Nullable[str]* | :heavy_check_mark: | Vault the intern owns, or null before it has been created. | +| `workspace_id` | *str* | :heavy_check_mark: | Workspace that owns the intern and scopes its secrets. | \ No newline at end of file diff --git a/docs/components/internlifecycleerrorerror.mdx b/docs/components/internlifecycleerrorerror.mdx new file mode 100644 index 00000000..c9eacd7d --- /dev/null +++ b/docs/components/internlifecycleerrorerror.mdx @@ -0,0 +1,10 @@ +--- +title: "InternLifecycleErrorError" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | +| `code` | [components.Code](../components/code.mdx) | :heavy_check_mark: | N/A | +| `message` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/internlistresponse.mdx b/docs/components/internlistresponse.mdx new file mode 100644 index 00000000..c3d3d07c --- /dev/null +++ b/docs/components/internlistresponse.mdx @@ -0,0 +1,13 @@ +--- +title: "InternListResponse" +--- + +Interns visible to the authenticated API key. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `data` | List[[components.Intern](../components/intern.mdx)] | :heavy_check_mark: | N/A | +| `has_more` | *bool* | :heavy_check_mark: | True when more interns match the current filters. | \ No newline at end of file diff --git a/docs/components/internstatus.mdx b/docs/components/internstatus.mdx new file mode 100644 index 00000000..b0753ab0 --- /dev/null +++ b/docs/components/internstatus.mdx @@ -0,0 +1,28 @@ +--- +title: "InternStatus" +--- + +Lifecycle status. + +## Example Usage + +```python +from openrouter.components import InternStatus + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: InternStatus = "awaiting_slack_install" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"awaiting_slack_install"` +- `"queued"` +- `"provisioning"` +- `"running"` +- `"failed"` +- `"stopped"` +- `"destroying"` +- `"destroy_failed"` diff --git a/docs/components/progress.mdx b/docs/components/progress.mdx new file mode 100644 index 00000000..1c5f4b73 --- /dev/null +++ b/docs/components/progress.mdx @@ -0,0 +1,14 @@ +--- +title: "Progress" +--- + +Active provisioning step, or null once provisioning has settled. + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `step_label` | *str* | :heavy_check_mark: | Human-readable label of the active provisioning step. | +| `step_number` | *int* | :heavy_check_mark: | One-based index of the active step. | +| `total_steps` | *int* | :heavy_check_mark: | Number of provisioning steps. | \ No newline at end of file diff --git a/docs/components/provisioninternresponse.mdx b/docs/components/provisioninternresponse.mdx new file mode 100644 index 00000000..be1e5af9 --- /dev/null +++ b/docs/components/provisioninternresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ProvisionInternResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `provisioning` | *Literal[True]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/responseserrorfield.mdx b/docs/components/responseserrorfield.mdx index 996cffee..c5eb0598 100644 --- a/docs/components/responseserrorfield.mdx +++ b/docs/components/responseserrorfield.mdx @@ -7,7 +7,7 @@ Error information returned from the API ## Fields -| Field | Type | Required | Description | -| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| `code` | [components.Code](../components/code.mdx) | :heavy_check_mark: | N/A | -| `message` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | +| `code` | [components.CodeEnum](../components/codeenum.mdx) | :heavy_check_mark: | N/A | +| `message` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/suspendinternresponse.mdx b/docs/components/suspendinternresponse.mdx new file mode 100644 index 00000000..7a513bd2 --- /dev/null +++ b/docs/components/suspendinternresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "SuspendInternResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `suspended` | *Literal[True]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/updateinternrequest.mdx b/docs/components/updateinternrequest.mdx new file mode 100644 index 00000000..49d486ef --- /dev/null +++ b/docs/components/updateinternrequest.mdx @@ -0,0 +1,15 @@ +--- +title: "UpdateInternRequest" +--- + +Lifecycle settings to change. Omitted fields stay unchanged and null clears a field. + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | New free-form description. Null clears it. | +| `instructions` | *OptionalNullable[str]* | :heavy_minus_sign: | New standing instructions. Null clears them. | +| `model` | *OptionalNullable[str]* | :heavy_minus_sign: | New OpenRouter model slug. Null restores the workspace default. | +| `name` | *Optional[str]* | :heavy_minus_sign: | New intern name, unique per creator within the workspace. | \ No newline at end of file diff --git a/docs/errors/internlifecycleerror.mdx b/docs/errors/internlifecycleerror.mdx new file mode 100644 index 00000000..9de3964c --- /dev/null +++ b/docs/errors/internlifecycleerror.mdx @@ -0,0 +1,12 @@ +--- +title: "InternLifecycleError" +--- + +Intern lifecycle request failure. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `error` | [components.InternLifecycleErrorError](../components/internlifecycleerrorerror.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/createinternglobals.mdx b/docs/operations/createinternglobals.mdx new file mode 100644 index 00000000..8eb5e1fc --- /dev/null +++ b/docs/operations/createinternglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "CreateInternGlobals" +--- + +## 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/createinternrequest.mdx b/docs/operations/createinternrequest.mdx new file mode 100644 index 00000000..0806040f --- /dev/null +++ b/docs/operations/createinternrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "CreateInternRequest" +--- + +## 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.
| | +| `idempotency_key` | *Optional[str]* | :heavy_minus_sign: | Key that makes retries resume the same create operation. Without one, the server derives a stable key from the request body. | create-research-assistant-2026-09-16 | +| `create_intern_request` | [components.CreateInternRequest](../components/createinternrequest.mdx) | :heavy_check_mark: | N/A | \{
"name": "research-assistant",
"provision": true,
"workspace_id": "89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb"
} | \ No newline at end of file diff --git a/docs/operations/deleteinternglobals.mdx b/docs/operations/deleteinternglobals.mdx new file mode 100644 index 00000000..fd39b2b5 --- /dev/null +++ b/docs/operations/deleteinternglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "DeleteInternGlobals" +--- + +## 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/deleteinternrequest.mdx b/docs/operations/deleteinternrequest.mdx new file mode 100644 index 00000000..b655daea --- /dev/null +++ b/docs/operations/deleteinternrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "DeleteInternRequest" +--- + +## 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: | ID of an intern visible to the authenticated API key. | 7c9e6679-7425-40de-944b-e07fc1f90ae7 | \ No newline at end of file diff --git a/docs/operations/getinternglobals.mdx b/docs/operations/getinternglobals.mdx new file mode 100644 index 00000000..118bb0d2 --- /dev/null +++ b/docs/operations/getinternglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "GetInternGlobals" +--- + +## 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/getinternrequest.mdx b/docs/operations/getinternrequest.mdx new file mode 100644 index 00000000..cd83fdf5 --- /dev/null +++ b/docs/operations/getinternrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "GetInternRequest" +--- + +## 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: | ID of an intern visible to the authenticated API key. | 7c9e6679-7425-40de-944b-e07fc1f90ae7 | \ No newline at end of file diff --git a/docs/operations/listinternsglobals.mdx b/docs/operations/listinternsglobals.mdx new file mode 100644 index 00000000..3a55ed59 --- /dev/null +++ b/docs/operations/listinternsglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "ListInternsGlobals" +--- + +## 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/listinternsrequest.mdx b/docs/operations/listinternsrequest.mdx new file mode 100644 index 00000000..d1a3e4c6 --- /dev/null +++ b/docs/operations/listinternsrequest.mdx @@ -0,0 +1,14 @@ +--- +title: "ListInternsRequest" +--- + +## 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.
| | +| `limit` | *Optional[int]* | :heavy_minus_sign: | Maximum number of interns to return, from 1 through 500. | 50 | +| `status` | List[[operations.Status](../operations/status.mdx)] | :heavy_minus_sign: | Comma-separated lifecycle statuses to include. | [
"queued",
"running"
] | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | Only return interns in this workspace. It must match the API key workspace. | 89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb | \ No newline at end of file diff --git a/docs/operations/provisioninternglobals.mdx b/docs/operations/provisioninternglobals.mdx new file mode 100644 index 00000000..5e790162 --- /dev/null +++ b/docs/operations/provisioninternglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "ProvisionInternGlobals" +--- + +## 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/provisioninternrequest.mdx b/docs/operations/provisioninternrequest.mdx new file mode 100644 index 00000000..5c14eb74 --- /dev/null +++ b/docs/operations/provisioninternrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "ProvisionInternRequest" +--- + +## 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: | ID of an intern visible to the authenticated API key. | 7c9e6679-7425-40de-944b-e07fc1f90ae7 | \ No newline at end of file diff --git a/docs/operations/status.mdx b/docs/operations/status.mdx new file mode 100644 index 00000000..afe17b53 --- /dev/null +++ b/docs/operations/status.mdx @@ -0,0 +1,26 @@ +--- +title: "Status" +--- + +## Example Usage + +```python +from openrouter.operations import Status + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: Status = "awaiting_slack_install" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"awaiting_slack_install"` +- `"queued"` +- `"provisioning"` +- `"running"` +- `"failed"` +- `"stopped"` +- `"destroying"` +- `"destroy_failed"` diff --git a/docs/operations/suspendinternglobals.mdx b/docs/operations/suspendinternglobals.mdx new file mode 100644 index 00000000..3837a617 --- /dev/null +++ b/docs/operations/suspendinternglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "SuspendInternGlobals" +--- + +## 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/suspendinternrequest.mdx b/docs/operations/suspendinternrequest.mdx new file mode 100644 index 00000000..d039292f --- /dev/null +++ b/docs/operations/suspendinternrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "SuspendInternRequest" +--- + +## 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: | ID of an intern visible to the authenticated API key. | 7c9e6679-7425-40de-944b-e07fc1f90ae7 | \ No newline at end of file diff --git a/docs/operations/updateinternglobals.mdx b/docs/operations/updateinternglobals.mdx new file mode 100644 index 00000000..ef2e1631 --- /dev/null +++ b/docs/operations/updateinternglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "UpdateInternGlobals" +--- + +## 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/updateinternrequest.mdx b/docs/operations/updateinternrequest.mdx new file mode 100644 index 00000000..059a2165 --- /dev/null +++ b/docs/operations/updateinternrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "UpdateInternRequest" +--- + +## 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: | ID of an intern visible to the authenticated API key. | 7c9e6679-7425-40de-944b-e07fc1f90ae7 | +| `update_intern_request` | [components.UpdateInternRequest](../components/updateinternrequest.mdx) | :heavy_check_mark: | N/A | \{
"description": "Researches customer questions",
"model": "openai/gpt-5.4"
} | \ No newline at end of file diff --git a/docs/sdks/interns/README.mdx b/docs/sdks/interns/README.mdx new file mode 100644 index 00000000..4b26b50d --- /dev/null +++ b/docs/sdks/interns/README.mdx @@ -0,0 +1,359 @@ +--- +title: "Interns" +description: "Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key." +--- + +## Overview + +Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key. + +### Available Operations + +* [list_interns](#list_interns) - List interns +* [create_intern](#create_intern) - Create an intern +* [delete_intern](#delete_intern) - Delete an intern +* [get_intern](#get_intern) - Get an intern +* [update_intern](#update_intern) - Update an intern +* [provision_intern](#provision_intern) - Provision an intern +* [suspend_intern](#suspend_intern) - Suspend an intern + +## list_interns + +Lists interns visible to the authenticated key, newest first. Filter by workspace and one or more lifecycle statuses. 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. + +### 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.list_interns() + + # Handle response + print(res) + +``` + +### 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.
| | +| `limit` | *Optional[int]* | :heavy_minus_sign: | Maximum number of interns to return, from 1 through 500. | 50 | +| `status` | List[[operations.Status](../../operations/status.mdx)] | :heavy_minus_sign: | Comma-separated lifecycle statuses to include. | [
"queued",
"running"
] | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | Only return interns in this workspace. It must match the API key workspace. | 89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.InternListResponse](../../components/internlistresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------- | ----------------------------- | ----------------------------- | +| errors.InternLifecycleError | 400, 401, 403, 404, 408 | application/json | +| errors.InternLifecycleError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## create_intern + +Creates an intern in an explicit workspace. The operation also creates its private vault. It can start provisioning immediately or wait for a later provision call. A retry with the same idempotency key and body resumes unfinished work. The request body is capped at 1048576 bytes and a larger body is refused with 413. 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. + +### 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.create_intern(name="research-assistant", workspace_id="89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb", provision=True) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `name` | *str* | :heavy_check_mark: | Intern name, unique per creator within the workspace. | | +| `workspace_id` | *str* | :heavy_check_mark: | Workspace that will own the intern. It must match the API key workspace. | | +| `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.
| | +| `idempotency_key` | *Optional[str]* | :heavy_minus_sign: | Key that makes retries resume the same create operation. Without one, the server derives a stable key from the request body. | create-research-assistant-2026-09-16 | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Free-form description, or null. | | +| `instructions` | *OptionalNullable[str]* | :heavy_minus_sign: | Standing instructions the intern boots with, or null. | | +| `provision` | *Optional[bool]* | :heavy_minus_sign: | Start provisioning during this create operation. Defaults to false. | | +| `vault_id` | *Optional[str]* | :heavy_minus_sign: | Vault owned by another intern in this workspace to attach as a borrowed vault. | | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.Intern](../../components/intern.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.InternLifecycleError | 400, 401, 403, 404, 408, 409, 413 | application/json | +| errors.InternLifecycleError | 500, 502 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## delete_intern + +Starts safe teardown of the intern, its runtime and its private vault. 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. + +### 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.delete_intern(intern_id="7c9e6679-7425-40de-944b-e07fc1f90ae7") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `intern_id` | *str* | :heavy_check_mark: | ID of an intern visible to the authenticated API key. | 7c9e6679-7425-40de-944b-e07fc1f90ae7 | +| `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.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.DeleteInternResponse](../../components/deleteinternresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------- | ----------------------------- | ----------------------------- | +| errors.InternLifecycleError | 401, 403, 404, 408, 409 | application/json | +| errors.InternLifecycleError | 500, 502 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## get_intern + +Returns the public lifecycle state and settings for one visible intern. 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. + +### 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.get_intern(intern_id="7c9e6679-7425-40de-944b-e07fc1f90ae7") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `intern_id` | *str* | :heavy_check_mark: | ID of an intern visible to the authenticated API key. | 7c9e6679-7425-40de-944b-e07fc1f90ae7 | +| `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.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.Intern](../../components/intern.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------- | ----------------------------- | ----------------------------- | +| errors.InternLifecycleError | 401, 403, 404, 408 | application/json | +| errors.InternLifecycleError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## update_intern + +Changes the intern name, description, instructions or model. Omitted fields stay unchanged. The request body is capped at 1048576 bytes and a larger body is refused with 413. 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. + +### 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.update_intern(intern_id="7c9e6679-7425-40de-944b-e07fc1f90ae7", description="Researches customer questions", model="openai/gpt-5.4") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `intern_id` | *str* | :heavy_check_mark: | ID of an intern visible to the authenticated API key. | 7c9e6679-7425-40de-944b-e07fc1f90ae7 | +| `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.
| | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | New free-form description. Null clears it. | | +| `instructions` | *OptionalNullable[str]* | :heavy_minus_sign: | New standing instructions. Null clears them. | | +| `model` | *OptionalNullable[str]* | :heavy_minus_sign: | New OpenRouter model slug. Null restores the workspace default. | | +| `name` | *Optional[str]* | :heavy_minus_sign: | New intern name, unique per creator within the workspace. | | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.Intern](../../components/intern.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------- | ----------------------------- | ----------------------------- | +| errors.InternLifecycleError | 400, 401, 403, 404, 408, 413 | application/json | +| errors.InternLifecycleError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## provision_intern + +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. + +### 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.provision_intern(intern_id="7c9e6679-7425-40de-944b-e07fc1f90ae7") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `intern_id` | *str* | :heavy_check_mark: | ID of an intern visible to the authenticated API key. | 7c9e6679-7425-40de-944b-e07fc1f90ae7 | +| `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.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.ProvisionInternResponse](../../components/provisioninternresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------- | ----------------------------- | ----------------------------- | +| errors.InternLifecycleError | 401, 403, 404, 408, 409 | application/json | +| errors.InternLifecycleError | 500, 502 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## suspend_intern + +Stops the intern runtime while keeping its disk and configuration for a later provision call. 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. + +### 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.suspend_intern(intern_id="7c9e6679-7425-40de-944b-e07fc1f90ae7") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `intern_id` | *str* | :heavy_check_mark: | ID of an intern visible to the authenticated API key. | 7c9e6679-7425-40de-944b-e07fc1f90ae7 | +| `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.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.SuspendInternResponse](../../components/suspendinternresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------- | ----------------------------- | ----------------------------- | +| 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 diff --git a/pyproject.toml b/pyproject.toml index fed68690..064099c5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.1.154" +version = "1.1.155" 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 e2deff10..dd5994a8 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.154" +__version__: str = "1.1.155" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.1.154 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.1.155 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index e1c0f7fe..7f9810b0 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -885,6 +885,7 @@ CreateGuardrailResponse, CreateGuardrailResponseTypedDict, ) + from .createinternrequest import CreateInternRequest, CreateInternRequestTypedDict from .createobservabilitydestinationrequest import ( CreateObservabilityDestinationRequest, CreateObservabilityDestinationRequestType, @@ -991,6 +992,10 @@ DeleteGuardrailResponse, DeleteGuardrailResponseTypedDict, ) + from .deleteinternresponse import ( + DeleteInternResponse, + DeleteInternResponseTypedDict, + ) from .deleteobservabilitydestinationresponse import ( DeleteObservabilityDestinationResponse, DeleteObservabilityDestinationResponseTypedDict, @@ -1521,10 +1526,24 @@ InputVideoTypedDict, ) from .instructtype import InstructType + from .intern import ( + Intern, + InternStatus, + InternTypedDict, + Progress, + ProgressTypedDict, + ) from .internalserverresponseerrordata import ( InternalServerResponseErrorData, InternalServerResponseErrorDataTypedDict, ) + from .internlifecycleerror import ( + Code, + CodeTypedDict, + InternLifecycleErrorError, + InternLifecycleErrorErrorTypedDict, + ) + from .internlistresponse import InternListResponse, InternListResponseTypedDict from .itemreferenceitem import ( ItemReferenceItem, ItemReferenceItemType, @@ -2595,6 +2614,10 @@ ProviderSortConfig, ProviderSortConfigTypedDict, ) + from .provisioninternresponse import ( + ProvisionInternResponse, + ProvisionInternResponseTypedDict, + ) from .publicendpoint import ( Embeddings, EmbeddingsTypedDict, @@ -2746,7 +2769,7 @@ ResponseOutputTextTypedDict, ) from .responseserrorfield import ( - Code, + CodeEnum, ResponsesErrorField, ResponsesErrorFieldTypedDict, ) @@ -2983,6 +3006,10 @@ SubmitGenerationFeedbackResponseDataTypedDict, SubmitGenerationFeedbackResponseTypedDict, ) + from .suspendinternresponse import ( + SuspendInternResponse, + SuspendInternResponseTypedDict, + ) from .taskclassificationitem import ( TaskClassificationItem, TaskClassificationItemTypedDict, @@ -3123,6 +3150,7 @@ UpdateGuardrailResponse, UpdateGuardrailResponseTypedDict, ) + from .updateinternrequest import UpdateInternRequest, UpdateInternRequestTypedDict from .updateobservabilitydestinationrequest import ( UpdateObservabilityDestinationRequest, UpdateObservabilityDestinationRequestTypedDict, @@ -3772,6 +3800,7 @@ "ClearToolInputs", "ClearToolInputsTypedDict", "Code", + "CodeEnum", "CodeInterpreterCallCodeDeltaEvent", "CodeInterpreterCallCodeDeltaEventType", "CodeInterpreterCallCodeDeltaEventTypedDict", @@ -3798,6 +3827,7 @@ "CodeInterpreterLogsOutputTypedDict", "CodeInterpreterServerTool", "CodeInterpreterServerToolTypedDict", + "CodeTypedDict", "CodexLocalShellTool", "CodexLocalShellToolType", "CodexLocalShellToolTypedDict", @@ -3925,6 +3955,8 @@ "CreateGuardrailRequestTypedDict", "CreateGuardrailResponse", "CreateGuardrailResponseTypedDict", + "CreateInternRequest", + "CreateInternRequestTypedDict", "CreateObservabilityDestinationRequest", "CreateObservabilityDestinationRequestType", "CreateObservabilityDestinationRequestTypedDict", @@ -3988,6 +4020,8 @@ "DeleteBYOKKeyResponseTypedDict", "DeleteGuardrailResponse", "DeleteGuardrailResponseTypedDict", + "DeleteInternResponse", + "DeleteInternResponseTypedDict", "DeleteObservabilityDestinationResponse", "DeleteObservabilityDestinationResponseTypedDict", "DeleteScimGroupMappingResponse", @@ -4393,6 +4427,13 @@ "InputsUnion1TypedDict", "InputsUnionTypedDict", "InstructType", + "Intern", + "InternLifecycleErrorError", + "InternLifecycleErrorErrorTypedDict", + "InternListResponse", + "InternListResponseTypedDict", + "InternStatus", + "InternTypedDict", "InternalServerResponseErrorData", "InternalServerResponseErrorDataTypedDict", "IssuedTokenType", @@ -5063,6 +5104,8 @@ "PricingOverrideTypedDict", "PricingTypedDict", "PrimaryMetric", + "Progress", + "ProgressTypedDict", "PromptCacheBreakpoint", "PromptCacheBreakpointMode", "PromptCacheBreakpointTypedDict", @@ -5091,6 +5134,8 @@ "ProviderSort", "ProviderSortConfig", "ProviderSortConfigTypedDict", + "ProvisionInternResponse", + "ProvisionInternResponseTypedDict", "PublicEndpoint", "PublicEndpointTypedDict", "PublicPricing", @@ -5377,6 +5422,8 @@ "SupportedFrameImage", "SupportedResolution", "SupportedSize", + "SuspendInternResponse", + "SuspendInternResponseTypedDict", "Syntax", "System", "SystemTypedDict", @@ -5583,6 +5630,8 @@ "UpdateGuardrailRequestTypedDict", "UpdateGuardrailResponse", "UpdateGuardrailResponseTypedDict", + "UpdateInternRequest", + "UpdateInternRequestTypedDict", "UpdateObservabilityDestinationRequest", "UpdateObservabilityDestinationRequestTypedDict", "UpdateObservabilityDestinationResponse", @@ -6308,6 +6357,8 @@ "CreateGuardrailRequestTypedDict": ".createguardrailrequest", "CreateGuardrailResponse": ".createguardrailresponse", "CreateGuardrailResponseTypedDict": ".createguardrailresponse", + "CreateInternRequest": ".createinternrequest", + "CreateInternRequestTypedDict": ".createinternrequest", "CreateObservabilityDestinationRequest": ".createobservabilitydestinationrequest", "CreateObservabilityDestinationRequestType": ".createobservabilitydestinationrequest", "CreateObservabilityDestinationRequestTypedDict": ".createobservabilitydestinationrequest", @@ -6380,6 +6431,8 @@ "DeleteBYOKKeyResponseTypedDict": ".deletebyokkeyresponse", "DeleteGuardrailResponse": ".deleteguardrailresponse", "DeleteGuardrailResponseTypedDict": ".deleteguardrailresponse", + "DeleteInternResponse": ".deleteinternresponse", + "DeleteInternResponseTypedDict": ".deleteinternresponse", "DeleteObservabilityDestinationResponse": ".deleteobservabilitydestinationresponse", "DeleteObservabilityDestinationResponseTypedDict": ".deleteobservabilitydestinationresponse", "DeleteScimGroupMappingResponse": ".deletescimgroupmappingresponse", @@ -6784,8 +6837,19 @@ "InputVideoType": ".inputvideo", "InputVideoTypedDict": ".inputvideo", "InstructType": ".instructtype", + "Intern": ".intern", + "InternStatus": ".intern", + "InternTypedDict": ".intern", + "Progress": ".intern", + "ProgressTypedDict": ".intern", "InternalServerResponseErrorData": ".internalserverresponseerrordata", "InternalServerResponseErrorDataTypedDict": ".internalserverresponseerrordata", + "Code": ".internlifecycleerror", + "CodeTypedDict": ".internlifecycleerror", + "InternLifecycleErrorError": ".internlifecycleerror", + "InternLifecycleErrorErrorTypedDict": ".internlifecycleerror", + "InternListResponse": ".internlistresponse", + "InternListResponseTypedDict": ".internlistresponse", "ItemReferenceItem": ".itemreferenceitem", "ItemReferenceItemType": ".itemreferenceitem", "ItemReferenceItemTypedDict": ".itemreferenceitem", @@ -7619,6 +7683,8 @@ "Partition": ".providersortconfig", "ProviderSortConfig": ".providersortconfig", "ProviderSortConfigTypedDict": ".providersortconfig", + "ProvisionInternResponse": ".provisioninternresponse", + "ProvisionInternResponseTypedDict": ".provisioninternresponse", "Embeddings": ".publicendpoint", "EmbeddingsTypedDict": ".publicendpoint", "ImageGeneration": ".publicendpoint", @@ -7725,7 +7791,7 @@ "ResponseOutputTextTopLogprobTypedDict": ".responseoutputtext", "ResponseOutputTextType": ".responseoutputtext", "ResponseOutputTextTypedDict": ".responseoutputtext", - "Code": ".responseserrorfield", + "CodeEnum": ".responseserrorfield", "ResponsesErrorField": ".responseserrorfield", "ResponsesErrorFieldTypedDict": ".responseserrorfield", "ReasoningConfig": ".responsesrequest", @@ -7901,6 +7967,8 @@ "SubmitGenerationFeedbackResponseData": ".submitgenerationfeedbackresponse", "SubmitGenerationFeedbackResponseDataTypedDict": ".submitgenerationfeedbackresponse", "SubmitGenerationFeedbackResponseTypedDict": ".submitgenerationfeedbackresponse", + "SuspendInternResponse": ".suspendinternresponse", + "SuspendInternResponseTypedDict": ".suspendinternresponse", "TaskClassificationItem": ".taskclassificationitem", "TaskClassificationItemTypedDict": ".taskclassificationitem", "TaskClassificationMacroCategory": ".taskclassificationmacrocategory", @@ -7994,6 +8062,8 @@ "UpdateGuardrailRequestTypedDict": ".updateguardrailrequest", "UpdateGuardrailResponse": ".updateguardrailresponse", "UpdateGuardrailResponseTypedDict": ".updateguardrailresponse", + "UpdateInternRequest": ".updateinternrequest", + "UpdateInternRequestTypedDict": ".updateinternrequest", "UpdateObservabilityDestinationRequest": ".updateobservabilitydestinationrequest", "UpdateObservabilityDestinationRequestTypedDict": ".updateobservabilitydestinationrequest", "UpdateObservabilityDestinationResponse": ".updateobservabilitydestinationresponse", diff --git a/src/openrouter/components/createinternrequest.py b/src/openrouter/components/createinternrequest.py new file mode 100644 index 00000000..f8da7513 --- /dev/null +++ b/src/openrouter/components/createinternrequest.py @@ -0,0 +1,77 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class CreateInternRequestTypedDict(TypedDict): + r"""Settings for a new intern in an explicit workspace.""" + + name: str + r"""Intern name, unique per creator within the workspace.""" + workspace_id: str + r"""Workspace that will own the intern. It must match the API key workspace.""" + description: NotRequired[Nullable[str]] + r"""Free-form description, or null.""" + instructions: NotRequired[Nullable[str]] + r"""Standing instructions the intern boots with, or null.""" + provision: NotRequired[bool] + r"""Start provisioning during this create operation. Defaults to false.""" + vault_id: NotRequired[str] + r"""Vault owned by another intern in this workspace to attach as a borrowed vault.""" + + +class CreateInternRequest(BaseModel): + r"""Settings for a new intern in an explicit workspace.""" + + name: str + r"""Intern name, unique per creator within the workspace.""" + + workspace_id: str + r"""Workspace that will own the intern. It must match the API key workspace.""" + + description: OptionalNullable[str] = UNSET + r"""Free-form description, or null.""" + + instructions: OptionalNullable[str] = UNSET + r"""Standing instructions the intern boots with, or null.""" + + provision: Optional[bool] = False + r"""Start provisioning during this create operation. Defaults to false.""" + + vault_id: Optional[str] = None + r"""Vault owned by another intern in this workspace to attach as a borrowed vault.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["description", "instructions", "provision", "vault_id"]) + nullable_fields = set(["description", "instructions"]) + 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/deleteinternresponse.py b/src/openrouter/components/deleteinternresponse.py new file mode 100644 index 00000000..8be686f4 --- /dev/null +++ b/src/openrouter/components/deleteinternresponse.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 openrouter.utils import validate_const +import pydantic +from pydantic.functional_validators import AfterValidator +from typing import Literal +from typing_extensions import Annotated, TypedDict + + +class DeleteInternResponseTypedDict(TypedDict): + deleting: Literal[True] + + +class DeleteInternResponse(BaseModel): + DELETING: Annotated[ + Annotated[Literal[True], AfterValidator(validate_const(True))], + pydantic.Field(alias="deleting"), + ] = True + + +try: + DeleteInternResponse.model_rebuild() +except NameError: + pass diff --git a/src/openrouter/components/intern.py b/src/openrouter/components/intern.py new file mode 100644 index 00000000..0613b4b5 --- /dev/null +++ b/src/openrouter/components/intern.py @@ -0,0 +1,153 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr +import pydantic +from pydantic import model_serializer +from typing import Literal, Union +from typing_extensions import Annotated, TypedDict + + +class ProgressTypedDict(TypedDict): + r"""Active provisioning step, or null once provisioning has settled.""" + + step_label: str + r"""Human-readable label of the active provisioning step.""" + step_number: int + r"""One-based index of the active step.""" + total_steps: int + r"""Number of provisioning steps.""" + + +class Progress(BaseModel): + r"""Active provisioning step, or null once provisioning has settled.""" + + step_label: Annotated[str, pydantic.Field(alias="stepLabel")] + r"""Human-readable label of the active provisioning step.""" + + step_number: Annotated[int, pydantic.Field(alias="stepNumber")] + r"""One-based index of the active step.""" + + total_steps: Annotated[int, pydantic.Field(alias="totalSteps")] + r"""Number of provisioning steps.""" + + +InternStatus = Union[ + Literal[ + "awaiting_slack_install", + "queued", + "provisioning", + "running", + "failed", + "stopped", + "destroying", + "destroy_failed", + ], + UnrecognizedStr, +] +r"""Lifecycle status.""" + + +class InternTypedDict(TypedDict): + r"""Public lifecycle state and settings for one intern.""" + + attached_vault_id: Nullable[str] + r"""Vault the intern borrows from another intern, or null when it borrows none.""" + created_at: str + r"""ISO 8601 creation time.""" + description: Nullable[str] + r"""Free-form description.""" + hostname: Nullable[str] + r"""Public hostname the intern is reachable at, or null until provisioning has assigned one.""" + id: str + r"""Intern id.""" + instructions: Nullable[str] + r"""Standing instructions the intern boots with.""" + last_failure_message: Nullable[str] + r"""Why the last provisioning attempt failed, when status is failed.""" + model: Nullable[str] + r"""OpenRouter model slug the intern runs, or null for the workspace default.""" + name: str + r"""Intern name, unique per creator within a workspace.""" + progress: Nullable[ProgressTypedDict] + r"""Active provisioning step, or null once provisioning has settled.""" + status: InternStatus + r"""Lifecycle status.""" + updated_at: str + r"""ISO 8601 last update time.""" + vault_id: Nullable[str] + r"""Vault the intern owns, or null before it has been created.""" + workspace_id: str + r"""Workspace that owns the intern and scopes its secrets.""" + + +class Intern(BaseModel): + r"""Public lifecycle state and settings for one intern.""" + + attached_vault_id: Nullable[str] + r"""Vault the intern borrows from another intern, or null when it borrows none.""" + + created_at: Annotated[str, pydantic.Field(alias="createdAt")] + r"""ISO 8601 creation time.""" + + description: Nullable[str] + r"""Free-form description.""" + + hostname: Nullable[str] + r"""Public hostname the intern is reachable at, or null until provisioning has assigned one.""" + + id: str + r"""Intern id.""" + + instructions: Nullable[str] + r"""Standing instructions the intern boots with.""" + + last_failure_message: Annotated[ + Nullable[str], pydantic.Field(alias="lastFailureMessage") + ] + r"""Why the last provisioning attempt failed, when status is failed.""" + + model: Nullable[str] + r"""OpenRouter model slug the intern runs, or null for the workspace default.""" + + name: str + r"""Intern name, unique per creator within a workspace.""" + + progress: Nullable[Progress] + r"""Active provisioning step, or null once provisioning has settled.""" + + status: InternStatus + r"""Lifecycle status.""" + + updated_at: Annotated[str, pydantic.Field(alias="updatedAt")] + r"""ISO 8601 last update time.""" + + vault_id: Nullable[str] + r"""Vault the intern owns, or null before it has been created.""" + + workspace_id: Annotated[str, pydantic.Field(alias="workspaceId")] + r"""Workspace that owns the intern and scopes its secrets.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m + + +try: + Progress.model_rebuild() +except NameError: + pass +try: + Intern.model_rebuild() +except NameError: + pass diff --git a/src/openrouter/components/internlifecycleerror.py b/src/openrouter/components/internlifecycleerror.py new file mode 100644 index 00000000..589fcd03 --- /dev/null +++ b/src/openrouter/components/internlifecycleerror.py @@ -0,0 +1,23 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Union +from typing_extensions import TypeAliasType, TypedDict + + +CodeTypedDict = TypeAliasType("CodeTypedDict", Union[str, int]) + + +Code = TypeAliasType("Code", Union[str, int]) + + +class InternLifecycleErrorErrorTypedDict(TypedDict): + code: CodeTypedDict + message: str + + +class InternLifecycleErrorError(BaseModel): + code: Code + + message: str diff --git a/src/openrouter/components/internlistresponse.py b/src/openrouter/components/internlistresponse.py new file mode 100644 index 00000000..941c3861 --- /dev/null +++ b/src/openrouter/components/internlistresponse.py @@ -0,0 +1,24 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .intern import Intern, InternTypedDict +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class InternListResponseTypedDict(TypedDict): + r"""Interns visible to the authenticated API key.""" + + data: List[InternTypedDict] + has_more: bool + r"""True when more interns match the current filters.""" + + +class InternListResponse(BaseModel): + r"""Interns visible to the authenticated API key.""" + + data: List[Intern] + + has_more: bool + r"""True when more interns match the current filters.""" diff --git a/src/openrouter/components/provisioninternresponse.py b/src/openrouter/components/provisioninternresponse.py new file mode 100644 index 00000000..5f4a4186 --- /dev/null +++ b/src/openrouter/components/provisioninternresponse.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 openrouter.utils import validate_const +import pydantic +from pydantic.functional_validators import AfterValidator +from typing import Literal +from typing_extensions import Annotated, TypedDict + + +class ProvisionInternResponseTypedDict(TypedDict): + provisioning: Literal[True] + + +class ProvisionInternResponse(BaseModel): + PROVISIONING: Annotated[ + Annotated[Literal[True], AfterValidator(validate_const(True))], + pydantic.Field(alias="provisioning"), + ] = True + + +try: + ProvisionInternResponse.model_rebuild() +except NameError: + pass diff --git a/src/openrouter/components/responseserrorfield.py b/src/openrouter/components/responseserrorfield.py index ac617a44..1364b9bd 100644 --- a/src/openrouter/components/responseserrorfield.py +++ b/src/openrouter/components/responseserrorfield.py @@ -6,7 +6,7 @@ from typing_extensions import TypedDict -Code = Union[ +CodeEnum = Union[ Literal[ "server_error", "rate_limit_exceeded", @@ -38,13 +38,13 @@ class ResponsesErrorFieldTypedDict(TypedDict): r"""Error information returned from the API""" - code: Code + code: CodeEnum message: str class ResponsesErrorField(BaseModel): r"""Error information returned from the API""" - code: Code + code: CodeEnum message: str diff --git a/src/openrouter/components/suspendinternresponse.py b/src/openrouter/components/suspendinternresponse.py new file mode 100644 index 00000000..703bf7de --- /dev/null +++ b/src/openrouter/components/suspendinternresponse.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 openrouter.utils import validate_const +import pydantic +from pydantic.functional_validators import AfterValidator +from typing import Literal +from typing_extensions import Annotated, TypedDict + + +class SuspendInternResponseTypedDict(TypedDict): + suspended: Literal[True] + + +class SuspendInternResponse(BaseModel): + SUSPENDED: Annotated[ + Annotated[Literal[True], AfterValidator(validate_const(True))], + pydantic.Field(alias="suspended"), + ] = True + + +try: + SuspendInternResponse.model_rebuild() +except NameError: + pass diff --git a/src/openrouter/components/updateinternrequest.py b/src/openrouter/components/updateinternrequest.py new file mode 100644 index 00000000..ceef4fe4 --- /dev/null +++ b/src/openrouter/components/updateinternrequest.py @@ -0,0 +1,67 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class UpdateInternRequestTypedDict(TypedDict): + r"""Lifecycle settings to change. Omitted fields stay unchanged and null clears a field.""" + + description: NotRequired[Nullable[str]] + r"""New free-form description. Null clears it.""" + instructions: NotRequired[Nullable[str]] + r"""New standing instructions. Null clears them.""" + model: NotRequired[Nullable[str]] + r"""New OpenRouter model slug. Null restores the workspace default.""" + name: NotRequired[str] + r"""New intern name, unique per creator within the workspace.""" + + +class UpdateInternRequest(BaseModel): + r"""Lifecycle settings to change. Omitted fields stay unchanged and null clears a field.""" + + description: OptionalNullable[str] = UNSET + r"""New free-form description. Null clears it.""" + + instructions: OptionalNullable[str] = UNSET + r"""New standing instructions. Null clears them.""" + + model: OptionalNullable[str] = UNSET + r"""New OpenRouter model slug. Null restores the workspace default.""" + + name: Optional[str] = None + r"""New intern name, unique per creator within the workspace.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["description", "instructions", "model", "name"]) + nullable_fields = set(["description", "instructions", "model"]) + 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/errors/__init__.py b/src/openrouter/errors/__init__.py index 90591064..f3643660 100644 --- a/src/openrouter/errors/__init__.py +++ b/src/openrouter/errors/__init__.py @@ -32,6 +32,7 @@ InternalServerResponseError, InternalServerResponseErrorData, ) + from .internlifecycleerror import InternLifecycleError, InternLifecycleErrorData from .no_response_error import NoResponseError from .notfoundresponse_error import NotFoundResponseError, NotFoundResponseErrorData from .oautherrorresponse import OAuthErrorResponse, OAuthErrorResponseData @@ -85,6 +86,8 @@ "GatewayTimeoutResponseErrorData", "GoneResponseError", "GoneResponseErrorData", + "InternLifecycleError", + "InternLifecycleErrorData", "InternalServerResponseError", "InternalServerResponseErrorData", "NoResponseError", @@ -130,6 +133,8 @@ "GoneResponseErrorData": ".goneresponse_error", "InternalServerResponseError": ".internalserverresponse_error", "InternalServerResponseErrorData": ".internalserverresponse_error", + "InternLifecycleError": ".internlifecycleerror", + "InternLifecycleErrorData": ".internlifecycleerror", "NoResponseError": ".no_response_error", "NotFoundResponseError": ".notfoundresponse_error", "NotFoundResponseErrorData": ".notfoundresponse_error", diff --git a/src/openrouter/errors/internlifecycleerror.py b/src/openrouter/errors/internlifecycleerror.py new file mode 100644 index 00000000..8a933524 --- /dev/null +++ b/src/openrouter/errors/internlifecycleerror.py @@ -0,0 +1,33 @@ +"""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 ( + internlifecycleerror as components_internlifecycleerror, +) +from openrouter.errors import OpenRouterError +from openrouter.types import BaseModel +from typing import Optional + + +class InternLifecycleErrorData(BaseModel): + error: components_internlifecycleerror.InternLifecycleErrorError + + +@dataclass(unsafe_hash=True) +class InternLifecycleError(OpenRouterError): + r"""Intern lifecycle request failure.""" + + data: InternLifecycleErrorData = field(hash=False) + + def __init__( + self, + data: InternLifecycleErrorData, + 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 new file mode 100644 index 00000000..873ba9c2 --- /dev/null +++ b/src/openrouter/interns.py @@ -0,0 +1,1917 @@ +"""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, Iterable, List, Mapping, Optional + + +class Interns(BaseSDK): + r"""Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key.""" + + def list_interns( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + limit: Optional[int] = None, + status: Optional[Iterable[operations.Status]] = None, + workspace_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, + ) -> components.InternListResponse: + r"""List interns + + Lists interns visible to the authenticated key, newest first. Filter by workspace and one or more lifecycle statuses. 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. + + If set, this operation will use `api_key` from the global security. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param limit: Maximum number of interns to return, from 1 through 500. + :param status: Comma-separated lifecycle statuses to include. + :param workspace_id: Only return interns in this workspace. It must match the API key workspace. + :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.ListInternsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + limit=limit, + status=utils.unmarshal(status, Optional[List[operations.Status]]), + workspace_id=workspace_id, + ) + + req = self._build_request( + method="GET", + path="/interns", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListInternsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + 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="listInterns", + 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), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.InternListResponse, http_res) + if utils.match_response( + http_res, ["400", "401", "403", "404", "408"], "application/json" + ): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def list_interns_async( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + limit: Optional[int] = None, + status: Optional[Iterable[operations.Status]] = None, + workspace_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, + ) -> components.InternListResponse: + r"""List interns + + Lists interns visible to the authenticated key, newest first. Filter by workspace and one or more lifecycle statuses. 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. + + If set, this operation will use `api_key` from the global security. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param limit: Maximum number of interns to return, from 1 through 500. + :param status: Comma-separated lifecycle statuses to include. + :param workspace_id: Only return interns in this workspace. It must match the API key workspace. + :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.ListInternsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + limit=limit, + status=utils.unmarshal(status, Optional[List[operations.Status]]), + workspace_id=workspace_id, + ) + + req = self._build_request_async( + method="GET", + path="/interns", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListInternsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + 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="listInterns", + 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), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.InternListResponse, http_res) + if utils.match_response( + http_res, ["400", "401", "403", "404", "408"], "application/json" + ): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def create_intern( + self, + *, + name: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + idempotency_key: Optional[str] = None, + description: OptionalNullable[str] = UNSET, + instructions: OptionalNullable[str] = UNSET, + provision: Optional[bool] = False, + vault_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, + ) -> components.Intern: + r"""Create an intern + + Creates an intern in an explicit workspace. The operation also creates its private vault. It can start provisioning immediately or wait for a later provision call. A retry with the same idempotency key and body resumes unfinished work. The request body is capped at 1048576 bytes and a larger body is refused with 413. 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. + + If set, this operation will use `api_key` from the global security. + + :param name: Intern name, unique per creator within the workspace. + :param workspace_id: Workspace that will own the intern. It must match the API key workspace. + :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 idempotency_key: Key that makes retries resume the same create operation. Without one, the server derives a stable key from the request body. + :param description: Free-form description, or null. + :param instructions: Standing instructions the intern boots with, or null. + :param provision: Start provisioning during this create operation. Defaults to false. + :param vault_id: Vault owned by another intern in this workspace to attach as a borrowed vault. + :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.CreateInternRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + idempotency_key=idempotency_key, + create_intern_request=components.CreateInternRequest( + description=description, + instructions=instructions, + name=name, + provision=provision, + vault_id=vault_id, + workspace_id=workspace_id, + ), + ) + + req = self._build_request( + method="POST", + path="/interns", + 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.CreateInternGlobals( + 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.create_intern_request, + False, + False, + "json", + components.CreateInternRequest, + ), + 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="createIntern", + 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), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, ["200", "201"], "application/json"): + return unmarshal_json_response(components.Intern, http_res) + if utils.match_response( + http_res, + ["400", "401", "403", "404", "408", "409", "413"], + "application/json", + ): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, ["500", "502"], "application/json"): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(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_intern_async( + self, + *, + name: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + idempotency_key: Optional[str] = None, + description: OptionalNullable[str] = UNSET, + instructions: OptionalNullable[str] = UNSET, + provision: Optional[bool] = False, + vault_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, + ) -> components.Intern: + r"""Create an intern + + Creates an intern in an explicit workspace. The operation also creates its private vault. It can start provisioning immediately or wait for a later provision call. A retry with the same idempotency key and body resumes unfinished work. The request body is capped at 1048576 bytes and a larger body is refused with 413. 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. + + If set, this operation will use `api_key` from the global security. + + :param name: Intern name, unique per creator within the workspace. + :param workspace_id: Workspace that will own the intern. It must match the API key workspace. + :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 idempotency_key: Key that makes retries resume the same create operation. Without one, the server derives a stable key from the request body. + :param description: Free-form description, or null. + :param instructions: Standing instructions the intern boots with, or null. + :param provision: Start provisioning during this create operation. Defaults to false. + :param vault_id: Vault owned by another intern in this workspace to attach as a borrowed vault. + :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.CreateInternRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + idempotency_key=idempotency_key, + create_intern_request=components.CreateInternRequest( + description=description, + instructions=instructions, + name=name, + provision=provision, + vault_id=vault_id, + workspace_id=workspace_id, + ), + ) + + req = self._build_request_async( + method="POST", + path="/interns", + 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.CreateInternGlobals( + 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.create_intern_request, + False, + False, + "json", + components.CreateInternRequest, + ), + 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="createIntern", + 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), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, ["200", "201"], "application/json"): + return unmarshal_json_response(components.Intern, http_res) + if utils.match_response( + http_res, + ["400", "401", "403", "404", "408", "409", "413"], + "application/json", + ): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, ["500", "502"], "application/json"): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def delete_intern( + self, + *, + intern_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.DeleteInternResponse: + r"""Delete an intern + + Starts safe teardown of the intern, its runtime and its private vault. 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. + + If set, this operation will use `api_key` from the global security. + + :param intern_id: ID of an intern visible to the authenticated API key. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.DeleteInternRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + intern_id=intern_id, + ) + + req = self._build_request( + method="DELETE", + path="/interns/{internId}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.DeleteInternGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + 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="deleteIntern", + 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), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "202", "application/json"): + return unmarshal_json_response(components.DeleteInternResponse, http_res) + if utils.match_response( + http_res, ["401", "403", "404", "408", "409"], "application/json" + ): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, ["500", "502"], "application/json"): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(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 delete_intern_async( + self, + *, + intern_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.DeleteInternResponse: + r"""Delete an intern + + Starts safe teardown of the intern, its runtime and its private vault. 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. + + If set, this operation will use `api_key` from the global security. + + :param intern_id: ID of an intern visible to the authenticated API key. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.DeleteInternRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + intern_id=intern_id, + ) + + req = self._build_request_async( + method="DELETE", + path="/interns/{internId}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.DeleteInternGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + 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="deleteIntern", + 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), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "202", "application/json"): + return unmarshal_json_response(components.DeleteInternResponse, http_res) + if utils.match_response( + http_res, ["401", "403", "404", "408", "409"], "application/json" + ): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, ["500", "502"], "application/json"): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def get_intern( + self, + *, + intern_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.Intern: + r"""Get an intern + + Returns the public lifecycle state and settings for one visible intern. 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. + + If set, this operation will use `api_key` from the global security. + + :param intern_id: ID of an intern visible to the authenticated API key. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetInternRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + intern_id=intern_id, + ) + + req = self._build_request( + method="GET", + path="/interns/{internId}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetInternGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + 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="getIntern", + 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), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.Intern, http_res) + if utils.match_response( + http_res, ["401", "403", "404", "408"], "application/json" + ): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def get_intern_async( + self, + *, + intern_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.Intern: + r"""Get an intern + + Returns the public lifecycle state and settings for one visible intern. 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. + + If set, this operation will use `api_key` from the global security. + + :param intern_id: ID of an intern visible to the authenticated API key. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetInternRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + intern_id=intern_id, + ) + + req = self._build_request_async( + method="GET", + path="/interns/{internId}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetInternGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + 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="getIntern", + 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), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.Intern, http_res) + if utils.match_response( + http_res, ["401", "403", "404", "408"], "application/json" + ): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def update_intern( + self, + *, + intern_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + description: OptionalNullable[str] = UNSET, + instructions: OptionalNullable[str] = UNSET, + model: OptionalNullable[str] = UNSET, + name: 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.Intern: + r"""Update an intern + + Changes the intern name, description, instructions or model. Omitted fields stay unchanged. The request body is capped at 1048576 bytes and a larger body is refused with 413. 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. + + If set, this operation will use `api_key` from the global security. + + :param intern_id: ID of an intern visible to the authenticated API key. + :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 description: New free-form description. Null clears it. + :param instructions: New standing instructions. Null clears them. + :param model: New OpenRouter model slug. Null restores the workspace default. + :param name: New intern name, unique per creator within the workspace. + :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.UpdateInternRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + intern_id=intern_id, + update_intern_request=components.UpdateInternRequest( + description=description, + instructions=instructions, + model=model, + name=name, + ), + ) + + req = self._build_request( + method="PATCH", + path="/interns/{internId}", + 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="application/json", + http_headers=http_headers, + _globals=operations.UpdateInternGlobals( + 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.update_intern_request, + False, + False, + "json", + components.UpdateInternRequest, + ), + 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="updateIntern", + 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), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.Intern, http_res) + if utils.match_response( + http_res, ["400", "401", "403", "404", "408", "413"], "application/json" + ): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(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 update_intern_async( + self, + *, + intern_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + description: OptionalNullable[str] = UNSET, + instructions: OptionalNullable[str] = UNSET, + model: OptionalNullable[str] = UNSET, + name: 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.Intern: + r"""Update an intern + + Changes the intern name, description, instructions or model. Omitted fields stay unchanged. The request body is capped at 1048576 bytes and a larger body is refused with 413. 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. + + If set, this operation will use `api_key` from the global security. + + :param intern_id: ID of an intern visible to the authenticated API key. + :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 description: New free-form description. Null clears it. + :param instructions: New standing instructions. Null clears them. + :param model: New OpenRouter model slug. Null restores the workspace default. + :param name: New intern name, unique per creator within the workspace. + :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.UpdateInternRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + intern_id=intern_id, + update_intern_request=components.UpdateInternRequest( + description=description, + instructions=instructions, + model=model, + name=name, + ), + ) + + req = self._build_request_async( + method="PATCH", + path="/interns/{internId}", + 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="application/json", + http_headers=http_headers, + _globals=operations.UpdateInternGlobals( + 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.update_intern_request, + False, + False, + "json", + components.UpdateInternRequest, + ), + 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="updateIntern", + 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), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.Intern, http_res) + if utils.match_response( + http_res, ["400", "401", "403", "404", "408", "413"], "application/json" + ): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def provision_intern( + self, + *, + intern_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ProvisionInternResponse: + r"""Provision an intern + + 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. + + If set, this operation will use `api_key` from the global security. + + :param intern_id: ID of an intern visible to the authenticated API key. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ProvisionInternRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + intern_id=intern_id, + ) + + req = self._build_request( + method="POST", + path="/interns/{internId}/provision", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ProvisionInternGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + 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="provisionIntern", + 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), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "202", "application/json"): + return unmarshal_json_response(components.ProvisionInternResponse, http_res) + if utils.match_response( + http_res, ["401", "403", "404", "408", "409"], "application/json" + ): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, ["500", "502"], "application/json"): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(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 provision_intern_async( + self, + *, + intern_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ProvisionInternResponse: + r"""Provision an intern + + 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. + + If set, this operation will use `api_key` from the global security. + + :param intern_id: ID of an intern visible to the authenticated API key. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ProvisionInternRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + intern_id=intern_id, + ) + + req = self._build_request_async( + method="POST", + path="/interns/{internId}/provision", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ProvisionInternGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + 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="provisionIntern", + 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), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "202", "application/json"): + return unmarshal_json_response(components.ProvisionInternResponse, http_res) + if utils.match_response( + http_res, ["401", "403", "404", "408", "409"], "application/json" + ): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, ["500", "502"], "application/json"): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def suspend_intern( + self, + *, + intern_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.SuspendInternResponse: + r"""Suspend an intern + + Stops the intern runtime while keeping its disk and configuration for a later provision call. 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. + + If set, this operation will use `api_key` from the global security. + + :param intern_id: ID of an intern visible to the authenticated API key. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.SuspendInternRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + intern_id=intern_id, + ) + + req = self._build_request( + method="POST", + path="/interns/{internId}/suspend", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.SuspendInternGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + 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="suspendIntern", + 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), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.SuspendInternResponse, http_res) + if utils.match_response( + http_res, ["401", "403", "404", "408", "409"], "application/json" + ): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, ["500", "502"], "application/json"): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(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 suspend_intern_async( + self, + *, + intern_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.SuspendInternResponse: + r"""Suspend an intern + + Stops the intern runtime while keeping its disk and configuration for a later provision call. 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. + + If set, this operation will use `api_key` from the global security. + + :param intern_id: ID of an intern visible to the authenticated API key. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.SuspendInternRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + intern_id=intern_id, + ) + + req = self._build_request_async( + method="POST", + path="/interns/{internId}/suspend", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.SuspendInternGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + 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="suspendIntern", + 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), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.SuspendInternResponse, http_res) + if utils.match_response( + http_res, ["401", "403", "404", "408", "409"], "application/json" + ): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(response_data, http_res) + if utils.match_response(http_res, ["500", "502"], "application/json"): + response_data = unmarshal_json_response( + errors.InternLifecycleErrorData, http_res + ) + raise errors.InternLifecycleError(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/operations/__init__.py b/src/openrouter/operations/__init__.py index 4c2089b3..13b659fb 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -142,6 +142,12 @@ CreateImagesResponse, CreateImagesResponseTypedDict, ) + from .createintern import ( + CreateInternGlobals, + CreateInternGlobalsTypedDict, + CreateInternRequest, + CreateInternRequestTypedDict, + ) from .createkeys import ( CreateKeysData, CreateKeysDataTypedDict, @@ -261,6 +267,12 @@ DeleteGuardrailRequest, DeleteGuardrailRequestTypedDict, ) + from .deleteintern import ( + DeleteInternGlobals, + DeleteInternGlobalsTypedDict, + DeleteInternRequest, + DeleteInternRequestTypedDict, + ) from .deleteinternvaultsecret import ( DeleteInternVaultSecretGlobals, DeleteInternVaultSecretGlobalsTypedDict, @@ -428,6 +440,12 @@ GetGuardrailRequest, GetGuardrailRequestTypedDict, ) + from .getintern import ( + GetInternGlobals, + GetInternGlobalsTypedDict, + GetInternRequest, + GetInternRequestTypedDict, + ) from .getkey import ( GetKeyData, GetKeyDataTypedDict, @@ -639,6 +657,13 @@ ListImageModelsRequest, ListImageModelsRequestTypedDict, ) + from .listinterns import ( + ListInternsGlobals, + ListInternsGlobalsTypedDict, + ListInternsRequest, + ListInternsRequestTypedDict, + Status, + ) from .listinternvaultsecrets import ( ListInternVaultSecretsGlobals, ListInternVaultSecretsGlobalsTypedDict, @@ -794,6 +819,12 @@ PromoteContainerFileRequest, PromoteContainerFileRequestTypedDict, ) + from .provisionintern import ( + ProvisionInternGlobals, + ProvisionInternGlobalsTypedDict, + ProvisionInternRequest, + ProvisionInternRequestTypedDict, + ) from .queryanalytics import ( ClassifierDimensions, ClassifierDimensionsTypedDict, @@ -857,6 +888,12 @@ SubmitGenerationFeedbackRequest, SubmitGenerationFeedbackRequestTypedDict, ) + from .suspendintern import ( + SuspendInternGlobals, + SuspendInternGlobalsTypedDict, + SuspendInternRequest, + SuspendInternRequestTypedDict, + ) from .updatebyokkey import ( UpdateBYOKKeyGlobals, UpdateBYOKKeyGlobalsTypedDict, @@ -869,6 +906,12 @@ UpdateGuardrailRequest, UpdateGuardrailRequestTypedDict, ) + from .updateintern import ( + UpdateInternGlobals, + UpdateInternGlobalsTypedDict, + UpdateInternRequest, + UpdateInternRequestTypedDict, + ) from .updatekeys import ( UpdateKeysData, UpdateKeysDataTypedDict, @@ -1019,6 +1062,10 @@ "CreateImagesRequestTypedDict", "CreateImagesResponse", "CreateImagesResponseTypedDict", + "CreateInternGlobals", + "CreateInternGlobalsTypedDict", + "CreateInternRequest", + "CreateInternRequestTypedDict", "CreateKeysData", "CreateKeysDataTypedDict", "CreateKeysGlobals", @@ -1099,6 +1146,10 @@ "DeleteGuardrailGlobalsTypedDict", "DeleteGuardrailRequest", "DeleteGuardrailRequestTypedDict", + "DeleteInternGlobals", + "DeleteInternGlobalsTypedDict", + "DeleteInternRequest", + "DeleteInternRequestTypedDict", "DeleteInternVaultSecretGlobals", "DeleteInternVaultSecretGlobalsTypedDict", "DeleteInternVaultSecretRequest", @@ -1220,6 +1271,10 @@ "GetGuardrailGlobalsTypedDict", "GetGuardrailRequest", "GetGuardrailRequestTypedDict", + "GetInternGlobals", + "GetInternGlobalsTypedDict", + "GetInternRequest", + "GetInternRequestTypedDict", "GetKeyData", "GetKeyDataTypedDict", "GetKeyGlobals", @@ -1378,6 +1433,10 @@ "ListInternVaultSecretsGlobalsTypedDict", "ListInternVaultSecretsRequest", "ListInternVaultSecretsRequestTypedDict", + "ListInternsGlobals", + "ListInternsGlobalsTypedDict", + "ListInternsRequest", + "ListInternsRequestTypedDict", "ListKeyAssignmentsGlobals", "ListKeyAssignmentsGlobalsTypedDict", "ListKeyAssignmentsRequest", @@ -1507,6 +1566,10 @@ "PromptTokensDetails", "PromptTokensDetailsTypedDict", "Provider", + "ProvisionInternGlobals", + "ProvisionInternGlobalsTypedDict", + "ProvisionInternRequest", + "ProvisionInternRequestTypedDict", "QueryAnalyticsData1", "QueryAnalyticsData1TypedDict", "QueryAnalyticsData2", @@ -1534,6 +1597,7 @@ "SendChatCompletionRequestResponse", "SendChatCompletionRequestResponseTypedDict", "Source", + "Status", "StoreInternVaultSecretGlobals", "StoreInternVaultSecretGlobalsTypedDict", "StoreInternVaultSecretRequest", @@ -1547,6 +1611,10 @@ "SubmitGenerationFeedbackGlobalsTypedDict", "SubmitGenerationFeedbackRequest", "SubmitGenerationFeedbackRequestTypedDict", + "SuspendInternGlobals", + "SuspendInternGlobalsTypedDict", + "SuspendInternRequest", + "SuspendInternRequestTypedDict", "TaskType", "TimeRange", "TimeRangeTypedDict", @@ -1562,6 +1630,10 @@ "UpdateGuardrailGlobalsTypedDict", "UpdateGuardrailRequest", "UpdateGuardrailRequestTypedDict", + "UpdateInternGlobals", + "UpdateInternGlobalsTypedDict", + "UpdateInternRequest", + "UpdateInternRequestTypedDict", "UpdateKeysData", "UpdateKeysDataTypedDict", "UpdateKeysGlobals", @@ -1717,6 +1789,10 @@ "CreateImagesRequestTypedDict": ".createimages", "CreateImagesResponse": ".createimages", "CreateImagesResponseTypedDict": ".createimages", + "CreateInternGlobals": ".createintern", + "CreateInternGlobalsTypedDict": ".createintern", + "CreateInternRequest": ".createintern", + "CreateInternRequestTypedDict": ".createintern", "CreateKeysData": ".createkeys", "CreateKeysDataTypedDict": ".createkeys", "CreateKeysGlobals": ".createkeys", @@ -1806,6 +1882,10 @@ "DeleteGuardrailGlobalsTypedDict": ".deleteguardrail", "DeleteGuardrailRequest": ".deleteguardrail", "DeleteGuardrailRequestTypedDict": ".deleteguardrail", + "DeleteInternGlobals": ".deleteintern", + "DeleteInternGlobalsTypedDict": ".deleteintern", + "DeleteInternRequest": ".deleteintern", + "DeleteInternRequestTypedDict": ".deleteintern", "DeleteInternVaultSecretGlobals": ".deleteinternvaultsecret", "DeleteInternVaultSecretGlobalsTypedDict": ".deleteinternvaultsecret", "DeleteInternVaultSecretRequest": ".deleteinternvaultsecret", @@ -1933,6 +2013,10 @@ "GetGuardrailGlobalsTypedDict": ".getguardrail", "GetGuardrailRequest": ".getguardrail", "GetGuardrailRequestTypedDict": ".getguardrail", + "GetInternGlobals": ".getintern", + "GetInternGlobalsTypedDict": ".getintern", + "GetInternRequest": ".getintern", + "GetInternRequestTypedDict": ".getintern", "GetKeyData": ".getkey", "GetKeyDataTypedDict": ".getkey", "GetKeyGlobals": ".getkey", @@ -2088,6 +2172,11 @@ "ListImageModelsGlobalsTypedDict": ".listimagemodels", "ListImageModelsRequest": ".listimagemodels", "ListImageModelsRequestTypedDict": ".listimagemodels", + "ListInternsGlobals": ".listinterns", + "ListInternsGlobalsTypedDict": ".listinterns", + "ListInternsRequest": ".listinterns", + "ListInternsRequestTypedDict": ".listinterns", + "Status": ".listinterns", "ListInternVaultSecretsGlobals": ".listinternvaultsecrets", "ListInternVaultSecretsGlobalsTypedDict": ".listinternvaultsecrets", "ListInternVaultSecretsRequest": ".listinternvaultsecrets", @@ -2203,6 +2292,10 @@ "PromoteContainerFileGlobalsTypedDict": ".promotecontainerfile", "PromoteContainerFileRequest": ".promotecontainerfile", "PromoteContainerFileRequestTypedDict": ".promotecontainerfile", + "ProvisionInternGlobals": ".provisionintern", + "ProvisionInternGlobalsTypedDict": ".provisionintern", + "ProvisionInternRequest": ".provisionintern", + "ProvisionInternRequestTypedDict": ".provisionintern", "ClassifierDimensions": ".queryanalytics", "ClassifierDimensionsTypedDict": ".queryanalytics", "ClassifierFilters": ".queryanalytics", @@ -2256,6 +2349,10 @@ "SubmitGenerationFeedbackGlobalsTypedDict": ".submitgenerationfeedback", "SubmitGenerationFeedbackRequest": ".submitgenerationfeedback", "SubmitGenerationFeedbackRequestTypedDict": ".submitgenerationfeedback", + "SuspendInternGlobals": ".suspendintern", + "SuspendInternGlobalsTypedDict": ".suspendintern", + "SuspendInternRequest": ".suspendintern", + "SuspendInternRequestTypedDict": ".suspendintern", "UpdateBYOKKeyGlobals": ".updatebyokkey", "UpdateBYOKKeyGlobalsTypedDict": ".updatebyokkey", "UpdateBYOKKeyRequest": ".updatebyokkey", @@ -2264,6 +2361,10 @@ "UpdateGuardrailGlobalsTypedDict": ".updateguardrail", "UpdateGuardrailRequest": ".updateguardrail", "UpdateGuardrailRequestTypedDict": ".updateguardrail", + "UpdateInternGlobals": ".updateintern", + "UpdateInternGlobalsTypedDict": ".updateintern", + "UpdateInternRequest": ".updateintern", + "UpdateInternRequestTypedDict": ".updateintern", "UpdateKeysData": ".updatekeys", "UpdateKeysDataTypedDict": ".updatekeys", "UpdateKeysGlobals": ".updatekeys", diff --git a/src/openrouter/operations/createintern.py b/src/openrouter/operations/createintern.py new file mode 100644 index 00000000..2efb94a2 --- /dev/null +++ b/src/openrouter/operations/createintern.py @@ -0,0 +1,158 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import createinternrequest as components_createinternrequest +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 CreateInternGlobalsTypedDict(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 CreateInternGlobals(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 CreateInternRequestTypedDict(TypedDict): + create_intern_request: components_createinternrequest.CreateInternRequestTypedDict + 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. + + """ + idempotency_key: NotRequired[str] + r"""Key that makes retries resume the same create operation. Without one, the server derives a stable key from the request body.""" + + +class CreateInternRequest(BaseModel): + create_intern_request: Annotated[ + components_createinternrequest.CreateInternRequest, + 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. + + """ + + idempotency_key: Annotated[ + Optional[str], + pydantic.Field(alias="Idempotency-Key"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Key that makes retries resume the same create operation. Without one, the server derives a stable key from the request body.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "HTTP-Referer", + "X-OpenRouter-Title", + "X-OpenRouter-Categories", + "Idempotency-Key", + ] + ) + 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/deleteintern.py b/src/openrouter/operations/deleteintern.py new file mode 100644 index 00000000..a1e8d0c9 --- /dev/null +++ b/src/openrouter/operations/deleteintern.py @@ -0,0 +1,146 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class DeleteInternGlobalsTypedDict(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 DeleteInternGlobals(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 DeleteInternRequestTypedDict(TypedDict): + intern_id: str + r"""ID of an intern visible to the authenticated API key.""" + 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 DeleteInternRequest(BaseModel): + intern_id: Annotated[ + str, + pydantic.Field(alias="internId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""ID of an intern visible to the authenticated API key.""" + + 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/getintern.py b/src/openrouter/operations/getintern.py new file mode 100644 index 00000000..137abb8f --- /dev/null +++ b/src/openrouter/operations/getintern.py @@ -0,0 +1,146 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetInternGlobalsTypedDict(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 GetInternGlobals(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 GetInternRequestTypedDict(TypedDict): + intern_id: str + r"""ID of an intern visible to the authenticated API key.""" + 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 GetInternRequest(BaseModel): + intern_id: Annotated[ + str, + pydantic.Field(alias="internId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""ID of an intern visible to the authenticated API key.""" + + 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/listinterns.py b/src/openrouter/operations/listinterns.py new file mode 100644 index 00000000..003e2127 --- /dev/null +++ b/src/openrouter/operations/listinterns.py @@ -0,0 +1,183 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata +import pydantic +from pydantic import model_serializer +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListInternsGlobalsTypedDict(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 ListInternsGlobals(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 + + +Status = Union[ + Literal[ + "awaiting_slack_install", + "queued", + "provisioning", + "running", + "failed", + "stopped", + "destroying", + "destroy_failed", + ], + UnrecognizedStr, +] + + +class ListInternsRequestTypedDict(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. + + """ + limit: NotRequired[int] + r"""Maximum number of interns to return, from 1 through 500.""" + status: NotRequired[List[Status]] + r"""Comma-separated lifecycle statuses to include.""" + workspace_id: NotRequired[str] + r"""Only return interns in this workspace. It must match the API key workspace.""" + + +class ListInternsRequest(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. + + """ + + limit: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Maximum number of interns to return, from 1 through 500.""" + + status: Annotated[ + Optional[List[Status]], + FieldMetadata(query=QueryParamMetadata(style="form", explode=False)), + ] = None + r"""Comma-separated lifecycle statuses to include.""" + + workspace_id: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Only return interns in this workspace. It must match the API key workspace.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "HTTP-Referer", + "X-OpenRouter-Title", + "X-OpenRouter-Categories", + "limit", + "status", + "workspace_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 diff --git a/src/openrouter/operations/provisionintern.py b/src/openrouter/operations/provisionintern.py new file mode 100644 index 00000000..2efbcc03 --- /dev/null +++ b/src/openrouter/operations/provisionintern.py @@ -0,0 +1,146 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ProvisionInternGlobalsTypedDict(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 ProvisionInternGlobals(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 ProvisionInternRequestTypedDict(TypedDict): + intern_id: str + r"""ID of an intern visible to the authenticated API key.""" + 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 ProvisionInternRequest(BaseModel): + intern_id: Annotated[ + str, + pydantic.Field(alias="internId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""ID of an intern visible to the authenticated API key.""" + + 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/suspendintern.py b/src/openrouter/operations/suspendintern.py new file mode 100644 index 00000000..7fff4cf0 --- /dev/null +++ b/src/openrouter/operations/suspendintern.py @@ -0,0 +1,146 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class SuspendInternGlobalsTypedDict(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 SuspendInternGlobals(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 SuspendInternRequestTypedDict(TypedDict): + intern_id: str + r"""ID of an intern visible to the authenticated API key.""" + 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 SuspendInternRequest(BaseModel): + intern_id: Annotated[ + str, + pydantic.Field(alias="internId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""ID of an intern visible to the authenticated API key.""" + + 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/updateintern.py b/src/openrouter/operations/updateintern.py new file mode 100644 index 00000000..d87519cf --- /dev/null +++ b/src/openrouter/operations/updateintern.py @@ -0,0 +1,158 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import updateinternrequest as components_updateinternrequest +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class UpdateInternGlobalsTypedDict(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 UpdateInternGlobals(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 UpdateInternRequestTypedDict(TypedDict): + intern_id: str + r"""ID of an intern visible to the authenticated API key.""" + update_intern_request: components_updateinternrequest.UpdateInternRequestTypedDict + 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 UpdateInternRequest(BaseModel): + intern_id: Annotated[ + str, + pydantic.Field(alias="internId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""ID of an intern visible to the authenticated API key.""" + + update_intern_request: Annotated[ + components_updateinternrequest.UpdateInternRequest, + 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/sdk.py b/src/openrouter/sdk.py index 488042f0..e1ca4315 100644 --- a/src/openrouter/sdk.py +++ b/src/openrouter/sdk.py @@ -32,6 +32,7 @@ from openrouter.generations import Generations from openrouter.guardrails import Guardrails from openrouter.images import Images + from openrouter.interns import Interns from openrouter.models_ import Models from openrouter.oauth import OAuth from openrouter.observability import Observability @@ -86,6 +87,8 @@ class OpenRouter(BaseSDK): r"""Guardrails endpoints""" images: "Images" r"""Images endpoints""" + interns: "Interns" + r"""Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key.""" api_keys: "APIKeys" r"""API key management endpoints""" models: "Models" @@ -129,6 +132,7 @@ class OpenRouter(BaseSDK): "generations": ("openrouter.generations", "Generations"), "guardrails": ("openrouter.guardrails", "Guardrails"), "images": ("openrouter.images", "Images"), + "interns": ("openrouter.interns", "Interns"), "api_keys": ("openrouter.api_keys", "APIKeys"), "models": ("openrouter.models_", "Models"), "observability": ("openrouter.observability", "Observability"), diff --git a/uv.lock b/uv.lock index d918fb24..d96dfcf2 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.1.154" +version = "1.1.155" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 5c6dddbc88d0e6428942451b0ba678964663f7b7 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Thu, 17 Sep 2026 03:34:45 +0000 Subject: [PATCH 2/3] empty commit to trigger [run-tests] workflow From 203ac7c01e598a49c857d052f2bd5d1c03691fa2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 17 Sep 2026 03:34:57 +0000 Subject: [PATCH 3/3] Chore: regenerate docs navigation Auto-generated-by: update-generated-files-action; https://github.com/OpenRouterTeam/python-sdk/actions/runs/35178695755 --- docs/docs.json | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/docs.json b/docs/docs.json index be1ac969..431a325c 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -26,6 +26,7 @@ "sdks/generations/README", "sdks/guardrails/README", "sdks/images/README", + "sdks/interns/README", "sdks/models/README", "sdks/oauth/README", "sdks/observability/README",