From 13e4ccdfe268c05f406ba6be46fc252e37485350 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Wed, 30 Sep 2026 18:11:19 +0000 Subject: [PATCH 1/3] ## Typescript SDK Changes: * `openrouter.endUsers.list()`: **Added** * `openrouter.endUsers.create()`: **Added** * `openrouter.endUsers.delete()`: **Added** * `openrouter.endUsers.get()`: **Added** * `openrouter.endUsers.update()`: **Added** --- .speakeasy/gen.lock | 259 ++++++++- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 516 ++++++++++++++++++ .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/models/createenduserrequest.mdx | 19 + docs/models/enduser.mdx | 25 + docs/models/enduserresponse.mdx | 24 + docs/models/listendusersresponse.mdx | 28 + .../operations/createenduserglobals.mdx | 19 + .../operations/createenduserrequest.mdx | 24 + .../operations/deleteenduserglobals.mdx | 19 + .../operations/deleteenduserrequest.mdx | 22 + docs/models/operations/getenduserglobals.mdx | 19 + docs/models/operations/getenduserrequest.mdx | 22 + .../models/operations/listendusersglobals.mdx | 19 + .../models/operations/listendusersrequest.mdx | 23 + .../operations/listendusersresponse.mdx | 29 + .../operations/updateenduserglobals.mdx | 19 + .../operations/updateenduserrequest.mdx | 26 + docs/models/updateenduserrequest.mdx | 19 + docs/sdks/endusers/README.mdx | 437 +++++++++++++++ jsr.json | 2 +- package.json | 10 +- src/funcs/endUsersCreate.ts | 216 ++++++++ src/funcs/endUsersDelete.ts | 215 ++++++++ src/funcs/endUsersGet.ts | 215 ++++++++ src/funcs/endUsersList.ts | 290 ++++++++++ src/funcs/endUsersUpdate.ts | 218 ++++++++ src/lib/config.ts | 4 +- src/models/createenduserrequest.ts | 34 ++ src/models/enduser.ts | 53 ++ src/models/enduserresponse.ts | 32 ++ src/models/index.ts | 5 + src/models/listendusersresponse.ts | 42 ++ src/models/operations/createenduser.ts | 85 +++ src/models/operations/deleteenduser.ts | 86 +++ src/models/operations/getenduser.ts | 86 +++ src/models/operations/index.ts | 5 + src/models/operations/listendusers.ts | 135 +++++ src/models/operations/updateenduser.ts | 91 +++ src/models/updateenduserrequest.ts | 39 ++ src/sdk/endusers.ts | 104 ++++ src/sdk/sdk.ts | 6 + 44 files changed, 3531 insertions(+), 34 deletions(-) create mode 100644 docs/models/createenduserrequest.mdx create mode 100644 docs/models/enduser.mdx create mode 100644 docs/models/enduserresponse.mdx create mode 100644 docs/models/listendusersresponse.mdx create mode 100644 docs/models/operations/createenduserglobals.mdx create mode 100644 docs/models/operations/createenduserrequest.mdx create mode 100644 docs/models/operations/deleteenduserglobals.mdx create mode 100644 docs/models/operations/deleteenduserrequest.mdx create mode 100644 docs/models/operations/getenduserglobals.mdx create mode 100644 docs/models/operations/getenduserrequest.mdx create mode 100644 docs/models/operations/listendusersglobals.mdx create mode 100644 docs/models/operations/listendusersrequest.mdx create mode 100644 docs/models/operations/listendusersresponse.mdx create mode 100644 docs/models/operations/updateenduserglobals.mdx create mode 100644 docs/models/operations/updateenduserrequest.mdx create mode 100644 docs/models/updateenduserrequest.mdx create mode 100644 docs/sdks/endusers/README.mdx create mode 100644 src/funcs/endUsersCreate.ts create mode 100644 src/funcs/endUsersDelete.ts create mode 100644 src/funcs/endUsersGet.ts create mode 100644 src/funcs/endUsersList.ts create mode 100644 src/funcs/endUsersUpdate.ts create mode 100644 src/models/createenduserrequest.ts create mode 100644 src/models/enduser.ts create mode 100644 src/models/enduserresponse.ts create mode 100644 src/models/listendusersresponse.ts create mode 100644 src/models/operations/createenduser.ts create mode 100644 src/models/operations/deleteenduser.ts create mode 100644 src/models/operations/getenduser.ts create mode 100644 src/models/operations/listendusers.ts create mode 100644 src/models/operations/updateenduser.ts create mode 100644 src/models/updateenduserrequest.ts create mode 100644 src/sdk/endusers.ts diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 0918849ee..4030d7963 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: "" id: "" management: - docChecksum: cdd8db23ed824aecfb06c831f0760664 + docChecksum: 7d036ccf73ffd9cea57fea1e28777140 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.4.10 - configChecksum: 2b61d0115ce0433e2d1f2de740746eba + releaseVersion: 1.4.11 + configChecksum: 0b8bfd7e5589a5ee7981c97f2fc79600 repoURL: https://github.com/OpenRouterTeam/typescript-sdk.git installationURL: https://github.com/OpenRouterTeam/typescript-sdk published: true persistentEdits: - generation_id: 0690a944-69d0-43ac-9f27-a976ab8c5130 - pristine_commit_hash: 50cfc7432886c51971dc7d4e8373ba7aa409913c - pristine_tree_hash: 5a29352c92c7cb9e47fd27d8109207ddcabdb4b3 + generation_id: 7d942872-a083-4652-a68c-0dacf8393b29 + pristine_commit_hash: 794fde00dc450053ed37b4ad5abb49040602e6ae + pristine_tree_hash: e95c029b6d822ef414f76f5ea24f5502018be559 features: typescript: acceptHeaders: 2.81.2 @@ -3850,6 +3850,10 @@ trackedFiles: id: 8548d8738625 last_write_checksum: sha1:7a74f590306690b268ef7ea8cb597ee890a43755 pristine_git_object: b9f409dc4ad48f30507eaae346661769e545f404 + docs/models/createenduserrequest.mdx: + id: 2913e82c6df3 + last_write_checksum: sha1:d01cc263feb2d7c252529c1f4e7675098298add1 + pristine_git_object: 90851a656f44b19a40a99e3ea7e748d6b837711d docs/models/createguardrailrequest.md: id: 414fbd831d11 last_write_checksum: sha1:02586363176c21ee908388bccc1b68daedc03c9b @@ -4501,6 +4505,14 @@ trackedFiles: id: 2599f615acd8 last_write_checksum: sha1:aee7ed80577f393405630c04957d5e13225f11e6 pristine_git_object: eb3c8bcd7a6129b6f2ccaa6e34e52233b64cd22c + docs/models/enduser.mdx: + id: 6b61d84ef09c + last_write_checksum: sha1:372b857c29367ed29d6671f9ea5c4613099d1c84 + pristine_git_object: ed275b828bd641f0e0f6210437b3d8a9fca1eeb9 + docs/models/enduserresponse.mdx: + id: f62b6d4b4440 + last_write_checksum: sha1:95745401f88614d855bb532bc1ee6142ac43c154 + pristine_git_object: f21c4ccc9d741da2b5b022d10af26e64ca21f5da docs/models/enumcapability.md: id: 222fb367bb5a last_write_checksum: sha1:359b07555b89401153e08cbcb9584da9b93fa1e5 @@ -6517,6 +6529,10 @@ trackedFiles: id: 67f685fdc519 last_write_checksum: sha1:79c69820f9ad6a9f6ec66e3c37fb9453522567b0 pristine_git_object: ed4b20bc21541428a22f523ca3b76f3c9caf2dc6 + docs/models/listendusersresponse.mdx: + id: 886073a09905 + last_write_checksum: sha1:4fa78418aa2a2e54372ec95bd68c2a6cf95ab328 + pristine_git_object: c6ce15cde705564ea7714fed398b38dae26ca37b docs/models/listguardrailsresponse.md: id: 0696b16e9857 last_write_checksum: sha1:7799b39e536b8f7377af1991b96f4a21e9ea6617 @@ -8435,6 +8451,14 @@ trackedFiles: id: "618888409156" last_write_checksum: sha1:206538c213029e344eb3f46ee4634ed753ee5879 pristine_git_object: 518b2109c4a142a4bebd5659d66906c53f5ab4c6 + docs/models/operations/createenduserglobals.mdx: + id: 0821e2105672 + last_write_checksum: sha1:91ef0821e53864461379558e3e48c45d5a7dcae8 + pristine_git_object: 1590d5b983fad62fb1907a43f68ca0725cc8cdbb + docs/models/operations/createenduserrequest.mdx: + id: 5ac1b7175542 + last_write_checksum: sha1:78868eb1dd57b6336c20b88fdd8a62dc918b6edb + pristine_git_object: efcbc7ce25d7fdb659aa4e891930c52f295edeb8 docs/models/operations/createguardrailglobals.mdx: id: 8f57a311ef27 last_write_checksum: sha1:a8878e65916d84eefba4e1683b9090d2de8e7b25 @@ -8786,6 +8810,14 @@ trackedFiles: id: 93e1a6557e28 last_write_checksum: sha1:11f4151c76765ad7157327e610744a80b6872702 pristine_git_object: d01f99bc7ae93c4e3bfcf6d268faf737a93011e6 + docs/models/operations/deleteenduserglobals.mdx: + id: 7169c8a1ae57 + last_write_checksum: sha1:bc45c32cb17ad72b0d143698ecccb086d27e39bb + pristine_git_object: e06315db56ae7397b5824d50baae23b8ef2eea14 + docs/models/operations/deleteenduserrequest.mdx: + id: c777a49bbbaa + last_write_checksum: sha1:2bb37f9f9a297a59a4f57fa0f4a18f1ad83ef5e1 + pristine_git_object: 6626390b19005db65f09699a3384b3a62f74f7c3 docs/models/operations/deletefileglobals.md: id: 93f9251e96e0 last_write_checksum: sha1:17781ea33f383e498bfb0c1e3ae98e2a26130bd1 @@ -9258,6 +9290,14 @@ trackedFiles: id: 7e3452452864 last_write_checksum: sha1:a403230ccbcf3ab0b3940d475ab4f3442adcae8e pristine_git_object: 026d3311f2f673636eaf2022bc020b4e9c21bbe8 + docs/models/operations/getenduserglobals.mdx: + id: c8d4884a2980 + last_write_checksum: sha1:23bf13d29c095fe36abea223d58021e0b35a18b8 + pristine_git_object: b391ec73efc64bc5d54a054407801fdcfd1f3ec4 + docs/models/operations/getenduserrequest.mdx: + id: 57b6e423c523 + last_write_checksum: sha1:be53c9847eb37dbd3fcdcba655d33751ca947b45 + pristine_git_object: 7238fb70902bd1b2a9f65bf1fb30a254a2c13f1c docs/models/operations/getfilemetadataglobals.md: id: 83c2510439af last_write_checksum: sha1:9f6fcba5f236fe99b92fa110a87d20708d0d1bbf @@ -9732,6 +9772,18 @@ trackedFiles: id: d9ce10710845 last_write_checksum: sha1:47e141f1d57d09c8e64c28fac87b5b520f12df92 pristine_git_object: 97c2584267e2a945e5b7766b1de3f82153e6e948 + docs/models/operations/listendusersglobals.mdx: + id: 150f248a5ba1 + last_write_checksum: sha1:9ab9ac4b251ec6b0b880bc1570c3cc017a2fa932 + pristine_git_object: 0a953dc8fb1c7a6d62ff1bb5d460b29c3bd358b6 + docs/models/operations/listendusersrequest.mdx: + id: 980cdfd14268 + last_write_checksum: sha1:bb85c5ecebd99bd055d124c5ad1436849a0e9b26 + pristine_git_object: ad676c0b77b0e88f8500dde2d857f3634e8fd9e7 + docs/models/operations/listendusersresponse.mdx: + id: 24039ce40e13 + last_write_checksum: sha1:cd809f25438829c0399405f9c6917e85232e4953 + pristine_git_object: d8c8222688556dc0025478c33a5fd7356b300f55 docs/models/operations/listfilesglobals.md: id: a1b76a1b24f4 last_write_checksum: sha1:cf32848052e3200a3f7ff7441fac942766f9cc8f @@ -10545,6 +10597,14 @@ trackedFiles: id: 6dd63623997d last_write_checksum: sha1:b043927dd7b96acb75d1134d609d9e6255c6bd9f pristine_git_object: 55b9afe5b7bd4e30ae6e6085df24cdf6090ae737 + docs/models/operations/updateenduserglobals.mdx: + id: 6b487676eeba + last_write_checksum: sha1:5ff3b564ea9937603d9c8469e655516ed50991ab + pristine_git_object: b59f4abfb13d59d80bc98152390f61a3c18c620b + docs/models/operations/updateenduserrequest.mdx: + id: 60ceef4bf4f8 + last_write_checksum: sha1:20911ee5def6d463f539b08ea93f486de6c2cfd5 + pristine_git_object: aca63240c03a96b82175da875611fcf5454ca980 docs/models/operations/updateguardrailglobals.mdx: id: 9c70f690c6b2 last_write_checksum: sha1:e81fd476e5e81d70525ea3d8cf8e7931895558e1 @@ -14358,6 +14418,10 @@ trackedFiles: id: 3ad646ddc662 last_write_checksum: sha1:3b05974a66941923ac497223876df22ff0d15fc3 pristine_git_object: df6661a26fafa22e8ec88d7eee320e9fcce2e595 + docs/models/updateenduserrequest.mdx: + id: 693677e5c064 + last_write_checksum: sha1:dd42746d34194975bb1c6a76e42f246d9e18947d + pristine_git_object: d5e77b0607168277d518836976b244ad5b989eed docs/models/updateguardrailrequest.md: id: 720b87f201c8 last_write_checksum: sha1:176be95b06185a80ec7019ec99167f84c6fec461 @@ -15047,6 +15111,10 @@ trackedFiles: id: 62dfac9f7b71 last_write_checksum: sha1:9b2fe2a009462a0da7739ad887d2e96ac77ecb65 pristine_git_object: 6629f1c023db678339202fc200738af1b98cefb8 + docs/sdks/endusers/README.mdx: + id: ba369f05185b + last_write_checksum: sha1:2c0022796ac8766840c3808391b887a7e24f7645 + pristine_git_object: a25075e648e934f4716e383179569aab8a58f10a docs/sdks/files/README.md: id: e576d7a117f0 last_write_checksum: sha1:b79bb5f476d0265d6eccb9c139fdbc1861b7488f @@ -15211,12 +15279,12 @@ trackedFiles: pristine_git_object: 410efafd6a7f50d91ccb87131fedbe0c3d47e15a jsr.json: id: 7f6ab7767282 - last_write_checksum: sha1:c4e8e1de5a908143982a633210aba05f09ef9621 - pristine_git_object: 0ef9ababeba47aa41223458d48e844b65d1f2540 + last_write_checksum: sha1:2811386ee9a26c1cbc0033fc7efd85fa5f58a8e4 + pristine_git_object: eb65c9822075818362bbc5fad213574d0d76aa5c package.json: id: 7030d0b2f71b - last_write_checksum: sha1:7f7017260638e98184e470f5a1074633d64956f7 - pristine_git_object: 2787949c04546c88eba2384d89b13594e9f2e416 + last_write_checksum: sha1:0730be1e22129c06be04d0e9c2e78f48f964cea4 + pristine_git_object: f55a16326eb16852daaa2b2bf6156b210826116c src/core.ts: id: f431fdbcd144 last_write_checksum: sha1:5aa66b0b6a5964f3eea7f3098c2eb3c0ee9c0131 @@ -15349,6 +15417,26 @@ trackedFiles: id: dbe9751f8369 last_write_checksum: sha1:a81c2db74730e3bcc3ce4e6543802ac611b85aad pristine_git_object: 0594f16a7b09935414c086512953889a9fc4c5d6 + src/funcs/endUsersCreate.ts: + id: 78ea72b341ba + last_write_checksum: sha1:32fb36ac769b66a1454a969392b60b6218aee2ee + pristine_git_object: 1bb981d90188ba546f6ccdfadb0ae5632c7d17db + src/funcs/endUsersDelete.ts: + id: 30bac7aa7889 + last_write_checksum: sha1:ccc6cd234f602ee792fe52f12b512b01fee6f475 + pristine_git_object: c32be569d8d07496a3d9e63d1cab076d70a668dc + src/funcs/endUsersGet.ts: + id: 8f983b00a600 + last_write_checksum: sha1:09a02ee7e7bf61550cb5a1f243ee7650017f32fc + pristine_git_object: 67d765459f210f3dbb16d56e77a93d276247d68b + src/funcs/endUsersList.ts: + id: d58d0dba487d + last_write_checksum: sha1:8ddb186b8c0ea3365caec7747eb71c15046efe8f + pristine_git_object: cd090bb67effb53daf561d5e8e48ec2f7dc4074f + src/funcs/endUsersUpdate.ts: + id: 7fb2aab2b543 + last_write_checksum: sha1:d1d0b334812d3629e4d473878065dfce9e833b37 + pristine_git_object: fbdf1aaa1c3d13884d3f04cf3fdf11b708f3df4a src/funcs/endpointsList.ts: id: ea932ec09987 last_write_checksum: sha1:8b5b468d51af80cfa4be37d98ec9058de70b3e61 @@ -15807,8 +15895,8 @@ trackedFiles: pristine_git_object: a187e58707bdb726ca2aff74941efe7493422d4e src/lib/config.ts: id: 320761608fb3 - last_write_checksum: sha1:0759025c0f31fbe8da38207d2b3a6d1e0039fd3d - pristine_git_object: dda9bda425ea5183b77f8b37f41decd6ae3a33a7 + last_write_checksum: sha1:312110b8ec2a99b871469ebf7803e6e5ddfe4547 + pristine_git_object: cce25acc9ba190c8720ebc05febc8d0568f413eb src/lib/dlv.ts: id: b1988214835a last_write_checksum: sha1:eaac763b22717206a6199104e0403ed17a4e2711 @@ -16919,6 +17007,10 @@ trackedFiles: id: 93fb8363303b last_write_checksum: sha1:5a3ee4e5d8f90bd181f9ac81e06af4f5295cf255 pristine_git_object: db7f7476736a5d486bcbfe50c06b5c80c6e2883e + src/models/createenduserrequest.ts: + id: ff82d51467ad + last_write_checksum: sha1:9311ada63fd3dd926bdef57dff943bdef93885a4 + pristine_git_object: 879187046b5730a0eb1e55cc0eedab8bc940e100 src/models/createguardrailrequest.ts: id: fbf07f1435fd last_write_checksum: sha1:66acff53bf7f1cc4371fb18e54eb741a5a376af6 @@ -17099,6 +17191,14 @@ trackedFiles: id: 83efda25dcf0 last_write_checksum: sha1:524ec06d8573df95f0a5d2daa1782106d1f7c7fb pristine_git_object: afd9fedd3b5285d3929fb4c6f3069b7423412d10 + src/models/enduser.ts: + id: f0f7f996359a + last_write_checksum: sha1:fc98631a971de21f36775e55dc0c2b41f90b710e + pristine_git_object: 125f42f9d1b1f2816c21b775e887e56b5db8950c + src/models/enduserresponse.ts: + id: 8e60bf584de3 + last_write_checksum: sha1:be2bb855e9e43121c38604bebf339ce653e78d9a + pristine_git_object: b90385b35abfd9288934378ca7e5c4a2dc3e98ec src/models/enumcapability.ts: id: 5ad7989f6f99 last_write_checksum: sha1:45b774cb0e11404faa7a432ed7eb8b8e8c904069 @@ -17569,8 +17669,8 @@ trackedFiles: pristine_git_object: 7abdfe096d3adff317db6837dc689c69db92e127 src/models/index.ts: id: f93644b0f37e - last_write_checksum: sha1:46795aabba1766242392766fade162605e10c27b - pristine_git_object: bcafeed8b529f2adad3384fe62fa66b5f3850cd3 + last_write_checksum: sha1:f46918993cf6fc594a1853c4020a62cf9f544fcd + pristine_git_object: 71bcb00a5bed72866963899f52bcce7accb9add7 src/models/inputaudio.ts: id: 9bdc14c7565f last_write_checksum: sha1:2f8dc4c1d6a9c2927d9eb186e0ecedf7b81838e6 @@ -17767,6 +17867,10 @@ trackedFiles: id: 5178e92a44ba last_write_checksum: sha1:18b629168f15330bee7e82f9f1d50f63fdd0f928 pristine_git_object: 71cf52aa220abd1f2e4de769b679815bc1c1ee7d + src/models/listendusersresponse.ts: + id: dc07ec7c7cd3 + last_write_checksum: sha1:5c66917c6a2886d44b32d92428b2206a45fe649f + pristine_git_object: 850860ac9f6cd6bf32efa2ab9f122cd4d9dbc85d src/models/listguardrailsresponse.ts: id: 281c3f73d27b last_write_checksum: sha1:c13d7812479837df8f29f6a6fa50cf2c338cb49b @@ -18235,6 +18339,10 @@ trackedFiles: id: 7c210337fdff last_write_checksum: sha1:b71388f10adb9ba3cd3ca19117b1aea65154a44f pristine_git_object: 3b6f5f9b7e3272cfce46b223963e8be2c0f3afb4 + src/models/operations/createenduser.ts: + id: 0f247a9b55fb + last_write_checksum: sha1:c51e71a87589f06d462bc384ce7aad2a493b8f91 + pristine_git_object: 5da4ce2feb88863bcc5995b96d4b74ace557d2db src/models/operations/createguardrail.ts: id: 36e5a2696dfd last_write_checksum: sha1:4c668c93e119266cfdc1c46da678151673696fdf @@ -18315,6 +18423,10 @@ trackedFiles: id: 948bcb0fbfc1 last_write_checksum: sha1:ef8e8608d2a775b4fef69e01fc91eb12075c9ac7 pristine_git_object: 2bd54f48f0c362b36d41cccf37e6366629b7e39e + src/models/operations/deleteenduser.ts: + id: 3ae73f681eb2 + last_write_checksum: sha1:4fa1f027b207f77fbdc61af592c7ea2d8e17ee59 + pristine_git_object: d91977aa3e6afa104b314b7ccf18dbcf7408a596 src/models/operations/deletefile.ts: id: 4b741f4bc99e last_write_checksum: sha1:0a5fd27b920f8838b1067c6f857b3798f4d3c997 @@ -18411,6 +18523,10 @@ trackedFiles: id: ddb4fa558414 last_write_checksum: sha1:7b258f7d7bcffbb310cb7a77ad4205aa70e6532b pristine_git_object: 38eb7f6f0d0007d758e8aa506507a4045ac483bd + src/models/operations/getenduser.ts: + id: a59cb5362b77 + last_write_checksum: sha1:630a61818da4e139e681414fa632f10223697f6b + pristine_git_object: 7e691d3e33e8e58050f8c17d77e2a40ca3270172 src/models/operations/getfilemetadata.ts: id: accbd0757579 last_write_checksum: sha1:9f6dfcf8d2a144589a41fa60fcd55d9b15c2f98d @@ -18505,8 +18621,8 @@ trackedFiles: pristine_git_object: a052ed42bd123e79be1f05dc823c808f8c32b383 src/models/operations/index.ts: id: 0d9ffaf774d2 - last_write_checksum: sha1:1ae2e2ad9252a08cb92299e9c0dd1bffc3afbe24 - pristine_git_object: a780c5cebfca999edc853e4dcb9e978a83c20f2b + last_write_checksum: sha1:4a773a8c8dc4256c8828d9c92fbd7f5a27e2f975 + pristine_git_object: 077cebae6972029cf96bf4fcb10222a18e991a4d src/models/operations/invokeintern.ts: id: f2b19fbd8a96 last_write_checksum: sha1:55f0d7c3a2020919fbf3e92c2c7524a75a412504 @@ -18539,6 +18655,10 @@ trackedFiles: id: d52e6aeefb5e last_write_checksum: sha1:cc3ac1f58f408404223743f0d9119d12c8d8f942 pristine_git_object: caa00bb10e50850762f9446f2674c7e71e3f3f58 + src/models/operations/listendusers.ts: + id: a9ea0c370613 + last_write_checksum: sha1:6a908d24fa2441c1e5bfe7dad4e3fd23210a6bd4 + pristine_git_object: 9af173b80be4e78ba3de7834ddc8b0adbc40aaeb src/models/operations/listfiles.ts: id: 9220b094caf4 last_write_checksum: sha1:2a42c6fb1638e7d1e80ef9c5c1fdcb0b99d718ce @@ -18695,6 +18815,10 @@ trackedFiles: id: e302ae3fa539 last_write_checksum: sha1:4c2c2862ec42a9e05af7b0c3e5fe2f6234969b05 pristine_git_object: e0cc22e58b768818ff68f4273c1323513115a1a4 + src/models/operations/updateenduser.ts: + id: 15ed3e7fa116 + last_write_checksum: sha1:ea14c72684fc2940e7df0f579de766290cfa3d3a + pristine_git_object: eb674442c71b29a76a74ccc60a91aa306da00fa1 src/models/operations/updateguardrail.ts: id: f9780f5d66dd last_write_checksum: sha1:db1008af35055ff6679ab053c9b5c375bfb0b303 @@ -19675,6 +19799,10 @@ trackedFiles: id: 016842b2461b last_write_checksum: sha1:eb08a44de913f4b9779fa375aa41e15154216e16 pristine_git_object: c14691083fe55e6bc7f5b5204fadbcafcf3c726b + src/models/updateenduserrequest.ts: + id: 74fcb924ddd3 + last_write_checksum: sha1:b1f968c8f4f6335461ee2a2e03501467635ff3ab + pristine_git_object: 4312f0dbed94b3d77d43cf59875e32424910982c src/models/updateguardrailrequest.ts: id: 8ae5b029f2d5 last_write_checksum: sha1:efd52c6243ef20383ac77507d052fbb843d0462a @@ -19951,6 +20079,10 @@ trackedFiles: id: f159be23d878 last_write_checksum: sha1:b7c40ff8c2398c5cbb61f6bc2df25410177feaf6 pristine_git_object: 38d8efb3aecac60c7725f3472d87064630f58c8e + src/sdk/endusers.ts: + id: 8e12697ee658 + last_write_checksum: sha1:ba2b7cdbc518bd1c2306b5b309e32aa9131bf728 + pristine_git_object: a72b7b403780f9c7846e9a99e41a54e93f9c9037 src/sdk/files.ts: id: bb9172f41ecb last_write_checksum: sha1:4a47f4c7367929db50d3d1837b2f2966990e03b8 @@ -20017,8 +20149,8 @@ trackedFiles: pristine_git_object: 8e9b4047e476a17451b5feb7e9d4a32eec7f61f8 src/sdk/sdk.ts: id: 784571af2f69 - last_write_checksum: sha1:1190b7841d0cea588ae8fbcdb8029534f428ea50 - pristine_git_object: 2ddd1f313563df2c7b3a2706155e6922164bb18a + last_write_checksum: sha1:c9a5a2c5d3fedd9c4f716bca1aa078870bec6481 + pristine_git_object: 0e92ecb55554d552bffe8661e891497c70989eb8 src/sdk/stt.ts: id: fd9e88c22d1f last_write_checksum: sha1:59ba5f5c87bc57bf52d0b46b81e194a3099b08fb @@ -23914,5 +24046,94 @@ examples: application/json: {"error": {"code": 404, "message": "Resource not found"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + listEndUsers: + speakeasy-default-list-end-users: + parameters: + query: + offset: 0 + limit: 50 + include_inactive: false + responses: + "200": + application/json: {"data": [{"created_at": "2026-09-16T12:00:00Z", "is_active": true, "updated_at": "2026-09-16T12:00:00Z", "user": "employee_123"}], "total_count": 1} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + createEndUser: + speakeasy-default-create-end-user: + requestBody: + application/json: {"user": "employee_123"} + responses: + "201": + application/json: {"data": {"created_at": "2026-09-16T12:00:00Z", "is_active": true, "updated_at": "2026-09-16T12:00:00Z", "user": "employee_123"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + deleteEndUser: + speakeasy-default-delete-end-user: + parameters: + path: + user: "employee_123" + responses: + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + getEndUser: + speakeasy-default-get-end-user: + parameters: + path: + user: "employee_123" + responses: + "200": + application/json: {"data": {"created_at": "2026-09-16T12:00:00Z", "is_active": true, "updated_at": "2026-09-16T12:00:00Z", "user": "employee_123"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + updateEndUser: + speakeasy-default-update-end-user: + parameters: + path: + user: "employee_123" + requestBody: + application/json: {"is_active": true} + responses: + "200": + application/json: {"data": {"created_at": "2026-09-16T12:00:00Z", "is_active": true, "updated_at": "2026-09-16T12:00:00Z", "user": "employee_123"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Typescript SDK Changes:\n* `openrouter.batch.createBatches()`: `response.results[].response.body` **Changed** (Breaking ⚠️)\n* `openrouter.batch.getBatches()`: `response.results[].response.body` **Changed** (Breaking ⚠️)\n* `openrouter.responses.send()`: \n * `request.responsesRequest.plugins[].union(alignment)` **Added**\n * `response` **Changed** (Breaking ⚠️)\n* `openrouter.beta.responses.send()`: \n * `request.responsesRequest.plugins[].union(alignment)` **Added**\n * `response` **Changed** (Breaking ⚠️)\n* `openrouter.chat.send()`: \n * `request.chatRequest.plugins[].union(alignment)` **Added**\n* `openrouter.presets.createPresetsChatCompletions()`: \n * `request.chatRequest.plugins[].union(alignment)` **Added**\n* `openrouter.presets.createPresetsMessages()`: \n * `request.messagesRequest.plugins[].union(alignment)` **Added**\n* `openrouter.presets.createPresetsResponses()`: \n * `request.responsesRequest.plugins[].union(alignment)` **Added**\n" +releaseNotes: | + ## Typescript SDK Changes: + * `openrouter.endUsers.list()`: **Added** + * `openrouter.endUsers.create()`: **Added** + * `openrouter.endUsers.delete()`: **Added** + * `openrouter.endUsers.get()`: **Added** + * `openrouter.endUsers.update()`: **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index ff7bb6671..9e4df8667 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true typescript: - version: 1.4.10 + version: 1.4.11 acceptHeaderEnum: false additionalDependencies: dependencies: diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 094c8b1ee..c6f83a757 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -9351,6 +9351,21 @@ components: - 'response' - 'sequence_number' type: 'object' + CreateEndUserRequest: + additionalProperties: false + example: + user: 'employee_123' + properties: + user: + description: 'Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths.' + example: 'employee_123' + maxLength: 256 + minLength: 1 + pattern: '^[^\p{Cc}]+$' + type: 'string' + required: + - 'user' + type: 'object' CreateGuardrailRequest: example: allowed_models: null @@ -10837,6 +10852,54 @@ components: example: 0 type: 'integer' x-speakeasy-unknown-values: allow + EndUser: + additionalProperties: false + example: + created_at: '2026-09-16T12:00:00Z' + is_active: true + updated_at: '2026-09-16T12:00:00Z' + user: 'employee_123' + properties: + created_at: + description: 'Registration creation time.' + example: '2026-09-16T12:00:00Z' + format: 'date-time' + type: 'string' + is_active: + description: 'Whether this registration is active. Not an inference authorization decision.' + example: true + type: 'boolean' + updated_at: + description: 'Last registration lifecycle update time.' + example: '2026-09-16T12:00:00Z' + format: 'date-time' + type: 'string' + user: + description: 'Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths.' + example: 'employee_123' + maxLength: 256 + minLength: 1 + pattern: '^[^\p{Cc}]+$' + type: 'string' + required: + - 'user' + - 'is_active' + - 'created_at' + - 'updated_at' + type: 'object' + EndUserResponse: + example: + data: + created_at: '2026-09-16T12:00:00Z' + is_active: true + updated_at: '2026-09-16T12:00:00Z' + user: 'employee_123' + properties: + data: + $ref: '#/components/schemas/EndUser' + required: + - 'data' + type: 'object' EnumCapability: description: 'A parameter that accepts one of a discrete set of string values.' example: @@ -15611,6 +15674,27 @@ components: - 'architecture' - 'endpoints' type: 'object' + ListEndUsersResponse: + example: + data: + - created_at: '2026-09-16T12:00:00Z' + is_active: true + updated_at: '2026-09-16T12:00:00Z' + user: 'employee_123' + total_count: 1 + properties: + data: + items: + $ref: '#/components/schemas/EndUser' + type: 'array' + total_count: + description: 'Number of registrations matching the filters before pagination.' + example: 1 + type: 'integer' + required: + - 'data' + - 'total_count' + type: 'object' ListGuardrailsResponse: example: data: @@ -31014,6 +31098,18 @@ components: required: - 'data' type: 'object' + UpdateEndUserRequest: + additionalProperties: false + example: + is_active: true + properties: + is_active: + description: 'Registration state only; does not enforce inference access.' + example: true + type: 'boolean' + required: + - 'is_active' + type: 'object' UpdateGuardrailRequest: example: description: 'Updated description' @@ -37698,6 +37794,424 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /end-users: + get: + description: 'List registrations belonging to the authenticated organization. Inactive registrations are excluded by default. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'listEndUsers' + parameters: + - description: 'Number of records to skip for pagination' + in: 'query' + name: 'offset' + required: false + schema: + default: 0 + description: 'Number of records to skip for pagination' + example: 0 + minimum: 0 + type: + - 'integer' + - 'null' + - description: 'Maximum number of records to return (max 100)' + in: 'query' + name: 'limit' + required: false + schema: + default: 50 + description: 'Maximum number of records to return (max 100)' + example: 50 + maximum: 100 + minimum: 1 + type: 'integer' + - description: 'Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths.' + in: 'query' + name: 'user' + required: false + schema: + description: 'Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths.' + example: 'employee_123' + maxLength: 256 + minLength: 1 + pattern: '^[^\p{Cc}]+$' + type: 'string' + - description: 'Include deactivated registrations.' + in: 'query' + name: 'include_inactive' + required: false + schema: + default: false + description: 'Include deactivated registrations.' + example: false + type: 'boolean' + responses: + '200': + content: + application/json: + example: + data: + - created_at: '2026-09-16T12:00:00Z' + is_active: true + updated_at: '2026-09-16T12:00:00Z' + user: 'employee_123' + total_count: 1 + schema: + $ref: '#/components/schemas/ListEndUsersResponse' + description: 'Matching registrations and their total count.' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'List registered end users' + tags: + - 'End Users' + x-speakeasy-name-override: 'list' + x-speakeasy-pagination: + inputs: + - in: 'parameters' + name: 'offset' + type: 'offset' + - in: 'parameters' + name: 'limit' + type: 'limit' + outputs: + results: '$.data' + type: 'offsetLimit' + post: + description: 'Register a caller-supplied tracking ID under the authenticated organization. No login account, policy, or credentials are created. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'createEndUser' + requestBody: + content: + application/json: + example: + user: 'employee_123' + schema: + $ref: '#/components/schemas/CreateEndUserRequest' + required: true + responses: + '201': + content: + application/json: + example: + data: + created_at: '2026-09-16T12:00:00Z' + is_active: true + updated_at: '2026-09-16T12:00:00Z' + user: 'employee_123' + schema: + $ref: '#/components/schemas/EndUserResponse' + description: 'The registered end user. No generated public identifier is returned.' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'This tracking ID is already registered' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'The tracking ID is already registered in this organization, active or not.' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Register an end user' + tags: + - 'End Users' + x-speakeasy-name-override: 'create' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /end-users/{user}: + delete: + description: 'Soft-deactivate a registration while retaining its tracking ID. Repeat deactivation succeeds. This does not block inference; reactivate through PATCH. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'deleteEndUser' + parameters: + - description: 'Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths.' + in: 'path' + name: 'user' + required: true + schema: + description: 'Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths.' + example: 'employee_123' + maxLength: 256 + minLength: 1 + pattern: '^[^\p{Cc}]+$' + type: 'string' + responses: + '204': + description: 'Registration is inactive.' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Deactivate a registered end user' + tags: + - 'End Users' + x-speakeasy-name-override: 'delete' + get: + description: 'Retrieve an active or inactive registration by its URL-encoded, caller-supplied tracking ID. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'getEndUser' + parameters: + - description: 'Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths.' + in: 'path' + name: 'user' + required: true + schema: + description: 'Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths.' + example: 'employee_123' + maxLength: 256 + minLength: 1 + pattern: '^[^\p{Cc}]+$' + type: 'string' + responses: + '200': + content: + application/json: + example: + data: + created_at: '2026-09-16T12:00:00Z' + is_active: true + updated_at: '2026-09-16T12:00:00Z' + user: 'employee_123' + schema: + $ref: '#/components/schemas/EndUserResponse' + description: 'The registered end user. No generated public identifier is returned.' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Get a registered end user' + tags: + - 'End Users' + x-speakeasy-name-override: 'get' + patch: + description: 'Update registration state without changing identity. State changes do not enforce inference access. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'updateEndUser' + parameters: + - description: 'Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths.' + in: 'path' + name: 'user' + required: true + schema: + description: 'Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths.' + example: 'employee_123' + maxLength: 256 + minLength: 1 + pattern: '^[^\p{Cc}]+$' + type: 'string' + requestBody: + content: + application/json: + example: + is_active: true + schema: + $ref: '#/components/schemas/UpdateEndUserRequest' + required: true + responses: + '200': + content: + application/json: + example: + data: + created_at: '2026-09-16T12:00:00Z' + is_active: true + updated_at: '2026-09-16T12:00:00Z' + user: 'employee_123' + schema: + $ref: '#/components/schemas/EndUserResponse' + description: 'The registered end user. No generated public identifier is returned.' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Update a registered end user' + tags: + - 'End Users' + x-speakeasy-name-override: 'update' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /endpoints/zdr: get: operationId: 'listEndpointsZdr' @@ -52628,6 +53142,8 @@ tags: name: 'Datasets' - description: 'Text embedding endpoints' name: 'Embeddings' + - description: 'End Users endpoints' + name: 'End Users' - description: 'Endpoint information' name: 'Endpoints' - description: 'Files endpoints' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 949f62fff..7e4aeb9bd 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:c8c79e1736c1fe4f8cf41b91c4cf5d1a15fcdb76c7894554473c9d66f5f8f623 - sourceBlobDigest: sha256:3bf709d7c34bd62926e0edcb4a446064621942f7c503bacc23efa1edfefc9289 + sourceRevisionDigest: sha256:3d82f751670dd50d0e90e04db39a4356806f6b9fe5792c91918ab84456510e81 + sourceBlobDigest: sha256:ea122925cea8384838d19e1b35f425a89536333f0131d822327c50413ae97dc0 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: openrouter: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:c8c79e1736c1fe4f8cf41b91c4cf5d1a15fcdb76c7894554473c9d66f5f8f623 - sourceBlobDigest: sha256:3bf709d7c34bd62926e0edcb4a446064621942f7c503bacc23efa1edfefc9289 + sourceRevisionDigest: sha256:3d82f751670dd50d0e90e04db39a4356806f6b9fe5792c91918ab84456510e81 + sourceBlobDigest: sha256:ea122925cea8384838d19e1b35f425a89536333f0131d822327c50413ae97dc0 codeSamplesNamespace: open-router-chat-completions-api-typescript-code-samples - codeSamplesRevisionDigest: sha256:612fc0efb47ef618e69ba80bfa02e837d56ffb63522f52666e1bd44b1aa93010 + codeSamplesRevisionDigest: sha256:f50b8af1648bcfb755bea92bd650bf4d119f04d90612262925cffc7502296edd workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 59b48746d..48f696fc8 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4256,4 +4256,14 @@ Based on: ### Generated - [typescript v1.4.10] . ### Releases -- [NPM v1.4.10] https://www.npmjs.com/package/@openrouter/sdk/v/1.4.10 - . \ No newline at end of file +- [NPM v1.4.10] https://www.npmjs.com/package/@openrouter/sdk/v/1.4.10 - . + +## 2026-09-30 18:08:24 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v1.4.11] . +### Releases +- [NPM v1.4.11] https://www.npmjs.com/package/@openrouter/sdk/v/1.4.11 - . \ No newline at end of file diff --git a/docs/models/createenduserrequest.mdx b/docs/models/createenduserrequest.mdx new file mode 100644 index 000000000..90851a656 --- /dev/null +++ b/docs/models/createenduserrequest.mdx @@ -0,0 +1,19 @@ +--- +title: "CreateEndUserRequest" +--- + +## Example Usage + +```typescript +import { CreateEndUserRequest } from "@openrouter/sdk/models"; + +let value: CreateEndUserRequest = { + user: "employee_123", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | +| `user` | *string* | :heavy_check_mark: | Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths. | employee_123 | \ No newline at end of file diff --git a/docs/models/enduser.mdx b/docs/models/enduser.mdx new file mode 100644 index 000000000..ed275b828 --- /dev/null +++ b/docs/models/enduser.mdx @@ -0,0 +1,25 @@ +--- +title: "EndUser" +--- + +## Example Usage + +```typescript +import { EndUser } from "@openrouter/sdk/models"; + +let value: EndUser = { + createdAt: new Date("2026-09-16T12:00:00Z"), + isActive: true, + updatedAt: new Date("2026-09-16T12:00:00Z"), + user: "employee_123", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | +| `createdAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | Registration creation time. | 2026-09-16T12:00:00Z | +| `isActive` | *boolean* | :heavy_check_mark: | Whether this registration is active. Not an inference authorization decision. | true | +| `updatedAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | Last registration lifecycle update time. | 2026-09-16T12:00:00Z | +| `user` | *string* | :heavy_check_mark: | Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths. | employee_123 | \ No newline at end of file diff --git a/docs/models/enduserresponse.mdx b/docs/models/enduserresponse.mdx new file mode 100644 index 000000000..f21c4ccc9 --- /dev/null +++ b/docs/models/enduserresponse.mdx @@ -0,0 +1,24 @@ +--- +title: "EndUserResponse" +--- + +## Example Usage + +```typescript +import { EndUserResponse } from "@openrouter/sdk/models"; + +let value: EndUserResponse = { + data: { + createdAt: new Date("2026-09-16T12:00:00Z"), + isActive: true, + updatedAt: new Date("2026-09-16T12:00:00Z"), + user: "employee_123", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `data` | [models.EndUser](../models/enduser.mdx) | :heavy_check_mark: | N/A | \{
"created_at": "2026-09-16T12:00:00Z",
"is_active": true,
"updated_at": "2026-09-16T12:00:00Z",
"user": "employee_123"
} | \ No newline at end of file diff --git a/docs/models/listendusersresponse.mdx b/docs/models/listendusersresponse.mdx new file mode 100644 index 000000000..c6ce15cde --- /dev/null +++ b/docs/models/listendusersresponse.mdx @@ -0,0 +1,28 @@ +--- +title: "ListEndUsersResponse" +--- + +## Example Usage + +```typescript +import { ListEndUsersResponse } from "@openrouter/sdk/models"; + +let value: ListEndUsersResponse = { + data: [ + { + createdAt: new Date("2026-09-16T12:00:00Z"), + isActive: true, + updatedAt: new Date("2026-09-16T12:00:00Z"), + user: "employee_123", + }, + ], + totalCount: 1, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `data` | [models.EndUser](../models/enduser.mdx)[] | :heavy_check_mark: | N/A | | +| `totalCount` | *number* | :heavy_check_mark: | Number of registrations matching the filters before pagination. | 1 | \ No newline at end of file diff --git a/docs/models/operations/createenduserglobals.mdx b/docs/models/operations/createenduserglobals.mdx new file mode 100644 index 000000000..1590d5b98 --- /dev/null +++ b/docs/models/operations/createenduserglobals.mdx @@ -0,0 +1,19 @@ +--- +title: "CreateEndUserGlobals" +--- + +## Example Usage + +```typescript +import { CreateEndUserGlobals } from "@openrouter/sdk/models/operations"; + +let value: CreateEndUserGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `httpReferer` | *string* | :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.
| +| `appTitle` | *string* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `appCategories` | *string* | :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/models/operations/createenduserrequest.mdx b/docs/models/operations/createenduserrequest.mdx new file mode 100644 index 000000000..efcbc7ce2 --- /dev/null +++ b/docs/models/operations/createenduserrequest.mdx @@ -0,0 +1,24 @@ +--- +title: "CreateEndUserRequest" +--- + +## Example Usage + +```typescript +import { CreateEndUserRequest } from "@openrouter/sdk/models/operations"; + +let value: CreateEndUserRequest = { + createEndUserRequest: { + user: "employee_123", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `httpReferer` | *string* | :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.
| | +| `appTitle` | *string* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `appCategories` | *string* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `createEndUserRequest` | [models.CreateEndUserRequest](../../models/createenduserrequest.mdx) | :heavy_check_mark: | N/A | \{
"user": "employee_123"
} | \ No newline at end of file diff --git a/docs/models/operations/deleteenduserglobals.mdx b/docs/models/operations/deleteenduserglobals.mdx new file mode 100644 index 000000000..e06315db5 --- /dev/null +++ b/docs/models/operations/deleteenduserglobals.mdx @@ -0,0 +1,19 @@ +--- +title: "DeleteEndUserGlobals" +--- + +## Example Usage + +```typescript +import { DeleteEndUserGlobals } from "@openrouter/sdk/models/operations"; + +let value: DeleteEndUserGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `httpReferer` | *string* | :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.
| +| `appTitle` | *string* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `appCategories` | *string* | :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/models/operations/deleteenduserrequest.mdx b/docs/models/operations/deleteenduserrequest.mdx new file mode 100644 index 000000000..6626390b1 --- /dev/null +++ b/docs/models/operations/deleteenduserrequest.mdx @@ -0,0 +1,22 @@ +--- +title: "DeleteEndUserRequest" +--- + +## Example Usage + +```typescript +import { DeleteEndUserRequest } from "@openrouter/sdk/models/operations"; + +let value: DeleteEndUserRequest = { + user: "employee_123", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `httpReferer` | *string* | :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.
| | +| `appTitle` | *string* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `appCategories` | *string* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `user` | *string* | :heavy_check_mark: | Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths. | employee_123 | \ No newline at end of file diff --git a/docs/models/operations/getenduserglobals.mdx b/docs/models/operations/getenduserglobals.mdx new file mode 100644 index 000000000..b391ec73e --- /dev/null +++ b/docs/models/operations/getenduserglobals.mdx @@ -0,0 +1,19 @@ +--- +title: "GetEndUserGlobals" +--- + +## Example Usage + +```typescript +import { GetEndUserGlobals } from "@openrouter/sdk/models/operations"; + +let value: GetEndUserGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `httpReferer` | *string* | :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.
| +| `appTitle` | *string* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `appCategories` | *string* | :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/models/operations/getenduserrequest.mdx b/docs/models/operations/getenduserrequest.mdx new file mode 100644 index 000000000..7238fb709 --- /dev/null +++ b/docs/models/operations/getenduserrequest.mdx @@ -0,0 +1,22 @@ +--- +title: "GetEndUserRequest" +--- + +## Example Usage + +```typescript +import { GetEndUserRequest } from "@openrouter/sdk/models/operations"; + +let value: GetEndUserRequest = { + user: "employee_123", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `httpReferer` | *string* | :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.
| | +| `appTitle` | *string* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `appCategories` | *string* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `user` | *string* | :heavy_check_mark: | Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths. | employee_123 | \ No newline at end of file diff --git a/docs/models/operations/listendusersglobals.mdx b/docs/models/operations/listendusersglobals.mdx new file mode 100644 index 000000000..0a953dc8f --- /dev/null +++ b/docs/models/operations/listendusersglobals.mdx @@ -0,0 +1,19 @@ +--- +title: "ListEndUsersGlobals" +--- + +## Example Usage + +```typescript +import { ListEndUsersGlobals } from "@openrouter/sdk/models/operations"; + +let value: ListEndUsersGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `httpReferer` | *string* | :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.
| +| `appTitle` | *string* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `appCategories` | *string* | :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/models/operations/listendusersrequest.mdx b/docs/models/operations/listendusersrequest.mdx new file mode 100644 index 000000000..ad676c0b7 --- /dev/null +++ b/docs/models/operations/listendusersrequest.mdx @@ -0,0 +1,23 @@ +--- +title: "ListEndUsersRequest" +--- + +## Example Usage + +```typescript +import { ListEndUsersRequest } from "@openrouter/sdk/models/operations"; + +let value: ListEndUsersRequest = {}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `httpReferer` | *string* | :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.
| | +| `appTitle` | *string* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `appCategories` | *string* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *number* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | +| `limit` | *number* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | +| `user` | *string* | :heavy_minus_sign: | Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths. | employee_123 | +| `includeInactive` | *boolean* | :heavy_minus_sign: | Include deactivated registrations. | false | \ No newline at end of file diff --git a/docs/models/operations/listendusersresponse.mdx b/docs/models/operations/listendusersresponse.mdx new file mode 100644 index 000000000..d8c822268 --- /dev/null +++ b/docs/models/operations/listendusersresponse.mdx @@ -0,0 +1,29 @@ +--- +title: "ListEndUsersResponse" +--- + +## Example Usage + +```typescript +import { ListEndUsersResponse } from "@openrouter/sdk/models/operations"; + +let value: ListEndUsersResponse = { + result: { + data: [ + { + createdAt: new Date("2026-09-16T12:00:00Z"), + isActive: true, + updatedAt: new Date("2026-09-16T12:00:00Z"), + user: "employee_123", + }, + ], + totalCount: 1, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `result` | [models.ListEndUsersResponse](../../models/listendusersresponse.mdx) | :heavy_check_mark: | N/A | \{
"data": [
\{
"created_at": "2026-09-16T12:00:00Z",
"is_active": true,
"updated_at": "2026-09-16T12:00:00Z",
"user": "employee_123"
}
],
"total_count": 1
} | \ No newline at end of file diff --git a/docs/models/operations/updateenduserglobals.mdx b/docs/models/operations/updateenduserglobals.mdx new file mode 100644 index 000000000..b59f4abfb --- /dev/null +++ b/docs/models/operations/updateenduserglobals.mdx @@ -0,0 +1,19 @@ +--- +title: "UpdateEndUserGlobals" +--- + +## Example Usage + +```typescript +import { UpdateEndUserGlobals } from "@openrouter/sdk/models/operations"; + +let value: UpdateEndUserGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `httpReferer` | *string* | :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.
| +| `appTitle` | *string* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `appCategories` | *string* | :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/models/operations/updateenduserrequest.mdx b/docs/models/operations/updateenduserrequest.mdx new file mode 100644 index 000000000..aca63240c --- /dev/null +++ b/docs/models/operations/updateenduserrequest.mdx @@ -0,0 +1,26 @@ +--- +title: "UpdateEndUserRequest" +--- + +## Example Usage + +```typescript +import { UpdateEndUserRequest } from "@openrouter/sdk/models/operations"; + +let value: UpdateEndUserRequest = { + user: "employee_123", + updateEndUserRequest: { + isActive: true, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `httpReferer` | *string* | :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.
| | +| `appTitle` | *string* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `appCategories` | *string* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `user` | *string* | :heavy_check_mark: | Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths. | employee_123 | +| `updateEndUserRequest` | [models.UpdateEndUserRequest](../../models/updateenduserrequest.mdx) | :heavy_check_mark: | N/A | \{
"is_active": true
} | \ No newline at end of file diff --git a/docs/models/updateenduserrequest.mdx b/docs/models/updateenduserrequest.mdx new file mode 100644 index 000000000..d5e77b060 --- /dev/null +++ b/docs/models/updateenduserrequest.mdx @@ -0,0 +1,19 @@ +--- +title: "UpdateEndUserRequest" +--- + +## Example Usage + +```typescript +import { UpdateEndUserRequest } from "@openrouter/sdk/models"; + +let value: UpdateEndUserRequest = { + isActive: true, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | +| `isActive` | *boolean* | :heavy_check_mark: | Registration state only; does not enforce inference access. | true | \ No newline at end of file diff --git a/docs/sdks/endusers/README.mdx b/docs/sdks/endusers/README.mdx new file mode 100644 index 000000000..a25075e64 --- /dev/null +++ b/docs/sdks/endusers/README.mdx @@ -0,0 +1,437 @@ +--- +title: "EndUsers" +description: "End Users endpoints" +--- + +## Overview + +End Users endpoints + +### Available Operations + +* [list](#list) - List registered end users +* [create](#create) - Register an end user +* [delete](#delete) - Deactivate a registered end user +* [get](#get) - Get a registered end user +* [update](#update) - Update a registered end user + +## list + +List registrations belonging to the authenticated organization. Inactive registrations are excluded by default. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```typescript +import { OpenRouter } from "@openrouter/sdk"; + +const openRouter = new OpenRouter({ + httpReferer: "", + appTitle: "", + appCategories: "", + apiKey: process.env["OPENROUTER_API_KEY"] ?? "", +}); + +async function run() { + const result = await openRouter.endUsers.list(); + + for await (const page of result) { + console.log(page); + } +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { OpenRouterCore } from "@openrouter/sdk/core.js"; +import { endUsersList } from "@openrouter/sdk/funcs/endUsersList.js"; + +// Use `OpenRouterCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const openRouter = new OpenRouterCore({ + httpReferer: "", + appTitle: "", + appCategories: "", + apiKey: process.env["OPENROUTER_API_KEY"] ?? "", +}); + +async function run() { + const res = await endUsersList(openRouter); + if (res.ok) { + const { value: result } = res; + for await (const page of result) { + console.log(page); + } + } else { + console.log("endUsersList failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.ListEndUsersRequest](../../models/operations/listendusersrequest.mdx) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.ListEndUsersResponse](../../models/operations/listendusersresponse.mdx)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## create + +Register a caller-supplied tracking ID under the authenticated organization. No login account, policy, or credentials are created. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```typescript +import { OpenRouter } from "@openrouter/sdk"; + +const openRouter = new OpenRouter({ + httpReferer: "", + appTitle: "", + appCategories: "", + apiKey: process.env["OPENROUTER_API_KEY"] ?? "", +}); + +async function run() { + const result = await openRouter.endUsers.create({ + createEndUserRequest: { + user: "employee_123", + }, + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { OpenRouterCore } from "@openrouter/sdk/core.js"; +import { endUsersCreate } from "@openrouter/sdk/funcs/endUsersCreate.js"; + +// Use `OpenRouterCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const openRouter = new OpenRouterCore({ + httpReferer: "", + appTitle: "", + appCategories: "", + apiKey: process.env["OPENROUTER_API_KEY"] ?? "", +}); + +async function run() { + const res = await endUsersCreate(openRouter, { + createEndUserRequest: { + user: "employee_123", + }, + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("endUsersCreate failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.CreateEndUserRequest](../../models/operations/createenduserrequest.mdx) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.EndUserResponse](../../models/enduserresponse.mdx)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## delete + +Soft-deactivate a registration while retaining its tracking ID. Repeat deactivation succeeds. This does not block inference; reactivate through PATCH. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```typescript +import { OpenRouter } from "@openrouter/sdk"; + +const openRouter = new OpenRouter({ + httpReferer: "", + appTitle: "", + appCategories: "", + apiKey: process.env["OPENROUTER_API_KEY"] ?? "", +}); + +async function run() { + await openRouter.endUsers.delete({ + user: "employee_123", + }); + + +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { OpenRouterCore } from "@openrouter/sdk/core.js"; +import { endUsersDelete } from "@openrouter/sdk/funcs/endUsersDelete.js"; + +// Use `OpenRouterCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const openRouter = new OpenRouterCore({ + httpReferer: "", + appTitle: "", + appCategories: "", + apiKey: process.env["OPENROUTER_API_KEY"] ?? "", +}); + +async function run() { + const res = await endUsersDelete(openRouter, { + user: "employee_123", + }); + if (res.ok) { + const { value: result } = res; + + } else { + console.log("endUsersDelete failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.DeleteEndUserRequest](../../models/operations/deleteenduserrequest.mdx) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## get + +Retrieve an active or inactive registration by its URL-encoded, caller-supplied tracking ID. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```typescript +import { OpenRouter } from "@openrouter/sdk"; + +const openRouter = new OpenRouter({ + httpReferer: "", + appTitle: "", + appCategories: "", + apiKey: process.env["OPENROUTER_API_KEY"] ?? "", +}); + +async function run() { + const result = await openRouter.endUsers.get({ + user: "employee_123", + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { OpenRouterCore } from "@openrouter/sdk/core.js"; +import { endUsersGet } from "@openrouter/sdk/funcs/endUsersGet.js"; + +// Use `OpenRouterCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const openRouter = new OpenRouterCore({ + httpReferer: "", + appTitle: "", + appCategories: "", + apiKey: process.env["OPENROUTER_API_KEY"] ?? "", +}); + +async function run() { + const res = await endUsersGet(openRouter, { + user: "employee_123", + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("endUsersGet failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.GetEndUserRequest](../../models/operations/getenduserrequest.mdx) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.EndUserResponse](../../models/enduserresponse.mdx)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## update + +Update registration state without changing identity. State changes do not enforce inference access. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```typescript +import { OpenRouter } from "@openrouter/sdk"; + +const openRouter = new OpenRouter({ + httpReferer: "", + appTitle: "", + appCategories: "", + apiKey: process.env["OPENROUTER_API_KEY"] ?? "", +}); + +async function run() { + const result = await openRouter.endUsers.update({ + user: "employee_123", + updateEndUserRequest: { + isActive: true, + }, + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { OpenRouterCore } from "@openrouter/sdk/core.js"; +import { endUsersUpdate } from "@openrouter/sdk/funcs/endUsersUpdate.js"; + +// Use `OpenRouterCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const openRouter = new OpenRouterCore({ + httpReferer: "", + appTitle: "", + appCategories: "", + apiKey: process.env["OPENROUTER_API_KEY"] ?? "", +}); + +async function run() { + const res = await endUsersUpdate(openRouter, { + user: "employee_123", + updateEndUserRequest: { + isActive: true, + }, + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("endUsersUpdate failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.UpdateEndUserRequest](../../models/operations/updateenduserrequest.mdx) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.EndUserResponse](../../models/enduserresponse.mdx)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/jsr.json b/jsr.json index 0ef9ababe..eb65c9822 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "@openrouter/sdk", - "version": "1.4.10", + "version": "1.4.11", "exports": { ".": "./src/index.ts", "./models/errors": "./src/models/errors/index.ts", diff --git a/package.json b/package.json index 2787949c0..f55a16326 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@openrouter/sdk", - "version": "1.4.10", + "version": "1.4.11", "author": "OpenRouter", "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.", "keywords": [ @@ -73,15 +73,15 @@ "lint": "eslint --cache --max-warnings=0 src", "build": "tsc && node scripts/unbarrel-imports.js", "prepublishOnly": "npm run build", - "typecheck": "tsc --noEmit", + "prepare": "npm run build", "typecheck:transit": "exit 0", "postinstall": "node scripts/check-types.js || true", - "prepare": "npm run build", - "compile": "tsc && node scripts/unbarrel-imports.js", "test": "vitest --run --project unit", "test:e2e": "vitest --run --project e2e", "test:transit": "exit 0", - "test:watch": "vitest --watch --project unit" + "test:watch": "vitest --watch --project unit", + "typecheck": "tsc --noEmit", + "compile": "tsc && node scripts/unbarrel-imports.js" }, "peerDependencies": { diff --git a/src/funcs/endUsersCreate.ts b/src/funcs/endUsersCreate.ts new file mode 100644 index 000000000..1bb981d90 --- /dev/null +++ b/src/funcs/endUsersCreate.ts @@ -0,0 +1,216 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 78ea72b341ba + */ + +import { OpenRouterCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import { matchStatusCode } from "../lib/http.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import * as errors from "../models/errors/index.js"; +import { OpenRouterError } from "../models/errors/openroutererror.js"; +import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as models from "../models/index.js"; +import * as operations from "../models/operations/index.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Register an end user + * + * @remarks + * Register a caller-supplied tracking ID under the authenticated organization. No login account, policy, or credentials are created. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ +export function endUsersCreate( + client: OpenRouterCore, + request: operations.CreateEndUserRequest, + options?: RequestOptions, +): APIPromise< + Result< + models.EndUserResponse, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.NotFoundResponseError + | errors.ConflictResponseError + | errors.InternalServerResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: OpenRouterCore, + request: operations.CreateEndUserRequest, + options?: RequestOptions, +): Promise< + [ + Result< + models.EndUserResponse, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.NotFoundResponseError + | errors.ConflictResponseError + | errors.InternalServerResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => operations.CreateEndUserRequest$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload.CreateEndUserRequest, { + explode: true, + }); + + const path = pathToFunc("/end-users")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "HTTP-Referer": encodeSimple( + "HTTP-Referer", + payload["HTTP-Referer"] ?? client._options.httpReferer, + { explode: false, charEncoding: "none" }, + ), + "X-OpenRouter-Categories": encodeSimple( + "X-OpenRouter-Categories", + payload.appCategories ?? client._options.appCategories, + { explode: false, charEncoding: "none" }, + ), + "X-OpenRouter-Title": encodeSimple( + "X-OpenRouter-Title", + payload.appTitle ?? client._options.appTitle, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "createEndUser", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + isErrorStatusCode: (statusCode: number) => + matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]), + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + models.EndUserResponse, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.NotFoundResponseError + | errors.ConflictResponseError + | errors.InternalServerResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(201, models.EndUserResponse$inboundSchema), + M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), + M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), + M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), + M.jsonErr(409, errors.ConflictResponseError$inboundSchema), + M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req, { extraFields: responseFields }); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/src/funcs/endUsersDelete.ts b/src/funcs/endUsersDelete.ts new file mode 100644 index 000000000..c32be569d --- /dev/null +++ b/src/funcs/endUsersDelete.ts @@ -0,0 +1,215 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 30bac7aa7889 + */ + +import * as z from "zod/v4"; +import { OpenRouterCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { matchStatusCode } from "../lib/http.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import * as errors from "../models/errors/index.js"; +import { OpenRouterError } from "../models/errors/openroutererror.js"; +import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Deactivate a registered end user + * + * @remarks + * Soft-deactivate a registration while retaining its tracking ID. Repeat deactivation succeeds. This does not block inference; reactivate through PATCH. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ +export function endUsersDelete( + client: OpenRouterCore, + request: operations.DeleteEndUserRequest, + options?: RequestOptions, +): APIPromise< + Result< + void, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.NotFoundResponseError + | errors.InternalServerResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: OpenRouterCore, + request: operations.DeleteEndUserRequest, + options?: RequestOptions, +): Promise< + [ + Result< + void, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.NotFoundResponseError + | errors.InternalServerResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => operations.DeleteEndUserRequest$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + user: encodeSimple("user", payload.user, { + explode: false, + charEncoding: "percent", + }), + }; + const path = pathToFunc("/end-users/{user}")(pathParams); + + const headers = new Headers(compactMap({ + Accept: "application/json", + "HTTP-Referer": encodeSimple( + "HTTP-Referer", + payload["HTTP-Referer"] ?? client._options.httpReferer, + { explode: false, charEncoding: "none" }, + ), + "X-OpenRouter-Categories": encodeSimple( + "X-OpenRouter-Categories", + payload.appCategories ?? client._options.appCategories, + { explode: false, charEncoding: "none" }, + ), + "X-OpenRouter-Title": encodeSimple( + "X-OpenRouter-Title", + payload.appTitle ?? client._options.appTitle, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "deleteEndUser", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "DELETE", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + isErrorStatusCode: (statusCode: number) => + matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]), + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + void, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.NotFoundResponseError + | errors.InternalServerResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.nil(204, z.void()), + M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), + M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), + M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), + M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req, { extraFields: responseFields }); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/src/funcs/endUsersGet.ts b/src/funcs/endUsersGet.ts new file mode 100644 index 000000000..67d765459 --- /dev/null +++ b/src/funcs/endUsersGet.ts @@ -0,0 +1,215 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 8f983b00a600 + */ + +import { OpenRouterCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { matchStatusCode } from "../lib/http.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import * as errors from "../models/errors/index.js"; +import { OpenRouterError } from "../models/errors/openroutererror.js"; +import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as models from "../models/index.js"; +import * as operations from "../models/operations/index.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Get a registered end user + * + * @remarks + * Retrieve an active or inactive registration by its URL-encoded, caller-supplied tracking ID. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ +export function endUsersGet( + client: OpenRouterCore, + request: operations.GetEndUserRequest, + options?: RequestOptions, +): APIPromise< + Result< + models.EndUserResponse, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.NotFoundResponseError + | errors.InternalServerResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: OpenRouterCore, + request: operations.GetEndUserRequest, + options?: RequestOptions, +): Promise< + [ + Result< + models.EndUserResponse, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.NotFoundResponseError + | errors.InternalServerResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => operations.GetEndUserRequest$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + user: encodeSimple("user", payload.user, { + explode: false, + charEncoding: "percent", + }), + }; + const path = pathToFunc("/end-users/{user}")(pathParams); + + const headers = new Headers(compactMap({ + Accept: "application/json", + "HTTP-Referer": encodeSimple( + "HTTP-Referer", + payload["HTTP-Referer"] ?? client._options.httpReferer, + { explode: false, charEncoding: "none" }, + ), + "X-OpenRouter-Categories": encodeSimple( + "X-OpenRouter-Categories", + payload.appCategories ?? client._options.appCategories, + { explode: false, charEncoding: "none" }, + ), + "X-OpenRouter-Title": encodeSimple( + "X-OpenRouter-Title", + payload.appTitle ?? client._options.appTitle, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "getEndUser", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + isErrorStatusCode: (statusCode: number) => + matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]), + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + models.EndUserResponse, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.NotFoundResponseError + | errors.InternalServerResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.EndUserResponse$inboundSchema), + M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), + M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), + M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), + M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req, { extraFields: responseFields }); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/src/funcs/endUsersList.ts b/src/funcs/endUsersList.ts new file mode 100644 index 000000000..cd090bb67 --- /dev/null +++ b/src/funcs/endUsersList.ts @@ -0,0 +1,290 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: d58d0dba487d + */ + +import { OpenRouterCore } from "../core.js"; +import { encodeFormQuery, encodeSimple } from "../lib/encodings.js"; +import { matchStatusCode } from "../lib/http.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import * as errors from "../models/errors/index.js"; +import { OpenRouterError } from "../models/errors/openroutererror.js"; +import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; +import { + createPageIterator, + haltIterator, + PageIterator, + Paginator, +} from "../types/operations.js"; + +/** + * List registered end users + * + * @remarks + * List registrations belonging to the authenticated organization. Inactive registrations are excluded by default. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ +export function endUsersList( + client: OpenRouterCore, + request?: operations.ListEndUsersRequest | undefined, + options?: RequestOptions, +): APIPromise< + PageIterator< + Result< + operations.ListEndUsersResponse, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.NotFoundResponseError + | errors.InternalServerResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + { offset: number } + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: OpenRouterCore, + request?: operations.ListEndUsersRequest | undefined, + options?: RequestOptions, +): Promise< + [ + PageIterator< + Result< + operations.ListEndUsersResponse, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.NotFoundResponseError + | errors.InternalServerResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + { offset: number } + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => + operations.ListEndUsersRequest$outboundSchema.optional().parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return [haltIterator(parsed), { status: "invalid" }]; + } + const payload = parsed.value; + const body = null; + + const path = pathToFunc("/end-users")(); + + const query = encodeFormQuery({ + "include_inactive": payload?.include_inactive, + "limit": payload?.limit, + "offset": payload?.offset, + "user": payload?.user, + }); + + const headers = new Headers(compactMap({ + Accept: "application/json", + "HTTP-Referer": encodeSimple( + "HTTP-Referer", + payload?.["HTTP-Referer"] ?? client._options.httpReferer, + { explode: false, charEncoding: "none" }, + ), + "X-OpenRouter-Categories": encodeSimple( + "X-OpenRouter-Categories", + payload?.appCategories ?? client._options.appCategories, + { explode: false, charEncoding: "none" }, + ), + "X-OpenRouter-Title": encodeSimple( + "X-OpenRouter-Title", + payload?.appTitle ?? client._options.appTitle, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "listEndUsers", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path, + headers: headers, + query: query, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [haltIterator(requestRes), { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + isErrorStatusCode: (statusCode: number) => + matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]), + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [haltIterator(doResult), { status: "request-error", request: req }]; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result, raw] = await M.match< + operations.ListEndUsersResponse, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.NotFoundResponseError + | errors.InternalServerResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, operations.ListEndUsersResponse$inboundSchema, { + key: "Result", + }), + M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), + M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), + M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), + M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req, { extraFields: responseFields }); + if (!result.ok) { + return [haltIterator(result), { + status: "complete", + request: req, + response, + }]; + } + + const nextFunc = ( + responseData: unknown, + ): { + next: Paginator< + Result< + operations.ListEndUsersResponse, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.NotFoundResponseError + | errors.InternalServerResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > + >; + "~next"?: { offset: number }; + } => { + const offset = request?.offset ?? 0; + + if (!responseData) { + return { next: () => null }; + } + const results = (responseData as { data: unknown }).data; + if (!Array.isArray(results) || !results.length) { + return { next: () => null }; + } + const limit = request?.limit ?? 50; + if (results.length < limit) { + return { next: () => null }; + } + const nextOffset = offset + results.length; + + const nextVal = () => + endUsersList( + client, + { + ...request!, + offset: nextOffset, + }, + options, + ); + + return { next: nextVal, "~next": { offset: nextOffset } }; + }; + + const page = { ...result, ...nextFunc(raw) }; + return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, { + status: "complete", + request: req, + response, + }]; +} diff --git a/src/funcs/endUsersUpdate.ts b/src/funcs/endUsersUpdate.ts new file mode 100644 index 000000000..fbdf1aaa1 --- /dev/null +++ b/src/funcs/endUsersUpdate.ts @@ -0,0 +1,218 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 7fb2aab2b543 + */ + +import { OpenRouterCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import { matchStatusCode } from "../lib/http.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import * as errors from "../models/errors/index.js"; +import { OpenRouterError } from "../models/errors/openroutererror.js"; +import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as models from "../models/index.js"; +import * as operations from "../models/operations/index.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Update a registered end user + * + * @remarks + * Update registration state without changing identity. State changes do not enforce inference access. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ +export function endUsersUpdate( + client: OpenRouterCore, + request: operations.UpdateEndUserRequest, + options?: RequestOptions, +): APIPromise< + Result< + models.EndUserResponse, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.NotFoundResponseError + | errors.InternalServerResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: OpenRouterCore, + request: operations.UpdateEndUserRequest, + options?: RequestOptions, +): Promise< + [ + Result< + models.EndUserResponse, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.NotFoundResponseError + | errors.InternalServerResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => operations.UpdateEndUserRequest$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload.UpdateEndUserRequest, { + explode: true, + }); + + const pathParams = { + user: encodeSimple("user", payload.user, { + explode: false, + charEncoding: "percent", + }), + }; + const path = pathToFunc("/end-users/{user}")(pathParams); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "HTTP-Referer": encodeSimple( + "HTTP-Referer", + payload["HTTP-Referer"] ?? client._options.httpReferer, + { explode: false, charEncoding: "none" }, + ), + "X-OpenRouter-Categories": encodeSimple( + "X-OpenRouter-Categories", + payload.appCategories ?? client._options.appCategories, + { explode: false, charEncoding: "none" }, + ), + "X-OpenRouter-Title": encodeSimple( + "X-OpenRouter-Title", + payload.appTitle ?? client._options.appTitle, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "updateEndUser", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "PATCH", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + isErrorStatusCode: (statusCode: number) => + matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]), + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + models.EndUserResponse, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.NotFoundResponseError + | errors.InternalServerResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.EndUserResponse$inboundSchema), + M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), + M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), + M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), + M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req, { extraFields: responseFields }); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/src/lib/config.ts b/src/lib/config.ts index 5fee3f9ce..f1d9de9d8 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -79,7 +79,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "1.0.0", - sdkVersion: "1.4.10", + sdkVersion: "1.4.11", genVersion: "2.914.0", - userAgent: "speakeasy-sdk/typescript 1.4.10 2.914.0 1.0.0 @openrouter/sdk", + userAgent: "speakeasy-sdk/typescript 1.4.11 2.914.0 1.0.0 @openrouter/sdk", } as const; diff --git a/src/models/createenduserrequest.ts b/src/models/createenduserrequest.ts new file mode 100644 index 000000000..879187046 --- /dev/null +++ b/src/models/createenduserrequest.ts @@ -0,0 +1,34 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: ff82d51467ad + */ + +import * as z from "zod/v4"; + +export type CreateEndUserRequest = { + /** + * Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths. + */ + user: string; +}; + +/** @internal */ +export type CreateEndUserRequest$Outbound = { + user: string; +}; + +/** @internal */ +export const CreateEndUserRequest$outboundSchema: z.ZodType< + CreateEndUserRequest$Outbound, + CreateEndUserRequest +> = z.object({ + user: z.string(), +}); + +export function createEndUserRequestToJSON( + createEndUserRequest: CreateEndUserRequest, +): string { + return JSON.stringify( + CreateEndUserRequest$outboundSchema.parse(createEndUserRequest), + ); +} diff --git a/src/models/enduser.ts b/src/models/enduser.ts new file mode 100644 index 000000000..125f42f9d --- /dev/null +++ b/src/models/enduser.ts @@ -0,0 +1,53 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: f0f7f996359a + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; + +export type EndUser = { + /** + * Registration creation time. + */ + createdAt: Date; + /** + * Whether this registration is active. Not an inference authorization decision. + */ + isActive: boolean; + /** + * Last registration lifecycle update time. + */ + updatedAt: Date; + /** + * Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths. + */ + user: string; +}; + +/** @internal */ +export const EndUser$inboundSchema: z.ZodType = z.object({ + created_at: z.iso.datetime({ offset: true }).transform(v => new Date(v)), + is_active: z.boolean(), + updated_at: z.iso.datetime({ offset: true }).transform(v => new Date(v)), + user: z.string(), +}).transform((v) => { + return remap$(v, { + "created_at": "createdAt", + "is_active": "isActive", + "updated_at": "updatedAt", + }); +}); + +export function endUserFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => EndUser$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'EndUser' from JSON`, + ); +} diff --git a/src/models/enduserresponse.ts b/src/models/enduserresponse.ts new file mode 100644 index 000000000..b90385b35 --- /dev/null +++ b/src/models/enduserresponse.ts @@ -0,0 +1,32 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 8e60bf584de3 + */ + +import * as z from "zod/v4"; +import { safeParse } from "../lib/schemas.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { EndUser, EndUser$inboundSchema } from "./enduser.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; + +export type EndUserResponse = { + data: EndUser; +}; + +/** @internal */ +export const EndUserResponse$inboundSchema: z.ZodType< + EndUserResponse, + unknown +> = z.object({ + data: EndUser$inboundSchema, +}); + +export function endUserResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => EndUserResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'EndUserResponse' from JSON`, + ); +} diff --git a/src/models/index.ts b/src/models/index.ts index bcafeed8b..71bcb00a5 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -265,6 +265,7 @@ export * from "./contextcompressionplugin.js"; export * from "./costdetails.js"; export * from "./createbyokkeyrequest.js"; export * from "./createbyokkeyresponse.js"; +export * from "./createenduserrequest.js"; export * from "./createguardrailrequest.js"; export * from "./createguardrailresponse.js"; export * from "./createinternrequest.js"; @@ -310,6 +311,8 @@ export * from "./edgenetworktimeoutresponseerrordata.js"; export * from "./endpointinfo.js"; export * from "./endpointsmetadata.js"; export * from "./endpointstatus.js"; +export * from "./enduser.js"; +export * from "./enduserresponse.js"; export * from "./enumcapability.js"; export * from "./errorevent.js"; export * from "./failabletoolcallstatus.js"; @@ -446,6 +449,7 @@ export * from "./legacychatcontentvideoinput.js"; export * from "./legacywebsearchservertool.js"; export * from "./listbyokkeysresponse.js"; export * from "./listendpointsresponse.js"; +export * from "./listendusersresponse.js"; export * from "./listguardrailsresponse.js"; export * from "./listkeyassignmentsresponse.js"; export * from "./listmemberassignmentsresponse.js"; @@ -781,6 +785,7 @@ export * from "./unifiedbenchmarkssearchrunconfig.js"; export * from "./unprocessableentityresponseerrordata.js"; export * from "./updatebyokkeyrequest.js"; export * from "./updatebyokkeyresponse.js"; +export * from "./updateenduserrequest.js"; export * from "./updateguardrailrequest.js"; export * from "./updateguardrailresponse.js"; export * from "./updateinternrequest.js"; diff --git a/src/models/listendusersresponse.ts b/src/models/listendusersresponse.ts new file mode 100644 index 000000000..850860ac9 --- /dev/null +++ b/src/models/listendusersresponse.ts @@ -0,0 +1,42 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: dc07ec7c7cd3 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { EndUser, EndUser$inboundSchema } from "./enduser.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; + +export type ListEndUsersResponse = { + data: Array; + /** + * Number of registrations matching the filters before pagination. + */ + totalCount: number; +}; + +/** @internal */ +export const ListEndUsersResponse$inboundSchema: z.ZodType< + ListEndUsersResponse, + unknown +> = z.object({ + data: z.array(EndUser$inboundSchema), + total_count: z.int(), +}).transform((v) => { + return remap$(v, { + "total_count": "totalCount", + }); +}); + +export function listEndUsersResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListEndUsersResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListEndUsersResponse' from JSON`, + ); +} diff --git a/src/models/operations/createenduser.ts b/src/models/operations/createenduser.ts new file mode 100644 index 000000000..5da4ce2fe --- /dev/null +++ b/src/models/operations/createenduser.ts @@ -0,0 +1,85 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 0f247a9b55fb + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../../lib/primitives.js"; +import * as models from "../index.js"; + +export type CreateEndUserGlobals = { + /** + * The app identifier should be your app's URL and is used as the primary identifier for rankings. + * + * @remarks + * This is used to track API usage per application. + */ + httpReferer?: string | undefined; + /** + * The app display name allows you to customize how your app appears in OpenRouter's dashboard. + * + * @remarks + */ + appTitle?: string | undefined; + /** + * Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings. + * + * @remarks + */ + appCategories?: string | undefined; +}; + +export type CreateEndUserRequest = { + /** + * The app identifier should be your app's URL and is used as the primary identifier for rankings. + * + * @remarks + * This is used to track API usage per application. + */ + httpReferer?: string | undefined; + /** + * The app display name allows you to customize how your app appears in OpenRouter's dashboard. + * + * @remarks + */ + appTitle?: string | undefined; + /** + * Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings. + * + * @remarks + */ + appCategories?: string | undefined; + createEndUserRequest: models.CreateEndUserRequest; +}; + +/** @internal */ +export type CreateEndUserRequest$Outbound = { + "HTTP-Referer"?: string | undefined; + appTitle?: string | undefined; + appCategories?: string | undefined; + CreateEndUserRequest: models.CreateEndUserRequest$Outbound; +}; + +/** @internal */ +export const CreateEndUserRequest$outboundSchema: z.ZodType< + CreateEndUserRequest$Outbound, + CreateEndUserRequest +> = z.object({ + httpReferer: z.string().optional(), + appTitle: z.string().optional(), + appCategories: z.string().optional(), + createEndUserRequest: models.CreateEndUserRequest$outboundSchema, +}).transform((v) => { + return remap$(v, { + httpReferer: "HTTP-Referer", + createEndUserRequest: "CreateEndUserRequest", + }); +}); + +export function createEndUserRequestToJSON( + createEndUserRequest: CreateEndUserRequest, +): string { + return JSON.stringify( + CreateEndUserRequest$outboundSchema.parse(createEndUserRequest), + ); +} diff --git a/src/models/operations/deleteenduser.ts b/src/models/operations/deleteenduser.ts new file mode 100644 index 000000000..d91977aa3 --- /dev/null +++ b/src/models/operations/deleteenduser.ts @@ -0,0 +1,86 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 3ae73f681eb2 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../../lib/primitives.js"; + +export type DeleteEndUserGlobals = { + /** + * The app identifier should be your app's URL and is used as the primary identifier for rankings. + * + * @remarks + * This is used to track API usage per application. + */ + httpReferer?: string | undefined; + /** + * The app display name allows you to customize how your app appears in OpenRouter's dashboard. + * + * @remarks + */ + appTitle?: string | undefined; + /** + * Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings. + * + * @remarks + */ + appCategories?: string | undefined; +}; + +export type DeleteEndUserRequest = { + /** + * The app identifier should be your app's URL and is used as the primary identifier for rankings. + * + * @remarks + * This is used to track API usage per application. + */ + httpReferer?: string | undefined; + /** + * The app display name allows you to customize how your app appears in OpenRouter's dashboard. + * + * @remarks + */ + appTitle?: string | undefined; + /** + * Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings. + * + * @remarks + */ + appCategories?: string | undefined; + /** + * Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths. + */ + user: string; +}; + +/** @internal */ +export type DeleteEndUserRequest$Outbound = { + "HTTP-Referer"?: string | undefined; + appTitle?: string | undefined; + appCategories?: string | undefined; + user: string; +}; + +/** @internal */ +export const DeleteEndUserRequest$outboundSchema: z.ZodType< + DeleteEndUserRequest$Outbound, + DeleteEndUserRequest +> = z.object({ + httpReferer: z.string().optional(), + appTitle: z.string().optional(), + appCategories: z.string().optional(), + user: z.string(), +}).transform((v) => { + return remap$(v, { + httpReferer: "HTTP-Referer", + }); +}); + +export function deleteEndUserRequestToJSON( + deleteEndUserRequest: DeleteEndUserRequest, +): string { + return JSON.stringify( + DeleteEndUserRequest$outboundSchema.parse(deleteEndUserRequest), + ); +} diff --git a/src/models/operations/getenduser.ts b/src/models/operations/getenduser.ts new file mode 100644 index 000000000..7e691d3e3 --- /dev/null +++ b/src/models/operations/getenduser.ts @@ -0,0 +1,86 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: a59cb5362b77 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../../lib/primitives.js"; + +export type GetEndUserGlobals = { + /** + * The app identifier should be your app's URL and is used as the primary identifier for rankings. + * + * @remarks + * This is used to track API usage per application. + */ + httpReferer?: string | undefined; + /** + * The app display name allows you to customize how your app appears in OpenRouter's dashboard. + * + * @remarks + */ + appTitle?: string | undefined; + /** + * Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings. + * + * @remarks + */ + appCategories?: string | undefined; +}; + +export type GetEndUserRequest = { + /** + * The app identifier should be your app's URL and is used as the primary identifier for rankings. + * + * @remarks + * This is used to track API usage per application. + */ + httpReferer?: string | undefined; + /** + * The app display name allows you to customize how your app appears in OpenRouter's dashboard. + * + * @remarks + */ + appTitle?: string | undefined; + /** + * Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings. + * + * @remarks + */ + appCategories?: string | undefined; + /** + * Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths. + */ + user: string; +}; + +/** @internal */ +export type GetEndUserRequest$Outbound = { + "HTTP-Referer"?: string | undefined; + appTitle?: string | undefined; + appCategories?: string | undefined; + user: string; +}; + +/** @internal */ +export const GetEndUserRequest$outboundSchema: z.ZodType< + GetEndUserRequest$Outbound, + GetEndUserRequest +> = z.object({ + httpReferer: z.string().optional(), + appTitle: z.string().optional(), + appCategories: z.string().optional(), + user: z.string(), +}).transform((v) => { + return remap$(v, { + httpReferer: "HTTP-Referer", + }); +}); + +export function getEndUserRequestToJSON( + getEndUserRequest: GetEndUserRequest, +): string { + return JSON.stringify( + GetEndUserRequest$outboundSchema.parse(getEndUserRequest), + ); +} diff --git a/src/models/operations/index.ts b/src/models/operations/index.ts index a780c5ceb..077cebae6 100644 --- a/src/models/operations/index.ts +++ b/src/models/operations/index.ts @@ -19,6 +19,7 @@ export * from "./createauthkeyscode.js"; export * from "./createbatches.js"; export * from "./createbyokkey.js"; export * from "./createembeddings.js"; +export * from "./createenduser.js"; export * from "./createguardrail.js"; export * from "./createimages.js"; export * from "./createintern.js"; @@ -39,6 +40,7 @@ export * from "./createvideos.js"; export * from "./createworkspace.js"; export * from "./deletebatch.js"; export * from "./deletebyokkey.js"; +export * from "./deleteenduser.js"; export * from "./deletefile.js"; export * from "./deleteguardrail.js"; export * from "./deleteintern.js"; @@ -63,6 +65,7 @@ export * from "./getbyokkey.js"; export * from "./getcontainerfile.js"; export * from "./getcredits.js"; export * from "./getcurrentkey.js"; +export * from "./getenduser.js"; export * from "./getfilemetadata.js"; export * from "./getgeneration.js"; export * from "./getguardrail.js"; @@ -94,6 +97,7 @@ export * from "./listcontainerfiles.js"; export * from "./listembeddingsmodels.js"; export * from "./listendpoints.js"; export * from "./listendpointszdr.js"; +export * from "./listendusers.js"; export * from "./listfiles.js"; export * from "./listgenerationcontent.js"; export * from "./listguardrailkeyassignments.js"; @@ -133,6 +137,7 @@ export * from "./storevaultsecret.js"; export * from "./submitgenerationfeedback.js"; export * from "./suspendintern.js"; export * from "./updatebyokkey.js"; +export * from "./updateenduser.js"; export * from "./updateguardrail.js"; export * from "./updateintern.js"; export * from "./updatekeys.js"; diff --git a/src/models/operations/listendusers.ts b/src/models/operations/listendusers.ts new file mode 100644 index 000000000..9af173b80 --- /dev/null +++ b/src/models/operations/listendusers.ts @@ -0,0 +1,135 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: a9ea0c370613 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import * as models from "../index.js"; + +export type ListEndUsersGlobals = { + /** + * The app identifier should be your app's URL and is used as the primary identifier for rankings. + * + * @remarks + * This is used to track API usage per application. + */ + httpReferer?: string | undefined; + /** + * The app display name allows you to customize how your app appears in OpenRouter's dashboard. + * + * @remarks + */ + appTitle?: string | undefined; + /** + * Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings. + * + * @remarks + */ + appCategories?: string | undefined; +}; + +export type ListEndUsersRequest = { + /** + * The app identifier should be your app's URL and is used as the primary identifier for rankings. + * + * @remarks + * This is used to track API usage per application. + */ + httpReferer?: string | undefined; + /** + * The app display name allows you to customize how your app appears in OpenRouter's dashboard. + * + * @remarks + */ + appTitle?: string | undefined; + /** + * Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings. + * + * @remarks + */ + appCategories?: string | undefined; + /** + * Number of records to skip for pagination + */ + offset?: number | null | undefined; + /** + * Maximum number of records to return (max 100) + */ + limit?: number | undefined; + /** + * Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths. + */ + user?: string | undefined; + /** + * Include deactivated registrations. + */ + includeInactive?: boolean | undefined; +}; + +export type ListEndUsersResponse = { + result: models.ListEndUsersResponse; +}; + +/** @internal */ +export type ListEndUsersRequest$Outbound = { + "HTTP-Referer"?: string | undefined; + appTitle?: string | undefined; + appCategories?: string | undefined; + offset: number | null; + limit: number; + user?: string | undefined; + include_inactive: boolean; +}; + +/** @internal */ +export const ListEndUsersRequest$outboundSchema: z.ZodType< + ListEndUsersRequest$Outbound, + ListEndUsersRequest +> = z.object({ + httpReferer: z.string().optional(), + appTitle: z.string().optional(), + appCategories: z.string().optional(), + offset: z.nullable(z.int().default(0)), + limit: z.int().default(50), + user: z.string().optional(), + includeInactive: z.boolean().default(false), +}).transform((v) => { + return remap$(v, { + httpReferer: "HTTP-Referer", + includeInactive: "include_inactive", + }); +}); + +export function listEndUsersRequestToJSON( + listEndUsersRequest: ListEndUsersRequest, +): string { + return JSON.stringify( + ListEndUsersRequest$outboundSchema.parse(listEndUsersRequest), + ); +} + +/** @internal */ +export const ListEndUsersResponse$inboundSchema: z.ZodType< + ListEndUsersResponse, + unknown +> = z.object({ + Result: models.ListEndUsersResponse$inboundSchema, +}).transform((v) => { + return remap$(v, { + "Result": "result", + }); +}); + +export function listEndUsersResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListEndUsersResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListEndUsersResponse' from JSON`, + ); +} diff --git a/src/models/operations/updateenduser.ts b/src/models/operations/updateenduser.ts new file mode 100644 index 000000000..eb674442c --- /dev/null +++ b/src/models/operations/updateenduser.ts @@ -0,0 +1,91 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 15ed3e7fa116 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../../lib/primitives.js"; +import * as models from "../index.js"; + +export type UpdateEndUserGlobals = { + /** + * The app identifier should be your app's URL and is used as the primary identifier for rankings. + * + * @remarks + * This is used to track API usage per application. + */ + httpReferer?: string | undefined; + /** + * The app display name allows you to customize how your app appears in OpenRouter's dashboard. + * + * @remarks + */ + appTitle?: string | undefined; + /** + * Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings. + * + * @remarks + */ + appCategories?: string | undefined; +}; + +export type UpdateEndUserRequest = { + /** + * The app identifier should be your app's URL and is used as the primary identifier for rankings. + * + * @remarks + * This is used to track API usage per application. + */ + httpReferer?: string | undefined; + /** + * The app display name allows you to customize how your app appears in OpenRouter's dashboard. + * + * @remarks + */ + appTitle?: string | undefined; + /** + * Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings. + * + * @remarks + */ + appCategories?: string | undefined; + /** + * Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths. + */ + user: string; + updateEndUserRequest: models.UpdateEndUserRequest; +}; + +/** @internal */ +export type UpdateEndUserRequest$Outbound = { + "HTTP-Referer"?: string | undefined; + appTitle?: string | undefined; + appCategories?: string | undefined; + user: string; + UpdateEndUserRequest: models.UpdateEndUserRequest$Outbound; +}; + +/** @internal */ +export const UpdateEndUserRequest$outboundSchema: z.ZodType< + UpdateEndUserRequest$Outbound, + UpdateEndUserRequest +> = z.object({ + httpReferer: z.string().optional(), + appTitle: z.string().optional(), + appCategories: z.string().optional(), + user: z.string(), + updateEndUserRequest: models.UpdateEndUserRequest$outboundSchema, +}).transform((v) => { + return remap$(v, { + httpReferer: "HTTP-Referer", + updateEndUserRequest: "UpdateEndUserRequest", + }); +}); + +export function updateEndUserRequestToJSON( + updateEndUserRequest: UpdateEndUserRequest, +): string { + return JSON.stringify( + UpdateEndUserRequest$outboundSchema.parse(updateEndUserRequest), + ); +} diff --git a/src/models/updateenduserrequest.ts b/src/models/updateenduserrequest.ts new file mode 100644 index 000000000..4312f0dbe --- /dev/null +++ b/src/models/updateenduserrequest.ts @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 74fcb924ddd3 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; + +export type UpdateEndUserRequest = { + /** + * Registration state only; does not enforce inference access. + */ + isActive: boolean; +}; + +/** @internal */ +export type UpdateEndUserRequest$Outbound = { + is_active: boolean; +}; + +/** @internal */ +export const UpdateEndUserRequest$outboundSchema: z.ZodType< + UpdateEndUserRequest$Outbound, + UpdateEndUserRequest +> = z.object({ + isActive: z.boolean(), +}).transform((v) => { + return remap$(v, { + isActive: "is_active", + }); +}); + +export function updateEndUserRequestToJSON( + updateEndUserRequest: UpdateEndUserRequest, +): string { + return JSON.stringify( + UpdateEndUserRequest$outboundSchema.parse(updateEndUserRequest), + ); +} diff --git a/src/sdk/endusers.ts b/src/sdk/endusers.ts new file mode 100644 index 000000000..a72b7b403 --- /dev/null +++ b/src/sdk/endusers.ts @@ -0,0 +1,104 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 8e12697ee658 + */ + +import { endUsersCreate } from "../funcs/endUsersCreate.js"; +import { endUsersDelete } from "../funcs/endUsersDelete.js"; +import { endUsersGet } from "../funcs/endUsersGet.js"; +import { endUsersList } from "../funcs/endUsersList.js"; +import { endUsersUpdate } from "../funcs/endUsersUpdate.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as models from "../models/index.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; +import { PageIterator, unwrapResultIterator } from "../types/operations.js"; + +export class EndUsers extends ClientSDK { + /** + * List registered end users + * + * @remarks + * List registrations belonging to the authenticated organization. Inactive registrations are excluded by default. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ + async list( + request?: operations.ListEndUsersRequest | undefined, + options?: RequestOptions, + ): Promise< + PageIterator + > { + return unwrapResultIterator(endUsersList( + this, + request, + options, + )); + } + + /** + * Register an end user + * + * @remarks + * Register a caller-supplied tracking ID under the authenticated organization. No login account, policy, or credentials are created. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ + async create( + request: operations.CreateEndUserRequest, + options?: RequestOptions, + ): Promise { + return unwrapAsync(endUsersCreate( + this, + request, + options, + )); + } + + /** + * Deactivate a registered end user + * + * @remarks + * Soft-deactivate a registration while retaining its tracking ID. Repeat deactivation succeeds. This does not block inference; reactivate through PATCH. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ + async delete( + request: operations.DeleteEndUserRequest, + options?: RequestOptions, + ): Promise { + return unwrapAsync(endUsersDelete( + this, + request, + options, + )); + } + + /** + * Get a registered end user + * + * @remarks + * Retrieve an active or inactive registration by its URL-encoded, caller-supplied tracking ID. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ + async get( + request: operations.GetEndUserRequest, + options?: RequestOptions, + ): Promise { + return unwrapAsync(endUsersGet( + this, + request, + options, + )); + } + + /** + * Update a registered end user + * + * @remarks + * Update registration state without changing identity. State changes do not enforce inference access. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ + async update( + request: operations.UpdateEndUserRequest, + options?: RequestOptions, + ): Promise { + return unwrapAsync(endUsersUpdate( + this, + request, + options, + )); + } +} diff --git a/src/sdk/sdk.ts b/src/sdk/sdk.ts index 2ddd1f313..0e92ecb55 100644 --- a/src/sdk/sdk.ts +++ b/src/sdk/sdk.ts @@ -18,6 +18,7 @@ import { Credits } from "./credits.js"; import { Datasets } from "./datasets.js"; import { Embeddings } from "./embeddings.js"; import { Endpoints } from "./endpoints.js"; +import { EndUsers } from "./endusers.js"; import { Files } from "./files.js"; import { Generations } from "./generations.js"; import { Guardrails } from "./guardrails.js"; @@ -124,6 +125,11 @@ export class OpenRouter extends ClientSDK { return (this._embeddings ??= new Embeddings(this._options)); } + private _endUsers?: EndUsers; + get endUsers(): EndUsers { + return (this._endUsers ??= new EndUsers(this._options)); + } + private _endpoints?: Endpoints; get endpoints(): Endpoints { return (this._endpoints ??= new Endpoints(this._options)); From 156e389c2182e01318be1308b38718813bc1f652 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Wed, 30 Sep 2026 18:11:29 +0000 Subject: [PATCH 2/3] empty commit to trigger [run-tests] workflow From ba1359b9b62c7fb283aff036cef6e115541168ef Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 30 Sep 2026 18:11:49 +0000 Subject: [PATCH 3/3] Chore: regenerate docs navigation Auto-generated-by: update-generated-files-action; https://github.com/OpenRouterTeam/typescript-sdk/actions/runs/36756810406 --- docs/docs.json | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/docs.json b/docs/docs.json index 224348707..b1ac956f4 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -24,6 +24,7 @@ "sdks/decisions/README", "sdks/embeddings/README", "sdks/endpoints/README", + "sdks/endusers/README", "sdks/files/README", "sdks/generations/README", "sdks/guardrails/README",