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

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 (492) hide show
  1. package/FUNCTIONS.md +3 -1
  2. package/REACT_QUERY.md +10 -6
  3. package/README.md +29 -36
  4. package/dist/commonjs/funcs/analyticsGetActivity.js +2 -3
  5. package/dist/commonjs/funcs/analyticsGetActivity.js.map +1 -1
  6. package/dist/commonjs/funcs/apiKeysDeleteKeysHash.js +2 -3
  7. package/dist/commonjs/funcs/apiKeysDeleteKeysHash.js.map +1 -1
  8. package/dist/commonjs/funcs/apiKeysGetAuthKey.js +2 -3
  9. package/dist/commonjs/funcs/apiKeysGetAuthKey.js.map +1 -1
  10. package/dist/commonjs/funcs/apiKeysGetKey.js +2 -3
  11. package/dist/commonjs/funcs/apiKeysGetKey.js.map +1 -1
  12. package/dist/commonjs/funcs/apiKeysGetKeys.js +2 -3
  13. package/dist/commonjs/funcs/apiKeysGetKeys.js.map +1 -1
  14. package/dist/commonjs/funcs/apiKeysGetKeysHash.js +2 -3
  15. package/dist/commonjs/funcs/apiKeysGetKeysHash.js.map +1 -1
  16. package/dist/commonjs/funcs/apiKeysPatchKeysHash.js +2 -3
  17. package/dist/commonjs/funcs/apiKeysPatchKeysHash.js.map +1 -1
  18. package/dist/commonjs/funcs/apiKeysPostKeys.js +2 -3
  19. package/dist/commonjs/funcs/apiKeysPostKeys.js.map +1 -1
  20. package/dist/commonjs/funcs/{chatSend.d.ts → chatGenerateResponse.d.ts} +6 -6
  21. package/dist/commonjs/funcs/chatGenerateResponse.d.ts.map +1 -0
  22. package/dist/commonjs/funcs/{chatSend.js → chatGenerateResponse.js} +13 -14
  23. package/dist/commonjs/funcs/chatGenerateResponse.js.map +1 -0
  24. package/dist/commonjs/funcs/embeddingsPostEmbeddings.js +2 -3
  25. package/dist/commonjs/funcs/embeddingsPostEmbeddings.js.map +1 -1
  26. package/dist/commonjs/funcs/endpointsGetEndpointsZdr.js +2 -3
  27. package/dist/commonjs/funcs/endpointsGetEndpointsZdr.js.map +1 -1
  28. package/dist/commonjs/funcs/endpointsGetModelsAuthorSlugEndpoints.js +2 -3
  29. package/dist/commonjs/funcs/endpointsGetModelsAuthorSlugEndpoints.js.map +1 -1
  30. package/dist/commonjs/funcs/generationsGetGeneration.js +2 -3
  31. package/dist/commonjs/funcs/generationsGetGeneration.js.map +1 -1
  32. package/dist/commonjs/funcs/getCredits.js +2 -3
  33. package/dist/commonjs/funcs/getCredits.js.map +1 -1
  34. package/dist/commonjs/funcs/getProviders.js +2 -3
  35. package/dist/commonjs/funcs/getProviders.js.map +1 -1
  36. package/dist/commonjs/funcs/modelsGetModels.js +2 -3
  37. package/dist/commonjs/funcs/modelsGetModels.js.map +1 -1
  38. package/dist/commonjs/funcs/modelsGetModelsCount.js +2 -3
  39. package/dist/commonjs/funcs/modelsGetModelsCount.js.map +1 -1
  40. package/dist/commonjs/funcs/modelsGetModelsUser.d.ts +1 -1
  41. package/dist/commonjs/funcs/modelsGetModelsUser.d.ts.map +1 -1
  42. package/dist/commonjs/funcs/modelsGetModelsUser.js +7 -12
  43. package/dist/commonjs/funcs/modelsGetModelsUser.js.map +1 -1
  44. package/dist/commonjs/funcs/parametersGetParametersAuthorSlug.d.ts +1 -1
  45. package/dist/commonjs/funcs/parametersGetParametersAuthorSlug.d.ts.map +1 -1
  46. package/dist/commonjs/funcs/parametersGetParametersAuthorSlug.js +7 -12
  47. package/dist/commonjs/funcs/parametersGetParametersAuthorSlug.js.map +1 -1
  48. package/dist/commonjs/funcs/postCreditsCoinbase.d.ts +1 -1
  49. package/dist/commonjs/funcs/postCreditsCoinbase.d.ts.map +1 -1
  50. package/dist/commonjs/funcs/postCreditsCoinbase.js +7 -12
  51. package/dist/commonjs/funcs/postCreditsCoinbase.js.map +1 -1
  52. package/dist/commonjs/lib/config.d.ts +8 -4
  53. package/dist/commonjs/lib/config.d.ts.map +1 -1
  54. package/dist/commonjs/lib/config.js +3 -3
  55. package/dist/commonjs/lib/config.js.map +1 -1
  56. package/dist/commonjs/lib/env.d.ts +2 -1
  57. package/dist/commonjs/lib/env.d.ts.map +1 -1
  58. package/dist/commonjs/lib/env.js +2 -1
  59. package/dist/commonjs/lib/env.js.map +1 -1
  60. package/dist/commonjs/lib/security.d.ts.map +1 -1
  61. package/dist/commonjs/lib/security.js +7 -1
  62. package/dist/commonjs/lib/security.js.map +1 -1
  63. package/dist/commonjs/models/chatcompletion.d.ts +43 -0
  64. package/dist/commonjs/models/chatcompletion.d.ts.map +1 -0
  65. package/dist/commonjs/models/{chatresponse.js → chatcompletion.js} +22 -22
  66. package/dist/commonjs/models/chatcompletion.js.map +1 -0
  67. package/dist/commonjs/models/chatcompletionchoice.d.ts +72 -0
  68. package/dist/commonjs/models/chatcompletionchoice.d.ts.map +1 -0
  69. package/dist/commonjs/models/{chatstreamingchoice.js → chatcompletionchoice.js} +32 -32
  70. package/dist/commonjs/models/chatcompletionchoice.js.map +1 -0
  71. package/dist/commonjs/models/chatcompletionchunk.d.ts +68 -0
  72. package/dist/commonjs/models/chatcompletionchunk.d.ts.map +1 -0
  73. package/dist/commonjs/models/{chatstreamingresponsechunk.js → chatcompletionchunk.js} +22 -55
  74. package/dist/commonjs/models/chatcompletionchunk.js.map +1 -0
  75. package/dist/commonjs/models/chatcompletionchunkchoice.d.ts +72 -0
  76. package/dist/commonjs/models/chatcompletionchunkchoice.d.ts.map +1 -0
  77. package/dist/commonjs/models/chatcompletionchunkchoice.js +108 -0
  78. package/dist/commonjs/models/chatcompletionchunkchoice.js.map +1 -0
  79. package/dist/commonjs/models/chatcompletionchunkchoicedelta.d.ts +61 -0
  80. package/dist/commonjs/models/chatcompletionchunkchoicedelta.d.ts.map +1 -0
  81. package/dist/commonjs/models/{chatstreamingmessagechunk.js → chatcompletionchunkchoicedelta.js} +22 -20
  82. package/dist/commonjs/models/chatcompletionchunkchoicedelta.js.map +1 -0
  83. package/dist/commonjs/models/chatcompletionchunkchoicedeltatoolcall.d.ts +62 -0
  84. package/dist/commonjs/models/chatcompletionchunkchoicedeltatoolcall.d.ts.map +1 -0
  85. package/dist/commonjs/models/chatcompletionchunkchoicedeltatoolcall.js +104 -0
  86. package/dist/commonjs/models/chatcompletionchunkchoicedeltatoolcall.js.map +1 -0
  87. package/dist/commonjs/models/chatcompletionerror.d.ts +35 -0
  88. package/dist/commonjs/models/chatcompletionerror.d.ts.map +1 -0
  89. package/dist/commonjs/models/chatcompletionerror.js +75 -0
  90. package/dist/commonjs/models/chatcompletionerror.js.map +1 -0
  91. package/dist/commonjs/models/chatcompletionmessage.d.ts +62 -0
  92. package/dist/commonjs/models/chatcompletionmessage.d.ts.map +1 -0
  93. package/dist/commonjs/models/chatcompletionmessage.js +113 -0
  94. package/dist/commonjs/models/chatcompletionmessage.js.map +1 -0
  95. package/dist/commonjs/models/errorresponse.d.ts +8 -8
  96. package/dist/commonjs/models/errorresponse.d.ts.map +1 -1
  97. package/dist/commonjs/models/errorresponse.js +13 -14
  98. package/dist/commonjs/models/errorresponse.js.map +1 -1
  99. package/dist/commonjs/models/errors/chatcompletionerror.d.ts +37 -0
  100. package/dist/commonjs/models/errors/chatcompletionerror.d.ts.map +1 -0
  101. package/dist/commonjs/models/errors/{chaterror.js → chatcompletionerror.js} +17 -17
  102. package/dist/commonjs/models/errors/chatcompletionerror.js.map +1 -0
  103. package/dist/commonjs/models/errors/index.d.ts +1 -1
  104. package/dist/commonjs/models/errors/index.d.ts.map +1 -1
  105. package/dist/commonjs/models/errors/index.js +1 -1
  106. package/dist/commonjs/models/errors/index.js.map +1 -1
  107. package/dist/commonjs/models/index.d.ts +9 -8
  108. package/dist/commonjs/models/index.d.ts.map +1 -1
  109. package/dist/commonjs/models/index.js +9 -8
  110. package/dist/commonjs/models/index.js.map +1 -1
  111. package/dist/commonjs/models/message.d.ts +19 -54
  112. package/dist/commonjs/models/message.d.ts.map +1 -1
  113. package/dist/commonjs/models/message.js +22 -73
  114. package/dist/commonjs/models/message.js.map +1 -1
  115. package/dist/commonjs/models/operations/getmodelsuser.d.ts +0 -25
  116. package/dist/commonjs/models/operations/getmodelsuser.d.ts.map +1 -1
  117. package/dist/commonjs/models/operations/getmodelsuser.js +2 -29
  118. package/dist/commonjs/models/operations/getmodelsuser.js.map +1 -1
  119. package/dist/commonjs/models/operations/getparametersauthorslug.d.ts +0 -25
  120. package/dist/commonjs/models/operations/getparametersauthorslug.d.ts.map +1 -1
  121. package/dist/commonjs/models/operations/getparametersauthorslug.js +1 -28
  122. package/dist/commonjs/models/operations/getparametersauthorslug.js.map +1 -1
  123. package/dist/commonjs/models/operations/postchatcompletions.d.ts +3 -3
  124. package/dist/commonjs/models/operations/postchatcompletions.d.ts.map +1 -1
  125. package/dist/commonjs/models/operations/postchatcompletions.js +3 -3
  126. package/dist/commonjs/models/operations/postchatcompletions.js.map +1 -1
  127. package/dist/commonjs/models/operations/postcreditscoinbase.d.ts +0 -25
  128. package/dist/commonjs/models/operations/postcreditscoinbase.d.ts.map +1 -1
  129. package/dist/commonjs/models/operations/postcreditscoinbase.js +1 -28
  130. package/dist/commonjs/models/operations/postcreditscoinbase.js.map +1 -1
  131. package/dist/commonjs/models/security.d.ts +4 -2
  132. package/dist/commonjs/models/security.d.ts.map +1 -1
  133. package/dist/commonjs/models/security.js +4 -2
  134. package/dist/commonjs/models/security.js.map +1 -1
  135. package/dist/commonjs/models/toolmessage.d.ts +55 -0
  136. package/dist/commonjs/models/toolmessage.d.ts.map +1 -0
  137. package/dist/commonjs/models/{toolresponsemessage.js → toolmessage.js} +32 -32
  138. package/dist/commonjs/models/toolmessage.js.map +1 -0
  139. package/dist/commonjs/react-query/chatGenerateResponse.d.ts +28 -0
  140. package/dist/commonjs/react-query/chatGenerateResponse.d.ts.map +1 -0
  141. package/dist/commonjs/react-query/chatGenerateResponse.js +50 -0
  142. package/dist/commonjs/react-query/chatGenerateResponse.js.map +1 -0
  143. package/dist/commonjs/react-query/index.d.ts +1 -1
  144. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  145. package/dist/commonjs/react-query/index.js +1 -1
  146. package/dist/commonjs/react-query/index.js.map +1 -1
  147. package/dist/commonjs/react-query/modelsGetModelsUser.d.ts +4 -4
  148. package/dist/commonjs/react-query/modelsGetModelsUser.d.ts.map +1 -1
  149. package/dist/commonjs/react-query/modelsGetModelsUser.js +8 -8
  150. package/dist/commonjs/react-query/modelsGetModelsUser.js.map +1 -1
  151. package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.d.ts +4 -4
  152. package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.d.ts.map +1 -1
  153. package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.js +8 -8
  154. package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.js.map +1 -1
  155. package/dist/commonjs/react-query/postCreditsCoinbase.d.ts +0 -1
  156. package/dist/commonjs/react-query/postCreditsCoinbase.d.ts.map +1 -1
  157. package/dist/commonjs/react-query/postCreditsCoinbase.js +2 -2
  158. package/dist/commonjs/react-query/postCreditsCoinbase.js.map +1 -1
  159. package/dist/commonjs/sdk/chat.d.ts +5 -5
  160. package/dist/commonjs/sdk/chat.d.ts.map +1 -1
  161. package/dist/commonjs/sdk/chat.js +7 -7
  162. package/dist/commonjs/sdk/chat.js.map +1 -1
  163. package/dist/commonjs/sdk/models.d.ts +1 -1
  164. package/dist/commonjs/sdk/models.d.ts.map +1 -1
  165. package/dist/commonjs/sdk/models.js +2 -2
  166. package/dist/commonjs/sdk/models.js.map +1 -1
  167. package/dist/commonjs/sdk/parameters.d.ts +1 -1
  168. package/dist/commonjs/sdk/parameters.d.ts.map +1 -1
  169. package/dist/commonjs/sdk/parameters.js +2 -2
  170. package/dist/commonjs/sdk/parameters.js.map +1 -1
  171. package/dist/commonjs/sdk/sdk.d.ts +1 -1
  172. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  173. package/dist/commonjs/sdk/sdk.js +2 -2
  174. package/dist/commonjs/sdk/sdk.js.map +1 -1
  175. package/dist/esm/funcs/analyticsGetActivity.js +2 -3
  176. package/dist/esm/funcs/analyticsGetActivity.js.map +1 -1
  177. package/dist/esm/funcs/apiKeysDeleteKeysHash.js +2 -3
  178. package/dist/esm/funcs/apiKeysDeleteKeysHash.js.map +1 -1
  179. package/dist/esm/funcs/apiKeysGetAuthKey.js +2 -3
  180. package/dist/esm/funcs/apiKeysGetAuthKey.js.map +1 -1
  181. package/dist/esm/funcs/apiKeysGetKey.js +2 -3
  182. package/dist/esm/funcs/apiKeysGetKey.js.map +1 -1
  183. package/dist/esm/funcs/apiKeysGetKeys.js +2 -3
  184. package/dist/esm/funcs/apiKeysGetKeys.js.map +1 -1
  185. package/dist/esm/funcs/apiKeysGetKeysHash.js +2 -3
  186. package/dist/esm/funcs/apiKeysGetKeysHash.js.map +1 -1
  187. package/dist/esm/funcs/apiKeysPatchKeysHash.js +2 -3
  188. package/dist/esm/funcs/apiKeysPatchKeysHash.js.map +1 -1
  189. package/dist/esm/funcs/apiKeysPostKeys.js +2 -3
  190. package/dist/esm/funcs/apiKeysPostKeys.js.map +1 -1
  191. package/dist/esm/funcs/{chatSend.d.ts → chatGenerateResponse.d.ts} +6 -6
  192. package/dist/esm/funcs/chatGenerateResponse.d.ts.map +1 -0
  193. package/dist/esm/funcs/{chatSend.js → chatGenerateResponse.js} +11 -12
  194. package/dist/esm/funcs/chatGenerateResponse.js.map +1 -0
  195. package/dist/esm/funcs/embeddingsPostEmbeddings.js +2 -3
  196. package/dist/esm/funcs/embeddingsPostEmbeddings.js.map +1 -1
  197. package/dist/esm/funcs/endpointsGetEndpointsZdr.js +2 -3
  198. package/dist/esm/funcs/endpointsGetEndpointsZdr.js.map +1 -1
  199. package/dist/esm/funcs/endpointsGetModelsAuthorSlugEndpoints.js +2 -3
  200. package/dist/esm/funcs/endpointsGetModelsAuthorSlugEndpoints.js.map +1 -1
  201. package/dist/esm/funcs/generationsGetGeneration.js +2 -3
  202. package/dist/esm/funcs/generationsGetGeneration.js.map +1 -1
  203. package/dist/esm/funcs/getCredits.js +2 -3
  204. package/dist/esm/funcs/getCredits.js.map +1 -1
  205. package/dist/esm/funcs/getProviders.js +2 -3
  206. package/dist/esm/funcs/getProviders.js.map +1 -1
  207. package/dist/esm/funcs/modelsGetModels.js +2 -3
  208. package/dist/esm/funcs/modelsGetModels.js.map +1 -1
  209. package/dist/esm/funcs/modelsGetModelsCount.js +2 -3
  210. package/dist/esm/funcs/modelsGetModelsCount.js.map +1 -1
  211. package/dist/esm/funcs/modelsGetModelsUser.d.ts +1 -1
  212. package/dist/esm/funcs/modelsGetModelsUser.d.ts.map +1 -1
  213. package/dist/esm/funcs/modelsGetModelsUser.js +8 -13
  214. package/dist/esm/funcs/modelsGetModelsUser.js.map +1 -1
  215. package/dist/esm/funcs/parametersGetParametersAuthorSlug.d.ts +1 -1
  216. package/dist/esm/funcs/parametersGetParametersAuthorSlug.d.ts.map +1 -1
  217. package/dist/esm/funcs/parametersGetParametersAuthorSlug.js +8 -13
  218. package/dist/esm/funcs/parametersGetParametersAuthorSlug.js.map +1 -1
  219. package/dist/esm/funcs/postCreditsCoinbase.d.ts +1 -1
  220. package/dist/esm/funcs/postCreditsCoinbase.d.ts.map +1 -1
  221. package/dist/esm/funcs/postCreditsCoinbase.js +8 -13
  222. package/dist/esm/funcs/postCreditsCoinbase.js.map +1 -1
  223. package/dist/esm/lib/config.d.ts +8 -4
  224. package/dist/esm/lib/config.d.ts.map +1 -1
  225. package/dist/esm/lib/config.js +3 -3
  226. package/dist/esm/lib/config.js.map +1 -1
  227. package/dist/esm/lib/env.d.ts +2 -1
  228. package/dist/esm/lib/env.d.ts.map +1 -1
  229. package/dist/esm/lib/env.js +2 -1
  230. package/dist/esm/lib/env.js.map +1 -1
  231. package/dist/esm/lib/security.d.ts.map +1 -1
  232. package/dist/esm/lib/security.js +7 -1
  233. package/dist/esm/lib/security.js.map +1 -1
  234. package/dist/esm/models/chatcompletion.d.ts +43 -0
  235. package/dist/esm/models/chatcompletion.d.ts.map +1 -0
  236. package/dist/esm/models/chatcompletion.js +54 -0
  237. package/dist/esm/models/chatcompletion.js.map +1 -0
  238. package/dist/esm/models/chatcompletionchoice.d.ts +72 -0
  239. package/dist/esm/models/chatcompletionchoice.d.ts.map +1 -0
  240. package/dist/esm/models/chatcompletionchoice.js +70 -0
  241. package/dist/esm/models/chatcompletionchoice.js.map +1 -0
  242. package/dist/esm/models/chatcompletionchunk.d.ts +68 -0
  243. package/dist/esm/models/chatcompletionchunk.d.ts.map +1 -0
  244. package/dist/esm/models/chatcompletionchunk.js +91 -0
  245. package/dist/esm/models/chatcompletionchunk.js.map +1 -0
  246. package/dist/esm/models/chatcompletionchunkchoice.d.ts +72 -0
  247. package/dist/esm/models/chatcompletionchunkchoice.d.ts.map +1 -0
  248. package/dist/esm/models/chatcompletionchunkchoice.js +70 -0
  249. package/dist/esm/models/chatcompletionchunkchoice.js.map +1 -0
  250. package/dist/esm/models/chatcompletionchunkchoicedelta.d.ts +61 -0
  251. package/dist/esm/models/chatcompletionchunkchoicedelta.d.ts.map +1 -0
  252. package/dist/esm/models/{chatstreamingmessagechunk.js → chatcompletionchunkchoicedelta.js} +19 -17
  253. package/dist/esm/models/chatcompletionchunkchoicedelta.js.map +1 -0
  254. package/dist/esm/models/chatcompletionchunkchoicedeltatoolcall.d.ts +62 -0
  255. package/dist/esm/models/chatcompletionchunkchoicedeltatoolcall.d.ts.map +1 -0
  256. package/dist/esm/models/chatcompletionchunkchoicedeltatoolcall.js +64 -0
  257. package/dist/esm/models/chatcompletionchunkchoicedeltatoolcall.js.map +1 -0
  258. package/dist/esm/models/chatcompletionerror.d.ts +35 -0
  259. package/dist/esm/models/chatcompletionerror.d.ts.map +1 -0
  260. package/dist/esm/models/chatcompletionerror.js +37 -0
  261. package/dist/esm/models/chatcompletionerror.js.map +1 -0
  262. package/dist/esm/models/chatcompletionmessage.d.ts +62 -0
  263. package/dist/esm/models/chatcompletionmessage.d.ts.map +1 -0
  264. package/dist/esm/models/chatcompletionmessage.js +73 -0
  265. package/dist/esm/models/chatcompletionmessage.js.map +1 -0
  266. package/dist/esm/models/errorresponse.d.ts +8 -8
  267. package/dist/esm/models/errorresponse.d.ts.map +1 -1
  268. package/dist/esm/models/errorresponse.js +12 -13
  269. package/dist/esm/models/errorresponse.js.map +1 -1
  270. package/dist/esm/models/errors/chatcompletionerror.d.ts +37 -0
  271. package/dist/esm/models/errors/chatcompletionerror.d.ts.map +1 -0
  272. package/dist/esm/models/errors/chatcompletionerror.js +48 -0
  273. package/dist/esm/models/errors/chatcompletionerror.js.map +1 -0
  274. package/dist/esm/models/errors/index.d.ts +1 -1
  275. package/dist/esm/models/errors/index.d.ts.map +1 -1
  276. package/dist/esm/models/errors/index.js +1 -1
  277. package/dist/esm/models/errors/index.js.map +1 -1
  278. package/dist/esm/models/index.d.ts +9 -8
  279. package/dist/esm/models/index.d.ts.map +1 -1
  280. package/dist/esm/models/index.js +9 -8
  281. package/dist/esm/models/index.js.map +1 -1
  282. package/dist/esm/models/message.d.ts +19 -54
  283. package/dist/esm/models/message.d.ts.map +1 -1
  284. package/dist/esm/models/message.js +21 -68
  285. package/dist/esm/models/message.js.map +1 -1
  286. package/dist/esm/models/operations/getmodelsuser.d.ts +0 -25
  287. package/dist/esm/models/operations/getmodelsuser.d.ts.map +1 -1
  288. package/dist/esm/models/operations/getmodelsuser.js +0 -25
  289. package/dist/esm/models/operations/getmodelsuser.js.map +1 -1
  290. package/dist/esm/models/operations/getparametersauthorslug.d.ts +0 -25
  291. package/dist/esm/models/operations/getparametersauthorslug.d.ts.map +1 -1
  292. package/dist/esm/models/operations/getparametersauthorslug.js +0 -25
  293. package/dist/esm/models/operations/getparametersauthorslug.js.map +1 -1
  294. package/dist/esm/models/operations/postchatcompletions.d.ts +3 -3
  295. package/dist/esm/models/operations/postchatcompletions.d.ts.map +1 -1
  296. package/dist/esm/models/operations/postchatcompletions.js +3 -3
  297. package/dist/esm/models/operations/postchatcompletions.js.map +1 -1
  298. package/dist/esm/models/operations/postcreditscoinbase.d.ts +0 -25
  299. package/dist/esm/models/operations/postcreditscoinbase.d.ts.map +1 -1
  300. package/dist/esm/models/operations/postcreditscoinbase.js +0 -25
  301. package/dist/esm/models/operations/postcreditscoinbase.js.map +1 -1
  302. package/dist/esm/models/security.d.ts +4 -2
  303. package/dist/esm/models/security.d.ts.map +1 -1
  304. package/dist/esm/models/security.js +4 -2
  305. package/dist/esm/models/security.js.map +1 -1
  306. package/dist/esm/models/toolmessage.d.ts +55 -0
  307. package/dist/esm/models/toolmessage.d.ts.map +1 -0
  308. package/dist/esm/models/toolmessage.js +69 -0
  309. package/dist/esm/models/toolmessage.js.map +1 -0
  310. package/dist/esm/react-query/chatGenerateResponse.d.ts +28 -0
  311. package/dist/esm/react-query/chatGenerateResponse.d.ts.map +1 -0
  312. package/dist/esm/react-query/chatGenerateResponse.js +43 -0
  313. package/dist/esm/react-query/chatGenerateResponse.js.map +1 -0
  314. package/dist/esm/react-query/index.d.ts +1 -1
  315. package/dist/esm/react-query/index.d.ts.map +1 -1
  316. package/dist/esm/react-query/index.js +1 -1
  317. package/dist/esm/react-query/index.js.map +1 -1
  318. package/dist/esm/react-query/modelsGetModelsUser.d.ts +4 -4
  319. package/dist/esm/react-query/modelsGetModelsUser.d.ts.map +1 -1
  320. package/dist/esm/react-query/modelsGetModelsUser.js +8 -8
  321. package/dist/esm/react-query/modelsGetModelsUser.js.map +1 -1
  322. package/dist/esm/react-query/parametersGetParametersAuthorSlug.d.ts +4 -4
  323. package/dist/esm/react-query/parametersGetParametersAuthorSlug.d.ts.map +1 -1
  324. package/dist/esm/react-query/parametersGetParametersAuthorSlug.js +8 -8
  325. package/dist/esm/react-query/parametersGetParametersAuthorSlug.js.map +1 -1
  326. package/dist/esm/react-query/postCreditsCoinbase.d.ts +0 -1
  327. package/dist/esm/react-query/postCreditsCoinbase.d.ts.map +1 -1
  328. package/dist/esm/react-query/postCreditsCoinbase.js +2 -2
  329. package/dist/esm/react-query/postCreditsCoinbase.js.map +1 -1
  330. package/dist/esm/sdk/chat.d.ts +5 -5
  331. package/dist/esm/sdk/chat.d.ts.map +1 -1
  332. package/dist/esm/sdk/chat.js +5 -5
  333. package/dist/esm/sdk/chat.js.map +1 -1
  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/parameters.d.ts +1 -1
  339. package/dist/esm/sdk/parameters.d.ts.map +1 -1
  340. package/dist/esm/sdk/parameters.js +2 -2
  341. package/dist/esm/sdk/parameters.js.map +1 -1
  342. package/dist/esm/sdk/sdk.d.ts +1 -1
  343. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  344. package/dist/esm/sdk/sdk.js +2 -2
  345. package/dist/esm/sdk/sdk.js.map +1 -1
  346. package/docs/sdks/analytics/README.md +6 -2
  347. package/docs/sdks/apikeys/README.md +42 -14
  348. package/docs/sdks/chat/README.md +17 -13
  349. package/docs/sdks/embeddings/README.md +6 -2
  350. package/docs/sdks/endpoints/README.md +12 -4
  351. package/docs/sdks/generations/README.md +6 -2
  352. package/docs/sdks/models/README.md +24 -13
  353. package/docs/sdks/openrouter/README.md +24 -13
  354. package/docs/sdks/parameters/README.md +10 -7
  355. package/examples/getCredits.example.ts +3 -1
  356. package/jsr.json +1 -1
  357. package/package.json +1 -1
  358. package/src/funcs/analyticsGetActivity.ts +2 -3
  359. package/src/funcs/apiKeysDeleteKeysHash.ts +2 -3
  360. package/src/funcs/apiKeysGetAuthKey.ts +2 -3
  361. package/src/funcs/apiKeysGetKey.ts +2 -3
  362. package/src/funcs/apiKeysGetKeys.ts +2 -3
  363. package/src/funcs/apiKeysGetKeysHash.ts +2 -3
  364. package/src/funcs/apiKeysPatchKeysHash.ts +2 -3
  365. package/src/funcs/apiKeysPostKeys.ts +2 -3
  366. package/src/funcs/{chatSend.ts → chatGenerateResponse.ts} +16 -13
  367. package/src/funcs/embeddingsPostEmbeddings.ts +2 -3
  368. package/src/funcs/endpointsGetEndpointsZdr.ts +2 -3
  369. package/src/funcs/endpointsGetModelsAuthorSlugEndpoints.ts +2 -3
  370. package/src/funcs/generationsGetGeneration.ts +2 -3
  371. package/src/funcs/getCredits.ts +2 -3
  372. package/src/funcs/getProviders.ts +2 -3
  373. package/src/funcs/modelsGetModels.ts +2 -3
  374. package/src/funcs/modelsGetModelsCount.ts +2 -3
  375. package/src/funcs/modelsGetModelsUser.ts +5 -15
  376. package/src/funcs/parametersGetParametersAuthorSlug.ts +5 -15
  377. package/src/funcs/postCreditsCoinbase.ts +5 -15
  378. package/src/lib/config.ts +8 -4
  379. package/src/lib/env.ts +4 -2
  380. package/src/lib/security.ts +8 -1
  381. package/src/models/{chatresponse.ts → chatcompletion.ts} +34 -34
  382. package/src/models/chatcompletionchoice.ts +132 -0
  383. package/src/models/chatcompletionchunk.ts +169 -0
  384. package/src/models/chatcompletionchunkchoice.ts +139 -0
  385. package/src/models/{chatstreamingmessagechunk.ts → chatcompletionchunkchoicedelta.ts} +36 -30
  386. package/src/models/chatcompletionchunkchoicedeltatoolcall.ts +166 -0
  387. package/src/models/chatcompletionerror.ts +78 -0
  388. package/src/models/chatcompletionmessage.ts +167 -0
  389. package/src/models/errorresponse.ts +15 -14
  390. package/src/models/errors/chatcompletionerror.ts +79 -0
  391. package/src/models/errors/index.ts +1 -1
  392. package/src/models/index.ts +9 -8
  393. package/src/models/message.ts +49 -151
  394. package/src/models/operations/getmodelsuser.ts +0 -58
  395. package/src/models/operations/getparametersauthorslug.ts +0 -60
  396. package/src/models/operations/postchatcompletions.ts +6 -8
  397. package/src/models/operations/postcreditscoinbase.ts +0 -60
  398. package/src/models/security.ts +8 -4
  399. package/src/models/toolmessage.ts +140 -0
  400. package/src/react-query/{chatSend.ts → chatGenerateResponse.ts} +30 -20
  401. package/src/react-query/index.ts +1 -1
  402. package/src/react-query/modelsGetModelsUser.ts +0 -8
  403. package/src/react-query/parametersGetParametersAuthorSlug.ts +0 -8
  404. package/src/react-query/postCreditsCoinbase.ts +0 -3
  405. package/src/sdk/chat.ts +11 -6
  406. package/src/sdk/models.ts +0 -2
  407. package/src/sdk/parameters.ts +0 -2
  408. package/src/sdk/sdk.ts +0 -2
  409. package/dist/commonjs/funcs/chatSend.d.ts.map +0 -1
  410. package/dist/commonjs/funcs/chatSend.js.map +0 -1
  411. package/dist/commonjs/models/chaterror.d.ts +0 -56
  412. package/dist/commonjs/models/chaterror.d.ts.map +0 -1
  413. package/dist/commonjs/models/chaterror.js +0 -99
  414. package/dist/commonjs/models/chaterror.js.map +0 -1
  415. package/dist/commonjs/models/chatresponse.d.ts +0 -43
  416. package/dist/commonjs/models/chatresponse.d.ts.map +0 -1
  417. package/dist/commonjs/models/chatresponse.js.map +0 -1
  418. package/dist/commonjs/models/chatresponsechoice.d.ts +0 -72
  419. package/dist/commonjs/models/chatresponsechoice.d.ts.map +0 -1
  420. package/dist/commonjs/models/chatresponsechoice.js +0 -108
  421. package/dist/commonjs/models/chatresponsechoice.js.map +0 -1
  422. package/dist/commonjs/models/chatstreamingchoice.d.ts +0 -72
  423. package/dist/commonjs/models/chatstreamingchoice.d.ts.map +0 -1
  424. package/dist/commonjs/models/chatstreamingchoice.js.map +0 -1
  425. package/dist/commonjs/models/chatstreamingmessagechunk.d.ts +0 -61
  426. package/dist/commonjs/models/chatstreamingmessagechunk.d.ts.map +0 -1
  427. package/dist/commonjs/models/chatstreamingmessagechunk.js.map +0 -1
  428. package/dist/commonjs/models/chatstreamingmessagetoolcall.d.ts +0 -62
  429. package/dist/commonjs/models/chatstreamingmessagetoolcall.d.ts.map +0 -1
  430. package/dist/commonjs/models/chatstreamingmessagetoolcall.js +0 -106
  431. package/dist/commonjs/models/chatstreamingmessagetoolcall.js.map +0 -1
  432. package/dist/commonjs/models/chatstreamingresponsechunk.d.ts +0 -97
  433. package/dist/commonjs/models/chatstreamingresponsechunk.d.ts.map +0 -1
  434. package/dist/commonjs/models/chatstreamingresponsechunk.js.map +0 -1
  435. package/dist/commonjs/models/errors/chaterror.d.ts +0 -37
  436. package/dist/commonjs/models/errors/chaterror.d.ts.map +0 -1
  437. package/dist/commonjs/models/errors/chaterror.js.map +0 -1
  438. package/dist/commonjs/models/toolresponsemessage.d.ts +0 -55
  439. package/dist/commonjs/models/toolresponsemessage.d.ts.map +0 -1
  440. package/dist/commonjs/models/toolresponsemessage.js.map +0 -1
  441. package/dist/commonjs/react-query/chatSend.d.ts +0 -28
  442. package/dist/commonjs/react-query/chatSend.d.ts.map +0 -1
  443. package/dist/commonjs/react-query/chatSend.js +0 -50
  444. package/dist/commonjs/react-query/chatSend.js.map +0 -1
  445. package/dist/esm/funcs/chatSend.d.ts.map +0 -1
  446. package/dist/esm/funcs/chatSend.js.map +0 -1
  447. package/dist/esm/models/chaterror.d.ts +0 -56
  448. package/dist/esm/models/chaterror.d.ts.map +0 -1
  449. package/dist/esm/models/chaterror.js +0 -59
  450. package/dist/esm/models/chaterror.js.map +0 -1
  451. package/dist/esm/models/chatresponse.d.ts +0 -43
  452. package/dist/esm/models/chatresponse.d.ts.map +0 -1
  453. package/dist/esm/models/chatresponse.js +0 -54
  454. package/dist/esm/models/chatresponse.js.map +0 -1
  455. package/dist/esm/models/chatresponsechoice.d.ts +0 -72
  456. package/dist/esm/models/chatresponsechoice.d.ts.map +0 -1
  457. package/dist/esm/models/chatresponsechoice.js +0 -70
  458. package/dist/esm/models/chatresponsechoice.js.map +0 -1
  459. package/dist/esm/models/chatstreamingchoice.d.ts +0 -72
  460. package/dist/esm/models/chatstreamingchoice.d.ts.map +0 -1
  461. package/dist/esm/models/chatstreamingchoice.js +0 -70
  462. package/dist/esm/models/chatstreamingchoice.js.map +0 -1
  463. package/dist/esm/models/chatstreamingmessagechunk.d.ts +0 -61
  464. package/dist/esm/models/chatstreamingmessagechunk.d.ts.map +0 -1
  465. package/dist/esm/models/chatstreamingmessagechunk.js.map +0 -1
  466. package/dist/esm/models/chatstreamingmessagetoolcall.d.ts +0 -62
  467. package/dist/esm/models/chatstreamingmessagetoolcall.d.ts.map +0 -1
  468. package/dist/esm/models/chatstreamingmessagetoolcall.js +0 -66
  469. package/dist/esm/models/chatstreamingmessagetoolcall.js.map +0 -1
  470. package/dist/esm/models/chatstreamingresponsechunk.d.ts +0 -97
  471. package/dist/esm/models/chatstreamingresponsechunk.d.ts.map +0 -1
  472. package/dist/esm/models/chatstreamingresponsechunk.js +0 -122
  473. package/dist/esm/models/chatstreamingresponsechunk.js.map +0 -1
  474. package/dist/esm/models/errors/chaterror.d.ts +0 -37
  475. package/dist/esm/models/errors/chaterror.d.ts.map +0 -1
  476. package/dist/esm/models/errors/chaterror.js +0 -48
  477. package/dist/esm/models/errors/chaterror.js.map +0 -1
  478. package/dist/esm/models/toolresponsemessage.d.ts +0 -55
  479. package/dist/esm/models/toolresponsemessage.d.ts.map +0 -1
  480. package/dist/esm/models/toolresponsemessage.js +0 -69
  481. package/dist/esm/models/toolresponsemessage.js.map +0 -1
  482. package/dist/esm/react-query/chatSend.d.ts +0 -28
  483. package/dist/esm/react-query/chatSend.d.ts.map +0 -1
  484. package/dist/esm/react-query/chatSend.js +0 -43
  485. package/dist/esm/react-query/chatSend.js.map +0 -1
  486. package/src/models/chaterror.ts +0 -114
  487. package/src/models/chatresponsechoice.ts +0 -132
  488. package/src/models/chatstreamingchoice.ts +0 -132
  489. package/src/models/chatstreamingmessagetoolcall.ts +0 -149
  490. package/src/models/chatstreamingresponsechunk.ts +0 -239
  491. package/src/models/errors/chaterror.ts +0 -79
  492. package/src/models/toolresponsemessage.ts +0 -144
