notdiamond 1.1.4 → 2.0.0-rc10

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 (441) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/LICENSE +201 -0
  3. package/README.md +642 -96
  4. package/api-promise.d.mts +2 -0
  5. package/api-promise.d.mts.map +1 -0
  6. package/api-promise.d.ts +2 -0
  7. package/api-promise.d.ts.map +1 -0
  8. package/api-promise.js +6 -0
  9. package/api-promise.js.map +1 -0
  10. package/api-promise.mjs +2 -0
  11. package/api-promise.mjs.map +1 -0
  12. package/client.d.mts +192 -0
  13. package/client.d.mts.map +1 -0
  14. package/client.d.ts +192 -0
  15. package/client.d.ts.map +1 -0
  16. package/client.js +463 -0
  17. package/client.js.map +1 -0
  18. package/client.mjs +459 -0
  19. package/client.mjs.map +1 -0
  20. package/core/api-promise.d.mts +46 -0
  21. package/core/api-promise.d.mts.map +1 -0
  22. package/core/api-promise.d.ts +46 -0
  23. package/core/api-promise.d.ts.map +1 -0
  24. package/core/api-promise.js +74 -0
  25. package/core/api-promise.js.map +1 -0
  26. package/core/api-promise.mjs +70 -0
  27. package/core/api-promise.mjs.map +1 -0
  28. package/core/error.d.mts +46 -0
  29. package/core/error.d.mts.map +1 -0
  30. package/core/error.d.ts +46 -0
  31. package/core/error.d.ts.map +1 -0
  32. package/core/error.js +113 -0
  33. package/core/error.js.map +1 -0
  34. package/core/error.mjs +97 -0
  35. package/core/error.mjs.map +1 -0
  36. package/core/resource.d.mts +6 -0
  37. package/core/resource.d.mts.map +1 -0
  38. package/core/resource.d.ts +6 -0
  39. package/core/resource.d.ts.map +1 -0
  40. package/core/resource.js +11 -0
  41. package/core/resource.js.map +1 -0
  42. package/core/resource.mjs +7 -0
  43. package/core/resource.mjs.map +1 -0
  44. package/core/uploads.d.mts +3 -0
  45. package/core/uploads.d.mts.map +1 -0
  46. package/core/uploads.d.ts +3 -0
  47. package/core/uploads.d.ts.map +1 -0
  48. package/core/uploads.js +6 -0
  49. package/core/uploads.js.map +1 -0
  50. package/core/uploads.mjs +2 -0
  51. package/core/uploads.mjs.map +1 -0
  52. package/error.d.mts +2 -0
  53. package/error.d.mts.map +1 -0
  54. package/error.d.ts +2 -0
  55. package/error.d.ts.map +1 -0
  56. package/error.js +6 -0
  57. package/error.js.map +1 -0
  58. package/error.mjs +2 -0
  59. package/error.mjs.map +1 -0
  60. package/index.d.mts +6 -0
  61. package/index.d.mts.map +1 -0
  62. package/index.d.ts +6 -0
  63. package/index.d.ts.map +1 -0
  64. package/index.js +30 -0
  65. package/index.js.map +1 -0
  66. package/index.mjs +7 -0
  67. package/index.mjs.map +1 -0
  68. package/internal/builtin-types.d.mts +73 -0
  69. package/internal/builtin-types.d.mts.map +1 -0
  70. package/internal/builtin-types.d.ts +73 -0
  71. package/internal/builtin-types.d.ts.map +1 -0
  72. package/internal/builtin-types.js +4 -0
  73. package/internal/builtin-types.js.map +1 -0
  74. package/internal/builtin-types.mjs +3 -0
  75. package/internal/builtin-types.mjs.map +1 -0
  76. package/internal/detect-platform.d.mts +15 -0
  77. package/internal/detect-platform.d.mts.map +1 -0
  78. package/internal/detect-platform.d.ts +15 -0
  79. package/internal/detect-platform.d.ts.map +1 -0
  80. package/internal/detect-platform.js +162 -0
  81. package/internal/detect-platform.js.map +1 -0
  82. package/internal/detect-platform.mjs +157 -0
  83. package/internal/detect-platform.mjs.map +1 -0
  84. package/internal/errors.d.mts +3 -0
  85. package/internal/errors.d.mts.map +1 -0
  86. package/internal/errors.d.ts +3 -0
  87. package/internal/errors.d.ts.map +1 -0
  88. package/internal/errors.js +41 -0
  89. package/internal/errors.js.map +1 -0
  90. package/internal/errors.mjs +36 -0
  91. package/internal/errors.mjs.map +1 -0
  92. package/internal/headers.d.mts +20 -0
  93. package/internal/headers.d.mts.map +1 -0
  94. package/internal/headers.d.ts +20 -0
  95. package/internal/headers.d.ts.map +1 -0
  96. package/internal/headers.js +79 -0
  97. package/internal/headers.js.map +1 -0
  98. package/internal/headers.mjs +74 -0
  99. package/internal/headers.mjs.map +1 -0
  100. package/internal/parse.d.mts +12 -0
  101. package/internal/parse.d.mts.map +1 -0
  102. package/internal/parse.d.ts +12 -0
  103. package/internal/parse.d.ts.map +1 -0
  104. package/internal/parse.js +35 -0
  105. package/internal/parse.js.map +1 -0
  106. package/internal/parse.mjs +32 -0
  107. package/internal/parse.mjs.map +1 -0
  108. package/internal/qs/formats.d.mts +7 -0
  109. package/internal/qs/formats.d.mts.map +1 -0
  110. package/internal/qs/formats.d.ts +7 -0
  111. package/internal/qs/formats.d.ts.map +1 -0
  112. package/internal/qs/formats.js +13 -0
  113. package/internal/qs/formats.js.map +1 -0
  114. package/internal/qs/formats.mjs +9 -0
  115. package/internal/qs/formats.mjs.map +1 -0
  116. package/internal/qs/index.d.mts +10 -0
  117. package/internal/qs/index.d.mts.map +1 -0
  118. package/internal/qs/index.d.ts +10 -0
  119. package/internal/qs/index.d.ts.map +1 -0
  120. package/internal/qs/index.js +14 -0
  121. package/internal/qs/index.js.map +1 -0
  122. package/internal/qs/index.mjs +10 -0
  123. package/internal/qs/index.mjs.map +1 -0
  124. package/internal/qs/stringify.d.mts +3 -0
  125. package/internal/qs/stringify.d.mts.map +1 -0
  126. package/internal/qs/stringify.d.ts +3 -0
  127. package/internal/qs/stringify.d.ts.map +1 -0
  128. package/internal/qs/stringify.js +277 -0
  129. package/internal/qs/stringify.js.map +1 -0
  130. package/internal/qs/stringify.mjs +274 -0
  131. package/internal/qs/stringify.mjs.map +1 -0
  132. package/internal/qs/types.d.mts +57 -0
  133. package/internal/qs/types.d.mts.map +1 -0
  134. package/internal/qs/types.d.ts +57 -0
  135. package/internal/qs/types.d.ts.map +1 -0
  136. package/internal/qs/types.js +3 -0
  137. package/internal/qs/types.js.map +1 -0
  138. package/internal/qs/types.mjs +2 -0
  139. package/internal/qs/types.mjs.map +1 -0
  140. package/internal/qs/utils.d.mts +15 -0
  141. package/internal/qs/utils.d.mts.map +1 -0
  142. package/internal/qs/utils.d.ts +15 -0
  143. package/internal/qs/utils.d.ts.map +1 -0
  144. package/internal/qs/utils.js +230 -0
  145. package/internal/qs/utils.js.map +1 -0
  146. package/internal/qs/utils.mjs +217 -0
  147. package/internal/qs/utils.mjs.map +1 -0
  148. package/internal/request-options.d.mts +75 -0
  149. package/internal/request-options.d.mts.map +1 -0
  150. package/internal/request-options.d.ts +75 -0
  151. package/internal/request-options.d.ts.map +1 -0
  152. package/internal/request-options.js +14 -0
  153. package/internal/request-options.js.map +1 -0
  154. package/internal/request-options.mjs +10 -0
  155. package/internal/request-options.mjs.map +1 -0
  156. package/internal/shim-types.d.mts +17 -0
  157. package/internal/shim-types.d.mts.map +1 -0
  158. package/internal/shim-types.d.ts +17 -0
  159. package/internal/shim-types.d.ts.map +1 -0
  160. package/internal/shim-types.js +4 -0
  161. package/internal/shim-types.js.map +1 -0
  162. package/internal/shim-types.mjs +3 -0
  163. package/internal/shim-types.mjs.map +1 -0
  164. package/internal/shims.d.mts +20 -0
  165. package/internal/shims.d.mts.map +1 -0
  166. package/internal/shims.d.ts +20 -0
  167. package/internal/shims.d.ts.map +1 -0
  168. package/internal/shims.js +92 -0
  169. package/internal/shims.js.map +1 -0
  170. package/internal/shims.mjs +85 -0
  171. package/internal/shims.mjs.map +1 -0
  172. package/internal/to-file.d.mts +45 -0
  173. package/internal/to-file.d.mts.map +1 -0
  174. package/internal/to-file.d.ts +45 -0
  175. package/internal/to-file.d.ts.map +1 -0
  176. package/internal/to-file.js +91 -0
  177. package/internal/to-file.js.map +1 -0
  178. package/internal/to-file.mjs +88 -0
  179. package/internal/to-file.mjs.map +1 -0
  180. package/internal/tslib.js +81 -0
  181. package/internal/tslib.mjs +17 -0
  182. package/internal/types.d.mts +69 -0
  183. package/internal/types.d.mts.map +1 -0
  184. package/internal/types.d.ts +69 -0
  185. package/internal/types.d.ts.map +1 -0
  186. package/internal/types.js +4 -0
  187. package/internal/types.js.map +1 -0
  188. package/internal/types.mjs +3 -0
  189. package/internal/types.mjs.map +1 -0
  190. package/internal/uploads.d.mts +42 -0
  191. package/internal/uploads.d.mts.map +1 -0
  192. package/internal/uploads.d.ts +42 -0
  193. package/internal/uploads.d.ts.map +1 -0
  194. package/internal/uploads.js +141 -0
  195. package/internal/uploads.js.map +1 -0
  196. package/internal/uploads.mjs +131 -0
  197. package/internal/uploads.mjs.map +1 -0
  198. package/internal/utils/base64.d.mts +3 -0
  199. package/internal/utils/base64.d.mts.map +1 -0
  200. package/internal/utils/base64.d.ts +3 -0
  201. package/internal/utils/base64.d.ts.map +1 -0
  202. package/internal/utils/base64.js +38 -0
  203. package/internal/utils/base64.js.map +1 -0
  204. package/internal/utils/base64.mjs +33 -0
  205. package/internal/utils/base64.mjs.map +1 -0
  206. package/internal/utils/bytes.d.mts +4 -0
  207. package/internal/utils/bytes.d.mts.map +1 -0
  208. package/internal/utils/bytes.d.ts +4 -0
  209. package/internal/utils/bytes.d.ts.map +1 -0
  210. package/internal/utils/bytes.js +31 -0
  211. package/internal/utils/bytes.js.map +1 -0
  212. package/internal/utils/bytes.mjs +26 -0
  213. package/internal/utils/bytes.mjs.map +1 -0
  214. package/internal/utils/env.d.mts +9 -0
  215. package/internal/utils/env.d.mts.map +1 -0
  216. package/internal/utils/env.d.ts +9 -0
  217. package/internal/utils/env.d.ts.map +1 -0
  218. package/internal/utils/env.js +24 -0
  219. package/internal/utils/env.js.map +1 -0
  220. package/internal/utils/env.mjs +20 -0
  221. package/internal/utils/env.mjs.map +1 -0
  222. package/internal/utils/log.d.mts +37 -0
  223. package/internal/utils/log.d.mts.map +1 -0
  224. package/internal/utils/log.d.ts +37 -0
  225. package/internal/utils/log.d.ts.map +1 -0
  226. package/internal/utils/log.js +85 -0
  227. package/internal/utils/log.js.map +1 -0
  228. package/internal/utils/log.mjs +79 -0
  229. package/internal/utils/log.mjs.map +1 -0
  230. package/internal/utils/path.d.mts +15 -0
  231. package/internal/utils/path.d.mts.map +1 -0
  232. package/internal/utils/path.d.ts +15 -0
  233. package/internal/utils/path.d.ts.map +1 -0
  234. package/internal/utils/path.js +79 -0
  235. package/internal/utils/path.js.map +1 -0
  236. package/internal/utils/path.mjs +74 -0
  237. package/internal/utils/path.mjs.map +1 -0
  238. package/internal/utils/sleep.d.mts +2 -0
  239. package/internal/utils/sleep.d.mts.map +1 -0
  240. package/internal/utils/sleep.d.ts +2 -0
  241. package/internal/utils/sleep.d.ts.map +1 -0
  242. package/internal/utils/sleep.js +7 -0
  243. package/internal/utils/sleep.js.map +1 -0
  244. package/internal/utils/sleep.mjs +3 -0
  245. package/internal/utils/sleep.mjs.map +1 -0
  246. package/internal/utils/uuid.d.mts +5 -0
  247. package/internal/utils/uuid.d.mts.map +1 -0
  248. package/internal/utils/uuid.d.ts +5 -0
  249. package/internal/utils/uuid.d.ts.map +1 -0
  250. package/internal/utils/uuid.js +19 -0
  251. package/internal/utils/uuid.js.map +1 -0
  252. package/internal/utils/uuid.mjs +15 -0
  253. package/internal/utils/uuid.mjs.map +1 -0
  254. package/internal/utils/values.d.mts +18 -0
  255. package/internal/utils/values.d.mts.map +1 -0
  256. package/internal/utils/values.d.ts +18 -0
  257. package/internal/utils/values.d.ts.map +1 -0
  258. package/internal/utils/values.js +112 -0
  259. package/internal/utils/values.js.map +1 -0
  260. package/internal/utils/values.mjs +94 -0
  261. package/internal/utils/values.mjs.map +1 -0
  262. package/internal/utils.d.mts +7 -0
  263. package/internal/utils.d.mts.map +1 -0
  264. package/internal/utils.d.ts +7 -0
  265. package/internal/utils.d.ts.map +1 -0
  266. package/internal/utils.js +11 -0
  267. package/internal/utils.js.map +1 -0
  268. package/internal/utils.mjs +8 -0
  269. package/internal/utils.mjs.map +1 -0
  270. package/package.json +129 -123
  271. package/resource.d.mts +2 -0
  272. package/resource.d.mts.map +1 -0
  273. package/resource.d.ts +2 -0
  274. package/resource.d.ts.map +1 -0
  275. package/resource.js +6 -0
  276. package/resource.js.map +1 -0
  277. package/resource.mjs +2 -0
  278. package/resource.mjs.map +1 -0
  279. package/resources/custom-router.d.mts +145 -0
  280. package/resources/custom-router.d.mts.map +1 -0
  281. package/resources/custom-router.d.ts +145 -0
  282. package/resources/custom-router.d.ts.map +1 -0
  283. package/resources/custom-router.js +83 -0
  284. package/resources/custom-router.js.map +1 -0
  285. package/resources/custom-router.mjs +79 -0
  286. package/resources/custom-router.mjs.map +1 -0
  287. package/resources/index.d.mts +7 -0
  288. package/resources/index.d.mts.map +1 -0
  289. package/resources/index.d.ts +7 -0
  290. package/resources/index.d.ts.map +1 -0
  291. package/resources/index.js +17 -0
  292. package/resources/index.js.map +1 -0
  293. package/resources/index.mjs +8 -0
  294. package/resources/index.mjs.map +1 -0
  295. package/resources/model-router.d.mts +196 -0
  296. package/resources/model-router.d.mts.map +1 -0
  297. package/resources/model-router.d.ts +196 -0
  298. package/resources/model-router.d.ts.map +1 -0
  299. package/resources/model-router.js +70 -0
  300. package/resources/model-router.js.map +1 -0
  301. package/resources/model-router.mjs +66 -0
  302. package/resources/model-router.mjs.map +1 -0
  303. package/resources/models.d.mts +110 -0
  304. package/resources/models.d.mts.map +1 -0
  305. package/resources/models.d.ts +110 -0
  306. package/resources/models.d.ts.map +1 -0
  307. package/resources/models.js +49 -0
  308. package/resources/models.js.map +1 -0
  309. package/resources/models.mjs +45 -0
  310. package/resources/models.mjs.map +1 -0
  311. package/resources/preferences.d.mts +97 -0
  312. package/resources/preferences.d.mts.map +1 -0
  313. package/resources/preferences.d.ts +97 -0
  314. package/resources/preferences.d.ts.map +1 -0
  315. package/resources/preferences.js +70 -0
  316. package/resources/preferences.js.map +1 -0
  317. package/resources/preferences.mjs +66 -0
  318. package/resources/preferences.mjs.map +1 -0
  319. package/resources/prompt-adaptation.d.mts +679 -0
  320. package/resources/prompt-adaptation.d.mts.map +1 -0
  321. package/resources/prompt-adaptation.d.ts +679 -0
  322. package/resources/prompt-adaptation.d.ts.map +1 -0
  323. package/resources/prompt-adaptation.js +266 -0
  324. package/resources/prompt-adaptation.js.map +1 -0
  325. package/resources/prompt-adaptation.mjs +262 -0
  326. package/resources/prompt-adaptation.mjs.map +1 -0
  327. package/resources/report/index.d.mts +3 -0
  328. package/resources/report/index.d.mts.map +1 -0
  329. package/resources/report/index.d.ts +3 -0
  330. package/resources/report/index.d.ts.map +1 -0
  331. package/resources/report/index.js +9 -0
  332. package/resources/report/index.js.map +1 -0
  333. package/resources/report/index.mjs +4 -0
  334. package/resources/report/index.mjs.map +1 -0
  335. package/resources/report/metrics.d.mts +87 -0
  336. package/resources/report/metrics.d.mts.map +1 -0
  337. package/resources/report/metrics.d.ts +87 -0
  338. package/resources/report/metrics.d.ts.map +1 -0
  339. package/resources/report/metrics.js +57 -0
  340. package/resources/report/metrics.js.map +1 -0
  341. package/resources/report/metrics.mjs +53 -0
  342. package/resources/report/metrics.mjs.map +1 -0
  343. package/resources/report/report.d.mts +10 -0
  344. package/resources/report/report.d.mts.map +1 -0
  345. package/resources/report/report.d.ts +10 -0
  346. package/resources/report/report.d.ts.map +1 -0
  347. package/resources/report/report.js +17 -0
  348. package/resources/report/report.js.map +1 -0
  349. package/resources/report/report.mjs +12 -0
  350. package/resources/report/report.mjs.map +1 -0
  351. package/resources/report.d.mts +2 -0
  352. package/resources/report.d.mts.map +1 -0
  353. package/resources/report.d.ts +2 -0
  354. package/resources/report.d.ts.map +1 -0
  355. package/resources/report.js +6 -0
  356. package/resources/report.js.map +1 -0
  357. package/resources/report.mjs +3 -0
  358. package/resources/report.mjs.map +1 -0
  359. package/resources.d.mts +2 -0
  360. package/resources.d.mts.map +1 -0
  361. package/resources.d.ts +2 -0
  362. package/resources.d.ts.map +1 -0
  363. package/resources.js +5 -0
  364. package/resources.js.map +1 -0
  365. package/resources.mjs +2 -0
  366. package/resources.mjs.map +1 -0
  367. package/src/api-promise.ts +2 -0
  368. package/src/client.ts +791 -0
  369. package/src/core/README.md +3 -0
  370. package/src/core/api-promise.ts +92 -0
  371. package/src/core/error.ts +130 -0
  372. package/src/core/resource.ts +11 -0
  373. package/src/core/uploads.ts +2 -0
  374. package/src/error.ts +2 -0
  375. package/src/index.ts +22 -0
  376. package/src/internal/README.md +3 -0
  377. package/src/internal/builtin-types.ts +93 -0
  378. package/src/internal/detect-platform.ts +196 -0
  379. package/src/internal/errors.ts +33 -0
  380. package/src/internal/headers.ts +97 -0
  381. package/src/internal/parse.ts +50 -0
  382. package/src/internal/qs/LICENSE.md +13 -0
  383. package/src/internal/qs/README.md +3 -0
  384. package/src/internal/qs/formats.ts +10 -0
  385. package/src/internal/qs/index.ts +13 -0
  386. package/src/internal/qs/stringify.ts +385 -0
  387. package/src/internal/qs/types.ts +71 -0
  388. package/src/internal/qs/utils.ts +265 -0
  389. package/src/internal/request-options.ts +91 -0
  390. package/src/internal/shim-types.ts +26 -0
  391. package/src/internal/shims.ts +107 -0
  392. package/src/internal/to-file.ts +154 -0
  393. package/src/internal/types.ts +95 -0
  394. package/src/internal/uploads.ts +187 -0
  395. package/src/internal/utils/base64.ts +40 -0
  396. package/src/internal/utils/bytes.ts +32 -0
  397. package/src/internal/utils/env.ts +20 -0
  398. package/src/internal/utils/log.ts +126 -0
  399. package/src/internal/utils/path.ts +88 -0
  400. package/src/internal/utils/sleep.ts +3 -0
  401. package/src/internal/utils/uuid.ts +17 -0
  402. package/src/internal/utils/values.ts +105 -0
  403. package/src/internal/utils.ts +8 -0
  404. package/src/lib/.keep +4 -0
  405. package/src/resource.ts +2 -0
  406. package/src/resources/custom-router.ts +168 -0
  407. package/src/resources/index.ts +33 -0
  408. package/src/resources/model-router.ts +224 -0
  409. package/src/resources/models.ts +133 -0
  410. package/src/resources/preferences.ts +121 -0
  411. package/src/resources/prompt-adaptation.ts +770 -0
  412. package/src/resources/report/index.ts +4 -0
  413. package/src/resources/report/metrics.ts +99 -0
  414. package/src/resources/report/report.ts +19 -0
  415. package/src/resources/report.ts +3 -0
  416. package/src/resources.ts +1 -0
  417. package/src/tsconfig.json +11 -0
  418. package/src/uploads.ts +2 -0
  419. package/src/version.ts +1 -0
  420. package/uploads.d.mts +2 -0
  421. package/uploads.d.mts.map +1 -0
  422. package/uploads.d.ts +2 -0
  423. package/uploads.d.ts.map +1 -0
  424. package/uploads.js +6 -0
  425. package/uploads.js.map +1 -0
  426. package/uploads.mjs +2 -0
  427. package/uploads.mjs.map +1 -0
  428. package/version.d.mts +2 -0
  429. package/version.d.mts.map +1 -0
  430. package/version.d.ts +2 -0
  431. package/version.d.ts.map +1 -0
  432. package/version.js +5 -0
  433. package/version.js.map +1 -0
  434. package/version.mjs +2 -0
  435. package/version.mjs.map +1 -0
  436. package/LICENCE +0 -21
  437. package/dist/index.cjs +0 -601
  438. package/dist/index.d.cts +0 -228
  439. package/dist/index.d.mts +0 -228
  440. package/dist/index.d.ts +0 -228
  441. package/dist/index.mjs +0 -580
