@openrouter/sdk 0.0.0-beta.4 → 0.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/REACT_QUERY.md +4 -4
  2. package/README.md +32 -17
  3. package/dist/{esm/funcs/postCreditsCoinbase.d.ts → commonjs/funcs/creditsPostCreditsCoinbase.d.ts} +2 -2
  4. package/dist/commonjs/funcs/creditsPostCreditsCoinbase.d.ts.map +1 -0
  5. package/dist/commonjs/funcs/{postCreditsCoinbase.js → creditsPostCreditsCoinbase.js} +3 -3
  6. package/dist/commonjs/funcs/creditsPostCreditsCoinbase.js.map +1 -0
  7. package/dist/commonjs/funcs/{embeddingsPostEmbeddings.d.ts → embeddingsGenerate.d.ts} +2 -2
  8. package/dist/commonjs/funcs/embeddingsGenerate.d.ts.map +1 -0
  9. package/dist/commonjs/funcs/{embeddingsPostEmbeddings.js → embeddingsGenerate.js} +3 -3
  10. package/dist/commonjs/funcs/embeddingsGenerate.js.map +1 -0
  11. package/dist/{esm/funcs/parametersGetParametersAuthorSlug.d.ts → commonjs/funcs/modelGetParametersAuthorSlug.d.ts} +2 -2
  12. package/dist/commonjs/funcs/modelGetParametersAuthorSlug.d.ts.map +1 -0
  13. package/dist/commonjs/funcs/{parametersGetParametersAuthorSlug.js → modelGetParametersAuthorSlug.js} +3 -3
  14. package/dist/commonjs/funcs/modelGetParametersAuthorSlug.js.map +1 -0
  15. package/dist/commonjs/funcs/oAuthPostAuthKeys.d.ts +17 -0
  16. package/dist/commonjs/funcs/oAuthPostAuthKeys.d.ts.map +1 -0
  17. package/dist/commonjs/funcs/oAuthPostAuthKeys.js +116 -0
  18. package/dist/commonjs/funcs/oAuthPostAuthKeys.js.map +1 -0
  19. package/dist/commonjs/funcs/oAuthPostAuthKeysCode.d.ts +17 -0
  20. package/dist/commonjs/funcs/oAuthPostAuthKeysCode.d.ts.map +1 -0
  21. package/dist/commonjs/funcs/oAuthPostAuthKeysCode.js +116 -0
  22. package/dist/commonjs/funcs/oAuthPostAuthKeysCode.js.map +1 -0
  23. package/dist/{esm/funcs/getProviders.d.ts → commonjs/funcs/providersGetProviders.d.ts} +5 -2
  24. package/dist/commonjs/funcs/providersGetProviders.d.ts.map +1 -0
  25. package/dist/commonjs/funcs/{getProviders.js → providersGetProviders.js} +6 -3
  26. package/dist/commonjs/funcs/providersGetProviders.js.map +1 -0
  27. package/dist/commonjs/lib/config.d.ts +3 -3
  28. package/dist/commonjs/lib/config.js +3 -3
  29. package/dist/commonjs/models/operations/index.d.ts +2 -0
  30. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  31. package/dist/commonjs/models/operations/index.js +2 -0
  32. package/dist/commonjs/models/operations/index.js.map +1 -1
  33. package/dist/commonjs/models/operations/postauthkeys.d.ts +132 -0
  34. package/dist/commonjs/models/operations/postauthkeys.d.ts.map +1 -0
  35. package/dist/commonjs/models/operations/postauthkeys.js +175 -0
  36. package/dist/commonjs/models/operations/postauthkeys.js.map +1 -0
  37. package/dist/commonjs/models/operations/postauthkeyscode.d.ts +167 -0
  38. package/dist/commonjs/models/operations/postauthkeyscode.d.ts.map +1 -0
  39. package/dist/commonjs/models/operations/postauthkeyscode.js +210 -0
  40. package/dist/commonjs/models/operations/postauthkeyscode.js.map +1 -0
  41. package/dist/commonjs/react-query/creditsPostCreditsCoinbase.d.ts +21 -0
  42. package/dist/commonjs/react-query/creditsPostCreditsCoinbase.d.ts.map +1 -0
  43. package/dist/commonjs/react-query/creditsPostCreditsCoinbase.js +44 -0
  44. package/dist/commonjs/react-query/creditsPostCreditsCoinbase.js.map +1 -0
  45. package/dist/commonjs/react-query/embeddingsGenerate.d.ts +23 -0
  46. package/dist/commonjs/react-query/embeddingsGenerate.d.ts.map +1 -0
  47. package/dist/commonjs/react-query/{embeddingsPostEmbeddings.js → embeddingsGenerate.js} +13 -13
  48. package/dist/commonjs/react-query/embeddingsGenerate.js.map +1 -0
  49. package/dist/commonjs/react-query/index.d.ts +6 -4
  50. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  51. package/dist/commonjs/react-query/index.js +6 -4
  52. package/dist/commonjs/react-query/index.js.map +1 -1
  53. package/dist/commonjs/react-query/modelGetParametersAuthorSlug.d.ts +38 -0
  54. package/dist/commonjs/react-query/modelGetParametersAuthorSlug.d.ts.map +1 -0
  55. package/dist/commonjs/react-query/modelGetParametersAuthorSlug.js +88 -0
  56. package/dist/commonjs/react-query/modelGetParametersAuthorSlug.js.map +1 -0
  57. package/dist/commonjs/react-query/oAuthPostAuthKeys.d.ts +23 -0
  58. package/dist/commonjs/react-query/oAuthPostAuthKeys.d.ts.map +1 -0
  59. package/dist/commonjs/react-query/oAuthPostAuthKeys.js +47 -0
  60. package/dist/commonjs/react-query/oAuthPostAuthKeys.js.map +1 -0
  61. package/dist/commonjs/react-query/oAuthPostAuthKeysCode.d.ts +23 -0
  62. package/dist/commonjs/react-query/oAuthPostAuthKeysCode.d.ts.map +1 -0
  63. package/dist/commonjs/react-query/oAuthPostAuthKeysCode.js +47 -0
  64. package/dist/commonjs/react-query/oAuthPostAuthKeysCode.js.map +1 -0
  65. package/dist/commonjs/react-query/providersGetProviders.d.ts +23 -0
  66. package/dist/commonjs/react-query/providersGetProviders.d.ts.map +1 -0
  67. package/dist/commonjs/react-query/providersGetProviders.js +69 -0
  68. package/dist/commonjs/react-query/providersGetProviders.js.map +1 -0
  69. package/dist/commonjs/sdk/credits.d.ts +9 -0
  70. package/dist/commonjs/sdk/credits.d.ts.map +1 -0
  71. package/dist/commonjs/sdk/credits.js +19 -0
  72. package/dist/commonjs/sdk/credits.js.map +1 -0
  73. package/dist/commonjs/sdk/embeddings.d.ts +1 -1
  74. package/dist/commonjs/sdk/embeddings.d.ts.map +1 -1
  75. package/dist/commonjs/sdk/embeddings.js +3 -3
  76. package/dist/commonjs/sdk/embeddings.js.map +1 -1
  77. package/dist/commonjs/sdk/{parameters.d.ts → model.d.ts} +2 -2
  78. package/dist/commonjs/sdk/model.d.ts.map +1 -0
  79. package/dist/commonjs/sdk/model.js +19 -0
  80. package/dist/commonjs/sdk/model.js.map +1 -0
  81. package/dist/commonjs/sdk/oauth.d.ts +19 -0
  82. package/dist/commonjs/sdk/oauth.d.ts.map +1 -0
  83. package/dist/commonjs/sdk/oauth.js +32 -0
  84. package/dist/commonjs/sdk/oauth.js.map +1 -0
  85. package/dist/commonjs/sdk/providers.d.ts +9 -0
  86. package/dist/commonjs/sdk/providers.d.ts.map +1 -0
  87. package/dist/commonjs/sdk/providers.js +19 -0
  88. package/dist/commonjs/sdk/providers.js.map +1 -0
  89. package/dist/commonjs/sdk/sdk.d.ts +12 -8
  90. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  91. package/dist/commonjs/sdk/sdk.js +15 -14
  92. package/dist/commonjs/sdk/sdk.js.map +1 -1
  93. package/dist/{commonjs/funcs/postCreditsCoinbase.d.ts → esm/funcs/creditsPostCreditsCoinbase.d.ts} +2 -2
  94. package/dist/esm/funcs/creditsPostCreditsCoinbase.d.ts.map +1 -0
  95. package/dist/esm/funcs/{postCreditsCoinbase.js → creditsPostCreditsCoinbase.js} +2 -2
  96. package/dist/esm/funcs/creditsPostCreditsCoinbase.js.map +1 -0
  97. package/dist/esm/funcs/{embeddingsPostEmbeddings.d.ts → embeddingsGenerate.d.ts} +2 -2
  98. package/dist/esm/funcs/embeddingsGenerate.d.ts.map +1 -0
  99. package/dist/esm/funcs/{embeddingsPostEmbeddings.js → embeddingsGenerate.js} +2 -2
  100. package/dist/esm/funcs/embeddingsGenerate.js.map +1 -0
  101. package/dist/{commonjs/funcs/parametersGetParametersAuthorSlug.d.ts → esm/funcs/modelGetParametersAuthorSlug.d.ts} +2 -2
  102. package/dist/esm/funcs/modelGetParametersAuthorSlug.d.ts.map +1 -0
  103. package/dist/esm/funcs/{parametersGetParametersAuthorSlug.js → modelGetParametersAuthorSlug.js} +2 -2
  104. package/dist/esm/funcs/modelGetParametersAuthorSlug.js.map +1 -0
  105. package/dist/esm/funcs/oAuthPostAuthKeys.d.ts +17 -0
  106. package/dist/esm/funcs/oAuthPostAuthKeys.d.ts.map +1 -0
  107. package/dist/esm/funcs/oAuthPostAuthKeys.js +80 -0
  108. package/dist/esm/funcs/oAuthPostAuthKeys.js.map +1 -0
  109. package/dist/esm/funcs/oAuthPostAuthKeysCode.d.ts +17 -0
  110. package/dist/esm/funcs/oAuthPostAuthKeysCode.d.ts.map +1 -0
  111. package/dist/esm/funcs/oAuthPostAuthKeysCode.js +80 -0
  112. package/dist/esm/funcs/oAuthPostAuthKeysCode.js.map +1 -0
  113. package/dist/{commonjs/funcs/getProviders.d.ts → esm/funcs/providersGetProviders.d.ts} +5 -2
  114. package/dist/esm/funcs/providersGetProviders.d.ts.map +1 -0
  115. package/dist/esm/funcs/{getProviders.js → providersGetProviders.js} +5 -2
  116. package/dist/esm/funcs/providersGetProviders.js.map +1 -0
  117. package/dist/esm/lib/config.d.ts +3 -3
  118. package/dist/esm/lib/config.js +3 -3
  119. package/dist/esm/models/operations/index.d.ts +2 -0
  120. package/dist/esm/models/operations/index.d.ts.map +1 -1
  121. package/dist/esm/models/operations/index.js +2 -0
  122. package/dist/esm/models/operations/index.js.map +1 -1
  123. package/dist/esm/models/operations/postauthkeys.d.ts +132 -0
  124. package/dist/esm/models/operations/postauthkeys.d.ts.map +1 -0
  125. package/dist/esm/models/operations/postauthkeys.js +133 -0
  126. package/dist/esm/models/operations/postauthkeys.js.map +1 -0
  127. package/dist/esm/models/operations/postauthkeyscode.d.ts +167 -0
  128. package/dist/esm/models/operations/postauthkeyscode.d.ts.map +1 -0
  129. package/dist/esm/models/operations/postauthkeyscode.js +166 -0
  130. package/dist/esm/models/operations/postauthkeyscode.js.map +1 -0
  131. package/dist/esm/react-query/creditsPostCreditsCoinbase.d.ts +21 -0
  132. package/dist/esm/react-query/creditsPostCreditsCoinbase.d.ts.map +1 -0
  133. package/dist/esm/react-query/{postCreditsCoinbase.js → creditsPostCreditsCoinbase.js} +10 -10
  134. package/dist/esm/react-query/creditsPostCreditsCoinbase.js.map +1 -0
  135. package/dist/esm/react-query/embeddingsGenerate.d.ts +23 -0
  136. package/dist/esm/react-query/embeddingsGenerate.d.ts.map +1 -0
  137. package/dist/esm/react-query/{embeddingsPostEmbeddings.js → embeddingsGenerate.js} +10 -10
  138. package/dist/esm/react-query/embeddingsGenerate.js.map +1 -0
  139. package/dist/esm/react-query/index.d.ts +6 -4
  140. package/dist/esm/react-query/index.d.ts.map +1 -1
  141. package/dist/esm/react-query/index.js +6 -4
  142. package/dist/esm/react-query/index.js.map +1 -1
  143. package/dist/esm/react-query/modelGetParametersAuthorSlug.d.ts +38 -0
  144. package/dist/esm/react-query/modelGetParametersAuthorSlug.d.ts.map +1 -0
  145. package/dist/esm/react-query/modelGetParametersAuthorSlug.js +78 -0
  146. package/dist/esm/react-query/modelGetParametersAuthorSlug.js.map +1 -0
  147. package/dist/esm/react-query/oAuthPostAuthKeys.d.ts +23 -0
  148. package/dist/esm/react-query/oAuthPostAuthKeys.d.ts.map +1 -0
  149. package/dist/esm/react-query/oAuthPostAuthKeys.js +42 -0
  150. package/dist/esm/react-query/oAuthPostAuthKeys.js.map +1 -0
  151. package/dist/esm/react-query/oAuthPostAuthKeysCode.d.ts +23 -0
  152. package/dist/esm/react-query/oAuthPostAuthKeysCode.d.ts.map +1 -0
  153. package/dist/esm/react-query/oAuthPostAuthKeysCode.js +42 -0
  154. package/dist/esm/react-query/oAuthPostAuthKeysCode.js.map +1 -0
  155. package/dist/esm/react-query/providersGetProviders.d.ts +23 -0
  156. package/dist/esm/react-query/providersGetProviders.d.ts.map +1 -0
  157. package/dist/esm/react-query/providersGetProviders.js +60 -0
  158. package/dist/esm/react-query/providersGetProviders.js.map +1 -0
  159. package/dist/esm/sdk/credits.d.ts +9 -0
  160. package/dist/esm/sdk/credits.d.ts.map +1 -0
  161. package/dist/esm/sdk/credits.js +15 -0
  162. package/dist/esm/sdk/credits.js.map +1 -0
  163. package/dist/esm/sdk/embeddings.d.ts +1 -1
  164. package/dist/esm/sdk/embeddings.d.ts.map +1 -1
  165. package/dist/esm/sdk/embeddings.js +3 -3
  166. package/dist/esm/sdk/embeddings.js.map +1 -1
  167. package/dist/esm/sdk/{parameters.d.ts → model.d.ts} +2 -2
  168. package/dist/esm/sdk/model.d.ts.map +1 -0
  169. package/dist/esm/sdk/{parameters.js → model.js} +4 -4
  170. package/dist/esm/sdk/model.js.map +1 -0
  171. package/dist/esm/sdk/oauth.d.ts +19 -0
  172. package/dist/esm/sdk/oauth.d.ts.map +1 -0
  173. package/dist/esm/sdk/oauth.js +28 -0
  174. package/dist/esm/sdk/oauth.js.map +1 -0
  175. package/dist/esm/sdk/providers.d.ts +9 -0
  176. package/dist/esm/sdk/providers.d.ts.map +1 -0
  177. package/dist/esm/sdk/providers.js +15 -0
  178. package/dist/esm/sdk/providers.js.map +1 -0
  179. package/dist/esm/sdk/sdk.d.ts +12 -8
  180. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  181. package/dist/esm/sdk/sdk.js +15 -14
  182. package/dist/esm/sdk/sdk.js.map +1 -1
  183. package/docs/sdks/credits/README.md +95 -0
  184. package/docs/sdks/embeddings/README.md +8 -8
  185. package/docs/sdks/{parameters → model}/README.md +12 -12
  186. package/docs/sdks/oauth/README.md +199 -0
  187. package/docs/sdks/openrouter/README.md +0 -183
  188. package/docs/sdks/providers/README.md +104 -0
  189. package/jsr.json +1 -1
  190. package/package.json +1 -1
  191. package/src/funcs/{postCreditsCoinbase.ts → creditsPostCreditsCoinbase.ts} +1 -1
  192. package/src/funcs/{embeddingsPostEmbeddings.ts → embeddingsGenerate.ts} +1 -1
  193. package/src/funcs/{parametersGetParametersAuthorSlug.ts → modelGetParametersAuthorSlug.ts} +1 -1
  194. package/src/funcs/oAuthPostAuthKeys.ts +164 -0
  195. package/src/funcs/oAuthPostAuthKeysCode.ts +164 -0
  196. package/src/funcs/{getProviders.ts → providersGetProviders.ts} +4 -1
  197. package/src/lib/config.ts +3 -3
  198. package/src/models/operations/index.ts +2 -0
  199. package/src/models/operations/postauthkeys.ts +272 -0
  200. package/src/models/operations/postauthkeyscode.ts +352 -0
  201. package/src/react-query/{postCreditsCoinbase.ts → creditsPostCreditsCoinbase.ts} +18 -18
  202. package/src/react-query/{embeddingsPostEmbeddings.ts → embeddingsGenerate.ts} +18 -19
  203. package/src/react-query/index.ts +6 -4
  204. package/src/react-query/{parametersGetParametersAuthorSlug.ts → modelGetParametersAuthorSlug.ts} +29 -34
  205. package/src/react-query/oAuthPostAuthKeys.ts +88 -0
  206. package/src/react-query/oAuthPostAuthKeysCode.ts +89 -0
  207. package/src/react-query/{getProviders.ts → providersGetProviders.ts} +35 -27
  208. package/src/sdk/credits.ts +26 -0
  209. package/src/sdk/embeddings.ts +3 -3
  210. package/src/sdk/{parameters.ts → model.ts} +3 -3
  211. package/src/sdk/oauth.ts +45 -0
  212. package/src/sdk/providers.ts +22 -0
  213. package/src/sdk/sdk.ts +22 -31
  214. package/dist/commonjs/funcs/embeddingsPostEmbeddings.d.ts.map +0 -1
  215. package/dist/commonjs/funcs/embeddingsPostEmbeddings.js.map +0 -1
  216. package/dist/commonjs/funcs/getProviders.d.ts.map +0 -1
  217. package/dist/commonjs/funcs/getProviders.js.map +0 -1
  218. package/dist/commonjs/funcs/parametersGetParametersAuthorSlug.d.ts.map +0 -1
  219. package/dist/commonjs/funcs/parametersGetParametersAuthorSlug.js.map +0 -1
  220. package/dist/commonjs/funcs/postCreditsCoinbase.d.ts.map +0 -1
  221. package/dist/commonjs/funcs/postCreditsCoinbase.js.map +0 -1
  222. package/dist/commonjs/react-query/embeddingsPostEmbeddings.d.ts +0 -23
  223. package/dist/commonjs/react-query/embeddingsPostEmbeddings.d.ts.map +0 -1
  224. package/dist/commonjs/react-query/embeddingsPostEmbeddings.js.map +0 -1
  225. package/dist/commonjs/react-query/getProviders.d.ts +0 -17
  226. package/dist/commonjs/react-query/getProviders.d.ts.map +0 -1
  227. package/dist/commonjs/react-query/getProviders.js +0 -63
  228. package/dist/commonjs/react-query/getProviders.js.map +0 -1
  229. package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.d.ts +0 -38
  230. package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.d.ts.map +0 -1
  231. package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.js +0 -88
  232. package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.js.map +0 -1
  233. package/dist/commonjs/react-query/postCreditsCoinbase.d.ts +0 -21
  234. package/dist/commonjs/react-query/postCreditsCoinbase.d.ts.map +0 -1
  235. package/dist/commonjs/react-query/postCreditsCoinbase.js +0 -44
  236. package/dist/commonjs/react-query/postCreditsCoinbase.js.map +0 -1
  237. package/dist/commonjs/sdk/parameters.d.ts.map +0 -1
  238. package/dist/commonjs/sdk/parameters.js +0 -19
  239. package/dist/commonjs/sdk/parameters.js.map +0 -1
  240. package/dist/esm/funcs/embeddingsPostEmbeddings.d.ts.map +0 -1
  241. package/dist/esm/funcs/embeddingsPostEmbeddings.js.map +0 -1
  242. package/dist/esm/funcs/getProviders.d.ts.map +0 -1
  243. package/dist/esm/funcs/getProviders.js.map +0 -1
  244. package/dist/esm/funcs/parametersGetParametersAuthorSlug.d.ts.map +0 -1
  245. package/dist/esm/funcs/parametersGetParametersAuthorSlug.js.map +0 -1
  246. package/dist/esm/funcs/postCreditsCoinbase.d.ts.map +0 -1
  247. package/dist/esm/funcs/postCreditsCoinbase.js.map +0 -1
  248. package/dist/esm/react-query/embeddingsPostEmbeddings.d.ts +0 -23
  249. package/dist/esm/react-query/embeddingsPostEmbeddings.d.ts.map +0 -1
  250. package/dist/esm/react-query/embeddingsPostEmbeddings.js.map +0 -1
  251. package/dist/esm/react-query/getProviders.d.ts +0 -17
  252. package/dist/esm/react-query/getProviders.d.ts.map +0 -1
  253. package/dist/esm/react-query/getProviders.js +0 -54
  254. package/dist/esm/react-query/getProviders.js.map +0 -1
  255. package/dist/esm/react-query/parametersGetParametersAuthorSlug.d.ts +0 -38
  256. package/dist/esm/react-query/parametersGetParametersAuthorSlug.d.ts.map +0 -1
  257. package/dist/esm/react-query/parametersGetParametersAuthorSlug.js +0 -78
  258. package/dist/esm/react-query/parametersGetParametersAuthorSlug.js.map +0 -1
  259. package/dist/esm/react-query/postCreditsCoinbase.d.ts +0 -21
  260. package/dist/esm/react-query/postCreditsCoinbase.d.ts.map +0 -1
  261. package/dist/esm/react-query/postCreditsCoinbase.js.map +0 -1
  262. package/dist/esm/sdk/parameters.d.ts.map +0 -1
  263. package/dist/esm/sdk/parameters.js.map +0 -1
