@openrouter/sdk 0.0.0-beta.2 → 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 (472) hide show
  1. package/FUNCTIONS.md +1 -3
  2. package/REACT_QUERY.md +10 -14
  3. package/README.md +62 -40
  4. package/dist/commonjs/funcs/analyticsGetActivity.js +3 -2
  5. package/dist/commonjs/funcs/analyticsGetActivity.js.map +1 -1
  6. package/dist/commonjs/funcs/apiKeysDeleteKeysHash.js +3 -2
  7. package/dist/commonjs/funcs/apiKeysDeleteKeysHash.js.map +1 -1
  8. package/dist/commonjs/funcs/apiKeysGetAuthKey.js +3 -2
  9. package/dist/commonjs/funcs/apiKeysGetAuthKey.js.map +1 -1
  10. package/dist/commonjs/funcs/apiKeysGetKey.js +3 -2
  11. package/dist/commonjs/funcs/apiKeysGetKey.js.map +1 -1
  12. package/dist/commonjs/funcs/apiKeysGetKeys.js +3 -2
  13. package/dist/commonjs/funcs/apiKeysGetKeys.js.map +1 -1
  14. package/dist/commonjs/funcs/apiKeysGetKeysHash.js +3 -2
  15. package/dist/commonjs/funcs/apiKeysGetKeysHash.js.map +1 -1
  16. package/dist/commonjs/funcs/apiKeysPatchKeysHash.js +3 -2
  17. package/dist/commonjs/funcs/apiKeysPatchKeysHash.js.map +1 -1
  18. package/dist/commonjs/funcs/apiKeysPostKeys.js +3 -2
  19. package/dist/commonjs/funcs/apiKeysPostKeys.js.map +1 -1
  20. package/dist/commonjs/funcs/chatSend.js +3 -2
  21. package/dist/commonjs/funcs/chatSend.js.map +1 -1
  22. package/dist/{esm/funcs/postCreditsCoinbase.d.ts → commonjs/funcs/creditsPostCreditsCoinbase.d.ts} +2 -2
  23. package/dist/commonjs/funcs/creditsPostCreditsCoinbase.d.ts.map +1 -0
  24. package/dist/commonjs/funcs/{postCreditsCoinbase.js → creditsPostCreditsCoinbase.js} +14 -9
  25. package/dist/commonjs/funcs/creditsPostCreditsCoinbase.js.map +1 -0
  26. package/dist/commonjs/funcs/{embeddingsPostEmbeddings.d.ts → embeddingsGenerate.d.ts} +2 -2
  27. package/dist/commonjs/funcs/embeddingsGenerate.d.ts.map +1 -0
  28. package/dist/commonjs/funcs/{embeddingsPostEmbeddings.js → embeddingsGenerate.js} +6 -5
  29. package/dist/commonjs/funcs/embeddingsGenerate.js.map +1 -0
  30. package/dist/commonjs/funcs/endpointsGetEndpointsZdr.js +3 -2
  31. package/dist/commonjs/funcs/endpointsGetEndpointsZdr.js.map +1 -1
  32. package/dist/commonjs/funcs/endpointsGetModelsAuthorSlugEndpoints.js +3 -2
  33. package/dist/commonjs/funcs/endpointsGetModelsAuthorSlugEndpoints.js.map +1 -1
  34. package/dist/commonjs/funcs/generationsGetGeneration.js +3 -2
  35. package/dist/commonjs/funcs/generationsGetGeneration.js.map +1 -1
  36. package/dist/commonjs/funcs/getCredits.js +3 -2
  37. package/dist/commonjs/funcs/getCredits.js.map +1 -1
  38. package/dist/{esm/funcs/parametersGetParametersAuthorSlug.d.ts → commonjs/funcs/modelGetParametersAuthorSlug.d.ts} +2 -2
  39. package/dist/commonjs/funcs/modelGetParametersAuthorSlug.d.ts.map +1 -0
  40. package/dist/commonjs/funcs/{parametersGetParametersAuthorSlug.js → modelGetParametersAuthorSlug.js} +14 -9
  41. package/dist/commonjs/funcs/modelGetParametersAuthorSlug.js.map +1 -0
  42. package/dist/commonjs/funcs/modelsGetModels.js +3 -2
  43. package/dist/commonjs/funcs/modelsGetModels.js.map +1 -1
  44. package/dist/commonjs/funcs/modelsGetModelsCount.js +3 -2
  45. package/dist/commonjs/funcs/modelsGetModelsCount.js.map +1 -1
  46. package/dist/commonjs/funcs/modelsGetModelsUser.d.ts +1 -1
  47. package/dist/commonjs/funcs/modelsGetModelsUser.d.ts.map +1 -1
  48. package/dist/commonjs/funcs/modelsGetModelsUser.js +12 -7
  49. package/dist/commonjs/funcs/modelsGetModelsUser.js.map +1 -1
  50. package/dist/commonjs/funcs/oAuthPostAuthKeys.d.ts +17 -0
  51. package/dist/commonjs/funcs/oAuthPostAuthKeys.d.ts.map +1 -0
  52. package/dist/commonjs/funcs/oAuthPostAuthKeys.js +116 -0
  53. package/dist/commonjs/funcs/oAuthPostAuthKeys.js.map +1 -0
  54. package/dist/commonjs/funcs/oAuthPostAuthKeysCode.d.ts +17 -0
  55. package/dist/commonjs/funcs/oAuthPostAuthKeysCode.d.ts.map +1 -0
  56. package/dist/commonjs/funcs/oAuthPostAuthKeysCode.js +116 -0
  57. package/dist/commonjs/funcs/oAuthPostAuthKeysCode.js.map +1 -0
  58. package/dist/{esm/funcs/getProviders.d.ts → commonjs/funcs/providersGetProviders.d.ts} +5 -2
  59. package/dist/commonjs/funcs/providersGetProviders.d.ts.map +1 -0
  60. package/dist/commonjs/funcs/{getProviders.js → providersGetProviders.js} +9 -5
  61. package/dist/commonjs/funcs/providersGetProviders.js.map +1 -0
  62. package/dist/commonjs/lib/config.d.ts +4 -8
  63. package/dist/commonjs/lib/config.d.ts.map +1 -1
  64. package/dist/commonjs/lib/config.js +3 -3
  65. package/dist/commonjs/lib/config.js.map +1 -1
  66. package/dist/commonjs/lib/env.d.ts +0 -1
  67. package/dist/commonjs/lib/env.d.ts.map +1 -1
  68. package/dist/commonjs/lib/env.js +0 -1
  69. package/dist/commonjs/lib/env.js.map +1 -1
  70. package/dist/commonjs/lib/security.d.ts.map +1 -1
  71. package/dist/commonjs/lib/security.js +1 -7
  72. package/dist/commonjs/lib/security.js.map +1 -1
  73. package/dist/commonjs/models/chaterror.d.ts +23 -2
  74. package/dist/commonjs/models/chaterror.d.ts.map +1 -1
  75. package/dist/commonjs/models/chaterror.js +27 -3
  76. package/dist/commonjs/models/chaterror.js.map +1 -1
  77. package/dist/commonjs/models/chatresponse.d.ts +2 -2
  78. package/dist/commonjs/models/chatresponse.d.ts.map +1 -1
  79. package/dist/commonjs/models/chatresponse.js +2 -2
  80. package/dist/commonjs/models/chatresponse.js.map +1 -1
  81. package/dist/commonjs/models/chatstreamingresponsechunk.d.ts +2 -2
  82. package/dist/commonjs/models/chatstreamingresponsechunk.d.ts.map +1 -1
  83. package/dist/commonjs/models/chatstreamingresponsechunk.js +2 -2
  84. package/dist/commonjs/models/chatstreamingresponsechunk.js.map +1 -1
  85. package/dist/commonjs/models/errorresponse.d.ts +8 -8
  86. package/dist/commonjs/models/errorresponse.d.ts.map +1 -1
  87. package/dist/commonjs/models/errorresponse.js +14 -13
  88. package/dist/commonjs/models/errorresponse.js.map +1 -1
  89. package/dist/commonjs/models/operations/getmodelsuser.d.ts +25 -0
  90. package/dist/commonjs/models/operations/getmodelsuser.d.ts.map +1 -1
  91. package/dist/commonjs/models/operations/getmodelsuser.js +29 -2
  92. package/dist/commonjs/models/operations/getmodelsuser.js.map +1 -1
  93. package/dist/commonjs/models/operations/getparametersauthorslug.d.ts +25 -0
  94. package/dist/commonjs/models/operations/getparametersauthorslug.d.ts.map +1 -1
  95. package/dist/commonjs/models/operations/getparametersauthorslug.js +28 -1
  96. package/dist/commonjs/models/operations/getparametersauthorslug.js.map +1 -1
  97. package/dist/commonjs/models/operations/index.d.ts +2 -0
  98. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  99. package/dist/commonjs/models/operations/index.js +2 -0
  100. package/dist/commonjs/models/operations/index.js.map +1 -1
  101. package/dist/commonjs/models/operations/postauthkeys.d.ts +132 -0
  102. package/dist/commonjs/models/operations/postauthkeys.d.ts.map +1 -0
  103. package/dist/commonjs/models/operations/postauthkeys.js +175 -0
  104. package/dist/commonjs/models/operations/postauthkeys.js.map +1 -0
  105. package/dist/commonjs/models/operations/postauthkeyscode.d.ts +167 -0
  106. package/dist/commonjs/models/operations/postauthkeyscode.d.ts.map +1 -0
  107. package/dist/commonjs/models/operations/postauthkeyscode.js +210 -0
  108. package/dist/commonjs/models/operations/postauthkeyscode.js.map +1 -0
  109. package/dist/commonjs/models/operations/postcreditscoinbase.d.ts +25 -0
  110. package/dist/commonjs/models/operations/postcreditscoinbase.d.ts.map +1 -1
  111. package/dist/commonjs/models/operations/postcreditscoinbase.js +28 -1
  112. package/dist/commonjs/models/operations/postcreditscoinbase.js.map +1 -1
  113. package/dist/commonjs/models/security.d.ts +0 -2
  114. package/dist/commonjs/models/security.d.ts.map +1 -1
  115. package/dist/commonjs/models/security.js +0 -2
  116. package/dist/commonjs/models/security.js.map +1 -1
  117. package/dist/commonjs/react-query/creditsPostCreditsCoinbase.d.ts +21 -0
  118. package/dist/commonjs/react-query/creditsPostCreditsCoinbase.d.ts.map +1 -0
  119. package/dist/commonjs/react-query/creditsPostCreditsCoinbase.js +44 -0
  120. package/dist/commonjs/react-query/creditsPostCreditsCoinbase.js.map +1 -0
  121. package/dist/commonjs/react-query/embeddingsGenerate.d.ts +23 -0
  122. package/dist/commonjs/react-query/embeddingsGenerate.d.ts.map +1 -0
  123. package/dist/commonjs/react-query/{embeddingsPostEmbeddings.js → embeddingsGenerate.js} +13 -13
  124. package/dist/commonjs/react-query/embeddingsGenerate.js.map +1 -0
  125. package/dist/commonjs/react-query/index.d.ts +6 -4
  126. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  127. package/dist/commonjs/react-query/index.js +6 -4
  128. package/dist/commonjs/react-query/index.js.map +1 -1
  129. package/dist/commonjs/react-query/modelGetParametersAuthorSlug.d.ts +38 -0
  130. package/dist/commonjs/react-query/modelGetParametersAuthorSlug.d.ts.map +1 -0
  131. package/dist/commonjs/react-query/modelGetParametersAuthorSlug.js +88 -0
  132. package/dist/commonjs/react-query/modelGetParametersAuthorSlug.js.map +1 -0
  133. package/dist/commonjs/react-query/modelsGetModelsUser.d.ts +4 -4
  134. package/dist/commonjs/react-query/modelsGetModelsUser.d.ts.map +1 -1
  135. package/dist/commonjs/react-query/modelsGetModelsUser.js +8 -8
  136. package/dist/commonjs/react-query/modelsGetModelsUser.js.map +1 -1
  137. package/dist/commonjs/react-query/oAuthPostAuthKeys.d.ts +23 -0
  138. package/dist/commonjs/react-query/oAuthPostAuthKeys.d.ts.map +1 -0
  139. package/dist/commonjs/react-query/oAuthPostAuthKeys.js +47 -0
  140. package/dist/commonjs/react-query/oAuthPostAuthKeys.js.map +1 -0
  141. package/dist/commonjs/react-query/oAuthPostAuthKeysCode.d.ts +23 -0
  142. package/dist/commonjs/react-query/oAuthPostAuthKeysCode.d.ts.map +1 -0
  143. package/dist/commonjs/react-query/oAuthPostAuthKeysCode.js +47 -0
  144. package/dist/commonjs/react-query/oAuthPostAuthKeysCode.js.map +1 -0
  145. package/dist/commonjs/react-query/providersGetProviders.d.ts +23 -0
  146. package/dist/commonjs/react-query/providersGetProviders.d.ts.map +1 -0
  147. package/dist/commonjs/react-query/providersGetProviders.js +69 -0
  148. package/dist/commonjs/react-query/providersGetProviders.js.map +1 -0
  149. package/dist/commonjs/sdk/credits.d.ts +9 -0
  150. package/dist/commonjs/sdk/credits.d.ts.map +1 -0
  151. package/dist/commonjs/sdk/credits.js +19 -0
  152. package/dist/commonjs/sdk/credits.js.map +1 -0
  153. package/dist/commonjs/sdk/embeddings.d.ts +1 -1
  154. package/dist/commonjs/sdk/embeddings.d.ts.map +1 -1
  155. package/dist/commonjs/sdk/embeddings.js +3 -3
  156. package/dist/commonjs/sdk/embeddings.js.map +1 -1
  157. package/dist/commonjs/sdk/model.d.ts +9 -0
  158. package/dist/commonjs/sdk/model.d.ts.map +1 -0
  159. package/dist/commonjs/sdk/model.js +19 -0
  160. package/dist/commonjs/sdk/model.js.map +1 -0
  161. package/dist/commonjs/sdk/models.d.ts +1 -1
  162. package/dist/commonjs/sdk/models.d.ts.map +1 -1
  163. package/dist/commonjs/sdk/models.js +2 -2
  164. package/dist/commonjs/sdk/models.js.map +1 -1
  165. package/dist/commonjs/sdk/oauth.d.ts +19 -0
  166. package/dist/commonjs/sdk/oauth.d.ts.map +1 -0
  167. package/dist/commonjs/sdk/oauth.js +32 -0
  168. package/dist/commonjs/sdk/oauth.js.map +1 -0
  169. package/dist/commonjs/sdk/providers.d.ts +9 -0
  170. package/dist/commonjs/sdk/providers.d.ts.map +1 -0
  171. package/dist/commonjs/sdk/providers.js +19 -0
  172. package/dist/commonjs/sdk/providers.js.map +1 -0
  173. package/dist/commonjs/sdk/sdk.d.ts +12 -8
  174. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  175. package/dist/commonjs/sdk/sdk.js +15 -14
  176. package/dist/commonjs/sdk/sdk.js.map +1 -1
  177. package/dist/esm/funcs/analyticsGetActivity.js +3 -2
  178. package/dist/esm/funcs/analyticsGetActivity.js.map +1 -1
  179. package/dist/esm/funcs/apiKeysDeleteKeysHash.js +3 -2
  180. package/dist/esm/funcs/apiKeysDeleteKeysHash.js.map +1 -1
  181. package/dist/esm/funcs/apiKeysGetAuthKey.js +3 -2
  182. package/dist/esm/funcs/apiKeysGetAuthKey.js.map +1 -1
  183. package/dist/esm/funcs/apiKeysGetKey.js +3 -2
  184. package/dist/esm/funcs/apiKeysGetKey.js.map +1 -1
  185. package/dist/esm/funcs/apiKeysGetKeys.js +3 -2
  186. package/dist/esm/funcs/apiKeysGetKeys.js.map +1 -1
  187. package/dist/esm/funcs/apiKeysGetKeysHash.js +3 -2
  188. package/dist/esm/funcs/apiKeysGetKeysHash.js.map +1 -1
  189. package/dist/esm/funcs/apiKeysPatchKeysHash.js +3 -2
  190. package/dist/esm/funcs/apiKeysPatchKeysHash.js.map +1 -1
  191. package/dist/esm/funcs/apiKeysPostKeys.js +3 -2
  192. package/dist/esm/funcs/apiKeysPostKeys.js.map +1 -1
  193. package/dist/esm/funcs/chatSend.js +3 -2
  194. package/dist/esm/funcs/chatSend.js.map +1 -1
  195. package/dist/{commonjs/funcs/postCreditsCoinbase.d.ts → esm/funcs/creditsPostCreditsCoinbase.d.ts} +2 -2
  196. package/dist/esm/funcs/creditsPostCreditsCoinbase.d.ts.map +1 -0
  197. package/dist/esm/funcs/{postCreditsCoinbase.js → creditsPostCreditsCoinbase.js} +14 -9
  198. package/dist/esm/funcs/creditsPostCreditsCoinbase.js.map +1 -0
  199. package/dist/esm/funcs/{embeddingsPostEmbeddings.d.ts → embeddingsGenerate.d.ts} +2 -2
  200. package/dist/esm/funcs/embeddingsGenerate.d.ts.map +1 -0
  201. package/dist/esm/funcs/{embeddingsPostEmbeddings.js → embeddingsGenerate.js} +5 -4
  202. package/dist/esm/funcs/embeddingsGenerate.js.map +1 -0
  203. package/dist/esm/funcs/endpointsGetEndpointsZdr.js +3 -2
  204. package/dist/esm/funcs/endpointsGetEndpointsZdr.js.map +1 -1
  205. package/dist/esm/funcs/endpointsGetModelsAuthorSlugEndpoints.js +3 -2
  206. package/dist/esm/funcs/endpointsGetModelsAuthorSlugEndpoints.js.map +1 -1
  207. package/dist/esm/funcs/generationsGetGeneration.js +3 -2
  208. package/dist/esm/funcs/generationsGetGeneration.js.map +1 -1
  209. package/dist/esm/funcs/getCredits.js +3 -2
  210. package/dist/esm/funcs/getCredits.js.map +1 -1
  211. package/dist/{commonjs/funcs/parametersGetParametersAuthorSlug.d.ts → esm/funcs/modelGetParametersAuthorSlug.d.ts} +2 -2
  212. package/dist/esm/funcs/modelGetParametersAuthorSlug.d.ts.map +1 -0
  213. package/dist/esm/funcs/{parametersGetParametersAuthorSlug.js → modelGetParametersAuthorSlug.js} +14 -9
  214. package/dist/esm/funcs/modelGetParametersAuthorSlug.js.map +1 -0
  215. package/dist/esm/funcs/modelsGetModels.js +3 -2
  216. package/dist/esm/funcs/modelsGetModels.js.map +1 -1
  217. package/dist/esm/funcs/modelsGetModelsCount.js +3 -2
  218. package/dist/esm/funcs/modelsGetModelsCount.js.map +1 -1
  219. package/dist/esm/funcs/modelsGetModelsUser.d.ts +1 -1
  220. package/dist/esm/funcs/modelsGetModelsUser.d.ts.map +1 -1
  221. package/dist/esm/funcs/modelsGetModelsUser.js +13 -8
  222. package/dist/esm/funcs/modelsGetModelsUser.js.map +1 -1
  223. package/dist/esm/funcs/oAuthPostAuthKeys.d.ts +17 -0
  224. package/dist/esm/funcs/oAuthPostAuthKeys.d.ts.map +1 -0
  225. package/dist/esm/funcs/oAuthPostAuthKeys.js +80 -0
  226. package/dist/esm/funcs/oAuthPostAuthKeys.js.map +1 -0
  227. package/dist/esm/funcs/oAuthPostAuthKeysCode.d.ts +17 -0
  228. package/dist/esm/funcs/oAuthPostAuthKeysCode.d.ts.map +1 -0
  229. package/dist/esm/funcs/oAuthPostAuthKeysCode.js +80 -0
  230. package/dist/esm/funcs/oAuthPostAuthKeysCode.js.map +1 -0
  231. package/dist/{commonjs/funcs/getProviders.d.ts → esm/funcs/providersGetProviders.d.ts} +5 -2
  232. package/dist/esm/funcs/providersGetProviders.d.ts.map +1 -0
  233. package/dist/esm/funcs/{getProviders.js → providersGetProviders.js} +8 -4
  234. package/dist/esm/funcs/providersGetProviders.js.map +1 -0
  235. package/dist/esm/lib/config.d.ts +4 -8
  236. package/dist/esm/lib/config.d.ts.map +1 -1
  237. package/dist/esm/lib/config.js +3 -3
  238. package/dist/esm/lib/config.js.map +1 -1
  239. package/dist/esm/lib/env.d.ts +0 -1
  240. package/dist/esm/lib/env.d.ts.map +1 -1
  241. package/dist/esm/lib/env.js +0 -1
  242. package/dist/esm/lib/env.js.map +1 -1
  243. package/dist/esm/lib/security.d.ts.map +1 -1
  244. package/dist/esm/lib/security.js +1 -7
  245. package/dist/esm/lib/security.js.map +1 -1
  246. package/dist/esm/models/chaterror.d.ts +23 -2
  247. package/dist/esm/models/chaterror.d.ts.map +1 -1
  248. package/dist/esm/models/chaterror.js +24 -2
  249. package/dist/esm/models/chaterror.js.map +1 -1
  250. package/dist/esm/models/chatresponse.d.ts +2 -2
  251. package/dist/esm/models/chatresponse.d.ts.map +1 -1
  252. package/dist/esm/models/chatresponse.js +2 -2
  253. package/dist/esm/models/chatresponse.js.map +1 -1
  254. package/dist/esm/models/chatstreamingresponsechunk.d.ts +2 -2
  255. package/dist/esm/models/chatstreamingresponsechunk.d.ts.map +1 -1
  256. package/dist/esm/models/chatstreamingresponsechunk.js +2 -2
  257. package/dist/esm/models/chatstreamingresponsechunk.js.map +1 -1
  258. package/dist/esm/models/errorresponse.d.ts +8 -8
  259. package/dist/esm/models/errorresponse.d.ts.map +1 -1
  260. package/dist/esm/models/errorresponse.js +13 -12
  261. package/dist/esm/models/errorresponse.js.map +1 -1
  262. package/dist/esm/models/operations/getmodelsuser.d.ts +25 -0
  263. package/dist/esm/models/operations/getmodelsuser.d.ts.map +1 -1
  264. package/dist/esm/models/operations/getmodelsuser.js +25 -0
  265. package/dist/esm/models/operations/getmodelsuser.js.map +1 -1
  266. package/dist/esm/models/operations/getparametersauthorslug.d.ts +25 -0
  267. package/dist/esm/models/operations/getparametersauthorslug.d.ts.map +1 -1
  268. package/dist/esm/models/operations/getparametersauthorslug.js +25 -0
  269. package/dist/esm/models/operations/getparametersauthorslug.js.map +1 -1
  270. package/dist/esm/models/operations/index.d.ts +2 -0
  271. package/dist/esm/models/operations/index.d.ts.map +1 -1
  272. package/dist/esm/models/operations/index.js +2 -0
  273. package/dist/esm/models/operations/index.js.map +1 -1
  274. package/dist/esm/models/operations/postauthkeys.d.ts +132 -0
  275. package/dist/esm/models/operations/postauthkeys.d.ts.map +1 -0
  276. package/dist/esm/models/operations/postauthkeys.js +133 -0
  277. package/dist/esm/models/operations/postauthkeys.js.map +1 -0
  278. package/dist/esm/models/operations/postauthkeyscode.d.ts +167 -0
  279. package/dist/esm/models/operations/postauthkeyscode.d.ts.map +1 -0
  280. package/dist/esm/models/operations/postauthkeyscode.js +166 -0
  281. package/dist/esm/models/operations/postauthkeyscode.js.map +1 -0
  282. package/dist/esm/models/operations/postcreditscoinbase.d.ts +25 -0
  283. package/dist/esm/models/operations/postcreditscoinbase.d.ts.map +1 -1
  284. package/dist/esm/models/operations/postcreditscoinbase.js +25 -0
  285. package/dist/esm/models/operations/postcreditscoinbase.js.map +1 -1
  286. package/dist/esm/models/security.d.ts +0 -2
  287. package/dist/esm/models/security.d.ts.map +1 -1
  288. package/dist/esm/models/security.js +0 -2
  289. package/dist/esm/models/security.js.map +1 -1
  290. package/dist/esm/react-query/creditsPostCreditsCoinbase.d.ts +21 -0
  291. package/dist/esm/react-query/creditsPostCreditsCoinbase.d.ts.map +1 -0
  292. package/dist/esm/react-query/{postCreditsCoinbase.js → creditsPostCreditsCoinbase.js} +10 -10
  293. package/dist/esm/react-query/creditsPostCreditsCoinbase.js.map +1 -0
  294. package/dist/esm/react-query/embeddingsGenerate.d.ts +23 -0
  295. package/dist/esm/react-query/embeddingsGenerate.d.ts.map +1 -0
  296. package/dist/esm/react-query/{embeddingsPostEmbeddings.js → embeddingsGenerate.js} +10 -10
  297. package/dist/esm/react-query/embeddingsGenerate.js.map +1 -0
  298. package/dist/esm/react-query/index.d.ts +6 -4
  299. package/dist/esm/react-query/index.d.ts.map +1 -1
  300. package/dist/esm/react-query/index.js +6 -4
  301. package/dist/esm/react-query/index.js.map +1 -1
  302. package/dist/esm/react-query/modelGetParametersAuthorSlug.d.ts +38 -0
  303. package/dist/esm/react-query/modelGetParametersAuthorSlug.d.ts.map +1 -0
  304. package/dist/esm/react-query/modelGetParametersAuthorSlug.js +78 -0
  305. package/dist/esm/react-query/modelGetParametersAuthorSlug.js.map +1 -0
  306. package/dist/esm/react-query/modelsGetModelsUser.d.ts +4 -4
  307. package/dist/esm/react-query/modelsGetModelsUser.d.ts.map +1 -1
  308. package/dist/esm/react-query/modelsGetModelsUser.js +8 -8
  309. package/dist/esm/react-query/modelsGetModelsUser.js.map +1 -1
  310. package/dist/esm/react-query/oAuthPostAuthKeys.d.ts +23 -0
  311. package/dist/esm/react-query/oAuthPostAuthKeys.d.ts.map +1 -0
  312. package/dist/esm/react-query/oAuthPostAuthKeys.js +42 -0
  313. package/dist/esm/react-query/oAuthPostAuthKeys.js.map +1 -0
  314. package/dist/esm/react-query/oAuthPostAuthKeysCode.d.ts +23 -0
  315. package/dist/esm/react-query/oAuthPostAuthKeysCode.d.ts.map +1 -0
  316. package/dist/esm/react-query/oAuthPostAuthKeysCode.js +42 -0
  317. package/dist/esm/react-query/oAuthPostAuthKeysCode.js.map +1 -0
  318. package/dist/esm/react-query/providersGetProviders.d.ts +23 -0
  319. package/dist/esm/react-query/providersGetProviders.d.ts.map +1 -0
  320. package/dist/esm/react-query/providersGetProviders.js +60 -0
  321. package/dist/esm/react-query/providersGetProviders.js.map +1 -0
  322. package/dist/esm/sdk/credits.d.ts +9 -0
  323. package/dist/esm/sdk/credits.d.ts.map +1 -0
  324. package/dist/esm/sdk/credits.js +15 -0
  325. package/dist/esm/sdk/credits.js.map +1 -0
  326. package/dist/esm/sdk/embeddings.d.ts +1 -1
  327. package/dist/esm/sdk/embeddings.d.ts.map +1 -1
  328. package/dist/esm/sdk/embeddings.js +3 -3
  329. package/dist/esm/sdk/embeddings.js.map +1 -1
  330. package/dist/esm/sdk/model.d.ts +9 -0
  331. package/dist/esm/sdk/model.d.ts.map +1 -0
  332. package/dist/esm/sdk/model.js +15 -0
  333. package/dist/esm/sdk/model.js.map +1 -0
  334. package/dist/esm/sdk/models.d.ts +1 -1
  335. package/dist/esm/sdk/models.d.ts.map +1 -1
  336. package/dist/esm/sdk/models.js +2 -2
  337. package/dist/esm/sdk/models.js.map +1 -1
  338. package/dist/esm/sdk/oauth.d.ts +19 -0
  339. package/dist/esm/sdk/oauth.d.ts.map +1 -0
  340. package/dist/esm/sdk/oauth.js +28 -0
  341. package/dist/esm/sdk/oauth.js.map +1 -0
  342. package/dist/esm/sdk/providers.d.ts +9 -0
  343. package/dist/esm/sdk/providers.d.ts.map +1 -0
  344. package/dist/esm/sdk/providers.js +15 -0
  345. package/dist/esm/sdk/providers.js.map +1 -0
  346. package/dist/esm/sdk/sdk.d.ts +12 -8
  347. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  348. package/dist/esm/sdk/sdk.js +15 -14
  349. package/dist/esm/sdk/sdk.js.map +1 -1
  350. package/docs/sdks/analytics/README.md +2 -6
  351. package/docs/sdks/apikeys/README.md +14 -42
  352. package/docs/sdks/chat/README.md +2 -6
  353. package/docs/sdks/credits/README.md +95 -0
  354. package/docs/sdks/embeddings/README.md +10 -14
  355. package/docs/sdks/endpoints/README.md +4 -12
  356. package/docs/sdks/generations/README.md +2 -6
  357. package/docs/sdks/{parameters → model}/README.md +19 -22
  358. package/docs/sdks/models/README.md +13 -24
  359. package/docs/sdks/oauth/README.md +199 -0
  360. package/docs/sdks/openrouter/README.md +2 -196
  361. package/docs/sdks/providers/README.md +104 -0
  362. package/examples/chatCompletions.example.ts +95 -0
  363. package/examples/getCredits.example.ts +1 -3
  364. package/jsr.json +1 -1
  365. package/package.json +1 -1
  366. package/src/funcs/analyticsGetActivity.ts +3 -2
  367. package/src/funcs/apiKeysDeleteKeysHash.ts +3 -2
  368. package/src/funcs/apiKeysGetAuthKey.ts +3 -2
  369. package/src/funcs/apiKeysGetKey.ts +3 -2
  370. package/src/funcs/apiKeysGetKeys.ts +3 -2
  371. package/src/funcs/apiKeysGetKeysHash.ts +3 -2
  372. package/src/funcs/apiKeysPatchKeysHash.ts +3 -2
  373. package/src/funcs/apiKeysPostKeys.ts +3 -2
  374. package/src/funcs/chatSend.ts +3 -2
  375. package/src/funcs/{postCreditsCoinbase.ts → creditsPostCreditsCoinbase.ts} +16 -6
  376. package/src/funcs/{embeddingsPostEmbeddings.ts → embeddingsGenerate.ts} +4 -3
  377. package/src/funcs/endpointsGetEndpointsZdr.ts +3 -2
  378. package/src/funcs/endpointsGetModelsAuthorSlugEndpoints.ts +3 -2
  379. package/src/funcs/generationsGetGeneration.ts +3 -2
  380. package/src/funcs/getCredits.ts +3 -2
  381. package/src/funcs/{parametersGetParametersAuthorSlug.ts → modelGetParametersAuthorSlug.ts} +16 -6
  382. package/src/funcs/modelsGetModels.ts +3 -2
  383. package/src/funcs/modelsGetModelsCount.ts +3 -2
  384. package/src/funcs/modelsGetModelsUser.ts +15 -5
  385. package/src/funcs/oAuthPostAuthKeys.ts +164 -0
  386. package/src/funcs/oAuthPostAuthKeysCode.ts +164 -0
  387. package/src/funcs/{getProviders.ts → providersGetProviders.ts} +7 -3
  388. package/src/lib/config.ts +4 -8
  389. package/src/lib/env.ts +0 -2
  390. package/src/lib/security.ts +1 -8
  391. package/src/models/chaterror.ts +44 -4
  392. package/src/models/chatresponse.ts +4 -4
  393. package/src/models/chatstreamingresponsechunk.ts +4 -4
  394. package/src/models/errorresponse.ts +14 -15
  395. package/src/models/operations/getmodelsuser.ts +58 -0
  396. package/src/models/operations/getparametersauthorslug.ts +60 -0
  397. package/src/models/operations/index.ts +2 -0
  398. package/src/models/operations/postauthkeys.ts +272 -0
  399. package/src/models/operations/postauthkeyscode.ts +352 -0
  400. package/src/models/operations/postcreditscoinbase.ts +60 -0
  401. package/src/models/security.ts +0 -4
  402. package/src/react-query/{postCreditsCoinbase.ts → creditsPostCreditsCoinbase.ts} +21 -18
  403. package/src/react-query/{embeddingsPostEmbeddings.ts → embeddingsGenerate.ts} +18 -19
  404. package/src/react-query/index.ts +6 -4
  405. package/src/react-query/{parametersGetParametersAuthorSlug.ts → modelGetParametersAuthorSlug.ts} +37 -34
  406. package/src/react-query/modelsGetModelsUser.ts +8 -0
  407. package/src/react-query/oAuthPostAuthKeys.ts +88 -0
  408. package/src/react-query/oAuthPostAuthKeysCode.ts +89 -0
  409. package/src/react-query/{getProviders.ts → providersGetProviders.ts} +35 -27
  410. package/src/sdk/credits.ts +26 -0
  411. package/src/sdk/embeddings.ts +3 -3
  412. package/src/sdk/{parameters.ts → model.ts} +5 -3
  413. package/src/sdk/models.ts +2 -0
  414. package/src/sdk/oauth.ts +45 -0
  415. package/src/sdk/providers.ts +22 -0
  416. package/src/sdk/sdk.ts +22 -29
  417. package/dist/commonjs/funcs/embeddingsPostEmbeddings.d.ts.map +0 -1
  418. package/dist/commonjs/funcs/embeddingsPostEmbeddings.js.map +0 -1
  419. package/dist/commonjs/funcs/getProviders.d.ts.map +0 -1
  420. package/dist/commonjs/funcs/getProviders.js.map +0 -1
  421. package/dist/commonjs/funcs/parametersGetParametersAuthorSlug.d.ts.map +0 -1
  422. package/dist/commonjs/funcs/parametersGetParametersAuthorSlug.js.map +0 -1
  423. package/dist/commonjs/funcs/postCreditsCoinbase.d.ts.map +0 -1
  424. package/dist/commonjs/funcs/postCreditsCoinbase.js.map +0 -1
  425. package/dist/commonjs/react-query/embeddingsPostEmbeddings.d.ts +0 -23
  426. package/dist/commonjs/react-query/embeddingsPostEmbeddings.d.ts.map +0 -1
  427. package/dist/commonjs/react-query/embeddingsPostEmbeddings.js.map +0 -1
  428. package/dist/commonjs/react-query/getProviders.d.ts +0 -17
  429. package/dist/commonjs/react-query/getProviders.d.ts.map +0 -1
  430. package/dist/commonjs/react-query/getProviders.js +0 -63
  431. package/dist/commonjs/react-query/getProviders.js.map +0 -1
  432. package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.d.ts +0 -38
  433. package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.d.ts.map +0 -1
  434. package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.js +0 -88
  435. package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.js.map +0 -1
  436. package/dist/commonjs/react-query/postCreditsCoinbase.d.ts +0 -20
  437. package/dist/commonjs/react-query/postCreditsCoinbase.d.ts.map +0 -1
  438. package/dist/commonjs/react-query/postCreditsCoinbase.js +0 -44
  439. package/dist/commonjs/react-query/postCreditsCoinbase.js.map +0 -1
  440. package/dist/commonjs/sdk/parameters.d.ts +0 -9
  441. package/dist/commonjs/sdk/parameters.d.ts.map +0 -1
  442. package/dist/commonjs/sdk/parameters.js +0 -19
  443. package/dist/commonjs/sdk/parameters.js.map +0 -1
  444. package/dist/esm/funcs/embeddingsPostEmbeddings.d.ts.map +0 -1
  445. package/dist/esm/funcs/embeddingsPostEmbeddings.js.map +0 -1
  446. package/dist/esm/funcs/getProviders.d.ts.map +0 -1
  447. package/dist/esm/funcs/getProviders.js.map +0 -1
  448. package/dist/esm/funcs/parametersGetParametersAuthorSlug.d.ts.map +0 -1
  449. package/dist/esm/funcs/parametersGetParametersAuthorSlug.js.map +0 -1
  450. package/dist/esm/funcs/postCreditsCoinbase.d.ts.map +0 -1
  451. package/dist/esm/funcs/postCreditsCoinbase.js.map +0 -1
  452. package/dist/esm/react-query/embeddingsPostEmbeddings.d.ts +0 -23
  453. package/dist/esm/react-query/embeddingsPostEmbeddings.d.ts.map +0 -1
  454. package/dist/esm/react-query/embeddingsPostEmbeddings.js.map +0 -1
  455. package/dist/esm/react-query/getProviders.d.ts +0 -17
  456. package/dist/esm/react-query/getProviders.d.ts.map +0 -1
  457. package/dist/esm/react-query/getProviders.js +0 -54
  458. package/dist/esm/react-query/getProviders.js.map +0 -1
  459. package/dist/esm/react-query/parametersGetParametersAuthorSlug.d.ts +0 -38
  460. package/dist/esm/react-query/parametersGetParametersAuthorSlug.d.ts.map +0 -1
  461. package/dist/esm/react-query/parametersGetParametersAuthorSlug.js +0 -78
  462. package/dist/esm/react-query/parametersGetParametersAuthorSlug.js.map +0 -1
  463. package/dist/esm/react-query/postCreditsCoinbase.d.ts +0 -20
  464. package/dist/esm/react-query/postCreditsCoinbase.d.ts.map +0 -1
  465. package/dist/esm/react-query/postCreditsCoinbase.js.map +0 -1
  466. package/dist/esm/sdk/parameters.d.ts +0 -9
  467. package/dist/esm/sdk/parameters.d.ts.map +0 -1
  468. package/dist/esm/sdk/parameters.js +0 -15
  469. package/dist/esm/sdk/parameters.js.map +0 -1
  470. package/examples/chatCompletion.example.ts +0 -19
  471. package/examples/chatCompletionStream.example.ts +0 -30
  472. package/examples/unauthorized.example.ts +0 -19