@@ -0,0 +1,196 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import * as PromptAdaptationAPI from "./prompt-adaptation.mjs";
3
+ import { APIPromise } from "../core/api-promise.mjs";
4
+ import { RequestOptions } from "../internal/request-options.mjs";
5
+ export declare class ModelRouter extends APIResource {
6
+ /**
7
+ * Select the optimal LLM to handle your query based on Not Diamond's routing
8
+ * algorithm.
9
+ *
10
+ * This endpoint analyzes your messages and returns the best-suited model from your
11
+ * specified providers. The router considers factors like query complexity, model
12
+ * capabilities, cost, and latency based on your preferences.
13
+ *
14
+ * **Key Features:**
15
+ *
16
+ * - Intelligent routing across multiple LLM providers
17
+ * - Support for custom routers trained on your evaluation data
18
+ * - Optional cost/latency optimization
19
+ * - Function calling support for compatible models
20
+ * - Privacy-preserving content hashing
21
+ *
22
+ * **Usage:**
23
+ *
24
+ * 1. Pass your messages in OpenAI format (array of objects with 'role' and
25
+ * 'content')
26
+ * 2. Specify which LLM providers you want to route between
27
+ * 3. Optionally provide a preference_id for personalized routing
28
+ * 4. Receive a recommended model and session_id
29
+ * 5. Use the session_id to submit feedback and improve routing
30
+ *
31
+ * **Related Endpoints:**
32
+ *
33
+ * - `POST /v2/preferences/userPreferenceCreate` - Create a preference ID for
34
+ * personalized routing
35
+ * - `POST /v2/report/metrics/feedback` - Submit feedback on routing decisions
36
+ * - `POST /v2/pzn/trainCustomRouter` - Train a custom router on your evaluation
37
+ * data
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const response = await client.modelRouter.selectModel({
42
+ * llm_providers: [
43
+ * { provider: 'openai', model: 'gpt-4o' },
44
+ * {
45
+ * provider: 'anthropic',
46
+ * model: 'claude-sonnet-4-5-20250929',
47
+ * },
48
+ * { provider: 'google', model: 'gemini-2.5-flash' },
49
+ * ],
50
+ * messages: [
51
+ * {
52
+ * role: 'system',
53
+ * content: 'You are a helpful assistant.',
54
+ * },
55
+ * {
56
+ * role: 'user',
57
+ * content: 'Explain quantum computing in simple terms',
58
+ * },
59
+ * ],
60
+ * });
61
+ * ```
62
+ */
63
+ selectModel(params: ModelRouterSelectModelParams, options?: RequestOptions): APIPromise<ModelRouterSelectModelResponse>;
64
+ }
65
+ /**
66
+ * Response from model selection endpoint.
67
+ */
68
+ export interface ModelRouterSelectModelResponse {
69
+ /**
70
+ * List containing the selected provider
71
+ */
72
+ providers: Array<ModelRouterSelectModelResponse.Provider>;
73
+ /**
74
+ * Unique session ID for this routing decision
75
+ */
76
+ session_id: string;
77
+ }
78
+ export declare namespace ModelRouterSelectModelResponse {
79
+ /**
80
+ * Selected LLM provider information from model selection endpoints.
81
+ *
82
+ * Part of ModelSelectResponse. Contains the provider and model that Not Diamond's
83
+ * routing algorithm selected as optimal for your query. Use these values to make
84
+ * your LLM API call to the recommended model.
85
+ */
86
+ interface Provider {
87
+ /**
88
+ * Model identifier for the selected model (e.g., 'gpt-4o',
89
+ * 'claude-3-opus-20240229')
90
+ */
91
+ model: string;
92
+ /**
93
+ * Provider name for the selected model (e.g., 'openai', 'anthropic', 'google')
94
+ */
95
+ provider: string;
96
+ }
97
+ }
98
+ export interface ModelRouterSelectModelParams {
99
+ /**
100
+ * Body param: List of LLM providers to route between. Specify at least one
101
+ * provider in format {provider, model}
102
+ */
103
+ llm_providers: Array<PromptAdaptationAPI.RequestProvider | ModelRouterSelectModelParams.OpenRouterProvider>;
104
+ /**
105
+ * Body param: Array of message objects in OpenAI format (with 'role' and 'content'
106
+ * keys)
107
+ */
108
+ messages: Array<{
109
+ [key: string]: string | Array<unknown>;
110
+ }> | string;
111
+ /**
112
+ * Query param: Optional format type. Use 'openrouter' to accept and return
113
+ * OpenRouter-format model identifiers
114
+ */
115
+ type?: string | null;
116
+ /**
117
+ * Body param: Whether to hash message content for privacy
118
+ */
119
+ hash_content?: boolean;
120
+ /**
121
+ * Body param: Maximum number of models to consider for routing. If not specified,
122
+ * considers all provided models
123
+ */
124
+ max_model_depth?: number | null;
125
+ /**
126
+ * Body param: Optimization metric for model selection
127
+ */
128
+ metric?: string;
129
+ /**
130
+ * Body param: Preference ID for personalized routing. Create one via POST
131
+ * /v2/preferences/userPreferenceCreate
132
+ */
133
+ preference_id?: string | null;
134
+ /**
135
+ * Body param: Previous session ID to link related requests
136
+ */
137
+ previous_session?: string | null;
138
+ /**
139
+ * Body param: OpenAI-format function calling tools
140
+ */
141
+ tools?: Array<{
142
+ [key: string]: unknown;
143
+ }> | null;
144
+ /**
145
+ * Body param: Optimization tradeoff strategy. Use 'cost' to prioritize cost
146
+ * savings or 'latency' to prioritize speed
147
+ */
148
+ tradeoff?: string | null;
149
+ }
150
+ export declare namespace ModelRouterSelectModelParams {
151
+ /**
152
+ * Model for specifying an LLM provider using OpenRouter format.
153
+ *
154
+ * Used in model routing requests when you want to specify providers using the
155
+ * OpenRouter naming convention (combined 'provider/model' format). This is an
156
+ * alternative to the standard RequestProvider which uses separate provider and
157
+ * model fields.
158
+ *
159
+ * **When to use:**
160
+ *
161
+ * - When working with OpenRouter-compatible systems
162
+ * - When you prefer the unified 'provider/model' format
163
+ * - For models accessed via OpenRouter proxy
164
+ */
165
+ interface OpenRouterProvider {
166
+ /**
167
+ * OpenRouter model identifier in 'provider/model' format (e.g., 'openai/gpt-4o',
168
+ * 'anthropic/claude-sonnet-4-5-20250929')
169
+ */
170
+ model: string;
171
+ /**
172
+ * Maximum context length for the model (required for custom models)
173
+ */
174
+ context_length?: number | null;
175
+ /**
176
+ * Input token price per million tokens in USD (required for custom models)
177
+ */
178
+ input_price?: number | null;
179
+ /**
180
+ * Whether this is a custom model not in Not Diamond's supported model list
181
+ */
182
+ is_custom?: boolean;
183
+ /**
184
+ * Average latency in seconds (required for custom models)
185
+ */
186
+ latency?: number | null;
187
+ /**
188
+ * Output token price per million tokens in USD (required for custom models)
189
+ */
190
+ output_price?: number | null;
191
+ }
192
+ }
193
+ export declare namespace ModelRouter {
194
+ export { type ModelRouterSelectModelResponse as ModelRouterSelectModelResponse, type ModelRouterSelectModelParams as ModelRouterSelectModelParams, };
195
+ }
196
+ //# sourceMappingURL=model-router.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-router.d.mts","sourceRoot":"","sources":["../src/resources/model-router.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,mBAAmB;OACxB,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwDG;IACH,WAAW,CACT,MAAM,EAAE,4BAA4B,EACpC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,8BAA8B,CAAC;CAI9C;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,SAAS,EAAE,KAAK,CAAC,8BAA8B,CAAC,QAAQ,CAAC,CAAC;IAE1D;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,yBAAiB,8BAA8B,CAAC;IAC9C;;;;;;OAMG;IACH,UAAiB,QAAQ;QACvB;;;WAGG;QACH,KAAK,EAAE,MAAM,CAAC;QAEd;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;KAClB;CACF;AAED,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,aAAa,EAAE,KAAK,CAAC,mBAAmB,CAAC,eAAe,GAAG,4BAA4B,CAAC,kBAAkB,CAAC,CAAC;IAE5G;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC,GAAG,MAAM,CAAC;IAErE;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;IAEjD;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,yBAAiB,4BAA4B,CAAC;IAC5C;;;;;;;;;;;;;OAaG;IACH,UAAiB,kBAAkB;QACjC;;;WAGG;QACH,KAAK,EAAE,MAAM,CAAC;QAEd;;WAEG;QACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAE/B;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAE5B;;WAEG;QACH,SAAS,CAAC,EAAE,OAAO,CAAC;QAEpB;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAExB;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC9B;CACF;AAED,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,OAAO,EACL,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,4BAA4B,IAAI,4BAA4B,GAClE,CAAC;CACH"}
@@ -0,0 +1,196 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import * as PromptAdaptationAPI from "./prompt-adaptation.js";
3
+ import { APIPromise } from "../core/api-promise.js";
4
+ import { RequestOptions } from "../internal/request-options.js";
5
+ export declare class ModelRouter extends APIResource {
6
+ /**
7
+ * Select the optimal LLM to handle your query based on Not Diamond's routing
8
+ * algorithm.
9
+ *
10
+ * This endpoint analyzes your messages and returns the best-suited model from your
11
+ * specified providers. The router considers factors like query complexity, model
12
+ * capabilities, cost, and latency based on your preferences.
13
+ *
14
+ * **Key Features:**
15
+ *
16
+ * - Intelligent routing across multiple LLM providers
17
+ * - Support for custom routers trained on your evaluation data
18
+ * - Optional cost/latency optimization
19
+ * - Function calling support for compatible models
20
+ * - Privacy-preserving content hashing
21
+ *
22
+ * **Usage:**
23
+ *
24
+ * 1. Pass your messages in OpenAI format (array of objects with 'role' and
25
+ * 'content')
26
+ * 2. Specify which LLM providers you want to route between
27
+ * 3. Optionally provide a preference_id for personalized routing
28
+ * 4. Receive a recommended model and session_id
29
+ * 5. Use the session_id to submit feedback and improve routing
30
+ *
31
+ * **Related Endpoints:**
32
+ *
33
+ * - `POST /v2/preferences/userPreferenceCreate` - Create a preference ID for
34
+ * personalized routing
35
+ * - `POST /v2/report/metrics/feedback` - Submit feedback on routing decisions
36
+ * - `POST /v2/pzn/trainCustomRouter` - Train a custom router on your evaluation
37
+ * data
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const response = await client.modelRouter.selectModel({
42
+ * llm_providers: [
43
+ * { provider: 'openai', model: 'gpt-4o' },
44
+ * {
45
+ * provider: 'anthropic',
46
+ * model: 'claude-sonnet-4-5-20250929',
47
+ * },
48
+ * { provider: 'google', model: 'gemini-2.5-flash' },
49
+ * ],
50
+ * messages: [
51
+ * {
52
+ * role: 'system',
53
+ * content: 'You are a helpful assistant.',
54
+ * },
55
+ * {
56
+ * role: 'user',
57
+ * content: 'Explain quantum computing in simple terms',
58
+ * },
59
+ * ],
60
+ * });
61
+ * ```
62
+ */
63
+ selectModel(params: ModelRouterSelectModelParams, options?: RequestOptions): APIPromise<ModelRouterSelectModelResponse>;
64
+ }
65
+ /**
66
+ * Response from model selection endpoint.
67
+ */
68
+ export interface ModelRouterSelectModelResponse {
69
+ /**
70
+ * List containing the selected provider
71
+ */
72
+ providers: Array<ModelRouterSelectModelResponse.Provider>;
73
+ /**
74
+ * Unique session ID for this routing decision
75
+ */
76
+ session_id: string;
77
+ }
78
+ export declare namespace ModelRouterSelectModelResponse {
79
+ /**
80
+ * Selected LLM provider information from model selection endpoints.
81
+ *
82
+ * Part of ModelSelectResponse. Contains the provider and model that Not Diamond's
83
+ * routing algorithm selected as optimal for your query. Use these values to make
84
+ * your LLM API call to the recommended model.
85
+ */
86
+ interface Provider {
87
+ /**
88
+ * Model identifier for the selected model (e.g., 'gpt-4o',
89
+ * 'claude-3-opus-20240229')
90
+ */
91
+ model: string;
92
+ /**
93
+ * Provider name for the selected model (e.g., 'openai', 'anthropic', 'google')
94
+ */
95
+ provider: string;
96
+ }
97
+ }
98
+ export interface ModelRouterSelectModelParams {
99
+ /**
100
+ * Body param: List of LLM providers to route between. Specify at least one
101
+ * provider in format {provider, model}
102
+ */
103
+ llm_providers: Array<PromptAdaptationAPI.RequestProvider | ModelRouterSelectModelParams.OpenRouterProvider>;
104
+ /**
105
+ * Body param: Array of message objects in OpenAI format (with 'role' and 'content'
106
+ * keys)
107
+ */
108
+ messages: Array<{
109
+ [key: string]: string | Array<unknown>;
110
+ }> | string;
111
+ /**
112
+ * Query param: Optional format type. Use 'openrouter' to accept and return
113
+ * OpenRouter-format model identifiers
114
+ */
115
+ type?: string | null;
116
+ /**
117
+ * Body param: Whether to hash message content for privacy
118
+ */
119
+ hash_content?: boolean;
120
+ /**
121
+ * Body param: Maximum number of models to consider for routing. If not specified,
122
+ * considers all provided models
123
+ */
124
+ max_model_depth?: number | null;
125
+ /**
126
+ * Body param: Optimization metric for model selection
127
+ */
128
+ metric?: string;
129
+ /**
130
+ * Body param: Preference ID for personalized routing. Create one via POST
131
+ * /v2/preferences/userPreferenceCreate
132
+ */
133
+ preference_id?: string | null;
134
+ /**
135
+ * Body param: Previous session ID to link related requests
136
+ */
137
+ previous_session?: string | null;
138
+ /**
139
+ * Body param: OpenAI-format function calling tools
140
+ */
141
+ tools?: Array<{
142
+ [key: string]: unknown;
143
+ }> | null;
144
+ /**
145
+ * Body param: Optimization tradeoff strategy. Use 'cost' to prioritize cost
146
+ * savings or 'latency' to prioritize speed
147
+ */
148
+ tradeoff?: string | null;
149
+ }
150
+ export declare namespace ModelRouterSelectModelParams {
151
+ /**
152
+ * Model for specifying an LLM provider using OpenRouter format.
153
+ *
154
+ * Used in model routing requests when you want to specify providers using the
155
+ * OpenRouter naming convention (combined 'provider/model' format). This is an
156
+ * alternative to the standard RequestProvider which uses separate provider and
157
+ * model fields.
158
+ *
159
+ * **When to use:**
160
+ *
161
+ * - When working with OpenRouter-compatible systems
162
+ * - When you prefer the unified 'provider/model' format
163
+ * - For models accessed via OpenRouter proxy
164
+ */
165
+ interface OpenRouterProvider {
166
+ /**
167
+ * OpenRouter model identifier in 'provider/model' format (e.g., 'openai/gpt-4o',
168
+ * 'anthropic/claude-sonnet-4-5-20250929')
169
+ */
170
+ model: string;
171
+ /**
172
+ * Maximum context length for the model (required for custom models)
173
+ */
174
+ context_length?: number | null;
175
+ /**
176
+ * Input token price per million tokens in USD (required for custom models)
177
+ */
178
+ input_price?: number | null;
179
+ /**
180
+ * Whether this is a custom model not in Not Diamond's supported model list
181
+ */
182
+ is_custom?: boolean;
183
+ /**
184
+ * Average latency in seconds (required for custom models)
185
+ */
186
+ latency?: number | null;
187
+ /**
188
+ * Output token price per million tokens in USD (required for custom models)
189
+ */
190
+ output_price?: number | null;
191
+ }
192
+ }
193
+ export declare namespace ModelRouter {
194
+ export { type ModelRouterSelectModelResponse as ModelRouterSelectModelResponse, type ModelRouterSelectModelParams as ModelRouterSelectModelParams, };
195
+ }
196
+ //# sourceMappingURL=model-router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-router.d.ts","sourceRoot":"","sources":["../src/resources/model-router.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,mBAAmB;OACxB,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwDG;IACH,WAAW,CACT,MAAM,EAAE,4BAA4B,EACpC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,8BAA8B,CAAC;CAI9C;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,SAAS,EAAE,KAAK,CAAC,8BAA8B,CAAC,QAAQ,CAAC,CAAC;IAE1D;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,yBAAiB,8BAA8B,CAAC;IAC9C;;;;;;OAMG;IACH,UAAiB,QAAQ;QACvB;;;WAGG;QACH,KAAK,EAAE,MAAM,CAAC;QAEd;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;KAClB;CACF;AAED,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,aAAa,EAAE,KAAK,CAAC,mBAAmB,CAAC,eAAe,GAAG,4BAA4B,CAAC,kBAAkB,CAAC,CAAC;IAE5G;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC,GAAG,MAAM,CAAC;IAErE;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;IAEjD;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,yBAAiB,4BAA4B,CAAC;IAC5C;;;;;;;;;;;;;OAaG;IACH,UAAiB,kBAAkB;QACjC;;;WAGG;QACH,KAAK,EAAE,MAAM,CAAC;QAEd;;WAEG;QACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAE/B;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAE5B;;WAEG;QACH,SAAS,CAAC,EAAE,OAAO,CAAC;QAEpB;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAExB;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC9B;CACF;AAED,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,OAAO,EACL,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,4BAA4B,IAAI,4BAA4B,GAClE,CAAC;CACH"}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ModelRouter = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ class ModelRouter extends resource_1.APIResource {
7
+ /**
8
+ * Select the optimal LLM to handle your query based on Not Diamond's routing
9
+ * algorithm.
10
+ *
11
+ * This endpoint analyzes your messages and returns the best-suited model from your
12
+ * specified providers. The router considers factors like query complexity, model
13
+ * capabilities, cost, and latency based on your preferences.
14
+ *
15
+ * **Key Features:**
16
+ *
17
+ * - Intelligent routing across multiple LLM providers
18
+ * - Support for custom routers trained on your evaluation data
19
+ * - Optional cost/latency optimization
20
+ * - Function calling support for compatible models
21
+ * - Privacy-preserving content hashing
22
+ *
23
+ * **Usage:**
24
+ *
25
+ * 1. Pass your messages in OpenAI format (array of objects with 'role' and
26
+ * 'content')
27
+ * 2. Specify which LLM providers you want to route between
28
+ * 3. Optionally provide a preference_id for personalized routing
29
+ * 4. Receive a recommended model and session_id
30
+ * 5. Use the session_id to submit feedback and improve routing
31
+ *
32
+ * **Related Endpoints:**
33
+ *
34
+ * - `POST /v2/preferences/userPreferenceCreate` - Create a preference ID for
35
+ * personalized routing
36
+ * - `POST /v2/report/metrics/feedback` - Submit feedback on routing decisions
37
+ * - `POST /v2/pzn/trainCustomRouter` - Train a custom router on your evaluation
38
+ * data
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const response = await client.modelRouter.selectModel({
43
+ * llm_providers: [
44
+ * { provider: 'openai', model: 'gpt-4o' },
45
+ * {
46
+ * provider: 'anthropic',
47
+ * model: 'claude-sonnet-4-5-20250929',
48
+ * },
49
+ * { provider: 'google', model: 'gemini-2.5-flash' },
50
+ * ],
51
+ * messages: [
52
+ * {
53
+ * role: 'system',
54
+ * content: 'You are a helpful assistant.',
55
+ * },
56
+ * {
57
+ * role: 'user',
58
+ * content: 'Explain quantum computing in simple terms',
59
+ * },
60
+ * ],
61
+ * });
62
+ * ```
63
+ */
64
+ selectModel(params, options) {
65
+ const { type, ...body } = params;
66
+ return this._client.post('/v2/modelRouter/modelSelect', { query: { type }, body, ...options });
67
+ }
68
+ }
69
+ exports.ModelRouter = ModelRouter;
70
+ //# sourceMappingURL=model-router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-router.js","sourceRoot":"","sources":["../src/resources/model-router.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAK/C,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwDG;IACH,WAAW,CACT,MAAoC,EACpC,OAAwB;QAExB,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjG,CAAC;CACF;AAjED,kCAiEC"}
@@ -0,0 +1,66 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../core/resource.mjs";
3
+ export class ModelRouter extends APIResource {
4
+ /**
5
+ * Select the optimal LLM to handle your query based on Not Diamond's routing
6
+ * algorithm.
7
+ *
8
+ * This endpoint analyzes your messages and returns the best-suited model from your
9
+ * specified providers. The router considers factors like query complexity, model
10
+ * capabilities, cost, and latency based on your preferences.
11
+ *
12
+ * **Key Features:**
13
+ *
14
+ * - Intelligent routing across multiple LLM providers
15
+ * - Support for custom routers trained on your evaluation data
16
+ * - Optional cost/latency optimization
17
+ * - Function calling support for compatible models
18
+ * - Privacy-preserving content hashing
19
+ *
20
+ * **Usage:**
21
+ *
22
+ * 1. Pass your messages in OpenAI format (array of objects with 'role' and
23
+ * 'content')
24
+ * 2. Specify which LLM providers you want to route between
25
+ * 3. Optionally provide a preference_id for personalized routing
26
+ * 4. Receive a recommended model and session_id
27
+ * 5. Use the session_id to submit feedback and improve routing
28
+ *
29
+ * **Related Endpoints:**
30
+ *
31
+ * - `POST /v2/preferences/userPreferenceCreate` - Create a preference ID for
32
+ * personalized routing
33
+ * - `POST /v2/report/metrics/feedback` - Submit feedback on routing decisions
34
+ * - `POST /v2/pzn/trainCustomRouter` - Train a custom router on your evaluation
35
+ * data
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const response = await client.modelRouter.selectModel({
40
+ * llm_providers: [
41
+ * { provider: 'openai', model: 'gpt-4o' },
42
+ * {
43
+ * provider: 'anthropic',
44
+ * model: 'claude-sonnet-4-5-20250929',
45
+ * },
46
+ * { provider: 'google', model: 'gemini-2.5-flash' },
47
+ * ],
48
+ * messages: [
49
+ * {
50
+ * role: 'system',
51
+ * content: 'You are a helpful assistant.',
52
+ * },
53
+ * {
54
+ * role: 'user',
55
+ * content: 'Explain quantum computing in simple terms',
56
+ * },
57
+ * ],
58
+ * });
59
+ * ```
60
+ */
61
+ selectModel(params, options) {
62
+ const { type, ...body } = params;
63
+ return this._client.post('/v2/modelRouter/modelSelect', { query: { type }, body, ...options });
64
+ }
65
+ }
66
+ //# sourceMappingURL=model-router.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-router.mjs","sourceRoot":"","sources":["../src/resources/model-router.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAKtB,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwDG;IACH,WAAW,CACT,MAAoC,EACpC,OAAwB;QAExB,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjG,CAAC;CACF"}
@@ -0,0 +1,110 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import { APIPromise } from "../core/api-promise.mjs";
3
+ import { RequestOptions } from "../internal/request-options.mjs";
4
+ export declare class Models extends APIResource {
5
+ /**
6
+ * List all supported text generation models with optional filtering.
7
+ *
8
+ * including pricing, context length, latency, and OpenRouter availability.
9
+ *
10
+ * **Note:** Image generation models are excluded from this endpoint.
11
+ *
12
+ * **Examples:**
13
+ *
14
+ * - Get all models: `/v2/models`
15
+ * - OpenRouter only: `/v2/models?openrouter_only=true`
16
+ * - Specific provider: `/v2/models?provider=openai`
17
+ * - Multiple providers: `/v2/models?provider=openai&provider=anthropic`
18
+ *
19
+ * **Query Parameters:**
20
+ *
21
+ * - **provider**: Filter by provider name(s). Can specify multiple times for
22
+ * multiple providers (e.g., `?provider=openai&provider=anthropic`)
23
+ * - **openrouter_only**: Return only models that have OpenRouter support (default:
24
+ * false)
25
+ *
26
+ * **Returns:**
27
+ *
28
+ * - **models**: List of active text generation model objects with metadata
29
+ * - **total**: Total number of active models returned
30
+ * - **deprecated_models**: List of deprecated text generation model objects with
31
+ * metadata (respects the same filters as active models)
32
+ *
33
+ * **Caching:**
34
+ *
35
+ * - Response is cacheable for 1 hour (model list rarely changes)
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const models = await client.models.list();
40
+ * ```
41
+ */
42
+ list(query?: ModelListParams | null | undefined, options?: RequestOptions): APIPromise<ModelListResponse>;
43
+ }
44
+ /**
45
+ * Response model for a single LLM model from GET /v2/models endpoint.
46
+ *
47
+ * Contains metadata about a supported text generation model including pricing,
48
+ * context limits, and availability information.
49
+ */
50
+ export interface Model {
51
+ /**
52
+ * Maximum context window size in tokens
53
+ */
54
+ context_length: number;
55
+ /**
56
+ * Price per million input tokens in USD
57
+ */
58
+ input_price: number;
59
+ /**
60
+ * Model identifier (e.g., 'gpt-4', 'claude-3-opus-20240229')
61
+ */
62
+ model: string;
63
+ /**
64
+ * Price per million output tokens in USD
65
+ */
66
+ output_price: number;
67
+ /**
68
+ * Provider name (e.g., 'openai', 'anthropic', 'google')
69
+ */
70
+ provider: string;
71
+ /**
72
+ * OpenRouter model identifier if available, null if not supported via OpenRouter
73
+ */
74
+ openrouter_model?: string | null;
75
+ }
76
+ /**
77
+ * Response model for GET /v2/models endpoint.
78
+ *
79
+ * Returns a list of all supported text generation models with their metadata,
80
+ * separated into active and deprecated models.
81
+ */
82
+ export interface ModelListResponse {
83
+ /**
84
+ * List of deprecated models that are no longer recommended but may still work
85
+ */
86
+ deprecated_models: Array<Model>;
87
+ /**
88
+ * List of active/supported text generation models with their metadata
89
+ */
90
+ models: Array<Model>;
91
+ /**
92
+ * Total count of active models in the response
93
+ */
94
+ total: number;
95
+ }
96
+ export interface ModelListParams {
97
+ /**
98
+ * Return only OpenRouter-supported models
99
+ */
100
+ openrouter_only?: boolean;
101
+ /**
102
+ * Filter by provider name(s). Can specify multiple providers (e.g., 'openai',
103
+ * 'anthropic')
104
+ */
105
+ provider?: Array<string> | null;
106
+ }
107
+ export declare namespace Models {
108
+ export { type Model as Model, type ModelListResponse as ModelListResponse, type ModelListParams as ModelListParams, };
109
+ }
110
+ //# sourceMappingURL=models.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.mts","sourceRoot":"","sources":["../src/resources/models.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,IAAI,CACF,KAAK,GAAE,eAAe,GAAG,IAAI,GAAG,SAAc,EAC9C,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,iBAAiB,CAAC;CAGjC;AAED;;;;;GAKG;AACH,MAAM,WAAW,KAAK;IACpB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,iBAAiB,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAEhC;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAErB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,KAAK,KAAK,IAAI,KAAK,EACnB,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,eAAe,IAAI,eAAe,GACxC,CAAC;CACH"}