@@ -8,11 +8,11 @@ import { safeParse } from "../lib/schemas.js";
8
8
  import { ClosedEnum } from "../types/enums.js";
9
9
  import { Result as SafeParseResult } from "../types/fp.js";
10
10
  import {
11
- ChatStreamingMessageToolCall,
12
- ChatStreamingMessageToolCall$inboundSchema,
13
- ChatStreamingMessageToolCall$Outbound,
14
- ChatStreamingMessageToolCall$outboundSchema,
15
- } from "./chatstreamingmessagetoolcall.js";
11
+ ChatCompletionChunkChoiceDeltaToolCall,
12
+ ChatCompletionChunkChoiceDeltaToolCall$inboundSchema,
13
+ ChatCompletionChunkChoiceDeltaToolCall$Outbound,
14
+ ChatCompletionChunkChoiceDeltaToolCall$outboundSchema,
15
+ } from "./chatcompletionchunkchoicedeltatoolcall.js";
16
16
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
17
17
 
18
18
  export const Role = {
@@ -20,12 +20,12 @@ export const Role = {
20
20
  } as const;
21
21
  export type Role = ClosedEnum<typeof Role>;
22
22
 
23
- export type ChatStreamingMessageChunk = {
23
+ export type ChatCompletionChunkChoiceDelta = {
24
24
  role?: Role | undefined;
25
25
  content?: string | null | undefined;
26
26
  reasoning?: string | null | undefined;
27
27
  refusal?: string | null | undefined;
28
- toolCalls?: Array<ChatStreamingMessageToolCall> | undefined;
28
+ toolCalls?: Array<ChatCompletionChunkChoiceDeltaToolCall> | undefined;
29
29
  };
30
30
 
31
31
  /** @internal */
@@ -49,8 +49,8 @@ export namespace Role$ {
49
49
  }
50
50
 
51
51
  /** @internal */
52
- export const ChatStreamingMessageChunk$inboundSchema: z.ZodType<
53
- ChatStreamingMessageChunk,
52
+ export const ChatCompletionChunkChoiceDelta$inboundSchema: z.ZodType<
53
+ ChatCompletionChunkChoiceDelta,
54
54
  z.ZodTypeDef,
55
55
  unknown
56
56
  > = z.object({
@@ -58,7 +58,8 @@ export const ChatStreamingMessageChunk$inboundSchema: z.ZodType<
58
58
  content: z.nullable(z.string()).optional(),
59
59
  reasoning: z.nullable(z.string()).optional(),
60
60
  refusal: z.nullable(z.string()).optional(),
61
- tool_calls: z.array(ChatStreamingMessageToolCall$inboundSchema).optional(),
61
+ tool_calls: z.array(ChatCompletionChunkChoiceDeltaToolCall$inboundSchema)
62
+ .optional(),
62
63
  }).transform((v) => {
63
64
  return remap$(v, {
64
65
  "tool_calls": "toolCalls",
@@ -66,25 +67,28 @@ export const ChatStreamingMessageChunk$inboundSchema: z.ZodType<
66
67
  });
67
68
 
68
69
  /** @internal */
69
- export type ChatStreamingMessageChunk$Outbound = {
70
+ export type ChatCompletionChunkChoiceDelta$Outbound = {
70
71
  role?: string | undefined;
71
72
  content?: string | null | undefined;
72
73
  reasoning?: string | null | undefined;
73
74
  refusal?: string | null | undefined;
74
- tool_calls?: Array<ChatStreamingMessageToolCall$Outbound> | undefined;
75
+ tool_calls?:
76
+ | Array<ChatCompletionChunkChoiceDeltaToolCall$Outbound>
77
+ | undefined;
75
78
  };
76
79
 
77
80
  /** @internal */
78
- export const ChatStreamingMessageChunk$outboundSchema: z.ZodType<
79
- ChatStreamingMessageChunk$Outbound,
81
+ export const ChatCompletionChunkChoiceDelta$outboundSchema: z.ZodType<
82
+ ChatCompletionChunkChoiceDelta$Outbound,
80
83
  z.ZodTypeDef,
81
- ChatStreamingMessageChunk
84
+ ChatCompletionChunkChoiceDelta
82
85
  > = z.object({
83
86
  role: Role$outboundSchema.optional(),
84
87
  content: z.nullable(z.string()).optional(),
85
88
  reasoning: z.nullable(z.string()).optional(),
86
89
  refusal: z.nullable(z.string()).optional(),
87
- toolCalls: z.array(ChatStreamingMessageToolCall$outboundSchema).optional(),
90
+ toolCalls: z.array(ChatCompletionChunkChoiceDeltaToolCall$outboundSchema)
91
+ .optional(),
88
92
  }).transform((v) => {
89
93
  return remap$(v, {
90
94
  toolCalls: "tool_calls",
@@ -95,29 +99,31 @@ export const ChatStreamingMessageChunk$outboundSchema: z.ZodType<
95
99
  * @internal
96
100
  * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
97
101
  */
98
- export namespace ChatStreamingMessageChunk$ {
99
- /** @deprecated use `ChatStreamingMessageChunk$inboundSchema` instead. */
100
- export const inboundSchema = ChatStreamingMessageChunk$inboundSchema;
101
- /** @deprecated use `ChatStreamingMessageChunk$outboundSchema` instead. */
102
- export const outboundSchema = ChatStreamingMessageChunk$outboundSchema;
103
- /** @deprecated use `ChatStreamingMessageChunk$Outbound` instead. */
104
- export type Outbound = ChatStreamingMessageChunk$Outbound;
102
+ export namespace ChatCompletionChunkChoiceDelta$ {
103
+ /** @deprecated use `ChatCompletionChunkChoiceDelta$inboundSchema` instead. */
104
+ export const inboundSchema = ChatCompletionChunkChoiceDelta$inboundSchema;
105
+ /** @deprecated use `ChatCompletionChunkChoiceDelta$outboundSchema` instead. */
106
+ export const outboundSchema = ChatCompletionChunkChoiceDelta$outboundSchema;
107
+ /** @deprecated use `ChatCompletionChunkChoiceDelta$Outbound` instead. */
108
+ export type Outbound = ChatCompletionChunkChoiceDelta$Outbound;
105
109
  }
106
110
 
107
- export function chatStreamingMessageChunkToJSON(
108
- chatStreamingMessageChunk: ChatStreamingMessageChunk,
111
+ export function chatCompletionChunkChoiceDeltaToJSON(
112
+ chatCompletionChunkChoiceDelta: ChatCompletionChunkChoiceDelta,
109
113
  ): string {
110
114
  return JSON.stringify(
111
- ChatStreamingMessageChunk$outboundSchema.parse(chatStreamingMessageChunk),
115
+ ChatCompletionChunkChoiceDelta$outboundSchema.parse(
116
+ chatCompletionChunkChoiceDelta,
117
+ ),
112
118
  );
113
119
  }
114
120
 
115
- export function chatStreamingMessageChunkFromJSON(
121
+ export function chatCompletionChunkChoiceDeltaFromJSON(
116
122
  jsonString: string,
117
- ): SafeParseResult<ChatStreamingMessageChunk, SDKValidationError> {
123
+ ): SafeParseResult<ChatCompletionChunkChoiceDelta, SDKValidationError> {
118
124
  return safeParse(
119
125
  jsonString,
120
- (x) => ChatStreamingMessageChunk$inboundSchema.parse(JSON.parse(x)),
121
- `Failed to parse 'ChatStreamingMessageChunk' from JSON`,
126
+ (x) => ChatCompletionChunkChoiceDelta$inboundSchema.parse(JSON.parse(x)),
127
+ `Failed to parse 'ChatCompletionChunkChoiceDelta' from JSON`,
122
128
  );
123
129
  }
@@ -0,0 +1,166 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../types/fp.js";
8
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
9
+
10
+ export type ChatCompletionChunkChoiceDeltaToolCallFunction = {
11
+ name?: string | undefined;
12
+ arguments?: string | undefined;
13
+ };
14
+
15
+ export type ChatCompletionChunkChoiceDeltaToolCall = {
16
+ index: number;
17
+ id?: string | undefined;
18
+ type?: "function" | undefined;
19
+ function?: ChatCompletionChunkChoiceDeltaToolCallFunction | undefined;
20
+ };
21
+
22
+ /** @internal */
23
+ export const ChatCompletionChunkChoiceDeltaToolCallFunction$inboundSchema:
24
+ z.ZodType<
25
+ ChatCompletionChunkChoiceDeltaToolCallFunction,
26
+ z.ZodTypeDef,
27
+ unknown
28
+ > = z.object({
29
+ name: z.string().optional(),
30
+ arguments: z.string().optional(),
31
+ });
32
+
33
+ /** @internal */
34
+ export type ChatCompletionChunkChoiceDeltaToolCallFunction$Outbound = {
35
+ name?: string | undefined;
36
+ arguments?: string | undefined;
37
+ };
38
+
39
+ /** @internal */
40
+ export const ChatCompletionChunkChoiceDeltaToolCallFunction$outboundSchema:
41
+ z.ZodType<
42
+ ChatCompletionChunkChoiceDeltaToolCallFunction$Outbound,
43
+ z.ZodTypeDef,
44
+ ChatCompletionChunkChoiceDeltaToolCallFunction
45
+ > = z.object({
46
+ name: z.string().optional(),
47
+ arguments: z.string().optional(),
48
+ });
49
+
50
+ /**
51
+ * @internal
52
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
53
+ */
54
+ export namespace ChatCompletionChunkChoiceDeltaToolCallFunction$ {
55
+ /** @deprecated use `ChatCompletionChunkChoiceDeltaToolCallFunction$inboundSchema` instead. */
56
+ export const inboundSchema =
57
+ ChatCompletionChunkChoiceDeltaToolCallFunction$inboundSchema;
58
+ /** @deprecated use `ChatCompletionChunkChoiceDeltaToolCallFunction$outboundSchema` instead. */
59
+ export const outboundSchema =
60
+ ChatCompletionChunkChoiceDeltaToolCallFunction$outboundSchema;
61
+ /** @deprecated use `ChatCompletionChunkChoiceDeltaToolCallFunction$Outbound` instead. */
62
+ export type Outbound =
63
+ ChatCompletionChunkChoiceDeltaToolCallFunction$Outbound;
64
+ }
65
+
66
+ export function chatCompletionChunkChoiceDeltaToolCallFunctionToJSON(
67
+ chatCompletionChunkChoiceDeltaToolCallFunction:
68
+ ChatCompletionChunkChoiceDeltaToolCallFunction,
69
+ ): string {
70
+ return JSON.stringify(
71
+ ChatCompletionChunkChoiceDeltaToolCallFunction$outboundSchema.parse(
72
+ chatCompletionChunkChoiceDeltaToolCallFunction,
73
+ ),
74
+ );
75
+ }
76
+
77
+ export function chatCompletionChunkChoiceDeltaToolCallFunctionFromJSON(
78
+ jsonString: string,
79
+ ): SafeParseResult<
80
+ ChatCompletionChunkChoiceDeltaToolCallFunction,
81
+ SDKValidationError
82
+ > {
83
+ return safeParse(
84
+ jsonString,
85
+ (x) =>
86
+ ChatCompletionChunkChoiceDeltaToolCallFunction$inboundSchema.parse(
87
+ JSON.parse(x),
88
+ ),
89
+ `Failed to parse 'ChatCompletionChunkChoiceDeltaToolCallFunction' from JSON`,
90
+ );
91
+ }
92
+
93
+ /** @internal */
94
+ export const ChatCompletionChunkChoiceDeltaToolCall$inboundSchema: z.ZodType<
95
+ ChatCompletionChunkChoiceDeltaToolCall,
96
+ z.ZodTypeDef,
97
+ unknown
98
+ > = z.object({
99
+ index: z.number(),
100
+ id: z.string().optional(),
101
+ type: z.literal("function").optional(),
102
+ function: z.lazy(() =>
103
+ ChatCompletionChunkChoiceDeltaToolCallFunction$inboundSchema
104
+ ).optional(),
105
+ });
106
+
107
+ /** @internal */
108
+ export type ChatCompletionChunkChoiceDeltaToolCall$Outbound = {
109
+ index: number;
110
+ id?: string | undefined;
111
+ type?: "function" | undefined;
112
+ function?:
113
+ | ChatCompletionChunkChoiceDeltaToolCallFunction$Outbound
114
+ | undefined;
115
+ };
116
+
117
+ /** @internal */
118
+ export const ChatCompletionChunkChoiceDeltaToolCall$outboundSchema: z.ZodType<
119
+ ChatCompletionChunkChoiceDeltaToolCall$Outbound,
120
+ z.ZodTypeDef,
121
+ ChatCompletionChunkChoiceDeltaToolCall
122
+ > = z.object({
123
+ index: z.number(),
124
+ id: z.string().optional(),
125
+ type: z.literal("function").optional(),
126
+ function: z.lazy(() =>
127
+ ChatCompletionChunkChoiceDeltaToolCallFunction$outboundSchema
128
+ ).optional(),
129
+ });
130
+
131
+ /**
132
+ * @internal
133
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
134
+ */
135
+ export namespace ChatCompletionChunkChoiceDeltaToolCall$ {
136
+ /** @deprecated use `ChatCompletionChunkChoiceDeltaToolCall$inboundSchema` instead. */
137
+ export const inboundSchema =
138
+ ChatCompletionChunkChoiceDeltaToolCall$inboundSchema;
139
+ /** @deprecated use `ChatCompletionChunkChoiceDeltaToolCall$outboundSchema` instead. */
140
+ export const outboundSchema =
141
+ ChatCompletionChunkChoiceDeltaToolCall$outboundSchema;
142
+ /** @deprecated use `ChatCompletionChunkChoiceDeltaToolCall$Outbound` instead. */
143
+ export type Outbound = ChatCompletionChunkChoiceDeltaToolCall$Outbound;
144
+ }
145
+
146
+ export function chatCompletionChunkChoiceDeltaToolCallToJSON(
147
+ chatCompletionChunkChoiceDeltaToolCall:
148
+ ChatCompletionChunkChoiceDeltaToolCall,
149
+ ): string {
150
+ return JSON.stringify(
151
+ ChatCompletionChunkChoiceDeltaToolCall$outboundSchema.parse(
152
+ chatCompletionChunkChoiceDeltaToolCall,
153
+ ),
154
+ );
155
+ }
156
+
157
+ export function chatCompletionChunkChoiceDeltaToolCallFromJSON(
158
+ jsonString: string,
159
+ ): SafeParseResult<ChatCompletionChunkChoiceDeltaToolCall, SDKValidationError> {
160
+ return safeParse(
161
+ jsonString,
162
+ (x) =>
163
+ ChatCompletionChunkChoiceDeltaToolCall$inboundSchema.parse(JSON.parse(x)),
164
+ `Failed to parse 'ChatCompletionChunkChoiceDeltaToolCall' from JSON`,
165
+ );
166
+ }
@@ -0,0 +1,78 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../types/fp.js";
8
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
9
+
10
+ export type ChatCompletionErrorError = {
11
+ code: string | null;
12
+ message: string;
13
+ param: string | null;
14
+ type: string;
15
+ };
16
+
17
+ /** @internal */
18
+ export const ChatCompletionErrorError$inboundSchema: z.ZodType<
19
+ ChatCompletionErrorError,
20
+ z.ZodTypeDef,
21
+ unknown
22
+ > = z.object({
23
+ code: z.nullable(z.string()),
24
+ message: z.string(),
25
+ param: z.nullable(z.string()),
26
+ type: z.string(),
27
+ });
28
+
29
+ /** @internal */
30
+ export type ChatCompletionErrorError$Outbound = {
31
+ code: string | null;
32
+ message: string;
33
+ param: string | null;
34
+ type: string;
35
+ };
36
+
37
+ /** @internal */
38
+ export const ChatCompletionErrorError$outboundSchema: z.ZodType<
39
+ ChatCompletionErrorError$Outbound,
40
+ z.ZodTypeDef,
41
+ ChatCompletionErrorError
42
+ > = z.object({
43
+ code: z.nullable(z.string()),
44
+ message: z.string(),
45
+ param: z.nullable(z.string()),
46
+ type: z.string(),
47
+ });
48
+
49
+ /**
50
+ * @internal
51
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
52
+ */
53
+ export namespace ChatCompletionErrorError$ {
54
+ /** @deprecated use `ChatCompletionErrorError$inboundSchema` instead. */
55
+ export const inboundSchema = ChatCompletionErrorError$inboundSchema;
56
+ /** @deprecated use `ChatCompletionErrorError$outboundSchema` instead. */
57
+ export const outboundSchema = ChatCompletionErrorError$outboundSchema;
58
+ /** @deprecated use `ChatCompletionErrorError$Outbound` instead. */
59
+ export type Outbound = ChatCompletionErrorError$Outbound;
60
+ }
61
+
62
+ export function chatCompletionErrorErrorToJSON(
63
+ chatCompletionErrorError: ChatCompletionErrorError,
64
+ ): string {
65
+ return JSON.stringify(
66
+ ChatCompletionErrorError$outboundSchema.parse(chatCompletionErrorError),
67
+ );
68
+ }
69
+
70
+ export function chatCompletionErrorErrorFromJSON(
71
+ jsonString: string,
72
+ ): SafeParseResult<ChatCompletionErrorError, SDKValidationError> {
73
+ return safeParse(
74
+ jsonString,
75
+ (x) => ChatCompletionErrorError$inboundSchema.parse(JSON.parse(x)),
76
+ `Failed to parse 'ChatCompletionErrorError' from JSON`,
77
+ );
78
+ }
@@ -0,0 +1,167 @@
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 { Result as SafeParseResult } from "../types/fp.js";
9
+ import {
10
+ ChatMessageContentItem,
11
+ ChatMessageContentItem$inboundSchema,
12
+ ChatMessageContentItem$Outbound,
13
+ ChatMessageContentItem$outboundSchema,
14
+ } from "./chatmessagecontentitem.js";
15
+ import {
16
+ ChatMessageToolCall,
17
+ ChatMessageToolCall$inboundSchema,
18
+ ChatMessageToolCall$Outbound,
19
+ ChatMessageToolCall$outboundSchema,
20
+ } from "./chatmessagetoolcall.js";
21
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
22
+
23
+ export type ChatCompletionMessageContent =
24
+ | string
25
+ | Array<ChatMessageContentItem>;
26
+
27
+ export type ChatCompletionMessage = {
28
+ role: "assistant";
29
+ content?: string | Array<ChatMessageContentItem> | null | undefined;
30
+ name?: string | undefined;
31
+ toolCalls?: Array<ChatMessageToolCall> | undefined;
32
+ refusal?: string | null | undefined;
33
+ reasoning?: string | null | undefined;
34
+ };
35
+
36
+ /** @internal */
37
+ export const ChatCompletionMessageContent$inboundSchema: z.ZodType<
38
+ ChatCompletionMessageContent,
39
+ z.ZodTypeDef,
40
+ unknown
41
+ > = z.union([z.string(), z.array(ChatMessageContentItem$inboundSchema)]);
42
+
43
+ /** @internal */
44
+ export type ChatCompletionMessageContent$Outbound =
45
+ | string
46
+ | Array<ChatMessageContentItem$Outbound>;
47
+
48
+ /** @internal */
49
+ export const ChatCompletionMessageContent$outboundSchema: z.ZodType<
50
+ ChatCompletionMessageContent$Outbound,
51
+ z.ZodTypeDef,
52
+ ChatCompletionMessageContent
53
+ > = z.union([z.string(), z.array(ChatMessageContentItem$outboundSchema)]);
54
+
55
+ /**
56
+ * @internal
57
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
58
+ */
59
+ export namespace ChatCompletionMessageContent$ {
60
+ /** @deprecated use `ChatCompletionMessageContent$inboundSchema` instead. */
61
+ export const inboundSchema = ChatCompletionMessageContent$inboundSchema;
62
+ /** @deprecated use `ChatCompletionMessageContent$outboundSchema` instead. */
63
+ export const outboundSchema = ChatCompletionMessageContent$outboundSchema;
64
+ /** @deprecated use `ChatCompletionMessageContent$Outbound` instead. */
65
+ export type Outbound = ChatCompletionMessageContent$Outbound;
66
+ }
67
+
68
+ export function chatCompletionMessageContentToJSON(
69
+ chatCompletionMessageContent: ChatCompletionMessageContent,
70
+ ): string {
71
+ return JSON.stringify(
72
+ ChatCompletionMessageContent$outboundSchema.parse(
73
+ chatCompletionMessageContent,
74
+ ),
75
+ );
76
+ }
77
+
78
+ export function chatCompletionMessageContentFromJSON(
79
+ jsonString: string,
80
+ ): SafeParseResult<ChatCompletionMessageContent, SDKValidationError> {
81
+ return safeParse(
82
+ jsonString,
83
+ (x) => ChatCompletionMessageContent$inboundSchema.parse(JSON.parse(x)),
84
+ `Failed to parse 'ChatCompletionMessageContent' from JSON`,
85
+ );
86
+ }
87
+
88
+ /** @internal */
89
+ export const ChatCompletionMessage$inboundSchema: z.ZodType<
90
+ ChatCompletionMessage,
91
+ z.ZodTypeDef,
92
+ unknown
93
+ > = z.object({
94
+ role: z.literal("assistant"),
95
+ content: z.nullable(
96
+ z.union([z.string(), z.array(ChatMessageContentItem$inboundSchema)]),
97
+ ).optional(),
98
+ name: z.string().optional(),
99
+ tool_calls: z.array(ChatMessageToolCall$inboundSchema).optional(),
100
+ refusal: z.nullable(z.string()).optional(),
101
+ reasoning: z.nullable(z.string()).optional(),
102
+ }).transform((v) => {
103
+ return remap$(v, {
104
+ "tool_calls": "toolCalls",
105
+ });
106
+ });
107
+
108
+ /** @internal */
109
+ export type ChatCompletionMessage$Outbound = {
110
+ role: "assistant";
111
+ content?: string | Array<ChatMessageContentItem$Outbound> | null | undefined;
112
+ name?: string | undefined;
113
+ tool_calls?: Array<ChatMessageToolCall$Outbound> | undefined;
114
+ refusal?: string | null | undefined;
115
+ reasoning?: string | null | undefined;
116
+ };
117
+
118
+ /** @internal */
119
+ export const ChatCompletionMessage$outboundSchema: z.ZodType<
120
+ ChatCompletionMessage$Outbound,
121
+ z.ZodTypeDef,
122
+ ChatCompletionMessage
123
+ > = z.object({
124
+ role: z.literal("assistant"),
125
+ content: z.nullable(
126
+ z.union([z.string(), z.array(ChatMessageContentItem$outboundSchema)]),
127
+ ).optional(),
128
+ name: z.string().optional(),
129
+ toolCalls: z.array(ChatMessageToolCall$outboundSchema).optional(),
130
+ refusal: z.nullable(z.string()).optional(),
131
+ reasoning: z.nullable(z.string()).optional(),
132
+ }).transform((v) => {
133
+ return remap$(v, {
134
+ toolCalls: "tool_calls",
135
+ });
136
+ });
137
+
138
+ /**
139
+ * @internal
140
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
141
+ */
142
+ export namespace ChatCompletionMessage$ {
143
+ /** @deprecated use `ChatCompletionMessage$inboundSchema` instead. */
144
+ export const inboundSchema = ChatCompletionMessage$inboundSchema;
145
+ /** @deprecated use `ChatCompletionMessage$outboundSchema` instead. */
146
+ export const outboundSchema = ChatCompletionMessage$outboundSchema;
147
+ /** @deprecated use `ChatCompletionMessage$Outbound` instead. */
148
+ export type Outbound = ChatCompletionMessage$Outbound;
149
+ }
150
+
151
+ export function chatCompletionMessageToJSON(
152
+ chatCompletionMessage: ChatCompletionMessage,
153
+ ): string {
154
+ return JSON.stringify(
155
+ ChatCompletionMessage$outboundSchema.parse(chatCompletionMessage),
156
+ );
157
+ }
158
+
159
+ export function chatCompletionMessageFromJSON(
160
+ jsonString: string,
161
+ ): SafeParseResult<ChatCompletionMessage, SDKValidationError> {
162
+ return safeParse(
163
+ jsonString,
164
+ (x) => ChatCompletionMessage$inboundSchema.parse(JSON.parse(x)),
165
+ `Failed to parse 'ChatCompletionMessage' from JSON`,
166
+ );
167
+ }
@@ -9,7 +9,7 @@ import { ClosedEnum } from "../types/enums.js";
9
9
  import { Result as SafeParseResult } from "../types/fp.js";
10
10
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
11
11
 
12
- export const CodeEnum = {
12
+ export const Code = {
13
13
  OneHundred: 100,
14
14
  OneHundredAndOne: 101,
15
15
  OneHundredAndTwo: 102,
@@ -81,10 +81,10 @@ export const CodeEnum = {
81
81
  FiveHundredAndTwentyNine: 529,
82
82
  FiveHundredAndThirty: 530,
83
83
  } as const;
84
- export type CodeEnum = ClosedEnum<typeof CodeEnum>;
84
+ export type Code = ClosedEnum<typeof Code>;
85
85
 
86
86
  export type ErrorResponseError = {
87
- code: CodeEnum;
87
+ code: Code;
88
88
  message: string;
89
89
  metadata?: { [k: string]: any | null } | null | undefined;
90
90
  };
@@ -98,22 +98,23 @@ export type ErrorResponse = {
98
98
  };
99
99
 
100
100
  /** @internal */
101
- export const CodeEnum$inboundSchema: z.ZodNativeEnum<typeof CodeEnum> = z
102
- .nativeEnum(CodeEnum);
101
+ export const Code$inboundSchema: z.ZodNativeEnum<typeof Code> = z.nativeEnum(
102
+ Code,
103
+ );
103
104
 
104
105
  /** @internal */
105
- export const CodeEnum$outboundSchema: z.ZodNativeEnum<typeof CodeEnum> =
106
- CodeEnum$inboundSchema;
106
+ export const Code$outboundSchema: z.ZodNativeEnum<typeof Code> =
107
+ Code$inboundSchema;
107
108
 
108
109
  /**
109
110
  * @internal
110
111
  * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
111
112
  */
112
- export namespace CodeEnum$ {
113
- /** @deprecated use `CodeEnum$inboundSchema` instead. */
114
- export const inboundSchema = CodeEnum$inboundSchema;
115
- /** @deprecated use `CodeEnum$outboundSchema` instead. */
116
- export const outboundSchema = CodeEnum$outboundSchema;
113
+ export namespace Code$ {
114
+ /** @deprecated use `Code$inboundSchema` instead. */
115
+ export const inboundSchema = Code$inboundSchema;
116
+ /** @deprecated use `Code$outboundSchema` instead. */
117
+ export const outboundSchema = Code$outboundSchema;
117
118
  }
118
119
 
119
120
  /** @internal */
@@ -122,7 +123,7 @@ export const ErrorResponseError$inboundSchema: z.ZodType<
122
123
  z.ZodTypeDef,
123
124
  unknown
124
125
  > = z.object({
125
- code: CodeEnum$inboundSchema,
126
+ code: Code$inboundSchema,
126
127
  message: z.string(),
127
128
  metadata: z.nullable(z.record(z.nullable(z.any()))).optional(),
128
129
  });
@@ -140,7 +141,7 @@ export const ErrorResponseError$outboundSchema: z.ZodType<
140
141
  z.ZodTypeDef,
141
142
  ErrorResponseError
142
143
  > = z.object({
143
- code: CodeEnum$outboundSchema,
144
+ code: Code$outboundSchema,
144
145
  message: z.string(),
145
146
  metadata: z.nullable(z.record(z.nullable(z.any()))).optional(),
146
147
  });
@@ -0,0 +1,79 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import * as models from "../index.js";
7
+ import { OpenRouterError } from "./openroutererror.js";
8
+
9
+ export type ChatCompletionErrorData = {
10
+ error: models.ChatCompletionErrorError;
11
+ };
12
+
13
+ export class ChatCompletionError extends OpenRouterError {
14
+ error: models.ChatCompletionErrorError;
15
+
16
+ /** The original data that was passed to this error instance. */
17
+ data$: ChatCompletionErrorData;
18
+
19
+ constructor(
20
+ err: ChatCompletionErrorData,
21
+ httpMeta: { response: Response; request: Request; body: string },
22
+ ) {
23
+ const message = err.error?.message
24
+ || `API error occurred: ${JSON.stringify(err)}`;
25
+ super(message, httpMeta);
26
+ this.data$ = err;
27
+ this.error = err.error;
28
+
29
+ this.name = "ChatCompletionError";
30
+ }
31
+ }
32
+
33
+ /** @internal */
34
+ export const ChatCompletionError$inboundSchema: z.ZodType<
35
+ ChatCompletionError,
36
+ z.ZodTypeDef,
37
+ unknown
38
+ > = z.object({
39
+ error: z.lazy(() => models.ChatCompletionErrorError$inboundSchema),
40
+ request$: z.instanceof(Request),
41
+ response$: z.instanceof(Response),
42
+ body$: z.string(),
43
+ })
44
+ .transform((v) => {
45
+ return new ChatCompletionError(v, {
46
+ request: v.request$,
47
+ response: v.response$,
48
+ body: v.body$,
49
+ });
50
+ });
51
+
52
+ /** @internal */
53
+ export type ChatCompletionError$Outbound = {
54
+ error: models.ChatCompletionErrorError$Outbound;
55
+ };
56
+
57
+ /** @internal */
58
+ export const ChatCompletionError$outboundSchema: z.ZodType<
59
+ ChatCompletionError$Outbound,
60
+ z.ZodTypeDef,
61
+ ChatCompletionError
62
+ > = z.instanceof(ChatCompletionError)
63
+ .transform(v => v.data$)
64
+ .pipe(z.object({
65
+ error: z.lazy(() => models.ChatCompletionErrorError$outboundSchema),
66
+ }));
67
+
68
+ /**
69
+ * @internal
70
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
71
+ */
72
+ export namespace ChatCompletionError$ {
73
+ /** @deprecated use `ChatCompletionError$inboundSchema` instead. */
74
+ export const inboundSchema = ChatCompletionError$inboundSchema;
75
+ /** @deprecated use `ChatCompletionError$outboundSchema` instead. */
76
+ export const outboundSchema = ChatCompletionError$outboundSchema;
77
+ /** @deprecated use `ChatCompletionError$Outbound` instead. */
78
+ export type Outbound = ChatCompletionError$Outbound;
79
+ }