@@ -0,0 +1,164 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OpenRouterCore } from "../core.js";
6
+ import { encodeJSON } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import { OpenRouterError } from "../models/errors/openroutererror.js";
21
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
22
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
23
+ import * as operations from "../models/operations/index.js";
24
+ import { APICall, APIPromise } from "../types/async.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * Exchange authorization code for API key
29
+ *
30
+ * @remarks
31
+ * Exchange an authorization code from the PKCE flow for a user-controlled API key
32
+ */
33
+ export function oAuthPostAuthKeys(
34
+ client: OpenRouterCore,
35
+ request?: operations.PostAuthKeysRequest | undefined,
36
+ options?: RequestOptions,
37
+ ): APIPromise<
38
+ Result<
39
+ operations.PostAuthKeysResponse,
40
+ | OpenRouterError
41
+ | ResponseValidationError
42
+ | ConnectionError
43
+ | RequestAbortedError
44
+ | RequestTimeoutError
45
+ | InvalidRequestError
46
+ | UnexpectedClientError
47
+ | SDKValidationError
48
+ >
49
+ > {
50
+ return new APIPromise($do(
51
+ client,
52
+ request,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client: OpenRouterCore,
59
+ request?: operations.PostAuthKeysRequest | undefined,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ operations.PostAuthKeysResponse,
65
+ | OpenRouterError
66
+ | ResponseValidationError
67
+ | ConnectionError
68
+ | RequestAbortedError
69
+ | RequestTimeoutError
70
+ | InvalidRequestError
71
+ | UnexpectedClientError
72
+ | SDKValidationError
73
+ >,
74
+ APICall,
75
+ ]
76
+ > {
77
+ const parsed = safeParse(
78
+ request,
79
+ (value) =>
80
+ operations.PostAuthKeysRequest$outboundSchema.optional().parse(value),
81
+ "Input validation failed",
82
+ );
83
+ if (!parsed.ok) {
84
+ return [parsed, { status: "invalid" }];
85
+ }
86
+ const payload = parsed.value;
87
+ const body = payload === undefined
88
+ ? null
89
+ : encodeJSON("body", payload, { explode: true });
90
+
91
+ const path = pathToFunc("/auth/keys")();
92
+
93
+ const headers = new Headers(compactMap({
94
+ "Content-Type": "application/json",
95
+ Accept: "application/json",
96
+ }));
97
+
98
+ const secConfig = await extractSecurity(client._options.apiKey);
99
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
100
+ const requestSecurity = resolveGlobalSecurity(securityInput);
101
+
102
+ const context = {
103
+ options: client._options,
104
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
105
+ operationID: "post_/auth/keys",
106
+ oAuth2Scopes: [],
107
+
108
+ resolvedSecurity: requestSecurity,
109
+
110
+ securitySource: client._options.apiKey,
111
+ retryConfig: options?.retries
112
+ || client._options.retryConfig
113
+ || { strategy: "none" },
114
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
115
+ };
116
+
117
+ const requestRes = client._createRequest(context, {
118
+ security: requestSecurity,
119
+ method: "POST",
120
+ baseURL: options?.serverURL,
121
+ path: path,
122
+ headers: headers,
123
+ body: body,
124
+ userAgent: client._options.userAgent,
125
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
126
+ }, options);
127
+ if (!requestRes.ok) {
128
+ return [requestRes, { status: "invalid" }];
129
+ }
130
+ const req = requestRes.value;
131
+
132
+ const doResult = await client._do(req, {
133
+ context,
134
+ errorCodes: ["4XX", "5XX"],
135
+ retryConfig: context.retryConfig,
136
+ retryCodes: context.retryCodes,
137
+ });
138
+ if (!doResult.ok) {
139
+ return [doResult, { status: "request-error", request: req }];
140
+ }
141
+ const response = doResult.value;
142
+
143
+ const [result] = await M.match<
144
+ operations.PostAuthKeysResponse,
145
+ | OpenRouterError
146
+ | ResponseValidationError
147
+ | ConnectionError
148
+ | RequestAbortedError
149
+ | RequestTimeoutError
150
+ | InvalidRequestError
151
+ | UnexpectedClientError
152
+ | SDKValidationError
153
+ >(
154
+ M.json(200, operations.PostAuthKeysResponse$inboundSchema),
155
+ M.fail("4XX"),
156
+ M.fail("5XX"),
157
+ M.json("default", operations.PostAuthKeysResponse$inboundSchema),
158
+ )(response, req);
159
+ if (!result.ok) {
160
+ return [result, { status: "complete", request: req, response }];
161
+ }
162
+
163
+ return [result, { status: "complete", request: req, response }];
164
+ }
@@ -0,0 +1,164 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OpenRouterCore } from "../core.js";
6
+ import { encodeJSON } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import { OpenRouterError } from "../models/errors/openroutererror.js";
21
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
22
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
23
+ import * as operations from "../models/operations/index.js";
24
+ import { APICall, APIPromise } from "../types/async.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * Create authorization code
29
+ *
30
+ * @remarks
31
+ * Create an authorization code for the PKCE flow to generate a user-controlled API key
32
+ */
33
+ export function oAuthPostAuthKeysCode(
34
+ client: OpenRouterCore,
35
+ request?: operations.PostAuthKeysCodeRequest | undefined,
36
+ options?: RequestOptions,
37
+ ): APIPromise<
38
+ Result<
39
+ operations.PostAuthKeysCodeResponse,
40
+ | OpenRouterError
41
+ | ResponseValidationError
42
+ | ConnectionError
43
+ | RequestAbortedError
44
+ | RequestTimeoutError
45
+ | InvalidRequestError
46
+ | UnexpectedClientError
47
+ | SDKValidationError
48
+ >
49
+ > {
50
+ return new APIPromise($do(
51
+ client,
52
+ request,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client: OpenRouterCore,
59
+ request?: operations.PostAuthKeysCodeRequest | undefined,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ operations.PostAuthKeysCodeResponse,
65
+ | OpenRouterError
66
+ | ResponseValidationError
67
+ | ConnectionError
68
+ | RequestAbortedError
69
+ | RequestTimeoutError
70
+ | InvalidRequestError
71
+ | UnexpectedClientError
72
+ | SDKValidationError
73
+ >,
74
+ APICall,
75
+ ]
76
+ > {
77
+ const parsed = safeParse(
78
+ request,
79
+ (value) =>
80
+ operations.PostAuthKeysCodeRequest$outboundSchema.optional().parse(value),
81
+ "Input validation failed",
82
+ );
83
+ if (!parsed.ok) {
84
+ return [parsed, { status: "invalid" }];
85
+ }
86
+ const payload = parsed.value;
87
+ const body = payload === undefined
88
+ ? null
89
+ : encodeJSON("body", payload, { explode: true });
90
+
91
+ const path = pathToFunc("/auth/keys/code")();
92
+
93
+ const headers = new Headers(compactMap({
94
+ "Content-Type": "application/json",
95
+ Accept: "application/json",
96
+ }));
97
+
98
+ const secConfig = await extractSecurity(client._options.apiKey);
99
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
100
+ const requestSecurity = resolveGlobalSecurity(securityInput);
101
+
102
+ const context = {
103
+ options: client._options,
104
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
105
+ operationID: "post_/auth/keys/code",
106
+ oAuth2Scopes: [],
107
+
108
+ resolvedSecurity: requestSecurity,
109
+
110
+ securitySource: client._options.apiKey,
111
+ retryConfig: options?.retries
112
+ || client._options.retryConfig
113
+ || { strategy: "none" },
114
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
115
+ };
116
+
117
+ const requestRes = client._createRequest(context, {
118
+ security: requestSecurity,
119
+ method: "POST",
120
+ baseURL: options?.serverURL,
121
+ path: path,
122
+ headers: headers,
123
+ body: body,
124
+ userAgent: client._options.userAgent,
125
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
126
+ }, options);
127
+ if (!requestRes.ok) {
128
+ return [requestRes, { status: "invalid" }];
129
+ }
130
+ const req = requestRes.value;
131
+
132
+ const doResult = await client._do(req, {
133
+ context,
134
+ errorCodes: ["4XX", "5XX"],
135
+ retryConfig: context.retryConfig,
136
+ retryCodes: context.retryCodes,
137
+ });
138
+ if (!doResult.ok) {
139
+ return [doResult, { status: "request-error", request: req }];
140
+ }
141
+ const response = doResult.value;
142
+
143
+ const [result] = await M.match<
144
+ operations.PostAuthKeysCodeResponse,
145
+ | OpenRouterError
146
+ | ResponseValidationError
147
+ | ConnectionError
148
+ | RequestAbortedError
149
+ | RequestTimeoutError
150
+ | InvalidRequestError
151
+ | UnexpectedClientError
152
+ | SDKValidationError
153
+ >(
154
+ M.json(200, operations.PostAuthKeysCodeResponse$inboundSchema),
155
+ M.fail("4XX"),
156
+ M.fail("5XX"),
157
+ M.json("default", operations.PostAuthKeysCodeResponse$inboundSchema),
158
+ )(response, req);
159
+ if (!result.ok) {
160
+ return [result, { status: "complete", request: req, response }];
161
+ }
162
+
163
+ return [result, { status: "complete", request: req, response }];
164
+ }
@@ -23,7 +23,10 @@ import * as operations from "../models/operations/index.js";
23
23
  import { APICall, APIPromise } from "../types/async.js";
24
24
  import { Result } from "../types/fp.js";
25
25
 
26
- export function getProviders(
26
+ /**
27
+ * List all available model providers
28
+ */
29
+ export function providersGetProviders(
27
30
  client: OpenRouterCore,
28
31
  options?: RequestOptions,
29
32
  ): APIPromise<
package/src/lib/config.ts CHANGED
@@ -59,8 +59,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
59
59
  export const SDK_METADATA = {
60
60
  language: "typescript",
61
61
  openapiDocVersion: "1.0.0",
62
- sdkVersion: "0.0.0-beta.4",
63
- genVersion: "2.711.4",
62
+ sdkVersion: "0.0.0-beta.5",
63
+ genVersion: "2.714.1",
64
64
  userAgent:
65
- "speakeasy-sdk/typescript 0.0.0-beta.4 2.711.4 1.0.0 @openrouter/sdk",
65
+ "speakeasy-sdk/typescript 0.0.0-beta.5 2.714.1 1.0.0 @openrouter/sdk",
66
66
  } as const;
@@ -18,6 +18,8 @@ export * from "./getmodelsuser.js";
18
18
  export * from "./getparametersauthorslug.js";
19
19
  export * from "./getproviders.js";
20
20
  export * from "./patchkeyshash.js";
21
+ export * from "./postauthkeys.js";
22
+ export * from "./postauthkeyscode.js";
21
23
  export * from "./postchatcompletions.js";
22
24
  export * from "./postcreditscoinbase.js";
23
25
  export * from "./postembeddings.js";
@@ -0,0 +1,272 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+ import * as models from "../index.js";
12
+
13
+ /**
14
+ * The method used to generate the code challenge
15
+ */
16
+ export const PostAuthKeysCodeChallengeMethod = {
17
+ S256: "S256",
18
+ Plain: "plain",
19
+ } as const;
20
+ /**
21
+ * The method used to generate the code challenge
22
+ */
23
+ export type PostAuthKeysCodeChallengeMethod = ClosedEnum<
24
+ typeof PostAuthKeysCodeChallengeMethod
25
+ >;
26
+
27
+ export type PostAuthKeysRequest = {
28
+ /**
29
+ * The authorization code received from the OAuth redirect
30
+ */
31
+ code: string;
32
+ /**
33
+ * The code verifier if code_challenge was used in the authorization request
34
+ */
35
+ codeVerifier?: string | undefined;
36
+ /**
37
+ * The method used to generate the code challenge
38
+ */
39
+ codeChallengeMethod?: PostAuthKeysCodeChallengeMethod | undefined;
40
+ };
41
+
42
+ /**
43
+ * Successfully exchanged code for an API key
44
+ */
45
+ export type PostAuthKeysResponseBody = {
46
+ /**
47
+ * The API key to use for OpenRouter requests
48
+ */
49
+ key: string;
50
+ /**
51
+ * User ID associated with the API key
52
+ */
53
+ userId: string | null;
54
+ };
55
+
56
+ export type PostAuthKeysResponse =
57
+ | PostAuthKeysResponseBody
58
+ | models.ErrorResponse;
59
+
60
+ /** @internal */
61
+ export const PostAuthKeysCodeChallengeMethod$inboundSchema: z.ZodNativeEnum<
62
+ typeof PostAuthKeysCodeChallengeMethod
63
+ > = z.nativeEnum(PostAuthKeysCodeChallengeMethod);
64
+
65
+ /** @internal */
66
+ export const PostAuthKeysCodeChallengeMethod$outboundSchema: z.ZodNativeEnum<
67
+ typeof PostAuthKeysCodeChallengeMethod
68
+ > = PostAuthKeysCodeChallengeMethod$inboundSchema;
69
+
70
+ /**
71
+ * @internal
72
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
73
+ */
74
+ export namespace PostAuthKeysCodeChallengeMethod$ {
75
+ /** @deprecated use `PostAuthKeysCodeChallengeMethod$inboundSchema` instead. */
76
+ export const inboundSchema = PostAuthKeysCodeChallengeMethod$inboundSchema;
77
+ /** @deprecated use `PostAuthKeysCodeChallengeMethod$outboundSchema` instead. */
78
+ export const outboundSchema = PostAuthKeysCodeChallengeMethod$outboundSchema;
79
+ }
80
+
81
+ /** @internal */
82
+ export const PostAuthKeysRequest$inboundSchema: z.ZodType<
83
+ PostAuthKeysRequest,
84
+ z.ZodTypeDef,
85
+ unknown
86
+ > = z.object({
87
+ code: z.string(),
88
+ code_verifier: z.string().optional(),
89
+ code_challenge_method: PostAuthKeysCodeChallengeMethod$inboundSchema
90
+ .optional(),
91
+ }).transform((v) => {
92
+ return remap$(v, {
93
+ "code_verifier": "codeVerifier",
94
+ "code_challenge_method": "codeChallengeMethod",
95
+ });
96
+ });
97
+
98
+ /** @internal */
99
+ export type PostAuthKeysRequest$Outbound = {
100
+ code: string;
101
+ code_verifier?: string | undefined;
102
+ code_challenge_method?: string | undefined;
103
+ };
104
+
105
+ /** @internal */
106
+ export const PostAuthKeysRequest$outboundSchema: z.ZodType<
107
+ PostAuthKeysRequest$Outbound,
108
+ z.ZodTypeDef,
109
+ PostAuthKeysRequest
110
+ > = z.object({
111
+ code: z.string(),
112
+ codeVerifier: z.string().optional(),
113
+ codeChallengeMethod: PostAuthKeysCodeChallengeMethod$outboundSchema
114
+ .optional(),
115
+ }).transform((v) => {
116
+ return remap$(v, {
117
+ codeVerifier: "code_verifier",
118
+ codeChallengeMethod: "code_challenge_method",
119
+ });
120
+ });
121
+
122
+ /**
123
+ * @internal
124
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
125
+ */
126
+ export namespace PostAuthKeysRequest$ {
127
+ /** @deprecated use `PostAuthKeysRequest$inboundSchema` instead. */
128
+ export const inboundSchema = PostAuthKeysRequest$inboundSchema;
129
+ /** @deprecated use `PostAuthKeysRequest$outboundSchema` instead. */
130
+ export const outboundSchema = PostAuthKeysRequest$outboundSchema;
131
+ /** @deprecated use `PostAuthKeysRequest$Outbound` instead. */
132
+ export type Outbound = PostAuthKeysRequest$Outbound;
133
+ }
134
+
135
+ export function postAuthKeysRequestToJSON(
136
+ postAuthKeysRequest: PostAuthKeysRequest,
137
+ ): string {
138
+ return JSON.stringify(
139
+ PostAuthKeysRequest$outboundSchema.parse(postAuthKeysRequest),
140
+ );
141
+ }
142
+
143
+ export function postAuthKeysRequestFromJSON(
144
+ jsonString: string,
145
+ ): SafeParseResult<PostAuthKeysRequest, SDKValidationError> {
146
+ return safeParse(
147
+ jsonString,
148
+ (x) => PostAuthKeysRequest$inboundSchema.parse(JSON.parse(x)),
149
+ `Failed to parse 'PostAuthKeysRequest' from JSON`,
150
+ );
151
+ }
152
+
153
+ /** @internal */
154
+ export const PostAuthKeysResponseBody$inboundSchema: z.ZodType<
155
+ PostAuthKeysResponseBody,
156
+ z.ZodTypeDef,
157
+ unknown
158
+ > = z.object({
159
+ key: z.string(),
160
+ user_id: z.nullable(z.string()),
161
+ }).transform((v) => {
162
+ return remap$(v, {
163
+ "user_id": "userId",
164
+ });
165
+ });
166
+
167
+ /** @internal */
168
+ export type PostAuthKeysResponseBody$Outbound = {
169
+ key: string;
170
+ user_id: string | null;
171
+ };
172
+
173
+ /** @internal */
174
+ export const PostAuthKeysResponseBody$outboundSchema: z.ZodType<
175
+ PostAuthKeysResponseBody$Outbound,
176
+ z.ZodTypeDef,
177
+ PostAuthKeysResponseBody
178
+ > = z.object({
179
+ key: z.string(),
180
+ userId: z.nullable(z.string()),
181
+ }).transform((v) => {
182
+ return remap$(v, {
183
+ userId: "user_id",
184
+ });
185
+ });
186
+
187
+ /**
188
+ * @internal
189
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
190
+ */
191
+ export namespace PostAuthKeysResponseBody$ {
192
+ /** @deprecated use `PostAuthKeysResponseBody$inboundSchema` instead. */
193
+ export const inboundSchema = PostAuthKeysResponseBody$inboundSchema;
194
+ /** @deprecated use `PostAuthKeysResponseBody$outboundSchema` instead. */
195
+ export const outboundSchema = PostAuthKeysResponseBody$outboundSchema;
196
+ /** @deprecated use `PostAuthKeysResponseBody$Outbound` instead. */
197
+ export type Outbound = PostAuthKeysResponseBody$Outbound;
198
+ }
199
+
200
+ export function postAuthKeysResponseBodyToJSON(
201
+ postAuthKeysResponseBody: PostAuthKeysResponseBody,
202
+ ): string {
203
+ return JSON.stringify(
204
+ PostAuthKeysResponseBody$outboundSchema.parse(postAuthKeysResponseBody),
205
+ );
206
+ }
207
+
208
+ export function postAuthKeysResponseBodyFromJSON(
209
+ jsonString: string,
210
+ ): SafeParseResult<PostAuthKeysResponseBody, SDKValidationError> {
211
+ return safeParse(
212
+ jsonString,
213
+ (x) => PostAuthKeysResponseBody$inboundSchema.parse(JSON.parse(x)),
214
+ `Failed to parse 'PostAuthKeysResponseBody' from JSON`,
215
+ );
216
+ }
217
+
218
+ /** @internal */
219
+ export const PostAuthKeysResponse$inboundSchema: z.ZodType<
220
+ PostAuthKeysResponse,
221
+ z.ZodTypeDef,
222
+ unknown
223
+ > = z.union([
224
+ z.lazy(() => PostAuthKeysResponseBody$inboundSchema),
225
+ models.ErrorResponse$inboundSchema,
226
+ ]);
227
+
228
+ /** @internal */
229
+ export type PostAuthKeysResponse$Outbound =
230
+ | PostAuthKeysResponseBody$Outbound
231
+ | models.ErrorResponse$Outbound;
232
+
233
+ /** @internal */
234
+ export const PostAuthKeysResponse$outboundSchema: z.ZodType<
235
+ PostAuthKeysResponse$Outbound,
236
+ z.ZodTypeDef,
237
+ PostAuthKeysResponse
238
+ > = z.union([
239
+ z.lazy(() => PostAuthKeysResponseBody$outboundSchema),
240
+ models.ErrorResponse$outboundSchema,
241
+ ]);
242
+
243
+ /**
244
+ * @internal
245
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
246
+ */
247
+ export namespace PostAuthKeysResponse$ {
248
+ /** @deprecated use `PostAuthKeysResponse$inboundSchema` instead. */
249
+ export const inboundSchema = PostAuthKeysResponse$inboundSchema;
250
+ /** @deprecated use `PostAuthKeysResponse$outboundSchema` instead. */
251
+ export const outboundSchema = PostAuthKeysResponse$outboundSchema;
252
+ /** @deprecated use `PostAuthKeysResponse$Outbound` instead. */
253
+ export type Outbound = PostAuthKeysResponse$Outbound;
254
+ }
255
+
256
+ export function postAuthKeysResponseToJSON(
257
+ postAuthKeysResponse: PostAuthKeysResponse,
258
+ ): string {
259
+ return JSON.stringify(
260
+ PostAuthKeysResponse$outboundSchema.parse(postAuthKeysResponse),
261
+ );
262
+ }
263
+
264
+ export function postAuthKeysResponseFromJSON(
265
+ jsonString: string,
266
+ ): SafeParseResult<PostAuthKeysResponse, SDKValidationError> {
267
+ return safeParse(
268
+ jsonString,
269
+ (x) => PostAuthKeysResponse$inboundSchema.parse(JSON.parse(x)),
270
+ `Failed to parse 'PostAuthKeysResponse' from JSON`,
271
+ );
272
+ }