@@ -10,8 +10,6 @@ OpenRouter Documentation
10
10
  ### Available Operations
11
11
 
12
12
  * [getCredits](#getcredits) - Get total credits purchased and used for the authenticated user
13
- * [postCreditsCoinbase](#postcreditscoinbase) - Create a Coinbase charge for crypto payment
14
- * [getProviders](#getproviders)
15
13
 
16
14
  ## getCredits
17
15
 
@@ -24,9 +22,7 @@ Get total credits purchased and used for the authenticated user
24
22
  import { OpenRouter } from "@openrouter/sdk";
25
23
 
26
24
  const openRouter = new OpenRouter({
27
- security: {
28
- apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
29
- },
25
+ apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
30
26
  });
31
27
 
32
28
  async function run() {
@@ -49,9 +45,7 @@ import { getCredits } from "@openrouter/sdk/funcs/getCredits.js";
49
45
  // Use `OpenRouterCore` for best tree-shaking performance.
50
46
  // You can create one instance of it to use across an application.
51
47
  const openRouter = new OpenRouterCore({
52
- security: {
53
- apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
54
- },
48
+ apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
55
49
  });
56
50
 
57
51
  async function run() {
@@ -110,192 +104,4 @@ import {
110
104
 
111
105
  | Error Type | Status Code | Content Type |
112
106
  | ----------------------------- | ----------------------------- | ----------------------------- |
113
- | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
114
-
115
- ## postCreditsCoinbase
116
-
117
- Create a Coinbase charge for crypto payment
118
-
119
- ### Example Usage
120
-
121
- <!-- UsageSnippet language="typescript" operationID="post_/credits/coinbase" method="post" path="/credits/coinbase" -->
122
- ```typescript
123
- import { OpenRouter } from "@openrouter/sdk";
124
-
125
- const openRouter = new OpenRouter({
126
- security: {
127
- apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
128
- },
129
- });
130
-
131
- async function run() {
132
- const result = await openRouter.postCreditsCoinbase();
133
-
134
- console.log(result);
135
- }
136
-
137
- run();
138
- ```
139
-
140
- ### Standalone function
141
-
142
- The standalone function version of this method:
143
-
144
- ```typescript
145
- import { OpenRouterCore } from "@openrouter/sdk/core.js";
146
- import { postCreditsCoinbase } from "@openrouter/sdk/funcs/postCreditsCoinbase.js";
147
-
148
- // Use `OpenRouterCore` for best tree-shaking performance.
149
- // You can create one instance of it to use across an application.
150
- const openRouter = new OpenRouterCore({
151
- security: {
152
- apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
153
- },
154
- });
155
-
156
- async function run() {
157
- const res = await postCreditsCoinbase(openRouter);
158
- if (res.ok) {
159
- const { value: result } = res;
160
- console.log(result);
161
- } else {
162
- console.log("postCreditsCoinbase failed:", res.error);
163
- }
164
- }
165
-
166
- run();
167
- ```
168
-
169
- ### React hooks and utilities
170
-
171
- This method can be used in React components through the following hooks and
172
- associated utilities.
173
-
174
- > Check out [this guide][hook-guide] for information about each of the utilities
175
- > below and how to get started using React hooks.
176
-
177
- [hook-guide]: ../../../REACT_QUERY.md
178
-
179
- ```tsx
180
- import {
181
- // Mutation hook for triggering the API call.
182
- usePostCreditsCoinbaseMutation
183
- } from "@openrouter/sdk/react-query/postCreditsCoinbase.js";
184
- ```
185
-
186
- ### Parameters
187
-
188
- | Parameter | Type | Required | Description |
189
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
190
- | `request` | [operations.PostCreditsCoinbaseRequest](../../models/operations/postcreditscoinbaserequest.md) | :heavy_check_mark: | The request object to use for the request. |
191
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
192
- | `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. |
193
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
194
-
195
- ### Response
196
-
197
- **Promise\<[operations.PostCreditsCoinbaseResponse](../../models/operations/postcreditscoinbaseresponse.md)\>**
198
-
199
- ### Errors
200
-
201
- | Error Type | Status Code | Content Type |
202
- | ----------------------------- | ----------------------------- | ----------------------------- |
203
- | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
204
-
205
- ## getProviders
206
-
207
- ### Example Usage
208
-
209
- <!-- UsageSnippet language="typescript" operationID="get_/providers" method="get" path="/providers" -->
210
- ```typescript
211
- import { OpenRouter } from "@openrouter/sdk";
212
-
213
- const openRouter = new OpenRouter({
214
- security: {
215
- apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
216
- },
217
- });
218
-
219
- async function run() {
220
- const result = await openRouter.getProviders();
221
-
222
- console.log(result);
223
- }
224
-
225
- run();
226
- ```
227
-
228
- ### Standalone function
229
-
230
- The standalone function version of this method:
231
-
232
- ```typescript
233
- import { OpenRouterCore } from "@openrouter/sdk/core.js";
234
- import { getProviders } from "@openrouter/sdk/funcs/getProviders.js";
235
-
236
- // Use `OpenRouterCore` for best tree-shaking performance.
237
- // You can create one instance of it to use across an application.
238
- const openRouter = new OpenRouterCore({
239
- security: {
240
- apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
241
- },
242
- });
243
-
244
- async function run() {
245
- const res = await getProviders(openRouter);
246
- if (res.ok) {
247
- const { value: result } = res;
248
- console.log(result);
249
- } else {
250
- console.log("getProviders failed:", res.error);
251
- }
252
- }
253
-
254
- run();
255
- ```
256
-
257
- ### React hooks and utilities
258
-
259
- This method can be used in React components through the following hooks and
260
- associated utilities.
261
-
262
- > Check out [this guide][hook-guide] for information about each of the utilities
263
- > below and how to get started using React hooks.
264
-
265
- [hook-guide]: ../../../REACT_QUERY.md
266
-
267
- ```tsx
268
- import {
269
- // Query hooks for fetching data.
270
- useGetProviders,
271
- useGetProvidersSuspense,
272
-
273
- // Utility for prefetching data during server-side rendering and in React
274
- // Server Components that will be immediately available to client components
275
- // using the hooks.
276
- prefetchGetProviders,
277
-
278
- // Utility to invalidate the query cache for this query in response to
279
- // mutations and other user actions.
280
- invalidateAllGetProviders,
281
- } from "@openrouter/sdk/react-query/getProviders.js";
282
- ```
283
-
284
- ### Parameters
285
-
286
- | Parameter | Type | Required | Description |
287
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
288
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
289
- | `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. |
290
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
291
-
292
- ### Response
293
-
294
- **Promise\<[operations.GetProvidersResponse](../../models/operations/getprovidersresponse.md)\>**
295
-
296
- ### Errors
297
-
298
- | Error Type | Status Code | Content Type |
299
- | ----------------------------- | ----------------------------- | ----------------------------- |
300
- | errors.InternalServerError | 500 | application/json |
301
107
  | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
@@ -0,0 +1,104 @@
1
+ # Providers
2
+ (*providers*)
3
+
4
+ ## Overview
5
+
6
+ ### Available Operations
7
+
8
+ * [getProviders](#getproviders) - List all available model providers
9
+
10
+ ## getProviders
11
+
12
+ List all available model providers
13
+
14
+ ### Example Usage
15
+
16
+ <!-- UsageSnippet language="typescript" operationID="get_/providers" method="get" path="/providers" -->
17
+ ```typescript
18
+ import { OpenRouter } from "@openrouter/sdk";
19
+
20
+ const openRouter = new OpenRouter({
21
+ apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
22
+ });
23
+
24
+ async function run() {
25
+ const result = await openRouter.providers.getProviders();
26
+
27
+ console.log(result);
28
+ }
29
+
30
+ run();
31
+ ```
32
+
33
+ ### Standalone function
34
+
35
+ The standalone function version of this method:
36
+
37
+ ```typescript
38
+ import { OpenRouterCore } from "@openrouter/sdk/core.js";
39
+ import { providersGetProviders } from "@openrouter/sdk/funcs/providersGetProviders.js";
40
+
41
+ // Use `OpenRouterCore` for best tree-shaking performance.
42
+ // You can create one instance of it to use across an application.
43
+ const openRouter = new OpenRouterCore({
44
+ apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
45
+ });
46
+
47
+ async function run() {
48
+ const res = await providersGetProviders(openRouter);
49
+ if (res.ok) {
50
+ const { value: result } = res;
51
+ console.log(result);
52
+ } else {
53
+ console.log("providersGetProviders failed:", res.error);
54
+ }
55
+ }
56
+
57
+ run();
58
+ ```
59
+
60
+ ### React hooks and utilities
61
+
62
+ This method can be used in React components through the following hooks and
63
+ associated utilities.
64
+
65
+ > Check out [this guide][hook-guide] for information about each of the utilities
66
+ > below and how to get started using React hooks.
67
+
68
+ [hook-guide]: ../../../REACT_QUERY.md
69
+
70
+ ```tsx
71
+ import {
72
+ // Query hooks for fetching data.
73
+ useProvidersGetProviders,
74
+ useProvidersGetProvidersSuspense,
75
+
76
+ // Utility for prefetching data during server-side rendering and in React
77
+ // Server Components that will be immediately available to client components
78
+ // using the hooks.
79
+ prefetchProvidersGetProviders,
80
+
81
+ // Utility to invalidate the query cache for this query in response to
82
+ // mutations and other user actions.
83
+ invalidateAllProvidersGetProviders,
84
+ } from "@openrouter/sdk/react-query/providersGetProviders.js";
85
+ ```
86
+
87
+ ### Parameters
88
+
89
+ | Parameter | Type | Required | Description |
90
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
91
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
92
+ | `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. |
93
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
94
+
95
+ ### Response
96
+
97
+ **Promise\<[operations.GetProvidersResponse](../../models/operations/getprovidersresponse.md)\>**
98
+
99
+ ### Errors
100
+
101
+ | Error Type | Status Code | Content Type |
102
+ | ----------------------------- | ----------------------------- | ----------------------------- |
103
+ | errors.InternalServerError | 500 | application/json |
104
+ | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
@@ -0,0 +1,95 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import dotenv from "dotenv";
6
+ dotenv.config();
7
+ /**
8
+ * Example usage of the @openrouter/sdk SDK for chat completions
9
+ *
10
+ * To run this example from the examples directory with Bun:
11
+ * bun run chatCompletions.example.ts
12
+ */
13
+
14
+ import { OpenRouter } from "@openrouter/sdk";
15
+ import type { EventStream } from "@openrouter/sdk/lib/event-streams.js";
16
+ import type { ChatStreamingResponseChunk } from "@openrouter/sdk/models/index.js";
17
+
18
+ if (!process.env["OPENROUTER_API_KEY"]) {
19
+ throw new Error("Missing OPENROUTER_API_KEY environment variable");
20
+ }
21
+ const openRouter = new OpenRouter({
22
+ apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
23
+ debugLogger: console
24
+ });
25
+
26
+ async function nonStreamingExample() {
27
+ console.log("=== Non-Streaming Example ===\n");
28
+
29
+ const result = await openRouter.chat.send({
30
+ model: "qwen/qwen3-max",
31
+ messages: [
32
+ {
33
+ role: "user",
34
+ content: "Tell me a short joke about programming",
35
+ },
36
+ ],
37
+ stream: false,
38
+ });
39
+
40
+ if ("choices" in result) {
41
+ console.log("Model:", result.model);
42
+ console.log("Response:", result.choices[0].message.content);
43
+ console.log("Usage:", result.usage);
44
+ }
45
+ }
46
+
47
+ async function streamingExample() {
48
+ console.log("\n=== Streaming Example ===\n");
49
+
50
+ const result = await openRouter.chat.send({
51
+ model: "qwen/qwen3-max",
52
+ messages: [
53
+ {
54
+ role: "user",
55
+ content: "Write a haiku about TypeScript",
56
+ },
57
+ ],
58
+ stream: true,
59
+ streamOptions: {
60
+ includeUsage: true,
61
+ },
62
+ });
63
+
64
+ if (result && typeof result === "object" && Symbol.asyncIterator in result) {
65
+ const stream = result as EventStream<ChatStreamingResponseChunk>;
66
+
67
+ console.log("Streaming response:");
68
+ let fullContent = "";
69
+
70
+ for await (const chunk of stream) {
71
+ if (chunk.data.choices && chunk.data.choices[0]?.delta?.content) {
72
+ const content = chunk.data.choices[0].delta.content;
73
+ process.stdout.write(content);
74
+ fullContent += content;
75
+ }
76
+
77
+ if (chunk.data.usage) {
78
+ console.log("\n\nStream usage:", chunk.data.usage);
79
+ }
80
+ }
81
+
82
+ console.log("\n\nFull response:", fullContent);
83
+ }
84
+ }
85
+
86
+ async function main() {
87
+ try {
88
+ await nonStreamingExample();
89
+ await streamingExample();
90
+ } catch (error) {
91
+ console.error("Error:", error);
92
+ }
93
+ }
94
+
95
+ main();
@@ -14,9 +14,7 @@ dotenv.config();
14
14
  import { OpenRouter } from "@openrouter/sdk";
15
15
 
16
16
  const openRouter = new OpenRouter({
17
- security: {
18
- apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
19
- },
17
+ apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
20
18
  });
21
19
 
22
20
  async function main() {
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "0.0.0-beta.2",
5
+ "version": "0.0.0-beta.5",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openrouter/sdk",
3
- "version": "0.0.0-beta.2",
3
+ "version": "0.0.0-beta.5",
4
4
  "author": "OpenRouter",
5
5
  "type": "module",
6
6
  "tshy": {
@@ -96,7 +96,8 @@ async function $do(
96
96
  Accept: "application/json",
97
97
  }));
98
98
 
99
- const securityInput = await extractSecurity(client._options.security);
99
+ const secConfig = await extractSecurity(client._options.apiKey);
100
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
100
101
  const requestSecurity = resolveGlobalSecurity(securityInput);
101
102
 
102
103
  const context = {
@@ -107,7 +108,7 @@ async function $do(
107
108
 
108
109
  resolvedSecurity: requestSecurity,
109
110
 
110
- securitySource: client._options.security,
111
+ securitySource: client._options.apiKey,
111
112
  retryConfig: options?.retries
112
113
  || client._options.retryConfig
113
114
  || { strategy: "none" },
@@ -95,7 +95,8 @@ async function $do(
95
95
  Accept: "application/json",
96
96
  }));
97
97
 
98
- const securityInput = await extractSecurity(client._options.security);
98
+ const secConfig = await extractSecurity(client._options.apiKey);
99
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
99
100
  const requestSecurity = resolveGlobalSecurity(securityInput);
100
101
 
101
102
  const context = {
@@ -106,7 +107,7 @@ async function $do(
106
107
 
107
108
  resolvedSecurity: requestSecurity,
108
109
 
109
- securitySource: client._options.security,
110
+ securitySource: client._options.apiKey,
110
111
  retryConfig: options?.retries
111
112
  || client._options.retryConfig
112
113
  || { strategy: "none" },
@@ -75,7 +75,8 @@ async function $do(
75
75
  Accept: "application/json",
76
76
  }));
77
77
 
78
- const securityInput = await extractSecurity(client._options.security);
78
+ const secConfig = await extractSecurity(client._options.apiKey);
79
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
79
80
  const requestSecurity = resolveGlobalSecurity(securityInput);
80
81
 
81
82
  const context = {
@@ -86,7 +87,7 @@ async function $do(
86
87
 
87
88
  resolvedSecurity: requestSecurity,
88
89
 
89
- securitySource: client._options.security,
90
+ securitySource: client._options.apiKey,
90
91
  retryConfig: options?.retries
91
92
  || client._options.retryConfig
92
93
  || { strategy: "none" },
@@ -75,7 +75,8 @@ async function $do(
75
75
  Accept: "application/json",
76
76
  }));
77
77
 
78
- const securityInput = await extractSecurity(client._options.security);
78
+ const secConfig = await extractSecurity(client._options.apiKey);
79
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
79
80
  const requestSecurity = resolveGlobalSecurity(securityInput);
80
81
 
81
82
  const context = {
@@ -86,7 +87,7 @@ async function $do(
86
87
 
87
88
  resolvedSecurity: requestSecurity,
88
89
 
89
- securitySource: client._options.security,
90
+ securitySource: client._options.apiKey,
90
91
  retryConfig: options?.retries
91
92
  || client._options.retryConfig
92
93
  || { strategy: "none" },
@@ -93,7 +93,8 @@ async function $do(
93
93
  Accept: "application/json",
94
94
  }));
95
95
 
96
- const securityInput = await extractSecurity(client._options.security);
96
+ const secConfig = await extractSecurity(client._options.apiKey);
97
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
97
98
  const requestSecurity = resolveGlobalSecurity(securityInput);
98
99
 
99
100
  const context = {
@@ -104,7 +105,7 @@ async function $do(
104
105
 
105
106
  resolvedSecurity: requestSecurity,
106
107
 
107
- securitySource: client._options.security,
108
+ securitySource: client._options.apiKey,
108
109
  retryConfig: options?.retries
109
110
  || client._options.retryConfig
110
111
  || { strategy: "none" },
@@ -95,7 +95,8 @@ async function $do(
95
95
  Accept: "application/json",
96
96
  }));
97
97
 
98
- const securityInput = await extractSecurity(client._options.security);
98
+ const secConfig = await extractSecurity(client._options.apiKey);
99
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
99
100
  const requestSecurity = resolveGlobalSecurity(securityInput);
100
101
 
101
102
  const context = {
@@ -106,7 +107,7 @@ async function $do(
106
107
 
107
108
  resolvedSecurity: requestSecurity,
108
109
 
109
- securitySource: client._options.security,
110
+ securitySource: client._options.apiKey,
110
111
  retryConfig: options?.retries
111
112
  || client._options.retryConfig
112
113
  || { strategy: "none" },
@@ -96,7 +96,8 @@ async function $do(
96
96
  Accept: "application/json",
97
97
  }));
98
98
 
99
- const securityInput = await extractSecurity(client._options.security);
99
+ const secConfig = await extractSecurity(client._options.apiKey);
100
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
100
101
  const requestSecurity = resolveGlobalSecurity(securityInput);
101
102
 
102
103
  const context = {
@@ -107,7 +108,7 @@ async function $do(
107
108
 
108
109
  resolvedSecurity: requestSecurity,
109
110
 
110
- securitySource: client._options.security,
111
+ securitySource: client._options.apiKey,
111
112
  retryConfig: options?.retries
112
113
  || client._options.retryConfig
113
114
  || { strategy: "none" },
@@ -92,7 +92,8 @@ async function $do(
92
92
  Accept: "application/json",
93
93
  }));
94
94
 
95
- const securityInput = await extractSecurity(client._options.security);
95
+ const secConfig = await extractSecurity(client._options.apiKey);
96
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
96
97
  const requestSecurity = resolveGlobalSecurity(securityInput);
97
98
 
98
99
  const context = {
@@ -103,7 +104,7 @@ async function $do(
103
104
 
104
105
  resolvedSecurity: requestSecurity,
105
106
 
106
- securitySource: client._options.security,
107
+ securitySource: client._options.apiKey,
107
108
  retryConfig: options?.retries
108
109
  || client._options.retryConfig
109
110
  || { strategy: "none" },
@@ -105,7 +105,8 @@ async function $do(
105
105
  || "application/json;q=1, text/event-stream;q=0",
106
106
  }));
107
107
 
108
- const securityInput = await extractSecurity(client._options.security);
108
+ const secConfig = await extractSecurity(client._options.apiKey);
109
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
109
110
  const requestSecurity = resolveGlobalSecurity(securityInput);
110
111
 
111
112
  const context = {
@@ -116,7 +117,7 @@ async function $do(
116
117
 
117
118
  resolvedSecurity: requestSecurity,
118
119
 
119
- securitySource: client._options.security,
120
+ securitySource: client._options.apiKey,
120
121
  retryConfig: options?.retries
121
122
  || client._options.retryConfig
122
123
  || { strategy: "none" },