@tetral-ai/sdk 0.110.0-alpha.1

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 (1341) hide show
  1. package/.github/logo.svg +3 -0
  2. package/CHANGELOG.md +2815 -0
  3. package/COMPATIBILITY.md +97 -0
  4. package/LICENSE +8 -0
  5. package/README.md +132 -0
  6. package/_vendor/partial-json-parser/parser.d.mts +3 -0
  7. package/_vendor/partial-json-parser/parser.d.mts.map +1 -0
  8. package/_vendor/partial-json-parser/parser.d.ts +3 -0
  9. package/_vendor/partial-json-parser/parser.d.ts.map +1 -0
  10. package/_vendor/partial-json-parser/parser.js +238 -0
  11. package/_vendor/partial-json-parser/parser.js.map +1 -0
  12. package/_vendor/partial-json-parser/parser.mjs +235 -0
  13. package/_vendor/partial-json-parser/parser.mjs.map +1 -0
  14. package/api-promise.d.mts +3 -0
  15. package/api-promise.d.mts.map +1 -0
  16. package/api-promise.d.ts +3 -0
  17. package/api-promise.d.ts.map +1 -0
  18. package/api-promise.js +6 -0
  19. package/api-promise.js.map +1 -0
  20. package/api-promise.mjs +3 -0
  21. package/api-promise.mjs.map +1 -0
  22. package/api.md +1297 -0
  23. package/bin/cli +53 -0
  24. package/bin/migration-config.json +933 -0
  25. package/client.d.mts +387 -0
  26. package/client.d.mts.map +1 -0
  27. package/client.d.ts +387 -0
  28. package/client.d.ts.map +1 -0
  29. package/client.js +943 -0
  30. package/client.js.map +1 -0
  31. package/client.mjs +938 -0
  32. package/client.mjs.map +1 -0
  33. package/core/api-promise.d.mts +49 -0
  34. package/core/api-promise.d.mts.map +1 -0
  35. package/core/api-promise.d.ts +49 -0
  36. package/core/api-promise.d.ts.map +1 -0
  37. package/core/api-promise.js +76 -0
  38. package/core/api-promise.js.map +1 -0
  39. package/core/api-promise.mjs +72 -0
  40. package/core/api-promise.mjs.map +1 -0
  41. package/core/api.d.mts +11 -0
  42. package/core/api.d.mts.map +1 -0
  43. package/core/api.d.ts +11 -0
  44. package/core/api.d.ts.map +1 -0
  45. package/core/api.js +3 -0
  46. package/core/api.js.map +1 -0
  47. package/core/api.mjs +2 -0
  48. package/core/api.mjs.map +1 -0
  49. package/core/credentials.d.mts +131 -0
  50. package/core/credentials.d.mts.map +1 -0
  51. package/core/credentials.d.ts +131 -0
  52. package/core/credentials.d.ts.map +1 -0
  53. package/core/credentials.js +317 -0
  54. package/core/credentials.js.map +1 -0
  55. package/core/credentials.mjs +277 -0
  56. package/core/credentials.mjs.map +1 -0
  57. package/core/error.d.mts +61 -0
  58. package/core/error.d.mts.map +1 -0
  59. package/core/error.d.ts +61 -0
  60. package/core/error.d.ts.map +1 -0
  61. package/core/error.js +132 -0
  62. package/core/error.js.map +1 -0
  63. package/core/error.mjs +115 -0
  64. package/core/error.mjs.map +1 -0
  65. package/core/middleware.d.mts +154 -0
  66. package/core/middleware.d.mts.map +1 -0
  67. package/core/middleware.d.ts +154 -0
  68. package/core/middleware.d.ts.map +1 -0
  69. package/core/middleware.js +174 -0
  70. package/core/middleware.js.map +1 -0
  71. package/core/middleware.mjs +168 -0
  72. package/core/middleware.mjs.map +1 -0
  73. package/core/pagination.d.mts +122 -0
  74. package/core/pagination.d.mts.map +1 -0
  75. package/core/pagination.d.ts +122 -0
  76. package/core/pagination.d.ts.map +1 -0
  77. package/core/pagination.js +203 -0
  78. package/core/pagination.js.map +1 -0
  79. package/core/pagination.mjs +194 -0
  80. package/core/pagination.mjs.map +1 -0
  81. package/core/resource.d.mts +6 -0
  82. package/core/resource.d.mts.map +1 -0
  83. package/core/resource.d.ts +6 -0
  84. package/core/resource.d.ts.map +1 -0
  85. package/core/resource.js +11 -0
  86. package/core/resource.js.map +1 -0
  87. package/core/resource.mjs +7 -0
  88. package/core/resource.mjs.map +1 -0
  89. package/core/streaming.d.mts +42 -0
  90. package/core/streaming.d.mts.map +1 -0
  91. package/core/streaming.d.ts +42 -0
  92. package/core/streaming.d.ts.map +1 -0
  93. package/core/streaming.js +341 -0
  94. package/core/streaming.js.map +1 -0
  95. package/core/streaming.mjs +336 -0
  96. package/core/streaming.mjs.map +1 -0
  97. package/core/uploads.d.mts +3 -0
  98. package/core/uploads.d.mts.map +1 -0
  99. package/core/uploads.d.ts +3 -0
  100. package/core/uploads.d.ts.map +1 -0
  101. package/core/uploads.js +6 -0
  102. package/core/uploads.js.map +1 -0
  103. package/core/uploads.mjs +2 -0
  104. package/core/uploads.mjs.map +1 -0
  105. package/error.d.mts +3 -0
  106. package/error.d.mts.map +1 -0
  107. package/error.d.ts +3 -0
  108. package/error.d.ts.map +1 -0
  109. package/error.js +6 -0
  110. package/error.js.map +1 -0
  111. package/error.mjs +3 -0
  112. package/error.mjs.map +1 -0
  113. package/helpers/beta/environments.d.mts +25 -0
  114. package/helpers/beta/environments.d.mts.map +1 -0
  115. package/helpers/beta/environments.d.ts +25 -0
  116. package/helpers/beta/environments.d.ts.map +1 -0
  117. package/helpers/beta/environments.js +33 -0
  118. package/helpers/beta/environments.js.map +1 -0
  119. package/helpers/beta/environments.mjs +25 -0
  120. package/helpers/beta/environments.mjs.map +1 -0
  121. package/helpers/beta/json-schema.d.mts +37 -0
  122. package/helpers/beta/json-schema.d.mts.map +1 -0
  123. package/helpers/beta/json-schema.d.ts +37 -0
  124. package/helpers/beta/json-schema.d.ts.map +1 -0
  125. package/helpers/beta/json-schema.js +57 -0
  126. package/helpers/beta/json-schema.js.map +1 -0
  127. package/helpers/beta/json-schema.mjs +53 -0
  128. package/helpers/beta/json-schema.mjs.map +1 -0
  129. package/helpers/beta/mcp.d.mts +303 -0
  130. package/helpers/beta/mcp.d.mts.map +1 -0
  131. package/helpers/beta/mcp.d.ts +303 -0
  132. package/helpers/beta/mcp.d.ts.map +1 -0
  133. package/helpers/beta/mcp.js +419 -0
  134. package/helpers/beta/mcp.js.map +1 -0
  135. package/helpers/beta/mcp.mjs +406 -0
  136. package/helpers/beta/mcp.mjs.map +1 -0
  137. package/helpers/beta/memory.d.mts +11 -0
  138. package/helpers/beta/memory.d.mts.map +1 -0
  139. package/helpers/beta/memory.d.ts +11 -0
  140. package/helpers/beta/memory.d.ts.map +1 -0
  141. package/helpers/beta/memory.js +18 -0
  142. package/helpers/beta/memory.js.map +1 -0
  143. package/helpers/beta/memory.mjs +15 -0
  144. package/helpers/beta/memory.mjs.map +1 -0
  145. package/helpers/beta/zod.d.mts +33 -0
  146. package/helpers/beta/zod.d.mts.map +1 -0
  147. package/helpers/beta/zod.d.ts +33 -0
  148. package/helpers/beta/zod.d.ts.map +1 -0
  149. package/helpers/beta/zod.js +58 -0
  150. package/helpers/beta/zod.js.map +1 -0
  151. package/helpers/beta/zod.mjs +53 -0
  152. package/helpers/beta/zod.mjs.map +1 -0
  153. package/helpers/index.d.mts +3 -0
  154. package/helpers/index.d.mts.map +1 -0
  155. package/helpers/index.d.ts +3 -0
  156. package/helpers/index.d.ts.map +1 -0
  157. package/helpers/index.js +8 -0
  158. package/helpers/index.js.map +1 -0
  159. package/helpers/index.mjs +3 -0
  160. package/helpers/index.mjs.map +1 -0
  161. package/helpers/json-schema.d.mts +18 -0
  162. package/helpers/json-schema.d.mts.map +1 -0
  163. package/helpers/json-schema.d.ts +18 -0
  164. package/helpers/json-schema.d.ts.map +1 -0
  165. package/helpers/json-schema.js +37 -0
  166. package/helpers/json-schema.js.map +1 -0
  167. package/helpers/json-schema.mjs +34 -0
  168. package/helpers/json-schema.mjs.map +1 -0
  169. package/helpers/zod.d.mts +13 -0
  170. package/helpers/zod.d.mts.map +1 -0
  171. package/helpers/zod.d.ts +13 -0
  172. package/helpers/zod.d.ts.map +1 -0
  173. package/helpers/zod.js +47 -0
  174. package/helpers/zod.js.map +1 -0
  175. package/helpers/zod.mjs +43 -0
  176. package/helpers/zod.mjs.map +1 -0
  177. package/index.d.mts +10 -0
  178. package/index.d.mts.map +1 -0
  179. package/index.d.ts +10 -0
  180. package/index.d.ts.map +1 -0
  181. package/index.js +40 -0
  182. package/index.js.map +1 -0
  183. package/index.mjs +9 -0
  184. package/index.mjs.map +1 -0
  185. package/internal/builtin-types.d.mts +73 -0
  186. package/internal/builtin-types.d.mts.map +1 -0
  187. package/internal/builtin-types.d.ts +73 -0
  188. package/internal/builtin-types.d.ts.map +1 -0
  189. package/internal/builtin-types.js +4 -0
  190. package/internal/builtin-types.js.map +1 -0
  191. package/internal/builtin-types.mjs +3 -0
  192. package/internal/builtin-types.mjs.map +1 -0
  193. package/internal/constants.d.mts +5 -0
  194. package/internal/constants.d.mts.map +1 -0
  195. package/internal/constants.d.ts +5 -0
  196. package/internal/constants.d.ts.map +1 -0
  197. package/internal/constants.js +18 -0
  198. package/internal/constants.js.map +1 -0
  199. package/internal/constants.mjs +15 -0
  200. package/internal/constants.mjs.map +1 -0
  201. package/internal/decoders/jsonl.d.mts +10 -0
  202. package/internal/decoders/jsonl.d.mts.map +1 -0
  203. package/internal/decoders/jsonl.d.ts +10 -0
  204. package/internal/decoders/jsonl.d.ts.map +1 -0
  205. package/internal/decoders/jsonl.js +39 -0
  206. package/internal/decoders/jsonl.js.map +1 -0
  207. package/internal/decoders/jsonl.mjs +35 -0
  208. package/internal/decoders/jsonl.mjs.map +1 -0
  209. package/internal/decoders/line.d.mts +17 -0
  210. package/internal/decoders/line.d.mts.map +1 -0
  211. package/internal/decoders/line.d.ts +17 -0
  212. package/internal/decoders/line.d.ts.map +1 -0
  213. package/internal/decoders/line.js +113 -0
  214. package/internal/decoders/line.js.map +1 -0
  215. package/internal/decoders/line.mjs +108 -0
  216. package/internal/decoders/line.mjs.map +1 -0
  217. package/internal/detect-platform.d.mts +15 -0
  218. package/internal/detect-platform.d.mts.map +1 -0
  219. package/internal/detect-platform.d.ts +15 -0
  220. package/internal/detect-platform.d.ts.map +1 -0
  221. package/internal/detect-platform.js +162 -0
  222. package/internal/detect-platform.js.map +1 -0
  223. package/internal/detect-platform.mjs +157 -0
  224. package/internal/detect-platform.mjs.map +1 -0
  225. package/internal/errors.d.mts +3 -0
  226. package/internal/errors.d.mts.map +1 -0
  227. package/internal/errors.d.ts +3 -0
  228. package/internal/errors.d.ts.map +1 -0
  229. package/internal/errors.js +41 -0
  230. package/internal/errors.js.map +1 -0
  231. package/internal/errors.mjs +36 -0
  232. package/internal/errors.mjs.map +1 -0
  233. package/internal/headers.d.mts +29 -0
  234. package/internal/headers.d.mts.map +1 -0
  235. package/internal/headers.d.ts +29 -0
  236. package/internal/headers.d.ts.map +1 -0
  237. package/internal/headers.js +120 -0
  238. package/internal/headers.js.map +1 -0
  239. package/internal/headers.mjs +114 -0
  240. package/internal/headers.mjs.map +1 -0
  241. package/internal/message-stream-utils.d.mts +10 -0
  242. package/internal/message-stream-utils.d.mts.map +1 -0
  243. package/internal/message-stream-utils.d.ts +10 -0
  244. package/internal/message-stream-utils.d.ts.map +1 -0
  245. package/internal/message-stream-utils.js +34 -0
  246. package/internal/message-stream-utils.js.map +1 -0
  247. package/internal/message-stream-utils.mjs +30 -0
  248. package/internal/message-stream-utils.mjs.map +1 -0
  249. package/internal/parse.d.mts +17 -0
  250. package/internal/parse.d.mts.map +1 -0
  251. package/internal/parse.d.ts +17 -0
  252. package/internal/parse.d.ts.map +1 -0
  253. package/internal/parse.js +57 -0
  254. package/internal/parse.js.map +1 -0
  255. package/internal/parse.mjs +53 -0
  256. package/internal/parse.mjs.map +1 -0
  257. package/internal/qs/formats.d.mts +7 -0
  258. package/internal/qs/formats.d.mts.map +1 -0
  259. package/internal/qs/formats.d.ts +7 -0
  260. package/internal/qs/formats.d.ts.map +1 -0
  261. package/internal/qs/formats.js +13 -0
  262. package/internal/qs/formats.js.map +1 -0
  263. package/internal/qs/formats.mjs +9 -0
  264. package/internal/qs/formats.mjs.map +1 -0
  265. package/internal/qs/index.d.mts +10 -0
  266. package/internal/qs/index.d.mts.map +1 -0
  267. package/internal/qs/index.d.ts +10 -0
  268. package/internal/qs/index.d.ts.map +1 -0
  269. package/internal/qs/index.js +14 -0
  270. package/internal/qs/index.js.map +1 -0
  271. package/internal/qs/index.mjs +10 -0
  272. package/internal/qs/index.mjs.map +1 -0
  273. package/internal/qs/stringify.d.mts +3 -0
  274. package/internal/qs/stringify.d.mts.map +1 -0
  275. package/internal/qs/stringify.d.ts +3 -0
  276. package/internal/qs/stringify.d.ts.map +1 -0
  277. package/internal/qs/stringify.js +277 -0
  278. package/internal/qs/stringify.js.map +1 -0
  279. package/internal/qs/stringify.mjs +274 -0
  280. package/internal/qs/stringify.mjs.map +1 -0
  281. package/internal/qs/types.d.mts +57 -0
  282. package/internal/qs/types.d.mts.map +1 -0
  283. package/internal/qs/types.d.ts +57 -0
  284. package/internal/qs/types.d.ts.map +1 -0
  285. package/internal/qs/types.js +3 -0
  286. package/internal/qs/types.js.map +1 -0
  287. package/internal/qs/types.mjs +2 -0
  288. package/internal/qs/types.mjs.map +1 -0
  289. package/internal/qs/utils.d.mts +15 -0
  290. package/internal/qs/utils.d.mts.map +1 -0
  291. package/internal/qs/utils.d.ts +15 -0
  292. package/internal/qs/utils.d.ts.map +1 -0
  293. package/internal/qs/utils.js +230 -0
  294. package/internal/qs/utils.js.map +1 -0
  295. package/internal/qs/utils.mjs +217 -0
  296. package/internal/qs/utils.mjs.map +1 -0
  297. package/internal/request-options.d.mts +127 -0
  298. package/internal/request-options.d.mts.map +1 -0
  299. package/internal/request-options.d.ts +127 -0
  300. package/internal/request-options.d.ts.map +1 -0
  301. package/internal/request-options.js +25 -0
  302. package/internal/request-options.js.map +1 -0
  303. package/internal/request-options.mjs +20 -0
  304. package/internal/request-options.mjs.map +1 -0
  305. package/internal/shim-types.d.mts +17 -0
  306. package/internal/shim-types.d.mts.map +1 -0
  307. package/internal/shim-types.d.ts +17 -0
  308. package/internal/shim-types.d.ts.map +1 -0
  309. package/internal/shim-types.js +4 -0
  310. package/internal/shim-types.js.map +1 -0
  311. package/internal/shim-types.mjs +3 -0
  312. package/internal/shim-types.mjs.map +1 -0
  313. package/internal/shims.d.mts +26 -0
  314. package/internal/shims.d.mts.map +1 -0
  315. package/internal/shims.d.ts +26 -0
  316. package/internal/shims.d.ts.map +1 -0
  317. package/internal/shims.js +92 -0
  318. package/internal/shims.js.map +1 -0
  319. package/internal/shims.mjs +85 -0
  320. package/internal/shims.mjs.map +1 -0
  321. package/internal/stainless-helper-header.d.mts +60 -0
  322. package/internal/stainless-helper-header.d.mts.map +1 -0
  323. package/internal/stainless-helper-header.d.ts +60 -0
  324. package/internal/stainless-helper-header.d.ts.map +1 -0
  325. package/internal/stainless-helper-header.js +91 -0
  326. package/internal/stainless-helper-header.js.map +1 -0
  327. package/internal/stainless-helper-header.mjs +83 -0
  328. package/internal/stainless-helper-header.mjs.map +1 -0
  329. package/internal/stream-utils.d.mts +8 -0
  330. package/internal/stream-utils.d.mts.map +1 -0
  331. package/internal/stream-utils.d.ts +8 -0
  332. package/internal/stream-utils.d.ts.map +1 -0
  333. package/internal/stream-utils.js +38 -0
  334. package/internal/stream-utils.js.map +1 -0
  335. package/internal/stream-utils.mjs +35 -0
  336. package/internal/stream-utils.mjs.map +1 -0
  337. package/internal/to-file.d.mts +45 -0
  338. package/internal/to-file.d.mts.map +1 -0
  339. package/internal/to-file.d.ts +45 -0
  340. package/internal/to-file.d.ts.map +1 -0
  341. package/internal/to-file.js +96 -0
  342. package/internal/to-file.js.map +1 -0
  343. package/internal/to-file.mjs +93 -0
  344. package/internal/to-file.mjs.map +1 -0
  345. package/internal/tslib.js +81 -0
  346. package/internal/tslib.mjs +17 -0
  347. package/internal/types.d.mts +69 -0
  348. package/internal/types.d.mts.map +1 -0
  349. package/internal/types.d.ts +69 -0
  350. package/internal/types.d.ts.map +1 -0
  351. package/internal/types.js +4 -0
  352. package/internal/types.js.map +1 -0
  353. package/internal/types.mjs +3 -0
  354. package/internal/types.mjs.map +1 -0
  355. package/internal/uploads.d.mts +42 -0
  356. package/internal/uploads.d.mts.map +1 -0
  357. package/internal/uploads.d.ts +42 -0
  358. package/internal/uploads.d.ts.map +1 -0
  359. package/internal/uploads.js +145 -0
  360. package/internal/uploads.js.map +1 -0
  361. package/internal/uploads.mjs +135 -0
  362. package/internal/uploads.mjs.map +1 -0
  363. package/internal/utils/abort.d.mts +13 -0
  364. package/internal/utils/abort.d.mts.map +1 -0
  365. package/internal/utils/abort.d.ts +13 -0
  366. package/internal/utils/abort.d.ts.map +1 -0
  367. package/internal/utils/abort.js +26 -0
  368. package/internal/utils/abort.js.map +1 -0
  369. package/internal/utils/abort.mjs +23 -0
  370. package/internal/utils/abort.mjs.map +1 -0
  371. package/internal/utils/async-queue.d.mts +31 -0
  372. package/internal/utils/async-queue.d.mts.map +1 -0
  373. package/internal/utils/async-queue.d.ts +31 -0
  374. package/internal/utils/async-queue.d.ts.map +1 -0
  375. package/internal/utils/async-queue.js +75 -0
  376. package/internal/utils/async-queue.js.map +1 -0
  377. package/internal/utils/async-queue.mjs +71 -0
  378. package/internal/utils/async-queue.mjs.map +1 -0
  379. package/internal/utils/backoff.d.mts +23 -0
  380. package/internal/utils/backoff.d.mts.map +1 -0
  381. package/internal/utils/backoff.d.ts +23 -0
  382. package/internal/utils/backoff.d.ts.map +1 -0
  383. package/internal/utils/backoff.js +44 -0
  384. package/internal/utils/backoff.js.map +1 -0
  385. package/internal/utils/backoff.mjs +36 -0
  386. package/internal/utils/backoff.mjs.map +1 -0
  387. package/internal/utils/base64.d.mts +3 -0
  388. package/internal/utils/base64.d.mts.map +1 -0
  389. package/internal/utils/base64.d.ts +3 -0
  390. package/internal/utils/base64.d.ts.map +1 -0
  391. package/internal/utils/base64.js +38 -0
  392. package/internal/utils/base64.js.map +1 -0
  393. package/internal/utils/base64.mjs +33 -0
  394. package/internal/utils/base64.mjs.map +1 -0
  395. package/internal/utils/bytes.d.mts +4 -0
  396. package/internal/utils/bytes.d.mts.map +1 -0
  397. package/internal/utils/bytes.d.ts +4 -0
  398. package/internal/utils/bytes.d.ts.map +1 -0
  399. package/internal/utils/bytes.js +31 -0
  400. package/internal/utils/bytes.js.map +1 -0
  401. package/internal/utils/bytes.mjs +26 -0
  402. package/internal/utils/bytes.mjs.map +1 -0
  403. package/internal/utils/env.d.mts +9 -0
  404. package/internal/utils/env.d.mts.map +1 -0
  405. package/internal/utils/env.d.ts +9 -0
  406. package/internal/utils/env.d.ts.map +1 -0
  407. package/internal/utils/env.js +22 -0
  408. package/internal/utils/env.js.map +1 -0
  409. package/internal/utils/env.mjs +18 -0
  410. package/internal/utils/env.mjs.map +1 -0
  411. package/internal/utils/log.d.mts +47 -0
  412. package/internal/utils/log.d.mts.map +1 -0
  413. package/internal/utils/log.d.ts +47 -0
  414. package/internal/utils/log.d.ts.map +1 -0
  415. package/internal/utils/log.js +112 -0
  416. package/internal/utils/log.js.map +1 -0
  417. package/internal/utils/log.mjs +105 -0
  418. package/internal/utils/log.mjs.map +1 -0
  419. package/internal/utils/path.d.mts +15 -0
  420. package/internal/utils/path.d.mts.map +1 -0
  421. package/internal/utils/path.d.ts +15 -0
  422. package/internal/utils/path.d.ts.map +1 -0
  423. package/internal/utils/path.js +79 -0
  424. package/internal/utils/path.js.map +1 -0
  425. package/internal/utils/path.mjs +74 -0
  426. package/internal/utils/path.mjs.map +1 -0
  427. package/internal/utils/promise.d.mts +11 -0
  428. package/internal/utils/promise.d.mts.map +1 -0
  429. package/internal/utils/promise.d.ts +11 -0
  430. package/internal/utils/promise.d.ts.map +1 -0
  431. package/internal/utils/promise.js +18 -0
  432. package/internal/utils/promise.js.map +1 -0
  433. package/internal/utils/promise.mjs +15 -0
  434. package/internal/utils/promise.mjs.map +1 -0
  435. package/internal/utils/query.d.mts +2 -0
  436. package/internal/utils/query.d.mts.map +1 -0
  437. package/internal/utils/query.d.ts +2 -0
  438. package/internal/utils/query.d.ts.map +1 -0
  439. package/internal/utils/query.js +10 -0
  440. package/internal/utils/query.js.map +1 -0
  441. package/internal/utils/query.mjs +6 -0
  442. package/internal/utils/query.mjs.map +1 -0
  443. package/internal/utils/sleep.d.mts +10 -0
  444. package/internal/utils/sleep.d.mts.map +1 -0
  445. package/internal/utils/sleep.d.ts +10 -0
  446. package/internal/utils/sleep.d.ts.map +1 -0
  447. package/internal/utils/sleep.js +28 -0
  448. package/internal/utils/sleep.js.map +1 -0
  449. package/internal/utils/sleep.mjs +24 -0
  450. package/internal/utils/sleep.mjs.map +1 -0
  451. package/internal/utils/time.d.mts +3 -0
  452. package/internal/utils/time.d.mts.map +1 -0
  453. package/internal/utils/time.d.ts +3 -0
  454. package/internal/utils/time.d.ts.map +1 -0
  455. package/internal/utils/time.js +8 -0
  456. package/internal/utils/time.js.map +1 -0
  457. package/internal/utils/time.mjs +5 -0
  458. package/internal/utils/time.mjs.map +1 -0
  459. package/internal/utils/uuid.d.mts +5 -0
  460. package/internal/utils/uuid.d.mts.map +1 -0
  461. package/internal/utils/uuid.d.ts +5 -0
  462. package/internal/utils/uuid.d.ts.map +1 -0
  463. package/internal/utils/uuid.js +19 -0
  464. package/internal/utils/uuid.js.map +1 -0
  465. package/internal/utils/uuid.mjs +15 -0
  466. package/internal/utils/uuid.mjs.map +1 -0
  467. package/internal/utils/values.d.mts +19 -0
  468. package/internal/utils/values.d.mts.map +1 -0
  469. package/internal/utils/values.d.ts +19 -0
  470. package/internal/utils/values.d.ts.map +1 -0
  471. package/internal/utils/values.js +119 -0
  472. package/internal/utils/values.js.map +1 -0
  473. package/internal/utils/values.mjs +100 -0
  474. package/internal/utils/values.mjs.map +1 -0
  475. package/internal/utils.d.mts +8 -0
  476. package/internal/utils.d.mts.map +1 -0
  477. package/internal/utils.d.ts +8 -0
  478. package/internal/utils.d.ts.map +1 -0
  479. package/internal/utils.js +12 -0
  480. package/internal/utils.js.map +1 -0
  481. package/internal/utils.mjs +9 -0
  482. package/internal/utils.mjs.map +1 -0
  483. package/lib/BetaMessageStream.d.mts +122 -0
  484. package/lib/BetaMessageStream.d.mts.map +1 -0
  485. package/lib/BetaMessageStream.d.ts +122 -0
  486. package/lib/BetaMessageStream.d.ts.map +1 -0
  487. package/lib/BetaMessageStream.js +639 -0
  488. package/lib/BetaMessageStream.js.map +1 -0
  489. package/lib/BetaMessageStream.mjs +635 -0
  490. package/lib/BetaMessageStream.mjs.map +1 -0
  491. package/lib/MessageStream.d.mts +121 -0
  492. package/lib/MessageStream.d.mts.map +1 -0
  493. package/lib/MessageStream.d.ts +121 -0
  494. package/lib/MessageStream.d.ts.map +1 -0
  495. package/lib/MessageStream.js +595 -0
  496. package/lib/MessageStream.js.map +1 -0
  497. package/lib/MessageStream.mjs +591 -0
  498. package/lib/MessageStream.mjs.map +1 -0
  499. package/lib/beta-parser.d.mts +37 -0
  500. package/lib/beta-parser.d.mts.map +1 -0
  501. package/lib/beta-parser.d.ts +37 -0
  502. package/lib/beta-parser.d.ts.map +1 -0
  503. package/lib/beta-parser.js +79 -0
  504. package/lib/beta-parser.js.map +1 -0
  505. package/lib/beta-parser.mjs +75 -0
  506. package/lib/beta-parser.mjs.map +1 -0
  507. package/lib/credentials/credential-chain.d.mts +39 -0
  508. package/lib/credentials/credential-chain.d.mts.map +1 -0
  509. package/lib/credentials/credential-chain.d.ts +39 -0
  510. package/lib/credentials/credential-chain.d.ts.map +1 -0
  511. package/lib/credentials/credential-chain.js +245 -0
  512. package/lib/credentials/credential-chain.js.map +1 -0
  513. package/lib/credentials/credential-chain.mjs +208 -0
  514. package/lib/credentials/credential-chain.mjs.map +1 -0
  515. package/lib/credentials/identity-token.d.mts +11 -0
  516. package/lib/credentials/identity-token.d.mts.map +1 -0
  517. package/lib/credentials/identity-token.d.ts +11 -0
  518. package/lib/credentials/identity-token.d.ts.map +1 -0
  519. package/lib/credentials/identity-token.js +72 -0
  520. package/lib/credentials/identity-token.js.map +1 -0
  521. package/lib/credentials/identity-token.mjs +35 -0
  522. package/lib/credentials/identity-token.mjs.map +1 -0
  523. package/lib/credentials/oidc-federation.d.mts +40 -0
  524. package/lib/credentials/oidc-federation.d.mts.map +1 -0
  525. package/lib/credentials/oidc-federation.d.ts +40 -0
  526. package/lib/credentials/oidc-federation.d.ts.map +1 -0
  527. package/lib/credentials/oidc-federation.js +82 -0
  528. package/lib/credentials/oidc-federation.js.map +1 -0
  529. package/lib/credentials/oidc-federation.mjs +79 -0
  530. package/lib/credentials/oidc-federation.mjs.map +1 -0
  531. package/lib/credentials/token-cache.d.mts +54 -0
  532. package/lib/credentials/token-cache.d.mts.map +1 -0
  533. package/lib/credentials/token-cache.d.ts +54 -0
  534. package/lib/credentials/token-cache.d.ts.map +1 -0
  535. package/lib/credentials/token-cache.js +112 -0
  536. package/lib/credentials/token-cache.js.map +1 -0
  537. package/lib/credentials/token-cache.mjs +108 -0
  538. package/lib/credentials/token-cache.mjs.map +1 -0
  539. package/lib/credentials/types.d.mts +96 -0
  540. package/lib/credentials/types.d.mts.map +1 -0
  541. package/lib/credentials/types.d.ts +96 -0
  542. package/lib/credentials/types.d.ts.map +1 -0
  543. package/lib/credentials/types.js +266 -0
  544. package/lib/credentials/types.js.map +1 -0
  545. package/lib/credentials/types.mjs +224 -0
  546. package/lib/credentials/types.mjs.map +1 -0
  547. package/lib/credentials/user-oauth.d.mts +21 -0
  548. package/lib/credentials/user-oauth.d.mts.map +1 -0
  549. package/lib/credentials/user-oauth.d.ts +21 -0
  550. package/lib/credentials/user-oauth.d.ts.map +1 -0
  551. package/lib/credentials/user-oauth.js +130 -0
  552. package/lib/credentials/user-oauth.js.map +1 -0
  553. package/lib/credentials/user-oauth.mjs +94 -0
  554. package/lib/credentials/user-oauth.mjs.map +1 -0
  555. package/lib/credentials.d.mts +4 -0
  556. package/lib/credentials.d.mts.map +1 -0
  557. package/lib/credentials.d.ts +4 -0
  558. package/lib/credentials.d.ts.map +1 -0
  559. package/lib/credentials.js +8 -0
  560. package/lib/credentials.js.map +1 -0
  561. package/lib/credentials.mjs +3 -0
  562. package/lib/credentials.mjs.map +1 -0
  563. package/lib/environments/index.d.mts +4 -0
  564. package/lib/environments/index.d.mts.map +1 -0
  565. package/lib/environments/index.d.ts +4 -0
  566. package/lib/environments/index.d.ts.map +1 -0
  567. package/lib/environments/index.js +18 -0
  568. package/lib/environments/index.js.map +1 -0
  569. package/lib/environments/index.mjs +4 -0
  570. package/lib/environments/index.mjs.map +1 -0
  571. package/lib/environments/poller.d.mts +93 -0
  572. package/lib/environments/poller.d.mts.map +1 -0
  573. package/lib/environments/poller.d.ts +93 -0
  574. package/lib/environments/poller.d.ts.map +1 -0
  575. package/lib/environments/poller.js +185 -0
  576. package/lib/environments/poller.js.map +1 -0
  577. package/lib/environments/poller.mjs +176 -0
  578. package/lib/environments/poller.mjs.map +1 -0
  579. package/lib/environments/worker.d.mts +150 -0
  580. package/lib/environments/worker.d.mts.map +1 -0
  581. package/lib/environments/worker.d.ts +150 -0
  582. package/lib/environments/worker.d.ts.map +1 -0
  583. package/lib/environments/worker.js +271 -0
  584. package/lib/environments/worker.js.map +1 -0
  585. package/lib/environments/worker.mjs +267 -0
  586. package/lib/environments/worker.mjs.map +1 -0
  587. package/lib/helper-client.d.mts +34 -0
  588. package/lib/helper-client.d.mts.map +1 -0
  589. package/lib/helper-client.d.ts +34 -0
  590. package/lib/helper-client.d.ts.map +1 -0
  591. package/lib/helper-client.js +73 -0
  592. package/lib/helper-client.js.map +1 -0
  593. package/lib/helper-client.mjs +70 -0
  594. package/lib/helper-client.mjs.map +1 -0
  595. package/lib/middleware.d.mts +96 -0
  596. package/lib/middleware.d.mts.map +1 -0
  597. package/lib/middleware.d.ts +96 -0
  598. package/lib/middleware.d.ts.map +1 -0
  599. package/lib/middleware.js +711 -0
  600. package/lib/middleware.js.map +1 -0
  601. package/lib/middleware.mjs +706 -0
  602. package/lib/middleware.mjs.map +1 -0
  603. package/lib/parser.d.mts +32 -0
  604. package/lib/parser.d.mts.map +1 -0
  605. package/lib/parser.d.ts +32 -0
  606. package/lib/parser.d.ts.map +1 -0
  607. package/lib/parser.js +66 -0
  608. package/lib/parser.js.map +1 -0
  609. package/lib/parser.mjs +62 -0
  610. package/lib/parser.mjs.map +1 -0
  611. package/lib/sessions/accumulate.d.mts +22 -0
  612. package/lib/sessions/accumulate.d.mts.map +1 -0
  613. package/lib/sessions/accumulate.d.ts +22 -0
  614. package/lib/sessions/accumulate.d.ts.map +1 -0
  615. package/lib/sessions/accumulate.js +87 -0
  616. package/lib/sessions/accumulate.js.map +1 -0
  617. package/lib/sessions/accumulate.mjs +84 -0
  618. package/lib/sessions/accumulate.mjs.map +1 -0
  619. package/lib/tools/BetaRunnableTool.d.mts +68 -0
  620. package/lib/tools/BetaRunnableTool.d.mts.map +1 -0
  621. package/lib/tools/BetaRunnableTool.d.ts +68 -0
  622. package/lib/tools/BetaRunnableTool.d.ts.map +1 -0
  623. package/lib/tools/BetaRunnableTool.js +40 -0
  624. package/lib/tools/BetaRunnableTool.js.map +1 -0
  625. package/lib/tools/BetaRunnableTool.mjs +35 -0
  626. package/lib/tools/BetaRunnableTool.mjs.map +1 -0
  627. package/lib/tools/BetaToolRunner.d.mts +161 -0
  628. package/lib/tools/BetaToolRunner.d.mts.map +1 -0
  629. package/lib/tools/BetaToolRunner.d.ts +161 -0
  630. package/lib/tools/BetaToolRunner.d.ts.map +1 -0
  631. package/lib/tools/BetaToolRunner.js +400 -0
  632. package/lib/tools/BetaToolRunner.js.map +1 -0
  633. package/lib/tools/BetaToolRunner.mjs +396 -0
  634. package/lib/tools/BetaToolRunner.mjs.map +1 -0
  635. package/lib/tools/CompactionControl.d.mts +30 -0
  636. package/lib/tools/CompactionControl.d.mts.map +1 -0
  637. package/lib/tools/CompactionControl.d.ts +30 -0
  638. package/lib/tools/CompactionControl.d.ts.map +1 -0
  639. package/lib/tools/CompactionControl.js +28 -0
  640. package/lib/tools/CompactionControl.js.map +1 -0
  641. package/lib/tools/CompactionControl.mjs +25 -0
  642. package/lib/tools/CompactionControl.mjs.map +1 -0
  643. package/lib/tools/SessionToolRunner.d.mts +154 -0
  644. package/lib/tools/SessionToolRunner.d.mts.map +1 -0
  645. package/lib/tools/SessionToolRunner.d.ts +154 -0
  646. package/lib/tools/SessionToolRunner.d.ts.map +1 -0
  647. package/lib/tools/SessionToolRunner.js +474 -0
  648. package/lib/tools/SessionToolRunner.js.map +1 -0
  649. package/lib/tools/SessionToolRunner.mjs +470 -0
  650. package/lib/tools/SessionToolRunner.mjs.map +1 -0
  651. package/lib/tools/ToolError.d.mts +33 -0
  652. package/lib/tools/ToolError.d.mts.map +1 -0
  653. package/lib/tools/ToolError.d.ts +33 -0
  654. package/lib/tools/ToolError.d.ts.map +1 -0
  655. package/lib/tools/ToolError.js +42 -0
  656. package/lib/tools/ToolError.js.map +1 -0
  657. package/lib/tools/ToolError.mjs +38 -0
  658. package/lib/tools/ToolError.mjs.map +1 -0
  659. package/lib/tools/ToolRunner.d.mts +132 -0
  660. package/lib/tools/ToolRunner.d.mts.map +1 -0
  661. package/lib/tools/ToolRunner.d.ts +132 -0
  662. package/lib/tools/ToolRunner.d.ts.map +1 -0
  663. package/lib/tools/ToolRunner.js +294 -0
  664. package/lib/tools/ToolRunner.js.map +1 -0
  665. package/lib/tools/ToolRunner.mjs +290 -0
  666. package/lib/tools/ToolRunner.mjs.map +1 -0
  667. package/lib/transform-json-schema.d.mts +3 -0
  668. package/lib/transform-json-schema.d.mts.map +1 -0
  669. package/lib/transform-json-schema.d.ts +3 -0
  670. package/lib/transform-json-schema.d.ts.map +1 -0
  671. package/lib/transform-json-schema.js +114 -0
  672. package/lib/transform-json-schema.js.map +1 -0
  673. package/lib/transform-json-schema.mjs +111 -0
  674. package/lib/transform-json-schema.mjs.map +1 -0
  675. package/package.json +266 -0
  676. package/pagination.d.mts +3 -0
  677. package/pagination.d.mts.map +1 -0
  678. package/pagination.d.ts +3 -0
  679. package/pagination.d.ts.map +1 -0
  680. package/pagination.js +6 -0
  681. package/pagination.js.map +1 -0
  682. package/pagination.mjs +3 -0
  683. package/pagination.mjs.map +1 -0
  684. package/resource.d.mts +3 -0
  685. package/resource.d.mts.map +1 -0
  686. package/resource.d.ts +3 -0
  687. package/resource.d.ts.map +1 -0
  688. package/resource.js +6 -0
  689. package/resource.js.map +1 -0
  690. package/resource.mjs +3 -0
  691. package/resource.mjs.map +1 -0
  692. package/resources/beta/agents/agents.d.mts +917 -0
  693. package/resources/beta/agents/agents.d.mts.map +1 -0
  694. package/resources/beta/agents/agents.d.ts +917 -0
  695. package/resources/beta/agents/agents.d.ts.map +1 -0
  696. package/resources/beta/agents/agents.js +133 -0
  697. package/resources/beta/agents/agents.js.map +1 -0
  698. package/resources/beta/agents/agents.mjs +128 -0
  699. package/resources/beta/agents/agents.mjs.map +1 -0
  700. package/resources/beta/agents/index.d.mts +3 -0
  701. package/resources/beta/agents/index.d.mts.map +1 -0
  702. package/resources/beta/agents/index.d.ts +3 -0
  703. package/resources/beta/agents/index.d.ts.map +1 -0
  704. package/resources/beta/agents/index.js +9 -0
  705. package/resources/beta/agents/index.js.map +1 -0
  706. package/resources/beta/agents/index.mjs +4 -0
  707. package/resources/beta/agents/index.mjs.map +1 -0
  708. package/resources/beta/agents/versions.d.mts +33 -0
  709. package/resources/beta/agents/versions.d.mts.map +1 -0
  710. package/resources/beta/agents/versions.d.ts +33 -0
  711. package/resources/beta/agents/versions.d.ts.map +1 -0
  712. package/resources/beta/agents/versions.js +36 -0
  713. package/resources/beta/agents/versions.js.map +1 -0
  714. package/resources/beta/agents/versions.mjs +32 -0
  715. package/resources/beta/agents/versions.mjs.map +1 -0
  716. package/resources/beta/agents.d.mts +2 -0
  717. package/resources/beta/agents.d.mts.map +1 -0
  718. package/resources/beta/agents.d.ts +2 -0
  719. package/resources/beta/agents.d.ts.map +1 -0
  720. package/resources/beta/agents.js +6 -0
  721. package/resources/beta/agents.js.map +1 -0
  722. package/resources/beta/agents.mjs +3 -0
  723. package/resources/beta/agents.mjs.map +1 -0
  724. package/resources/beta/beta.d.mts +102 -0
  725. package/resources/beta/beta.d.mts.map +1 -0
  726. package/resources/beta/beta.d.ts +102 -0
  727. package/resources/beta/beta.d.ts.map +1 -0
  728. package/resources/beta/beta.js +65 -0
  729. package/resources/beta/beta.js.map +1 -0
  730. package/resources/beta/beta.mjs +60 -0
  731. package/resources/beta/beta.mjs.map +1 -0
  732. package/resources/beta/deployment-runs.d.mts +311 -0
  733. package/resources/beta/deployment-runs.d.mts.map +1 -0
  734. package/resources/beta/deployment-runs.d.ts +311 -0
  735. package/resources/beta/deployment-runs.d.ts.map +1 -0
  736. package/resources/beta/deployment-runs.js +60 -0
  737. package/resources/beta/deployment-runs.js.map +1 -0
  738. package/resources/beta/deployment-runs.mjs +56 -0
  739. package/resources/beta/deployment-runs.mjs.map +1 -0
  740. package/resources/beta/deployments.d.mts +688 -0
  741. package/resources/beta/deployments.d.mts.map +1 -0
  742. package/resources/beta/deployments.d.ts +688 -0
  743. package/resources/beta/deployments.d.ts.map +1 -0
  744. package/resources/beta/deployments.js +201 -0
  745. package/resources/beta/deployments.js.map +1 -0
  746. package/resources/beta/deployments.mjs +197 -0
  747. package/resources/beta/deployments.mjs.map +1 -0
  748. package/resources/beta/environments/environments.d.mts +463 -0
  749. package/resources/beta/environments/environments.d.mts.map +1 -0
  750. package/resources/beta/environments/environments.d.ts +463 -0
  751. package/resources/beta/environments/environments.d.ts.map +1 -0
  752. package/resources/beta/environments/environments.js +150 -0
  753. package/resources/beta/environments/environments.js.map +1 -0
  754. package/resources/beta/environments/environments.mjs +145 -0
  755. package/resources/beta/environments/environments.mjs.map +1 -0
  756. package/resources/beta/environments/index.d.mts +3 -0
  757. package/resources/beta/environments/index.d.mts.map +1 -0
  758. package/resources/beta/environments/index.d.ts +3 -0
  759. package/resources/beta/environments/index.d.ts.map +1 -0
  760. package/resources/beta/environments/index.js +9 -0
  761. package/resources/beta/environments/index.js.map +1 -0
  762. package/resources/beta/environments/index.mjs +4 -0
  763. package/resources/beta/environments/index.mjs.map +1 -0
  764. package/resources/beta/environments/work.d.mts +499 -0
  765. package/resources/beta/environments/work.d.mts.map +1 -0
  766. package/resources/beta/environments/work.d.ts +499 -0
  767. package/resources/beta/environments/work.d.ts.map +1 -0
  768. package/resources/beta/environments/work.js +281 -0
  769. package/resources/beta/environments/work.js.map +1 -0
  770. package/resources/beta/environments/work.mjs +275 -0
  771. package/resources/beta/environments/work.mjs.map +1 -0
  772. package/resources/beta/environments.d.mts +2 -0
  773. package/resources/beta/environments.d.mts.map +1 -0
  774. package/resources/beta/environments.d.ts +2 -0
  775. package/resources/beta/environments.d.ts.map +1 -0
  776. package/resources/beta/environments.js +6 -0
  777. package/resources/beta/environments.js.map +1 -0
  778. package/resources/beta/environments.mjs +3 -0
  779. package/resources/beta/environments.mjs.map +1 -0
  780. package/resources/beta/files.d.mts +179 -0
  781. package/resources/beta/files.d.mts.map +1 -0
  782. package/resources/beta/files.d.ts +179 -0
  783. package/resources/beta/files.d.ts.map +1 -0
  784. package/resources/beta/files.js +132 -0
  785. package/resources/beta/files.js.map +1 -0
  786. package/resources/beta/files.mjs +128 -0
  787. package/resources/beta/files.mjs.map +1 -0
  788. package/resources/beta/index.d.mts +15 -0
  789. package/resources/beta/index.d.mts.map +1 -0
  790. package/resources/beta/index.d.ts +15 -0
  791. package/resources/beta/index.d.ts.map +1 -0
  792. package/resources/beta/index.js +33 -0
  793. package/resources/beta/index.js.map +1 -0
  794. package/resources/beta/index.mjs +16 -0
  795. package/resources/beta/index.mjs.map +1 -0
  796. package/resources/beta/memory-stores/index.d.mts +4 -0
  797. package/resources/beta/memory-stores/index.d.mts.map +1 -0
  798. package/resources/beta/memory-stores/index.d.ts +4 -0
  799. package/resources/beta/memory-stores/index.d.ts.map +1 -0
  800. package/resources/beta/memory-stores/index.js +11 -0
  801. package/resources/beta/memory-stores/index.js.map +1 -0
  802. package/resources/beta/memory-stores/index.mjs +5 -0
  803. package/resources/beta/memory-stores/index.mjs.map +1 -0
  804. package/resources/beta/memory-stores/memories.d.mts +368 -0
  805. package/resources/beta/memory-stores/memories.d.mts.map +1 -0
  806. package/resources/beta/memory-stores/memories.d.ts +368 -0
  807. package/resources/beta/memory-stores/memories.d.ts.map +1 -0
  808. package/resources/beta/memory-stores/memories.js +134 -0
  809. package/resources/beta/memory-stores/memories.js.map +1 -0
  810. package/resources/beta/memory-stores/memories.mjs +130 -0
  811. package/resources/beta/memory-stores/memories.mjs.map +1 -0
  812. package/resources/beta/memory-stores/memory-stores.d.mts +235 -0
  813. package/resources/beta/memory-stores/memory-stores.d.mts.map +1 -0
  814. package/resources/beta/memory-stores/memory-stores.d.ts +235 -0
  815. package/resources/beta/memory-stores/memory-stores.d.ts.map +1 -0
  816. package/resources/beta/memory-stores/memory-stores.js +149 -0
  817. package/resources/beta/memory-stores/memory-stores.js.map +1 -0
  818. package/resources/beta/memory-stores/memory-stores.mjs +144 -0
  819. package/resources/beta/memory-stores/memory-stores.mjs.map +1 -0
  820. package/resources/beta/memory-stores/memory-versions.d.mts +241 -0
  821. package/resources/beta/memory-stores/memory-versions.d.mts.map +1 -0
  822. package/resources/beta/memory-stores/memory-versions.d.ts +241 -0
  823. package/resources/beta/memory-stores/memory-versions.d.ts.map +1 -0
  824. package/resources/beta/memory-stores/memory-versions.js +85 -0
  825. package/resources/beta/memory-stores/memory-versions.js.map +1 -0
  826. package/resources/beta/memory-stores/memory-versions.mjs +81 -0
  827. package/resources/beta/memory-stores/memory-versions.mjs.map +1 -0
  828. package/resources/beta/memory-stores.d.mts +2 -0
  829. package/resources/beta/memory-stores.d.mts.map +1 -0
  830. package/resources/beta/memory-stores.d.ts +2 -0
  831. package/resources/beta/memory-stores.d.ts.map +1 -0
  832. package/resources/beta/memory-stores.js +6 -0
  833. package/resources/beta/memory-stores.js.map +1 -0
  834. package/resources/beta/memory-stores.mjs +3 -0
  835. package/resources/beta/memory-stores.mjs.map +1 -0
  836. package/resources/beta/messages/batches.d.mts +689 -0
  837. package/resources/beta/messages/batches.d.mts.map +1 -0
  838. package/resources/beta/messages/batches.d.ts +689 -0
  839. package/resources/beta/messages/batches.d.ts.map +1 -0
  840. package/resources/beta/messages/batches.js +212 -0
  841. package/resources/beta/messages/batches.js.map +1 -0
  842. package/resources/beta/messages/batches.mjs +208 -0
  843. package/resources/beta/messages/batches.mjs.map +1 -0
  844. package/resources/beta/messages/index.d.mts +4 -0
  845. package/resources/beta/messages/index.d.mts.map +1 -0
  846. package/resources/beta/messages/index.d.ts +4 -0
  847. package/resources/beta/messages/index.d.ts.map +1 -0
  848. package/resources/beta/messages/index.js +12 -0
  849. package/resources/beta/messages/index.js.map +1 -0
  850. package/resources/beta/messages/index.mjs +5 -0
  851. package/resources/beta/messages/index.mjs.map +1 -0
  852. package/resources/beta/messages/messages.d.mts +3795 -0
  853. package/resources/beta/messages/messages.d.mts.map +1 -0
  854. package/resources/beta/messages/messages.d.ts +3795 -0
  855. package/resources/beta/messages/messages.d.ts.map +1 -0
  856. package/resources/beta/messages/messages.js +188 -0
  857. package/resources/beta/messages/messages.js.map +1 -0
  858. package/resources/beta/messages/messages.mjs +181 -0
  859. package/resources/beta/messages/messages.mjs.map +1 -0
  860. package/resources/beta/messages.d.mts +2 -0
  861. package/resources/beta/messages.d.mts.map +1 -0
  862. package/resources/beta/messages.d.ts +2 -0
  863. package/resources/beta/messages.d.ts.map +1 -0
  864. package/resources/beta/messages.js +6 -0
  865. package/resources/beta/messages.js.map +1 -0
  866. package/resources/beta/messages.mjs +3 -0
  867. package/resources/beta/messages.mjs.map +1 -0
  868. package/resources/beta/models.d.mts +223 -0
  869. package/resources/beta/models.d.mts.map +1 -0
  870. package/resources/beta/models.d.ts +223 -0
  871. package/resources/beta/models.d.ts.map +1 -0
  872. package/resources/beta/models.js +65 -0
  873. package/resources/beta/models.js.map +1 -0
  874. package/resources/beta/models.mjs +61 -0
  875. package/resources/beta/models.mjs.map +1 -0
  876. package/resources/beta/sessions/events.d.mts +1466 -0
  877. package/resources/beta/sessions/events.d.mts.map +1 -0
  878. package/resources/beta/sessions/events.d.ts +1466 -0
  879. package/resources/beta/sessions/events.d.ts.map +1 -0
  880. package/resources/beta/sessions/events.js +122 -0
  881. package/resources/beta/sessions/events.js.map +1 -0
  882. package/resources/beta/sessions/events.mjs +117 -0
  883. package/resources/beta/sessions/events.mjs.map +1 -0
  884. package/resources/beta/sessions/index.d.mts +5 -0
  885. package/resources/beta/sessions/index.d.mts.map +1 -0
  886. package/resources/beta/sessions/index.d.ts +5 -0
  887. package/resources/beta/sessions/index.d.ts.map +1 -0
  888. package/resources/beta/sessions/index.js +13 -0
  889. package/resources/beta/sessions/index.js.map +1 -0
  890. package/resources/beta/sessions/index.mjs +6 -0
  891. package/resources/beta/sessions/index.mjs.map +1 -0
  892. package/resources/beta/sessions/resources.d.mts +231 -0
  893. package/resources/beta/sessions/resources.d.mts.map +1 -0
  894. package/resources/beta/sessions/resources.d.ts +231 -0
  895. package/resources/beta/sessions/resources.d.ts.map +1 -0
  896. package/resources/beta/sessions/resources.js +135 -0
  897. package/resources/beta/sessions/resources.js.map +1 -0
  898. package/resources/beta/sessions/resources.mjs +131 -0
  899. package/resources/beta/sessions/resources.mjs.map +1 -0
  900. package/resources/beta/sessions/sessions.d.mts +819 -0
  901. package/resources/beta/sessions/sessions.d.mts.map +1 -0
  902. package/resources/beta/sessions/sessions.d.ts +819 -0
  903. package/resources/beta/sessions/sessions.d.ts.map +1 -0
  904. package/resources/beta/sessions/sessions.js +159 -0
  905. package/resources/beta/sessions/sessions.js.map +1 -0
  906. package/resources/beta/sessions/sessions.mjs +154 -0
  907. package/resources/beta/sessions/sessions.mjs.map +1 -0
  908. package/resources/beta/sessions/threads/events.d.mts +64 -0
  909. package/resources/beta/sessions/threads/events.d.mts.map +1 -0
  910. package/resources/beta/sessions/threads/events.d.ts +64 -0
  911. package/resources/beta/sessions/threads/events.d.ts.map +1 -0
  912. package/resources/beta/sessions/threads/events.js +60 -0
  913. package/resources/beta/sessions/threads/events.js.map +1 -0
  914. package/resources/beta/sessions/threads/events.mjs +56 -0
  915. package/resources/beta/sessions/threads/events.mjs.map +1 -0
  916. package/resources/beta/sessions/threads/index.d.mts +3 -0
  917. package/resources/beta/sessions/threads/index.d.mts.map +1 -0
  918. package/resources/beta/sessions/threads/index.d.ts +3 -0
  919. package/resources/beta/sessions/threads/index.d.ts.map +1 -0
  920. package/resources/beta/sessions/threads/index.js +9 -0
  921. package/resources/beta/sessions/threads/index.js.map +1 -0
  922. package/resources/beta/sessions/threads/index.mjs +4 -0
  923. package/resources/beta/sessions/threads/index.mjs.map +1 -0
  924. package/resources/beta/sessions/threads/threads.d.mts +183 -0
  925. package/resources/beta/sessions/threads/threads.d.mts.map +1 -0
  926. package/resources/beta/sessions/threads/threads.d.ts +183 -0
  927. package/resources/beta/sessions/threads/threads.d.ts.map +1 -0
  928. package/resources/beta/sessions/threads/threads.js +88 -0
  929. package/resources/beta/sessions/threads/threads.js.map +1 -0
  930. package/resources/beta/sessions/threads/threads.mjs +83 -0
  931. package/resources/beta/sessions/threads/threads.mjs.map +1 -0
  932. package/resources/beta/sessions/threads.d.mts +2 -0
  933. package/resources/beta/sessions/threads.d.mts.map +1 -0
  934. package/resources/beta/sessions/threads.d.ts +2 -0
  935. package/resources/beta/sessions/threads.d.ts.map +1 -0
  936. package/resources/beta/sessions/threads.js +6 -0
  937. package/resources/beta/sessions/threads.js.map +1 -0
  938. package/resources/beta/sessions/threads.mjs +3 -0
  939. package/resources/beta/sessions/threads.mjs.map +1 -0
  940. package/resources/beta/sessions.d.mts +2 -0
  941. package/resources/beta/sessions.d.mts.map +1 -0
  942. package/resources/beta/sessions.d.ts +2 -0
  943. package/resources/beta/sessions.d.ts.map +1 -0
  944. package/resources/beta/sessions.js +6 -0
  945. package/resources/beta/sessions.js.map +1 -0
  946. package/resources/beta/sessions.mjs +3 -0
  947. package/resources/beta/sessions.mjs.map +1 -0
  948. package/resources/beta/skills/index.d.mts +3 -0
  949. package/resources/beta/skills/index.d.mts.map +1 -0
  950. package/resources/beta/skills/index.d.ts +3 -0
  951. package/resources/beta/skills/index.d.ts.map +1 -0
  952. package/resources/beta/skills/index.js +9 -0
  953. package/resources/beta/skills/index.js.map +1 -0
  954. package/resources/beta/skills/index.mjs +4 -0
  955. package/resources/beta/skills/index.mjs.map +1 -0
  956. package/resources/beta/skills/skills.d.mts +258 -0
  957. package/resources/beta/skills/skills.d.mts.map +1 -0
  958. package/resources/beta/skills/skills.d.ts +258 -0
  959. package/resources/beta/skills/skills.d.ts.map +1 -0
  960. package/resources/beta/skills/skills.js +105 -0
  961. package/resources/beta/skills/skills.js.map +1 -0
  962. package/resources/beta/skills/skills.mjs +100 -0
  963. package/resources/beta/skills/skills.mjs.map +1 -0
  964. package/resources/beta/skills/versions.d.mts +298 -0
  965. package/resources/beta/skills/versions.d.mts.map +1 -0
  966. package/resources/beta/skills/versions.d.ts +298 -0
  967. package/resources/beta/skills/versions.d.ts.map +1 -0
  968. package/resources/beta/skills/versions.js +137 -0
  969. package/resources/beta/skills/versions.js.map +1 -0
  970. package/resources/beta/skills/versions.mjs +133 -0
  971. package/resources/beta/skills/versions.mjs.map +1 -0
  972. package/resources/beta/skills.d.mts +2 -0
  973. package/resources/beta/skills.d.mts.map +1 -0
  974. package/resources/beta/skills.d.ts +2 -0
  975. package/resources/beta/skills.d.ts.map +1 -0
  976. package/resources/beta/skills.js +6 -0
  977. package/resources/beta/skills.js.map +1 -0
  978. package/resources/beta/skills.mjs +3 -0
  979. package/resources/beta/skills.mjs.map +1 -0
  980. package/resources/beta/user-profiles.d.mts +228 -0
  981. package/resources/beta/user-profiles.d.mts.map +1 -0
  982. package/resources/beta/user-profiles.d.ts +228 -0
  983. package/resources/beta/user-profiles.d.ts.map +1 -0
  984. package/resources/beta/user-profiles.js +123 -0
  985. package/resources/beta/user-profiles.js.map +1 -0
  986. package/resources/beta/user-profiles.mjs +119 -0
  987. package/resources/beta/user-profiles.mjs.map +1 -0
  988. package/resources/beta/vaults/credentials.d.mts +843 -0
  989. package/resources/beta/vaults/credentials.d.mts.map +1 -0
  990. package/resources/beta/vaults/credentials.d.ts +843 -0
  991. package/resources/beta/vaults/credentials.d.ts.map +1 -0
  992. package/resources/beta/vaults/credentials.js +177 -0
  993. package/resources/beta/vaults/credentials.js.map +1 -0
  994. package/resources/beta/vaults/credentials.mjs +173 -0
  995. package/resources/beta/vaults/credentials.mjs.map +1 -0
  996. package/resources/beta/vaults/index.d.mts +3 -0
  997. package/resources/beta/vaults/index.d.mts.map +1 -0
  998. package/resources/beta/vaults/index.d.ts +3 -0
  999. package/resources/beta/vaults/index.d.ts.map +1 -0
  1000. package/resources/beta/vaults/index.js +9 -0
  1001. package/resources/beta/vaults/index.js.map +1 -0
  1002. package/resources/beta/vaults/index.mjs +4 -0
  1003. package/resources/beta/vaults/index.mjs.map +1 -0
  1004. package/resources/beta/vaults/vaults.d.mts +192 -0
  1005. package/resources/beta/vaults/vaults.d.mts.map +1 -0
  1006. package/resources/beta/vaults/vaults.d.ts +192 -0
  1007. package/resources/beta/vaults/vaults.d.ts.map +1 -0
  1008. package/resources/beta/vaults/vaults.js +149 -0
  1009. package/resources/beta/vaults/vaults.js.map +1 -0
  1010. package/resources/beta/vaults/vaults.mjs +144 -0
  1011. package/resources/beta/vaults/vaults.mjs.map +1 -0
  1012. package/resources/beta/vaults.d.mts +2 -0
  1013. package/resources/beta/vaults.d.mts.map +1 -0
  1014. package/resources/beta/vaults.d.ts +2 -0
  1015. package/resources/beta/vaults.d.ts.map +1 -0
  1016. package/resources/beta/vaults.js +6 -0
  1017. package/resources/beta/vaults.js.map +1 -0
  1018. package/resources/beta/vaults.mjs +3 -0
  1019. package/resources/beta/vaults.mjs.map +1 -0
  1020. package/resources/beta/webhooks.d.mts +399 -0
  1021. package/resources/beta/webhooks.d.mts.map +1 -0
  1022. package/resources/beta/webhooks.d.ts +399 -0
  1023. package/resources/beta/webhooks.d.ts.map +1 -0
  1024. package/resources/beta/webhooks.js +25 -0
  1025. package/resources/beta/webhooks.js.map +1 -0
  1026. package/resources/beta/webhooks.mjs +21 -0
  1027. package/resources/beta/webhooks.mjs.map +1 -0
  1028. package/resources/beta.d.mts +2 -0
  1029. package/resources/beta.d.mts.map +1 -0
  1030. package/resources/beta.d.ts +2 -0
  1031. package/resources/beta.d.ts.map +1 -0
  1032. package/resources/beta.js +6 -0
  1033. package/resources/beta.js.map +1 -0
  1034. package/resources/beta.mjs +3 -0
  1035. package/resources/beta.mjs.map +1 -0
  1036. package/resources/completions.d.mts +173 -0
  1037. package/resources/completions.d.mts.map +1 -0
  1038. package/resources/completions.d.ts +173 -0
  1039. package/resources/completions.d.ts.map +1 -0
  1040. package/resources/completions.js +23 -0
  1041. package/resources/completions.js.map +1 -0
  1042. package/resources/completions.mjs +19 -0
  1043. package/resources/completions.mjs.map +1 -0
  1044. package/resources/index.d.mts +6 -0
  1045. package/resources/index.d.mts.map +1 -0
  1046. package/resources/index.d.ts +6 -0
  1047. package/resources/index.d.ts.map +1 -0
  1048. package/resources/index.js +15 -0
  1049. package/resources/index.js.map +1 -0
  1050. package/resources/index.mjs +7 -0
  1051. package/resources/index.mjs.map +1 -0
  1052. package/resources/messages/batches.d.mts +313 -0
  1053. package/resources/messages/batches.d.mts.map +1 -0
  1054. package/resources/messages/batches.d.ts +313 -0
  1055. package/resources/messages/batches.d.ts.map +1 -0
  1056. package/resources/messages/batches.js +161 -0
  1057. package/resources/messages/batches.js.map +1 -0
  1058. package/resources/messages/batches.mjs +157 -0
  1059. package/resources/messages/batches.mjs.map +1 -0
  1060. package/resources/messages/index.d.mts +3 -0
  1061. package/resources/messages/index.d.mts.map +1 -0
  1062. package/resources/messages/index.d.ts +3 -0
  1063. package/resources/messages/index.d.ts.map +1 -0
  1064. package/resources/messages/index.js +9 -0
  1065. package/resources/messages/index.js.map +1 -0
  1066. package/resources/messages/index.mjs +4 -0
  1067. package/resources/messages/index.mjs.map +1 -0
  1068. package/resources/messages/messages.d.mts +2580 -0
  1069. package/resources/messages/messages.d.mts.map +1 -0
  1070. package/resources/messages/messages.d.ts +2580 -0
  1071. package/resources/messages/messages.d.ts.map +1 -0
  1072. package/resources/messages/messages.js +148 -0
  1073. package/resources/messages/messages.js.map +1 -0
  1074. package/resources/messages/messages.mjs +143 -0
  1075. package/resources/messages/messages.mjs.map +1 -0
  1076. package/resources/messages.d.mts +2 -0
  1077. package/resources/messages.d.mts.map +1 -0
  1078. package/resources/messages.d.ts +2 -0
  1079. package/resources/messages.d.ts.map +1 -0
  1080. package/resources/messages.js +6 -0
  1081. package/resources/messages.js.map +1 -0
  1082. package/resources/messages.mjs +3 -0
  1083. package/resources/messages.mjs.map +1 -0
  1084. package/resources/models.d.mts +197 -0
  1085. package/resources/models.d.mts.map +1 -0
  1086. package/resources/models.d.ts +197 -0
  1087. package/resources/models.d.ts.map +1 -0
  1088. package/resources/models.js +45 -0
  1089. package/resources/models.js.map +1 -0
  1090. package/resources/models.mjs +41 -0
  1091. package/resources/models.mjs.map +1 -0
  1092. package/resources/shared.d.mts +59 -0
  1093. package/resources/shared.d.mts.map +1 -0
  1094. package/resources/shared.d.ts +59 -0
  1095. package/resources/shared.d.ts.map +1 -0
  1096. package/resources/shared.js +4 -0
  1097. package/resources/shared.js.map +1 -0
  1098. package/resources/shared.mjs +3 -0
  1099. package/resources/shared.mjs.map +1 -0
  1100. package/resources/top-level.d.mts +2 -0
  1101. package/resources/top-level.d.mts.map +1 -0
  1102. package/resources/top-level.d.ts +2 -0
  1103. package/resources/top-level.d.ts.map +1 -0
  1104. package/resources/top-level.js +4 -0
  1105. package/resources/top-level.js.map +1 -0
  1106. package/resources/top-level.mjs +3 -0
  1107. package/resources/top-level.mjs.map +1 -0
  1108. package/resources.d.mts +2 -0
  1109. package/resources.d.mts.map +1 -0
  1110. package/resources.d.ts +2 -0
  1111. package/resources.d.ts.map +1 -0
  1112. package/resources.js +5 -0
  1113. package/resources.js.map +1 -0
  1114. package/resources.mjs +2 -0
  1115. package/resources.mjs.map +1 -0
  1116. package/src/_vendor/partial-json-parser/README.md +3 -0
  1117. package/src/_vendor/partial-json-parser/parser.ts +280 -0
  1118. package/src/api-promise.ts +2 -0
  1119. package/src/client.ts +1858 -0
  1120. package/src/core/README.md +3 -0
  1121. package/src/core/api-promise.ts +101 -0
  1122. package/src/core/api.ts +11 -0
  1123. package/src/core/credentials.ts +379 -0
  1124. package/src/core/error.ts +160 -0
  1125. package/src/core/middleware.ts +339 -0
  1126. package/src/core/pagination.ts +378 -0
  1127. package/src/core/resource.ts +11 -0
  1128. package/src/core/streaming.ts +403 -0
  1129. package/src/core/uploads.ts +2 -0
  1130. package/src/error.ts +2 -0
  1131. package/src/helpers/beta/environments.ts +36 -0
  1132. package/src/helpers/beta/json-schema.ts +85 -0
  1133. package/src/helpers/beta/mcp.ts +624 -0
  1134. package/src/helpers/beta/memory.ts +28 -0
  1135. package/src/helpers/beta/zod.ts +81 -0
  1136. package/src/helpers/index.ts +2 -0
  1137. package/src/helpers/json-schema.ts +48 -0
  1138. package/src/helpers/zod.ts +57 -0
  1139. package/src/index.ts +47 -0
  1140. package/src/internal/README.md +3 -0
  1141. package/src/internal/builtin-types.ts +93 -0
  1142. package/src/internal/constants.ts +15 -0
  1143. package/src/internal/decoders/jsonl.ts +48 -0
  1144. package/src/internal/decoders/line.ts +135 -0
  1145. package/src/internal/detect-platform.ts +196 -0
  1146. package/src/internal/errors.ts +33 -0
  1147. package/src/internal/headers.ts +142 -0
  1148. package/src/internal/message-stream-utils.ts +30 -0
  1149. package/src/internal/parse.ts +86 -0
  1150. package/src/internal/qs/LICENSE.md +13 -0
  1151. package/src/internal/qs/README.md +3 -0
  1152. package/src/internal/qs/formats.ts +10 -0
  1153. package/src/internal/qs/index.ts +13 -0
  1154. package/src/internal/qs/stringify.ts +385 -0
  1155. package/src/internal/qs/types.ts +71 -0
  1156. package/src/internal/qs/utils.ts +265 -0
  1157. package/src/internal/request-options.ts +146 -0
  1158. package/src/internal/shim-types.ts +26 -0
  1159. package/src/internal/shims.ts +107 -0
  1160. package/src/internal/stainless-helper-header.ts +122 -0
  1161. package/src/internal/stream-utils.ts +32 -0
  1162. package/src/internal/to-file.ts +159 -0
  1163. package/src/internal/types.ts +93 -0
  1164. package/src/internal/uploads.ts +204 -0
  1165. package/src/internal/utils/abort.ts +21 -0
  1166. package/src/internal/utils/async-queue.ts +66 -0
  1167. package/src/internal/utils/backoff.ts +41 -0
  1168. package/src/internal/utils/base64.ts +40 -0
  1169. package/src/internal/utils/bytes.ts +32 -0
  1170. package/src/internal/utils/env.ts +18 -0
  1171. package/src/internal/utils/log.ts +158 -0
  1172. package/src/internal/utils/path.ts +88 -0
  1173. package/src/internal/utils/promise.ts +18 -0
  1174. package/src/internal/utils/query.ts +7 -0
  1175. package/src/internal/utils/sleep.ts +26 -0
  1176. package/src/internal/utils/time.ts +4 -0
  1177. package/src/internal/utils/uuid.ts +17 -0
  1178. package/src/internal/utils/values.ts +112 -0
  1179. package/src/internal/utils.ts +9 -0
  1180. package/src/lib/.keep +4 -0
  1181. package/src/lib/BetaMessageStream.ts +781 -0
  1182. package/src/lib/MessageStream.ts +740 -0
  1183. package/src/lib/beta-parser.ts +148 -0
  1184. package/src/lib/credentials/credential-chain.ts +292 -0
  1185. package/src/lib/credentials/identity-token.ts +37 -0
  1186. package/src/lib/credentials/oidc-federation.ts +140 -0
  1187. package/src/lib/credentials/token-cache.ts +130 -0
  1188. package/src/lib/credentials/types.ts +295 -0
  1189. package/src/lib/credentials/user-oauth.ts +144 -0
  1190. package/src/lib/credentials.ts +3 -0
  1191. package/src/lib/environments/index.ts +23 -0
  1192. package/src/lib/environments/poller.ts +257 -0
  1193. package/src/lib/environments/worker.ts +404 -0
  1194. package/src/lib/helper-client.ts +102 -0
  1195. package/src/lib/middleware.ts +949 -0
  1196. package/src/lib/parser.ts +125 -0
  1197. package/src/lib/sessions/accumulate.ts +129 -0
  1198. package/src/lib/tools/BetaRunnableTool.ts +130 -0
  1199. package/src/lib/tools/BetaToolRunner.ts +542 -0
  1200. package/src/lib/tools/CompactionControl.ts +57 -0
  1201. package/src/lib/tools/SessionToolRunner.ts +616 -0
  1202. package/src/lib/tools/ToolError.ts +47 -0
  1203. package/src/lib/tools/ToolRunner.ts +381 -0
  1204. package/src/lib/transform-json-schema.ts +124 -0
  1205. package/src/pagination.ts +2 -0
  1206. package/src/resource.ts +2 -0
  1207. package/src/resources/beta/agents/agents.ts +1279 -0
  1208. package/src/resources/beta/agents/index.ts +65 -0
  1209. package/src/resources/beta/agents/versions.ts +58 -0
  1210. package/src/resources/beta/agents.ts +3 -0
  1211. package/src/resources/beta/beta.ts +1267 -0
  1212. package/src/resources/beta/deployment-runs.ts +446 -0
  1213. package/src/resources/beta/deployments.ts +982 -0
  1214. package/src/resources/beta/environments/environments.ts +673 -0
  1215. package/src/resources/beta/environments/index.ts +45 -0
  1216. package/src/resources/beta/environments/work.ts +699 -0
  1217. package/src/resources/beta/environments.ts +3 -0
  1218. package/src/resources/beta/files.ts +294 -0
  1219. package/src/resources/beta/index.ts +570 -0
  1220. package/src/resources/beta/memory-stores/index.ts +47 -0
  1221. package/src/resources/beta/memory-stores/memories.ts +535 -0
  1222. package/src/resources/beta/memory-stores/memory-stores.ts +422 -0
  1223. package/src/resources/beta/memory-stores/memory-versions.ts +348 -0
  1224. package/src/resources/beta/memory-stores.ts +3 -0
  1225. package/src/resources/beta/messages/batches.ts +877 -0
  1226. package/src/resources/beta/messages/index.ts +261 -0
  1227. package/src/resources/beta/messages/messages.ts +5454 -0
  1228. package/src/resources/beta/messages.ts +3 -0
  1229. package/src/resources/beta/models.ts +301 -0
  1230. package/src/resources/beta/sessions/events.ts +2036 -0
  1231. package/src/resources/beta/sessions/index.ts +154 -0
  1232. package/src/resources/beta/sessions/resources.ts +373 -0
  1233. package/src/resources/beta/sessions/sessions.ts +1341 -0
  1234. package/src/resources/beta/sessions/threads/events.ts +107 -0
  1235. package/src/resources/beta/sessions/threads/index.ts +15 -0
  1236. package/src/resources/beta/sessions/threads/threads.ts +314 -0
  1237. package/src/resources/beta/sessions/threads.ts +3 -0
  1238. package/src/resources/beta/sessions.ts +3 -0
  1239. package/src/resources/beta/skills/index.ts +27 -0
  1240. package/src/resources/beta/skills/skills.ts +392 -0
  1241. package/src/resources/beta/skills/versions.ts +433 -0
  1242. package/src/resources/beta/skills.ts +3 -0
  1243. package/src/resources/beta/user-profiles.ts +330 -0
  1244. package/src/resources/beta/vaults/credentials.ts +1172 -0
  1245. package/src/resources/beta/vaults/index.ts +66 -0
  1246. package/src/resources/beta/vaults/vaults.ts +409 -0
  1247. package/src/resources/beta/vaults.ts +3 -0
  1248. package/src/resources/beta/webhooks.ts +647 -0
  1249. package/src/resources/beta.ts +3 -0
  1250. package/src/resources/completions.ts +221 -0
  1251. package/src/resources/index.ts +211 -0
  1252. package/src/resources/messages/batches.ts +414 -0
  1253. package/src/resources/messages/index.ts +194 -0
  1254. package/src/resources/messages/messages.ts +3765 -0
  1255. package/src/resources/messages.ts +3 -0
  1256. package/src/resources/models.ts +274 -0
  1257. package/src/resources/shared.ts +112 -0
  1258. package/src/resources/top-level.ts +3 -0
  1259. package/src/resources.ts +1 -0
  1260. package/src/streaming.ts +2 -0
  1261. package/src/tools/agent-toolset/fs-util.ts +157 -0
  1262. package/src/tools/agent-toolset/node.browser.ts +90 -0
  1263. package/src/tools/agent-toolset/node.ts +817 -0
  1264. package/src/tools/agent-toolset/skills.ts +256 -0
  1265. package/src/tools/memory/node.browser.ts +64 -0
  1266. package/src/tools/memory/node.ts +400 -0
  1267. package/src/tsconfig.json +11 -0
  1268. package/src/uploads.ts +2 -0
  1269. package/src/version.ts +1 -0
  1270. package/streaming.d.mts +3 -0
  1271. package/streaming.d.mts.map +1 -0
  1272. package/streaming.d.ts +3 -0
  1273. package/streaming.d.ts.map +1 -0
  1274. package/streaming.js +6 -0
  1275. package/streaming.js.map +1 -0
  1276. package/streaming.mjs +3 -0
  1277. package/streaming.mjs.map +1 -0
  1278. package/tools/agent-toolset/fs-util.d.mts +50 -0
  1279. package/tools/agent-toolset/fs-util.d.mts.map +1 -0
  1280. package/tools/agent-toolset/fs-util.d.ts +50 -0
  1281. package/tools/agent-toolset/fs-util.d.ts.map +1 -0
  1282. package/tools/agent-toolset/fs-util.js +162 -0
  1283. package/tools/agent-toolset/fs-util.js.map +1 -0
  1284. package/tools/agent-toolset/fs-util.mjs +154 -0
  1285. package/tools/agent-toolset/fs-util.mjs.map +1 -0
  1286. package/tools/agent-toolset/node.browser.d.mts +42 -0
  1287. package/tools/agent-toolset/node.browser.d.mts.map +1 -0
  1288. package/tools/agent-toolset/node.browser.d.ts +42 -0
  1289. package/tools/agent-toolset/node.browser.d.ts.map +1 -0
  1290. package/tools/agent-toolset/node.browser.js +81 -0
  1291. package/tools/agent-toolset/node.browser.js.map +1 -0
  1292. package/tools/agent-toolset/node.browser.mjs +66 -0
  1293. package/tools/agent-toolset/node.browser.mjs.map +1 -0
  1294. package/tools/agent-toolset/node.d.mts +149 -0
  1295. package/tools/agent-toolset/node.d.mts.map +1 -0
  1296. package/tools/agent-toolset/node.d.ts +149 -0
  1297. package/tools/agent-toolset/node.d.ts.map +1 -0
  1298. package/tools/agent-toolset/node.js +768 -0
  1299. package/tools/agent-toolset/node.js.map +1 -0
  1300. package/tools/agent-toolset/node.mjs +753 -0
  1301. package/tools/agent-toolset/node.mjs.map +1 -0
  1302. package/tools/agent-toolset/skills.d.mts +50 -0
  1303. package/tools/agent-toolset/skills.d.mts.map +1 -0
  1304. package/tools/agent-toolset/skills.d.ts +50 -0
  1305. package/tools/agent-toolset/skills.d.ts.map +1 -0
  1306. package/tools/agent-toolset/skills.js +249 -0
  1307. package/tools/agent-toolset/skills.js.map +1 -0
  1308. package/tools/agent-toolset/skills.mjs +243 -0
  1309. package/tools/agent-toolset/skills.mjs.map +1 -0
  1310. package/tools/memory/node.browser.d.mts +27 -0
  1311. package/tools/memory/node.browser.d.mts.map +1 -0
  1312. package/tools/memory/node.browser.d.ts +27 -0
  1313. package/tools/memory/node.browser.d.ts.map +1 -0
  1314. package/tools/memory/node.browser.js +49 -0
  1315. package/tools/memory/node.browser.js.map +1 -0
  1316. package/tools/memory/node.browser.mjs +44 -0
  1317. package/tools/memory/node.browser.mjs.map +1 -0
  1318. package/tools/memory/node.d.mts +18 -0
  1319. package/tools/memory/node.d.mts.map +1 -0
  1320. package/tools/memory/node.d.ts +18 -0
  1321. package/tools/memory/node.d.ts.map +1 -0
  1322. package/tools/memory/node.js +331 -0
  1323. package/tools/memory/node.js.map +1 -0
  1324. package/tools/memory/node.mjs +325 -0
  1325. package/tools/memory/node.mjs.map +1 -0
  1326. package/uploads.d.mts +3 -0
  1327. package/uploads.d.mts.map +1 -0
  1328. package/uploads.d.ts +3 -0
  1329. package/uploads.d.ts.map +1 -0
  1330. package/uploads.js +6 -0
  1331. package/uploads.js.map +1 -0
  1332. package/uploads.mjs +3 -0
  1333. package/uploads.mjs.map +1 -0
  1334. package/version.d.mts +2 -0
  1335. package/version.d.mts.map +1 -0
  1336. package/version.d.ts +2 -0
  1337. package/version.d.ts.map +1 -0
  1338. package/version.js +5 -0
  1339. package/version.js.map +1 -0
  1340. package/version.mjs +2 -0
  1341. package/version.mjs.map +1 -0
@@ -0,0 +1,3765 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIPromise } from '../../core/api-promise';
4
+ import { APIResource } from '../../core/resource';
5
+ import { Stream } from '../../core/streaming';
6
+ import { buildHeaders } from '../../internal/headers';
7
+ import { RequestOptions } from '../../internal/request-options';
8
+ import { stainlessHelperHeader } from '../../internal/stainless-helper-header';
9
+ import { MessageStream } from '../../lib/MessageStream';
10
+ import {
11
+ parseMessage,
12
+ type ExtractParsedContentFromParams,
13
+ type ParseableMessageCreateParams,
14
+ type ParsedMessage,
15
+ } from '../../lib/parser';
16
+ import * as BatchesAPI from './batches';
17
+ import {
18
+ BatchCreateParams,
19
+ BatchListParams,
20
+ Batches,
21
+ DeletedMessageBatch,
22
+ MessageBatch,
23
+ MessageBatchCanceledResult,
24
+ MessageBatchErroredResult,
25
+ MessageBatchExpiredResult,
26
+ MessageBatchIndividualResponse,
27
+ MessageBatchRequestCounts,
28
+ MessageBatchResult,
29
+ MessageBatchSucceededResult,
30
+ MessageBatchesPage,
31
+ } from './batches';
32
+ import * as MessagesAPI from './messages';
33
+
34
+ import { MODEL_NONSTREAMING_TOKENS } from '../../internal/constants';
35
+
36
+ export class Messages extends APIResource {
37
+ batches: BatchesAPI.Batches = new BatchesAPI.Batches(this._client);
38
+
39
+ /**
40
+ * Send a structured list of input messages with text and/or image content, and the
41
+ * model will generate the next message in the conversation.
42
+ *
43
+ * The Messages API can be used for either single queries or stateless multi-turn
44
+ * conversations.
45
+ *
46
+ * Learn more about the Messages API in our
47
+ * [user guide](https://platform.claude.com/docs/en/get-started)
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const message = await client.messages.create({
52
+ * max_tokens: 1024,
53
+ * messages: [{ content: 'Hello, world', role: 'user' }],
54
+ * model: 'claude-opus-4-6',
55
+ * });
56
+ * ```
57
+ */
58
+ create(params: MessageCreateParamsNonStreaming, options?: RequestOptions): APIPromise<Message>;
59
+ create(
60
+ params: MessageCreateParamsStreaming,
61
+ options?: RequestOptions,
62
+ ): APIPromise<Stream<RawMessageStreamEvent>>;
63
+ create(
64
+ params: MessageCreateParamsBase,
65
+ options?: RequestOptions,
66
+ ): APIPromise<Stream<RawMessageStreamEvent> | Message>;
67
+ create(
68
+ params: MessageCreateParams,
69
+ options?: RequestOptions,
70
+ ): APIPromise<Message> | APIPromise<Stream<RawMessageStreamEvent>> {
71
+ const { user_profile_id, ...body } = params;
72
+ if (body.model in DEPRECATED_MODELS) {
73
+ console.warn(
74
+ `The model '${body.model}' is deprecated and will reach end-of-life on ${
75
+ DEPRECATED_MODELS[body.model]
76
+ }\nPlease migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`,
77
+ );
78
+ }
79
+ if (
80
+ MODELS_TO_WARN_WITH_THINKING_ENABLED.includes(body.model) &&
81
+ body.thinking &&
82
+ body.thinking.type === 'enabled'
83
+ ) {
84
+ console.warn(
85
+ `Using Claude with ${body.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`,
86
+ );
87
+ }
88
+
89
+ let timeout = (this._client as any)._options.timeout as number | null;
90
+ if (!body.stream && timeout == null) {
91
+ const maxNonstreamingTokens = MODEL_NONSTREAMING_TOKENS[body.model] ?? undefined;
92
+ timeout = this._client.calculateNonstreamingTimeout(body.max_tokens, maxNonstreamingTokens);
93
+ }
94
+
95
+ // Collect helper info from tools and messages
96
+ const helperHeader = stainlessHelperHeader(body.tools, body.messages);
97
+ return this._client.post('/v1/messages', {
98
+ body,
99
+ timeout: timeout ?? 600000,
100
+ ...options,
101
+ headers: buildHeaders([
102
+ { ...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined) },
103
+ helperHeader,
104
+ options?.headers,
105
+ ]),
106
+ stream: params.stream ?? false,
107
+ }) as APIPromise<Message> | APIPromise<Stream<RawMessageStreamEvent>>;
108
+ }
109
+
110
+ /**
111
+ * Send a structured list of input messages with text and/or image content, along with an expected `output_config.format` and
112
+ * the response will be automatically parsed and available in the `parsed_output` property of the message.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * const message = await client.messages.parse({
117
+ * model: 'claude-sonnet-4-5-20250929',
118
+ * max_tokens: 1024,
119
+ * messages: [{ role: 'user', content: 'What is 2+2?' }],
120
+ * output_config: {
121
+ * format: zodOutputFormat(z.object({ answer: z.number() })),
122
+ * },
123
+ * });
124
+ *
125
+ * console.log(message.parsed_output?.answer); // 4
126
+ * ```
127
+ */
128
+ parse<Params extends MessageCreateParamsNonStreaming>(
129
+ params: Params,
130
+ options?: RequestOptions,
131
+ ): APIPromise<ParsedMessage<ExtractParsedContentFromParams<Params>>> {
132
+ return this.create(params, options).then((message) =>
133
+ parseMessage(message, params, { logger: this._client.logger ?? console }),
134
+ ) as APIPromise<ParsedMessage<ExtractParsedContentFromParams<Params>>>;
135
+ }
136
+
137
+ /**
138
+ * Create a Message stream.
139
+ *
140
+ * If `output_config.format` is provided with a parseable format (like `zodOutputFormat()`),
141
+ * the final message will include a `parsed_output` property with the parsed content.
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * const stream = client.messages.stream({
146
+ * model: 'claude-sonnet-4-5-20250929',
147
+ * max_tokens: 1024,
148
+ * messages: [{ role: 'user', content: 'What is 2+2?' }],
149
+ * output_config: {
150
+ * format: zodOutputFormat(z.object({ answer: z.number() })),
151
+ * },
152
+ * });
153
+ *
154
+ * const message = await stream.finalMessage();
155
+ * console.log(message.parsed_output?.answer); // 4
156
+ * ```
157
+ */
158
+ stream<Params extends MessageStreamParams>(
159
+ body: Params,
160
+ options?: RequestOptions,
161
+ ): MessageStream<ExtractParsedContentFromParams<Params>> {
162
+ return MessageStream.createMessage<ExtractParsedContentFromParams<Params>>(
163
+ this,
164
+ body as MessageCreateParamsBase,
165
+ options,
166
+ { logger: this._client.logger ?? console },
167
+ );
168
+ }
169
+
170
+ /**
171
+ * Count the number of tokens in a Message.
172
+ *
173
+ * The Token Count API can be used to count the number of tokens in a Message,
174
+ * including tools, images, and documents, without creating it.
175
+ *
176
+ * Learn more about token counting in our
177
+ * [user guide](https://platform.claude.com/docs/en/build-with-claude/token-counting)
178
+ *
179
+ * @example
180
+ * ```ts
181
+ * const messageTokensCount =
182
+ * await client.messages.countTokens({
183
+ * messages: [{ content: 'Hello, world', role: 'user' }],
184
+ * model: 'claude-opus-4-6',
185
+ * });
186
+ * ```
187
+ */
188
+ countTokens(params: MessageCountTokensParams, options?: RequestOptions): APIPromise<MessageTokensCount> {
189
+ const { user_profile_id, ...body } = params;
190
+ return this._client.post('/v1/messages/count_tokens', {
191
+ body,
192
+ ...options,
193
+ headers: buildHeaders([
194
+ { ...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined) },
195
+ options?.headers,
196
+ ]),
197
+ });
198
+ }
199
+ }
200
+
201
+ export interface Base64ImageSource {
202
+ data: string;
203
+
204
+ media_type: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
205
+
206
+ type: 'base64';
207
+ }
208
+
209
+ export interface Base64PDFSource {
210
+ data: string;
211
+
212
+ media_type: 'application/pdf';
213
+
214
+ type: 'base64';
215
+ }
216
+
217
+ export interface BashCodeExecutionOutputBlock {
218
+ file_id: string;
219
+
220
+ type: 'bash_code_execution_output';
221
+ }
222
+
223
+ export interface BashCodeExecutionOutputBlockParam {
224
+ file_id: string;
225
+
226
+ type: 'bash_code_execution_output';
227
+ }
228
+
229
+ export interface BashCodeExecutionResultBlock {
230
+ content: Array<BashCodeExecutionOutputBlock>;
231
+
232
+ return_code: number;
233
+
234
+ stderr: string;
235
+
236
+ stdout: string;
237
+
238
+ type: 'bash_code_execution_result';
239
+ }
240
+
241
+ export interface BashCodeExecutionResultBlockParam {
242
+ content: Array<BashCodeExecutionOutputBlockParam>;
243
+
244
+ return_code: number;
245
+
246
+ stderr: string;
247
+
248
+ stdout: string;
249
+
250
+ type: 'bash_code_execution_result';
251
+ }
252
+
253
+ export interface BashCodeExecutionToolResultBlock {
254
+ content: BashCodeExecutionToolResultError | BashCodeExecutionResultBlock;
255
+
256
+ tool_use_id: string;
257
+
258
+ type: 'bash_code_execution_tool_result';
259
+ }
260
+
261
+ export interface BashCodeExecutionToolResultBlockParam {
262
+ content: BashCodeExecutionToolResultErrorParam | BashCodeExecutionResultBlockParam;
263
+
264
+ tool_use_id: string;
265
+
266
+ type: 'bash_code_execution_tool_result';
267
+
268
+ /**
269
+ * Create a cache control breakpoint at this content block.
270
+ */
271
+ cache_control?: CacheControlEphemeral | null;
272
+ }
273
+
274
+ export interface BashCodeExecutionToolResultError {
275
+ error_code: BashCodeExecutionToolResultErrorCode;
276
+
277
+ type: 'bash_code_execution_tool_result_error';
278
+ }
279
+
280
+ export type BashCodeExecutionToolResultErrorCode =
281
+ | 'invalid_tool_input'
282
+ | 'unavailable'
283
+ | 'too_many_requests'
284
+ | 'execution_time_exceeded'
285
+ | 'output_file_too_large';
286
+
287
+ export interface BashCodeExecutionToolResultErrorParam {
288
+ error_code: BashCodeExecutionToolResultErrorCode;
289
+
290
+ type: 'bash_code_execution_tool_result_error';
291
+ }
292
+
293
+ export interface CacheControlEphemeral {
294
+ type: 'ephemeral';
295
+
296
+ /**
297
+ * The time-to-live for the cache control breakpoint.
298
+ *
299
+ * This may be one the following values:
300
+ *
301
+ * - `5m`: 5 minutes
302
+ * - `1h`: 1 hour
303
+ *
304
+ * Defaults to `5m`. See
305
+ * [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching)
306
+ * for details.
307
+ */
308
+ ttl?: '5m' | '1h';
309
+ }
310
+
311
+ export interface CacheCreation {
312
+ /**
313
+ * The number of input tokens used to create the 1 hour cache entry.
314
+ */
315
+ ephemeral_1h_input_tokens: number;
316
+
317
+ /**
318
+ * The number of input tokens used to create the 5 minute cache entry.
319
+ */
320
+ ephemeral_5m_input_tokens: number;
321
+ }
322
+
323
+ export interface CitationCharLocation {
324
+ cited_text: string;
325
+
326
+ document_index: number;
327
+
328
+ document_title: string | null;
329
+
330
+ end_char_index: number;
331
+
332
+ file_id: string | null;
333
+
334
+ start_char_index: number;
335
+
336
+ type: 'char_location';
337
+ }
338
+
339
+ export interface CitationCharLocationParam {
340
+ cited_text: string;
341
+
342
+ document_index: number;
343
+
344
+ document_title: string | null;
345
+
346
+ end_char_index: number;
347
+
348
+ start_char_index: number;
349
+
350
+ type: 'char_location';
351
+ }
352
+
353
+ export interface CitationContentBlockLocation {
354
+ /**
355
+ * The full text of the cited block range, concatenated.
356
+ *
357
+ * Always equals the contents of `content[start_block_index:end_block_index]`
358
+ * joined together. The text block is the minimal citable unit; this field is never
359
+ * a substring of a single block. Not counted toward output tokens, and not counted
360
+ * toward input tokens when sent back in subsequent turns.
361
+ */
362
+ cited_text: string;
363
+
364
+ document_index: number;
365
+
366
+ document_title: string | null;
367
+
368
+ /**
369
+ * Exclusive 0-based end index of the cited block range in the source's `content`
370
+ * array.
371
+ *
372
+ * Always greater than `start_block_index`; a single-block citation has
373
+ * `end_block_index = start_block_index + 1`.
374
+ */
375
+ end_block_index: number;
376
+
377
+ file_id: string | null;
378
+
379
+ /**
380
+ * 0-based index of the first cited block in the source's `content` array.
381
+ */
382
+ start_block_index: number;
383
+
384
+ type: 'content_block_location';
385
+ }
386
+
387
+ export interface CitationContentBlockLocationParam {
388
+ /**
389
+ * The full text of the cited block range, concatenated.
390
+ *
391
+ * Always equals the contents of `content[start_block_index:end_block_index]`
392
+ * joined together. The text block is the minimal citable unit; this field is never
393
+ * a substring of a single block. Not counted toward output tokens, and not counted
394
+ * toward input tokens when sent back in subsequent turns.
395
+ */
396
+ cited_text: string;
397
+
398
+ document_index: number;
399
+
400
+ document_title: string | null;
401
+
402
+ /**
403
+ * Exclusive 0-based end index of the cited block range in the source's `content`
404
+ * array.
405
+ *
406
+ * Always greater than `start_block_index`; a single-block citation has
407
+ * `end_block_index = start_block_index + 1`.
408
+ */
409
+ end_block_index: number;
410
+
411
+ /**
412
+ * 0-based index of the first cited block in the source's `content` array.
413
+ */
414
+ start_block_index: number;
415
+
416
+ type: 'content_block_location';
417
+ }
418
+
419
+ export interface CitationPageLocation {
420
+ cited_text: string;
421
+
422
+ document_index: number;
423
+
424
+ document_title: string | null;
425
+
426
+ end_page_number: number;
427
+
428
+ file_id: string | null;
429
+
430
+ start_page_number: number;
431
+
432
+ type: 'page_location';
433
+ }
434
+
435
+ export interface CitationPageLocationParam {
436
+ cited_text: string;
437
+
438
+ document_index: number;
439
+
440
+ document_title: string | null;
441
+
442
+ end_page_number: number;
443
+
444
+ start_page_number: number;
445
+
446
+ type: 'page_location';
447
+ }
448
+
449
+ export interface CitationSearchResultLocationParam {
450
+ /**
451
+ * The full text of the cited block range, concatenated.
452
+ *
453
+ * Always equals the contents of `content[start_block_index:end_block_index]`
454
+ * joined together. The text block is the minimal citable unit; this field is never
455
+ * a substring of a single block. Not counted toward output tokens, and not counted
456
+ * toward input tokens when sent back in subsequent turns.
457
+ */
458
+ cited_text: string;
459
+
460
+ /**
461
+ * Exclusive 0-based end index of the cited block range in the source's `content`
462
+ * array.
463
+ *
464
+ * Always greater than `start_block_index`; a single-block citation has
465
+ * `end_block_index = start_block_index + 1`.
466
+ */
467
+ end_block_index: number;
468
+
469
+ /**
470
+ * 0-based index of the cited search result among all `search_result` content
471
+ * blocks in the request, in the order they appear across messages and tool
472
+ * results.
473
+ *
474
+ * Counted separately from `document_index`; server-side web search results are not
475
+ * included in this count.
476
+ */
477
+ search_result_index: number;
478
+
479
+ source: string;
480
+
481
+ /**
482
+ * 0-based index of the first cited block in the source's `content` array.
483
+ */
484
+ start_block_index: number;
485
+
486
+ title: string | null;
487
+
488
+ type: 'search_result_location';
489
+ }
490
+
491
+ export interface CitationWebSearchResultLocationParam {
492
+ cited_text: string;
493
+
494
+ encrypted_index: string;
495
+
496
+ title: string | null;
497
+
498
+ type: 'web_search_result_location';
499
+
500
+ url: string;
501
+ }
502
+
503
+ export interface CitationsConfig {
504
+ enabled: boolean;
505
+ }
506
+
507
+ export interface CitationsConfigParam {
508
+ enabled?: boolean;
509
+ }
510
+
511
+ export interface CitationsDelta {
512
+ citation:
513
+ | CitationCharLocation
514
+ | CitationPageLocation
515
+ | CitationContentBlockLocation
516
+ | CitationsWebSearchResultLocation
517
+ | CitationsSearchResultLocation;
518
+
519
+ type: 'citations_delta';
520
+ }
521
+
522
+ export interface CitationsSearchResultLocation {
523
+ /**
524
+ * The full text of the cited block range, concatenated.
525
+ *
526
+ * Always equals the contents of `content[start_block_index:end_block_index]`
527
+ * joined together. The text block is the minimal citable unit; this field is never
528
+ * a substring of a single block. Not counted toward output tokens, and not counted
529
+ * toward input tokens when sent back in subsequent turns.
530
+ */
531
+ cited_text: string;
532
+
533
+ /**
534
+ * Exclusive 0-based end index of the cited block range in the source's `content`
535
+ * array.
536
+ *
537
+ * Always greater than `start_block_index`; a single-block citation has
538
+ * `end_block_index = start_block_index + 1`.
539
+ */
540
+ end_block_index: number;
541
+
542
+ /**
543
+ * 0-based index of the cited search result among all `search_result` content
544
+ * blocks in the request, in the order they appear across messages and tool
545
+ * results.
546
+ *
547
+ * Counted separately from `document_index`; server-side web search results are not
548
+ * included in this count.
549
+ */
550
+ search_result_index: number;
551
+
552
+ source: string;
553
+
554
+ /**
555
+ * 0-based index of the first cited block in the source's `content` array.
556
+ */
557
+ start_block_index: number;
558
+
559
+ title: string | null;
560
+
561
+ type: 'search_result_location';
562
+ }
563
+
564
+ export interface CitationsWebSearchResultLocation {
565
+ cited_text: string;
566
+
567
+ encrypted_index: string;
568
+
569
+ title: string | null;
570
+
571
+ type: 'web_search_result_location';
572
+
573
+ url: string;
574
+ }
575
+
576
+ export interface CodeExecutionOutputBlock {
577
+ file_id: string;
578
+
579
+ type: 'code_execution_output';
580
+ }
581
+
582
+ export interface CodeExecutionOutputBlockParam {
583
+ file_id: string;
584
+
585
+ type: 'code_execution_output';
586
+ }
587
+
588
+ export interface CodeExecutionResultBlock {
589
+ content: Array<CodeExecutionOutputBlock>;
590
+
591
+ return_code: number;
592
+
593
+ stderr: string;
594
+
595
+ stdout: string;
596
+
597
+ type: 'code_execution_result';
598
+ }
599
+
600
+ export interface CodeExecutionResultBlockParam {
601
+ content: Array<CodeExecutionOutputBlockParam>;
602
+
603
+ return_code: number;
604
+
605
+ stderr: string;
606
+
607
+ stdout: string;
608
+
609
+ type: 'code_execution_result';
610
+ }
611
+
612
+ export interface CodeExecutionTool20250522 {
613
+ /**
614
+ * Name of the tool.
615
+ *
616
+ * This is how the tool will be called by the model and in `tool_use` blocks.
617
+ */
618
+ name: 'code_execution';
619
+
620
+ type: 'code_execution_20250522';
621
+
622
+ allowed_callers?: Array<
623
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
624
+ >;
625
+
626
+ /**
627
+ * Create a cache control breakpoint at this content block.
628
+ */
629
+ cache_control?: CacheControlEphemeral | null;
630
+
631
+ /**
632
+ * If true, tool will not be included in initial system prompt. Only loaded when
633
+ * returned via tool_reference from tool search.
634
+ */
635
+ defer_loading?: boolean;
636
+
637
+ /**
638
+ * When true, guarantees schema validation on tool names and inputs
639
+ */
640
+ strict?: boolean;
641
+ }
642
+
643
+ export interface CodeExecutionTool20250825 {
644
+ /**
645
+ * Name of the tool.
646
+ *
647
+ * This is how the tool will be called by the model and in `tool_use` blocks.
648
+ */
649
+ name: 'code_execution';
650
+
651
+ type: 'code_execution_20250825';
652
+
653
+ allowed_callers?: Array<
654
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
655
+ >;
656
+
657
+ /**
658
+ * Create a cache control breakpoint at this content block.
659
+ */
660
+ cache_control?: CacheControlEphemeral | null;
661
+
662
+ /**
663
+ * If true, tool will not be included in initial system prompt. Only loaded when
664
+ * returned via tool_reference from tool search.
665
+ */
666
+ defer_loading?: boolean;
667
+
668
+ /**
669
+ * When true, guarantees schema validation on tool names and inputs
670
+ */
671
+ strict?: boolean;
672
+ }
673
+
674
+ /**
675
+ * Code execution tool with REPL state persistence (daemon mode + gVisor
676
+ * checkpoint).
677
+ */
678
+ export interface CodeExecutionTool20260120 {
679
+ /**
680
+ * Name of the tool.
681
+ *
682
+ * This is how the tool will be called by the model and in `tool_use` blocks.
683
+ */
684
+ name: 'code_execution';
685
+
686
+ type: 'code_execution_20260120';
687
+
688
+ allowed_callers?: Array<
689
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
690
+ >;
691
+
692
+ /**
693
+ * Create a cache control breakpoint at this content block.
694
+ */
695
+ cache_control?: CacheControlEphemeral | null;
696
+
697
+ /**
698
+ * If true, tool will not be included in initial system prompt. Only loaded when
699
+ * returned via tool_reference from tool search.
700
+ */
701
+ defer_loading?: boolean;
702
+
703
+ /**
704
+ * When true, guarantees schema validation on tool names and inputs
705
+ */
706
+ strict?: boolean;
707
+ }
708
+
709
+ /**
710
+ * Code execution tool with REPL state persistence.
711
+ */
712
+ export interface CodeExecutionTool20260521 {
713
+ /**
714
+ * Name of the tool.
715
+ *
716
+ * This is how the tool will be called by the model and in `tool_use` blocks.
717
+ */
718
+ name: 'code_execution';
719
+
720
+ type: 'code_execution_20260521';
721
+
722
+ allowed_callers?: Array<
723
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
724
+ >;
725
+
726
+ /**
727
+ * Create a cache control breakpoint at this content block.
728
+ */
729
+ cache_control?: CacheControlEphemeral | null;
730
+
731
+ /**
732
+ * If true, tool will not be included in initial system prompt. Only loaded when
733
+ * returned via tool_reference from tool search.
734
+ */
735
+ defer_loading?: boolean;
736
+
737
+ /**
738
+ * When true, guarantees schema validation on tool names and inputs
739
+ */
740
+ strict?: boolean;
741
+ }
742
+
743
+ export interface CodeExecutionToolResultBlock {
744
+ /**
745
+ * Code execution result with encrypted stdout for PFC + web_search results.
746
+ */
747
+ content: CodeExecutionToolResultBlockContent;
748
+
749
+ tool_use_id: string;
750
+
751
+ type: 'code_execution_tool_result';
752
+ }
753
+
754
+ /**
755
+ * Code execution result with encrypted stdout for PFC + web_search results.
756
+ */
757
+ export type CodeExecutionToolResultBlockContent =
758
+ | CodeExecutionToolResultError
759
+ | CodeExecutionResultBlock
760
+ | EncryptedCodeExecutionResultBlock;
761
+
762
+ export interface CodeExecutionToolResultBlockParam {
763
+ /**
764
+ * Code execution result with encrypted stdout for PFC + web_search results.
765
+ */
766
+ content: CodeExecutionToolResultBlockParamContent;
767
+
768
+ tool_use_id: string;
769
+
770
+ type: 'code_execution_tool_result';
771
+
772
+ /**
773
+ * Create a cache control breakpoint at this content block.
774
+ */
775
+ cache_control?: CacheControlEphemeral | null;
776
+ }
777
+
778
+ /**
779
+ * Code execution result with encrypted stdout for PFC + web_search results.
780
+ */
781
+ export type CodeExecutionToolResultBlockParamContent =
782
+ | CodeExecutionToolResultErrorParam
783
+ | CodeExecutionResultBlockParam
784
+ | EncryptedCodeExecutionResultBlockParam;
785
+
786
+ export interface CodeExecutionToolResultError {
787
+ error_code: CodeExecutionToolResultErrorCode;
788
+
789
+ type: 'code_execution_tool_result_error';
790
+ }
791
+
792
+ export type CodeExecutionToolResultErrorCode =
793
+ | 'invalid_tool_input'
794
+ | 'unavailable'
795
+ | 'too_many_requests'
796
+ | 'execution_time_exceeded';
797
+
798
+ export interface CodeExecutionToolResultErrorParam {
799
+ error_code: CodeExecutionToolResultErrorCode;
800
+
801
+ type: 'code_execution_tool_result_error';
802
+ }
803
+
804
+ /**
805
+ * Information about the container used in the request (for the code execution
806
+ * tool)
807
+ */
808
+ export interface Container {
809
+ /**
810
+ * Identifier for the container used in this request
811
+ */
812
+ id: string;
813
+
814
+ /**
815
+ * The time at which the container will expire.
816
+ */
817
+ expires_at: string;
818
+ }
819
+
820
+ /**
821
+ * Response model for a file uploaded to the container.
822
+ */
823
+ export interface ContainerUploadBlock {
824
+ file_id: string;
825
+
826
+ type: 'container_upload';
827
+ }
828
+
829
+ /**
830
+ * A content block that represents a file to be uploaded to the container Files
831
+ * uploaded via this block will be available in the container's input directory.
832
+ */
833
+ export interface ContainerUploadBlockParam {
834
+ file_id: string;
835
+
836
+ type: 'container_upload';
837
+
838
+ /**
839
+ * Create a cache control breakpoint at this content block.
840
+ */
841
+ cache_control?: CacheControlEphemeral | null;
842
+ }
843
+
844
+ /**
845
+ * Response model for a file uploaded to the container.
846
+ */
847
+ export type ContentBlock =
848
+ | TextBlock
849
+ | ThinkingBlock
850
+ | RedactedThinkingBlock
851
+ | ToolUseBlock
852
+ | ServerToolUseBlock
853
+ | WebSearchToolResultBlock
854
+ | WebFetchToolResultBlock
855
+ | CodeExecutionToolResultBlock
856
+ | BashCodeExecutionToolResultBlock
857
+ | TextEditorCodeExecutionToolResultBlock
858
+ | ToolSearchToolResultBlock
859
+ | ContainerUploadBlock;
860
+
861
+ /**
862
+ * Regular text content.
863
+ */
864
+ export type ContentBlockParam =
865
+ | TextBlockParam
866
+ | ImageBlockParam
867
+ | DocumentBlockParam
868
+ | SearchResultBlockParam
869
+ | ThinkingBlockParam
870
+ | RedactedThinkingBlockParam
871
+ | ToolUseBlockParam
872
+ | ToolResultBlockParam
873
+ | ServerToolUseBlockParam
874
+ | WebSearchToolResultBlockParam
875
+ | WebFetchToolResultBlockParam
876
+ | CodeExecutionToolResultBlockParam
877
+ | BashCodeExecutionToolResultBlockParam
878
+ | TextEditorCodeExecutionToolResultBlockParam
879
+ | ToolSearchToolResultBlockParam
880
+ | ContainerUploadBlockParam
881
+ | MidConversationSystemBlockParam;
882
+
883
+ export interface ContentBlockSource {
884
+ content: string | Array<ContentBlockSourceContent>;
885
+
886
+ type: 'content';
887
+ }
888
+
889
+ export type ContentBlockSourceContent = TextBlockParam | ImageBlockParam;
890
+
891
+ /**
892
+ * Tool invocation directly from the model.
893
+ */
894
+ export interface DirectCaller {
895
+ type: 'direct';
896
+ }
897
+
898
+ export interface DocumentBlock {
899
+ /**
900
+ * Citation configuration for the document
901
+ */
902
+ citations: CitationsConfig | null;
903
+
904
+ source: Base64PDFSource | PlainTextSource;
905
+
906
+ /**
907
+ * The title of the document
908
+ */
909
+ title: string | null;
910
+
911
+ type: 'document';
912
+ }
913
+
914
+ export interface DocumentBlockParam {
915
+ source: Base64PDFSource | PlainTextSource | ContentBlockSource | URLPDFSource;
916
+
917
+ type: 'document';
918
+
919
+ /**
920
+ * Create a cache control breakpoint at this content block.
921
+ */
922
+ cache_control?: CacheControlEphemeral | null;
923
+
924
+ citations?: CitationsConfigParam | null;
925
+
926
+ context?: string | null;
927
+
928
+ title?: string | null;
929
+ }
930
+
931
+ /**
932
+ * Code execution result with encrypted stdout for PFC + web_search results.
933
+ */
934
+ export interface EncryptedCodeExecutionResultBlock {
935
+ content: Array<CodeExecutionOutputBlock>;
936
+
937
+ encrypted_stdout: string;
938
+
939
+ return_code: number;
940
+
941
+ stderr: string;
942
+
943
+ type: 'encrypted_code_execution_result';
944
+ }
945
+
946
+ /**
947
+ * Code execution result with encrypted stdout for PFC + web_search results.
948
+ */
949
+ export interface EncryptedCodeExecutionResultBlockParam {
950
+ content: Array<CodeExecutionOutputBlockParam>;
951
+
952
+ encrypted_stdout: string;
953
+
954
+ return_code: number;
955
+
956
+ stderr: string;
957
+
958
+ type: 'encrypted_code_execution_result';
959
+ }
960
+
961
+ export interface ImageBlockParam {
962
+ source: Base64ImageSource | URLImageSource;
963
+
964
+ type: 'image';
965
+
966
+ /**
967
+ * Create a cache control breakpoint at this content block.
968
+ */
969
+ cache_control?: CacheControlEphemeral | null;
970
+ }
971
+
972
+ export interface InputJSONDelta {
973
+ partial_json: string;
974
+
975
+ type: 'input_json_delta';
976
+ }
977
+
978
+ export interface JSONOutputFormat {
979
+ /**
980
+ * The JSON schema of the format
981
+ */
982
+ schema: { [key: string]: unknown };
983
+
984
+ type: 'json_schema';
985
+ }
986
+
987
+ export interface MemoryTool20250818 {
988
+ /**
989
+ * Name of the tool.
990
+ *
991
+ * This is how the tool will be called by the model and in `tool_use` blocks.
992
+ */
993
+ name: 'memory';
994
+
995
+ type: 'memory_20250818';
996
+
997
+ allowed_callers?: Array<
998
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
999
+ >;
1000
+
1001
+ /**
1002
+ * Create a cache control breakpoint at this content block.
1003
+ */
1004
+ cache_control?: CacheControlEphemeral | null;
1005
+
1006
+ /**
1007
+ * If true, tool will not be included in initial system prompt. Only loaded when
1008
+ * returned via tool_reference from tool search.
1009
+ */
1010
+ defer_loading?: boolean;
1011
+
1012
+ input_examples?: Array<{ [key: string]: unknown }>;
1013
+
1014
+ /**
1015
+ * When true, guarantees schema validation on tool names and inputs
1016
+ */
1017
+ strict?: boolean;
1018
+ }
1019
+
1020
+ export interface Message {
1021
+ /**
1022
+ * Unique object identifier.
1023
+ *
1024
+ * The format and length of IDs may change over time.
1025
+ */
1026
+ id: string;
1027
+
1028
+ /**
1029
+ * Information about the container used in the request (for the code execution
1030
+ * tool)
1031
+ */
1032
+ container: Container | null;
1033
+
1034
+ /**
1035
+ * Content generated by the model.
1036
+ *
1037
+ * This is an array of content blocks, each of which has a `type` that determines
1038
+ * its shape.
1039
+ *
1040
+ * Example:
1041
+ *
1042
+ * ```json
1043
+ * [{ "type": "text", "text": "Hi, I'm Claude." }]
1044
+ * ```
1045
+ *
1046
+ * If the request input `messages` ended with an `assistant` turn, then the
1047
+ * response `content` will continue directly from that last turn. You can use this
1048
+ * to constrain the model's output.
1049
+ *
1050
+ * For example, if the input `messages` were:
1051
+ *
1052
+ * ```json
1053
+ * [
1054
+ * {
1055
+ * "role": "user",
1056
+ * "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
1057
+ * },
1058
+ * { "role": "assistant", "content": "The best answer is (" }
1059
+ * ]
1060
+ * ```
1061
+ *
1062
+ * Then the response `content` might be:
1063
+ *
1064
+ * ```json
1065
+ * [{ "type": "text", "text": "B)" }]
1066
+ * ```
1067
+ */
1068
+ content: Array<ContentBlock>;
1069
+
1070
+ /**
1071
+ * The model that will complete your prompt.
1072
+ *
1073
+ * See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
1074
+ * details and options.
1075
+ */
1076
+ model: Model;
1077
+
1078
+ /**
1079
+ * Conversational role of the generated message.
1080
+ *
1081
+ * This will always be `"assistant"`.
1082
+ */
1083
+ role: 'assistant';
1084
+
1085
+ /**
1086
+ * Structured information about a refusal.
1087
+ */
1088
+ stop_details: RefusalStopDetails | null;
1089
+
1090
+ /**
1091
+ * The reason that we stopped.
1092
+ *
1093
+ * This may be one the following values:
1094
+ *
1095
+ * - `"end_turn"`: the model reached a natural stopping point
1096
+ * - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
1097
+ * - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
1098
+ * - `"tool_use"`: the model invoked one or more tools
1099
+ * - `"pause_turn"`: we paused a long-running turn. You may provide the response
1100
+ * back as-is in a subsequent request to let the model continue.
1101
+ * - `"refusal"`: when streaming classifiers intervene to handle potential policy
1102
+ * violations
1103
+ *
1104
+ * In non-streaming mode this value is always non-null. In streaming mode, it is
1105
+ * null in the `message_start` event and non-null otherwise.
1106
+ */
1107
+ stop_reason: StopReason | null;
1108
+
1109
+ /**
1110
+ * Which custom stop sequence was generated, if any.
1111
+ *
1112
+ * This value will be a non-null string if one of your custom stop sequences was
1113
+ * generated.
1114
+ */
1115
+ stop_sequence: string | null;
1116
+
1117
+ /**
1118
+ * Object type.
1119
+ *
1120
+ * For Messages, this is always `"message"`.
1121
+ */
1122
+ type: 'message';
1123
+
1124
+ /**
1125
+ * Billing and rate-limit usage.
1126
+ *
1127
+ * Anthropic's API bills and rate-limits by token counts, as tokens represent the
1128
+ * underlying cost to our systems.
1129
+ *
1130
+ * Under the hood, the API transforms requests into a format suitable for the
1131
+ * model. The model's output then goes through a parsing stage before becoming an
1132
+ * API response. As a result, the token counts in `usage` will not match one-to-one
1133
+ * with the exact visible content of an API request or response.
1134
+ *
1135
+ * For example, `output_tokens` will be non-zero, even for an empty string response
1136
+ * from Claude.
1137
+ *
1138
+ * Total input tokens in a request is the summation of `input_tokens`,
1139
+ * `cache_creation_input_tokens`, and `cache_read_input_tokens`.
1140
+ */
1141
+ usage: Usage;
1142
+ }
1143
+
1144
+ /**
1145
+ * Code execution tool with REPL state persistence (daemon mode + gVisor
1146
+ * checkpoint).
1147
+ */
1148
+ export type MessageCountTokensTool =
1149
+ | Tool
1150
+ | ToolBash20250124
1151
+ | CodeExecutionTool20250522
1152
+ | CodeExecutionTool20250825
1153
+ | CodeExecutionTool20260120
1154
+ | CodeExecutionTool20260521
1155
+ | MemoryTool20250818
1156
+ | ToolTextEditor20250124
1157
+ | ToolTextEditor20250429
1158
+ | ToolTextEditor20250728
1159
+ | WebSearchTool20250305
1160
+ | WebFetchTool20250910
1161
+ | WebSearchTool20260209
1162
+ | WebFetchTool20260209
1163
+ | WebFetchTool20260309
1164
+ | WebSearchTool20260318
1165
+ | WebFetchTool20260318
1166
+ | ToolSearchToolBm25_20251119
1167
+ | ToolSearchToolRegex20251119;
1168
+
1169
+ export interface MessageDeltaUsage {
1170
+ /**
1171
+ * The cumulative number of input tokens used to create the cache entry.
1172
+ */
1173
+ cache_creation_input_tokens: number | null;
1174
+
1175
+ /**
1176
+ * The cumulative number of input tokens read from the cache.
1177
+ */
1178
+ cache_read_input_tokens: number | null;
1179
+
1180
+ /**
1181
+ * The cumulative number of input tokens which were used.
1182
+ */
1183
+ input_tokens: number | null;
1184
+
1185
+ /**
1186
+ * The cumulative number of output tokens which were used.
1187
+ */
1188
+ output_tokens: number;
1189
+
1190
+ /**
1191
+ * Breakdown of output tokens by category.
1192
+ *
1193
+ * `output_tokens` remains the inclusive, authoritative total used for billing.
1194
+ * This object provides a read-only decomposition for observability — for example,
1195
+ * how many of the billed output tokens were spent on internal reasoning that may
1196
+ * have been summarized before being returned to you.
1197
+ */
1198
+ output_tokens_details: OutputTokensDetails | null;
1199
+
1200
+ /**
1201
+ * The number of server tool requests.
1202
+ */
1203
+ server_tool_use: ServerToolUsage | null;
1204
+ }
1205
+
1206
+ export interface MessageParam {
1207
+ content: string | Array<ContentBlockParam>;
1208
+
1209
+ role: 'user' | 'assistant' | 'system';
1210
+ }
1211
+
1212
+ export interface MessageTokensCount {
1213
+ /**
1214
+ * The total number of tokens across the provided list of messages, system prompt,
1215
+ * and tools.
1216
+ */
1217
+ input_tokens: number;
1218
+ }
1219
+
1220
+ export interface Metadata {
1221
+ /**
1222
+ * An external identifier for the user who is associated with the request.
1223
+ *
1224
+ * This should be a uuid, hash value, or other opaque identifier. Anthropic may use
1225
+ * this id to help detect abuse. Do not include any identifying information such as
1226
+ * name, email address, or phone number.
1227
+ */
1228
+ user_id?: string | null;
1229
+ }
1230
+
1231
+ /**
1232
+ * System instructions that appear mid-conversation.
1233
+ *
1234
+ * Use this block to provide or update system-level instructions at a specific
1235
+ * point in the conversation, rather than only via the top-level `system`
1236
+ * parameter.
1237
+ */
1238
+ export interface MidConversationSystemBlockParam {
1239
+ /**
1240
+ * System instruction text blocks.
1241
+ */
1242
+ content: Array<TextBlockParam>;
1243
+
1244
+ type: 'mid_conv_system';
1245
+
1246
+ /**
1247
+ * Create a cache control breakpoint at this content block.
1248
+ */
1249
+ cache_control?: CacheControlEphemeral | null;
1250
+ }
1251
+
1252
+ /**
1253
+ * The model that will complete your prompt.
1254
+ *
1255
+ * See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
1256
+ * details and options.
1257
+ */
1258
+ export type Model =
1259
+ | 'claude-sonnet-5'
1260
+ | 'claude-fable-5'
1261
+ | 'claude-mythos-5'
1262
+ | 'claude-opus-4-8'
1263
+ | 'claude-opus-4-7'
1264
+ | 'claude-mythos-preview'
1265
+ | 'claude-opus-4-6'
1266
+ | 'claude-sonnet-4-6'
1267
+ | 'claude-haiku-4-5'
1268
+ | 'claude-haiku-4-5-20251001'
1269
+ | 'claude-opus-4-5'
1270
+ | 'claude-opus-4-5-20251101'
1271
+ | 'claude-sonnet-4-5'
1272
+ | 'claude-sonnet-4-5-20250929'
1273
+ | 'claude-opus-4-1'
1274
+ | 'claude-opus-4-1-20250805'
1275
+ | (string & {});
1276
+
1277
+ export interface OutputConfig {
1278
+ /**
1279
+ * All possible effort levels.
1280
+ */
1281
+ effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | null;
1282
+
1283
+ /**
1284
+ * A schema to specify Claude's output format in responses. See
1285
+ * [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
1286
+ */
1287
+ format?: JSONOutputFormat | null;
1288
+ }
1289
+
1290
+ export interface OutputTokensDetails {
1291
+ /**
1292
+ * Number of output tokens the model generated as internal reasoning, including the
1293
+ * thinking-block delimiter tokens.
1294
+ *
1295
+ * Reflects the raw reasoning the model produced, not the (possibly shorter)
1296
+ * summarized thinking text returned in the response body. Computed by
1297
+ * re-tokenizing the raw reasoning text, so it may differ from the model's exact
1298
+ * generation count by a small number of tokens. Always ≤ `output_tokens`;
1299
+ * `output_tokens - thinking_tokens` approximates the non-reasoning output.
1300
+ */
1301
+ thinking_tokens: number;
1302
+ }
1303
+ const DEPRECATED_MODELS: {
1304
+ [K in Model]?: string;
1305
+ } = {
1306
+ 'claude-1.3': 'November 6th, 2024',
1307
+ 'claude-1.3-100k': 'November 6th, 2024',
1308
+ 'claude-instant-1.1': 'November 6th, 2024',
1309
+ 'claude-instant-1.1-100k': 'November 6th, 2024',
1310
+ 'claude-instant-1.2': 'November 6th, 2024',
1311
+ 'claude-3-sonnet-20240229': 'July 21st, 2025',
1312
+ 'claude-3-opus-20240229': 'January 5th, 2026',
1313
+ 'claude-2.1': 'July 21st, 2025',
1314
+ 'claude-2.0': 'July 21st, 2025',
1315
+ 'claude-3-7-sonnet-latest': 'February 19th, 2026',
1316
+ 'claude-3-7-sonnet-20250219': 'February 19th, 2026',
1317
+ 'claude-3-5-haiku-latest': 'February 19th, 2026',
1318
+ 'claude-3-5-haiku-20241022': 'February 19th, 2026',
1319
+ 'claude-opus-4-0': 'June 15th, 2026',
1320
+ 'claude-opus-4-20250514': 'June 15th, 2026',
1321
+ 'claude-sonnet-4-0': 'June 15th, 2026',
1322
+ 'claude-sonnet-4-20250514': 'June 15th, 2026',
1323
+ 'claude-opus-4-1': 'August 5th, 2026',
1324
+ 'claude-opus-4-1-20250805': 'August 5th, 2026',
1325
+ 'claude-mythos-preview': 'June 30th, 2026',
1326
+ };
1327
+
1328
+ const MODELS_TO_WARN_WITH_THINKING_ENABLED: Model[] = ['claude-mythos-preview', 'claude-opus-4-6'];
1329
+
1330
+ export interface PlainTextSource {
1331
+ data: string;
1332
+
1333
+ media_type: 'text/plain';
1334
+
1335
+ type: 'text';
1336
+ }
1337
+
1338
+ export type RawContentBlockDelta =
1339
+ | TextDelta
1340
+ | InputJSONDelta
1341
+ | CitationsDelta
1342
+ | ThinkingDelta
1343
+ | SignatureDelta;
1344
+
1345
+ export interface RawContentBlockDeltaEvent {
1346
+ delta: RawContentBlockDelta;
1347
+
1348
+ index: number;
1349
+
1350
+ type: 'content_block_delta';
1351
+ }
1352
+
1353
+ export interface RawContentBlockStartEvent {
1354
+ /**
1355
+ * Response model for a file uploaded to the container.
1356
+ */
1357
+ content_block:
1358
+ | TextBlock
1359
+ | ThinkingBlock
1360
+ | RedactedThinkingBlock
1361
+ | ToolUseBlock
1362
+ | ServerToolUseBlock
1363
+ | WebSearchToolResultBlock
1364
+ | WebFetchToolResultBlock
1365
+ | CodeExecutionToolResultBlock
1366
+ | BashCodeExecutionToolResultBlock
1367
+ | TextEditorCodeExecutionToolResultBlock
1368
+ | ToolSearchToolResultBlock
1369
+ | ContainerUploadBlock;
1370
+
1371
+ index: number;
1372
+
1373
+ type: 'content_block_start';
1374
+ }
1375
+
1376
+ export interface RawContentBlockStopEvent {
1377
+ index: number;
1378
+
1379
+ type: 'content_block_stop';
1380
+ }
1381
+
1382
+ export interface RawMessageDeltaEvent {
1383
+ delta: RawMessageDeltaEvent.Delta;
1384
+
1385
+ type: 'message_delta';
1386
+
1387
+ /**
1388
+ * Billing and rate-limit usage.
1389
+ *
1390
+ * Anthropic's API bills and rate-limits by token counts, as tokens represent the
1391
+ * underlying cost to our systems.
1392
+ *
1393
+ * Under the hood, the API transforms requests into a format suitable for the
1394
+ * model. The model's output then goes through a parsing stage before becoming an
1395
+ * API response. As a result, the token counts in `usage` will not match one-to-one
1396
+ * with the exact visible content of an API request or response.
1397
+ *
1398
+ * For example, `output_tokens` will be non-zero, even for an empty string response
1399
+ * from Claude.
1400
+ *
1401
+ * Total input tokens in a request is the summation of `input_tokens`,
1402
+ * `cache_creation_input_tokens`, and `cache_read_input_tokens`.
1403
+ */
1404
+ usage: MessageDeltaUsage;
1405
+ }
1406
+
1407
+ export namespace RawMessageDeltaEvent {
1408
+ export interface Delta {
1409
+ /**
1410
+ * Information about the container used in the request (for the code execution
1411
+ * tool)
1412
+ */
1413
+ container: MessagesAPI.Container | null;
1414
+
1415
+ /**
1416
+ * Structured information about a refusal.
1417
+ */
1418
+ stop_details: MessagesAPI.RefusalStopDetails | null;
1419
+
1420
+ stop_reason: MessagesAPI.StopReason | null;
1421
+
1422
+ stop_sequence: string | null;
1423
+ }
1424
+ }
1425
+
1426
+ export interface RawMessageStartEvent {
1427
+ message: Message;
1428
+
1429
+ type: 'message_start';
1430
+ }
1431
+
1432
+ export interface RawMessageStopEvent {
1433
+ type: 'message_stop';
1434
+ }
1435
+
1436
+ export type RawMessageStreamEvent =
1437
+ | RawMessageStartEvent
1438
+ | RawMessageDeltaEvent
1439
+ | RawMessageStopEvent
1440
+ | RawContentBlockStartEvent
1441
+ | RawContentBlockDeltaEvent
1442
+ | RawContentBlockStopEvent;
1443
+
1444
+ export interface RedactedThinkingBlock {
1445
+ data: string;
1446
+
1447
+ type: 'redacted_thinking';
1448
+ }
1449
+
1450
+ export interface RedactedThinkingBlockParam {
1451
+ data: string;
1452
+
1453
+ type: 'redacted_thinking';
1454
+ }
1455
+
1456
+ /**
1457
+ * Structured information about a refusal.
1458
+ */
1459
+ export interface RefusalStopDetails {
1460
+ /**
1461
+ * The policy category that triggered a refusal.
1462
+ */
1463
+ category: 'cyber' | 'bio' | 'frontier_llm' | 'reasoning_extraction' | null;
1464
+
1465
+ /**
1466
+ * Human-readable explanation of the refusal.
1467
+ *
1468
+ * This text is not guaranteed to be stable. `null` when no explanation is
1469
+ * available for the category.
1470
+ */
1471
+ explanation: string | null;
1472
+
1473
+ type: 'refusal';
1474
+ }
1475
+
1476
+ export interface SearchResultBlockParam {
1477
+ content: Array<TextBlockParam>;
1478
+
1479
+ source: string;
1480
+
1481
+ title: string;
1482
+
1483
+ type: 'search_result';
1484
+
1485
+ /**
1486
+ * Create a cache control breakpoint at this content block.
1487
+ */
1488
+ cache_control?: CacheControlEphemeral | null;
1489
+
1490
+ citations?: CitationsConfigParam;
1491
+ }
1492
+
1493
+ /**
1494
+ * Tool invocation generated by a server-side tool.
1495
+ */
1496
+ export interface ServerToolCaller {
1497
+ tool_id: string;
1498
+
1499
+ type: 'code_execution_20250825';
1500
+ }
1501
+
1502
+ export interface ServerToolCaller20260120 {
1503
+ tool_id: string;
1504
+
1505
+ type: 'code_execution_20260120';
1506
+ }
1507
+
1508
+ export interface ServerToolUsage {
1509
+ /**
1510
+ * The number of web fetch tool requests.
1511
+ */
1512
+ web_fetch_requests: number;
1513
+
1514
+ /**
1515
+ * The number of web search tool requests.
1516
+ */
1517
+ web_search_requests: number;
1518
+ }
1519
+
1520
+ export interface ServerToolUseBlock {
1521
+ id: string;
1522
+
1523
+ /**
1524
+ * Tool invocation directly from the model.
1525
+ */
1526
+ caller: DirectCaller | ServerToolCaller | ServerToolCaller20260120;
1527
+
1528
+ input: unknown;
1529
+
1530
+ name:
1531
+ | 'web_search'
1532
+ | 'web_fetch'
1533
+ | 'code_execution'
1534
+ | 'bash_code_execution'
1535
+ | 'text_editor_code_execution'
1536
+ | 'tool_search_tool_regex'
1537
+ | 'tool_search_tool_bm25';
1538
+
1539
+ type: 'server_tool_use';
1540
+ }
1541
+
1542
+ export interface ServerToolUseBlockParam {
1543
+ id: string;
1544
+
1545
+ input: unknown;
1546
+
1547
+ name:
1548
+ | 'web_search'
1549
+ | 'web_fetch'
1550
+ | 'code_execution'
1551
+ | 'bash_code_execution'
1552
+ | 'text_editor_code_execution'
1553
+ | 'tool_search_tool_regex'
1554
+ | 'tool_search_tool_bm25';
1555
+
1556
+ type: 'server_tool_use';
1557
+
1558
+ /**
1559
+ * Create a cache control breakpoint at this content block.
1560
+ */
1561
+ cache_control?: CacheControlEphemeral | null;
1562
+
1563
+ /**
1564
+ * Tool invocation directly from the model.
1565
+ */
1566
+ caller?: DirectCaller | ServerToolCaller | ServerToolCaller20260120;
1567
+ }
1568
+
1569
+ export interface SignatureDelta {
1570
+ signature: string;
1571
+
1572
+ type: 'signature_delta';
1573
+ }
1574
+
1575
+ export type StopReason = 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | 'pause_turn' | 'refusal';
1576
+
1577
+ export interface TextBlock {
1578
+ /**
1579
+ * Citations supporting the text block.
1580
+ *
1581
+ * The type of citation returned will depend on the type of document being cited.
1582
+ * Citing a PDF results in `page_location`, plain text results in `char_location`,
1583
+ * and content document results in `content_block_location`.
1584
+ */
1585
+ citations: Array<TextCitation> | null;
1586
+
1587
+ text: string;
1588
+
1589
+ type: 'text';
1590
+ }
1591
+
1592
+ export interface TextBlockParam {
1593
+ text: string;
1594
+
1595
+ type: 'text';
1596
+
1597
+ /**
1598
+ * Create a cache control breakpoint at this content block.
1599
+ */
1600
+ cache_control?: CacheControlEphemeral | null;
1601
+
1602
+ citations?: Array<TextCitationParam> | null;
1603
+ }
1604
+
1605
+ export type TextCitation =
1606
+ | CitationCharLocation
1607
+ | CitationPageLocation
1608
+ | CitationContentBlockLocation
1609
+ | CitationsWebSearchResultLocation
1610
+ | CitationsSearchResultLocation;
1611
+
1612
+ export type TextCitationParam =
1613
+ | CitationCharLocationParam
1614
+ | CitationPageLocationParam
1615
+ | CitationContentBlockLocationParam
1616
+ | CitationWebSearchResultLocationParam
1617
+ | CitationSearchResultLocationParam;
1618
+
1619
+ export interface TextDelta {
1620
+ text: string;
1621
+
1622
+ type: 'text_delta';
1623
+ }
1624
+
1625
+ export interface TextEditorCodeExecutionCreateResultBlock {
1626
+ is_file_update: boolean;
1627
+
1628
+ type: 'text_editor_code_execution_create_result';
1629
+ }
1630
+
1631
+ export interface TextEditorCodeExecutionCreateResultBlockParam {
1632
+ is_file_update: boolean;
1633
+
1634
+ type: 'text_editor_code_execution_create_result';
1635
+ }
1636
+
1637
+ export interface TextEditorCodeExecutionStrReplaceResultBlock {
1638
+ lines: Array<string> | null;
1639
+
1640
+ new_lines: number | null;
1641
+
1642
+ new_start: number | null;
1643
+
1644
+ old_lines: number | null;
1645
+
1646
+ old_start: number | null;
1647
+
1648
+ type: 'text_editor_code_execution_str_replace_result';
1649
+ }
1650
+
1651
+ export interface TextEditorCodeExecutionStrReplaceResultBlockParam {
1652
+ type: 'text_editor_code_execution_str_replace_result';
1653
+
1654
+ lines?: Array<string> | null;
1655
+
1656
+ new_lines?: number | null;
1657
+
1658
+ new_start?: number | null;
1659
+
1660
+ old_lines?: number | null;
1661
+
1662
+ old_start?: number | null;
1663
+ }
1664
+
1665
+ export interface TextEditorCodeExecutionToolResultBlock {
1666
+ content:
1667
+ | TextEditorCodeExecutionToolResultError
1668
+ | TextEditorCodeExecutionViewResultBlock
1669
+ | TextEditorCodeExecutionCreateResultBlock
1670
+ | TextEditorCodeExecutionStrReplaceResultBlock;
1671
+
1672
+ tool_use_id: string;
1673
+
1674
+ type: 'text_editor_code_execution_tool_result';
1675
+ }
1676
+
1677
+ export interface TextEditorCodeExecutionToolResultBlockParam {
1678
+ content:
1679
+ | TextEditorCodeExecutionToolResultErrorParam
1680
+ | TextEditorCodeExecutionViewResultBlockParam
1681
+ | TextEditorCodeExecutionCreateResultBlockParam
1682
+ | TextEditorCodeExecutionStrReplaceResultBlockParam;
1683
+
1684
+ tool_use_id: string;
1685
+
1686
+ type: 'text_editor_code_execution_tool_result';
1687
+
1688
+ /**
1689
+ * Create a cache control breakpoint at this content block.
1690
+ */
1691
+ cache_control?: CacheControlEphemeral | null;
1692
+ }
1693
+
1694
+ export interface TextEditorCodeExecutionToolResultError {
1695
+ error_code: TextEditorCodeExecutionToolResultErrorCode;
1696
+
1697
+ error_message: string | null;
1698
+
1699
+ type: 'text_editor_code_execution_tool_result_error';
1700
+ }
1701
+
1702
+ export type TextEditorCodeExecutionToolResultErrorCode =
1703
+ | 'invalid_tool_input'
1704
+ | 'unavailable'
1705
+ | 'too_many_requests'
1706
+ | 'execution_time_exceeded'
1707
+ | 'file_not_found';
1708
+
1709
+ export interface TextEditorCodeExecutionToolResultErrorParam {
1710
+ error_code: TextEditorCodeExecutionToolResultErrorCode;
1711
+
1712
+ type: 'text_editor_code_execution_tool_result_error';
1713
+
1714
+ error_message?: string | null;
1715
+ }
1716
+
1717
+ export interface TextEditorCodeExecutionViewResultBlock {
1718
+ content: string;
1719
+
1720
+ file_type: 'text' | 'image' | 'pdf';
1721
+
1722
+ num_lines: number | null;
1723
+
1724
+ start_line: number | null;
1725
+
1726
+ total_lines: number | null;
1727
+
1728
+ type: 'text_editor_code_execution_view_result';
1729
+ }
1730
+
1731
+ export interface TextEditorCodeExecutionViewResultBlockParam {
1732
+ content: string;
1733
+
1734
+ file_type: 'text' | 'image' | 'pdf';
1735
+
1736
+ type: 'text_editor_code_execution_view_result';
1737
+
1738
+ num_lines?: number | null;
1739
+
1740
+ start_line?: number | null;
1741
+
1742
+ total_lines?: number | null;
1743
+ }
1744
+
1745
+ export interface ThinkingBlock {
1746
+ signature: string;
1747
+
1748
+ thinking: string;
1749
+
1750
+ type: 'thinking';
1751
+ }
1752
+
1753
+ export interface ThinkingBlockParam {
1754
+ signature: string;
1755
+
1756
+ thinking: string;
1757
+
1758
+ type: 'thinking';
1759
+ }
1760
+
1761
+ export interface ThinkingConfigAdaptive {
1762
+ type: 'adaptive';
1763
+
1764
+ /**
1765
+ * Controls how thinking content appears in the response. When set to `summarized`,
1766
+ * thinking is returned normally. When set to `omitted`, thinking content is
1767
+ * redacted but a signature is returned for multi-turn continuity. Defaults to
1768
+ * `summarized`.
1769
+ */
1770
+ display?: 'summarized' | 'omitted' | null;
1771
+ }
1772
+
1773
+ export interface ThinkingConfigDisabled {
1774
+ type: 'disabled';
1775
+ }
1776
+
1777
+ export interface ThinkingConfigEnabled {
1778
+ /**
1779
+ * Determines how many tokens Claude can use for its internal reasoning process.
1780
+ * Larger budgets can enable more thorough analysis for complex problems, improving
1781
+ * response quality.
1782
+ *
1783
+ * Must be ≥1024 and less than `max_tokens`.
1784
+ *
1785
+ * See
1786
+ * [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
1787
+ * for details.
1788
+ */
1789
+ budget_tokens: number;
1790
+
1791
+ type: 'enabled';
1792
+
1793
+ /**
1794
+ * Controls how thinking content appears in the response. When set to `summarized`,
1795
+ * thinking is returned normally. When set to `omitted`, thinking content is
1796
+ * redacted but a signature is returned for multi-turn continuity. Defaults to
1797
+ * `summarized`.
1798
+ */
1799
+ display?: 'summarized' | 'omitted' | null;
1800
+ }
1801
+
1802
+ /**
1803
+ * Configuration for enabling Claude's extended thinking.
1804
+ *
1805
+ * When enabled, responses include `thinking` content blocks showing Claude's
1806
+ * thinking process before the final answer. Requires a minimum budget of 1,024
1807
+ * tokens and counts towards your `max_tokens` limit.
1808
+ *
1809
+ * See
1810
+ * [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
1811
+ * for details.
1812
+ */
1813
+ export type ThinkingConfigParam = ThinkingConfigEnabled | ThinkingConfigDisabled | ThinkingConfigAdaptive;
1814
+
1815
+ export interface ThinkingDelta {
1816
+ thinking: string;
1817
+
1818
+ type: 'thinking_delta';
1819
+ }
1820
+
1821
+ export interface Tool {
1822
+ /**
1823
+ * [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
1824
+ *
1825
+ * This defines the shape of the `input` that your tool accepts and that the model
1826
+ * will produce.
1827
+ */
1828
+ input_schema: Tool.InputSchema;
1829
+
1830
+ /**
1831
+ * Name of the tool.
1832
+ *
1833
+ * This is how the tool will be called by the model and in `tool_use` blocks.
1834
+ */
1835
+ name: string;
1836
+
1837
+ allowed_callers?: Array<
1838
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
1839
+ >;
1840
+
1841
+ /**
1842
+ * Create a cache control breakpoint at this content block.
1843
+ */
1844
+ cache_control?: CacheControlEphemeral | null;
1845
+
1846
+ /**
1847
+ * If true, tool will not be included in initial system prompt. Only loaded when
1848
+ * returned via tool_reference from tool search.
1849
+ */
1850
+ defer_loading?: boolean;
1851
+
1852
+ /**
1853
+ * Description of what this tool does.
1854
+ *
1855
+ * Tool descriptions should be as detailed as possible. The more information that
1856
+ * the model has about what the tool is and how to use it, the better it will
1857
+ * perform. You can use natural language descriptions to reinforce important
1858
+ * aspects of the tool input JSON schema.
1859
+ */
1860
+ description?: string;
1861
+
1862
+ /**
1863
+ * Enable eager input streaming for this tool. When true, tool input parameters
1864
+ * will be streamed incrementally as they are generated, and types will be inferred
1865
+ * on-the-fly rather than buffering the full JSON output. When false, streaming is
1866
+ * disabled for this tool even if the fine-grained-tool-streaming beta is active.
1867
+ * When null (default), uses the default behavior based on beta headers.
1868
+ */
1869
+ eager_input_streaming?: boolean | null;
1870
+
1871
+ input_examples?: Array<{ [key: string]: unknown }>;
1872
+
1873
+ /**
1874
+ * When true, guarantees schema validation on tool names and inputs
1875
+ */
1876
+ strict?: boolean;
1877
+
1878
+ type?: 'custom' | null;
1879
+ }
1880
+
1881
+ export namespace Tool {
1882
+ /**
1883
+ * [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
1884
+ *
1885
+ * This defines the shape of the `input` that your tool accepts and that the model
1886
+ * will produce.
1887
+ */
1888
+ export interface InputSchema {
1889
+ type: 'object';
1890
+
1891
+ properties?: unknown | null;
1892
+
1893
+ required?: Array<string> | null;
1894
+
1895
+ [k: string]: unknown;
1896
+ }
1897
+ }
1898
+
1899
+ export interface ToolBash20250124 {
1900
+ /**
1901
+ * Name of the tool.
1902
+ *
1903
+ * This is how the tool will be called by the model and in `tool_use` blocks.
1904
+ */
1905
+ name: 'bash';
1906
+
1907
+ type: 'bash_20250124';
1908
+
1909
+ allowed_callers?: Array<
1910
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
1911
+ >;
1912
+
1913
+ /**
1914
+ * Create a cache control breakpoint at this content block.
1915
+ */
1916
+ cache_control?: CacheControlEphemeral | null;
1917
+
1918
+ /**
1919
+ * If true, tool will not be included in initial system prompt. Only loaded when
1920
+ * returned via tool_reference from tool search.
1921
+ */
1922
+ defer_loading?: boolean;
1923
+
1924
+ input_examples?: Array<{ [key: string]: unknown }>;
1925
+
1926
+ /**
1927
+ * When true, guarantees schema validation on tool names and inputs
1928
+ */
1929
+ strict?: boolean;
1930
+ }
1931
+
1932
+ /**
1933
+ * How the model should use the provided tools. The model can use a specific tool,
1934
+ * any available tool, decide by itself, or not use tools at all.
1935
+ */
1936
+ export type ToolChoice = ToolChoiceAuto | ToolChoiceAny | ToolChoiceTool | ToolChoiceNone;
1937
+
1938
+ /**
1939
+ * The model will use any available tools.
1940
+ */
1941
+ export interface ToolChoiceAny {
1942
+ type: 'any';
1943
+
1944
+ /**
1945
+ * Whether to disable parallel tool use.
1946
+ *
1947
+ * Defaults to `false`. If set to `true`, the model will output exactly one tool
1948
+ * use.
1949
+ */
1950
+ disable_parallel_tool_use?: boolean;
1951
+ }
1952
+
1953
+ /**
1954
+ * The model will automatically decide whether to use tools.
1955
+ */
1956
+ export interface ToolChoiceAuto {
1957
+ type: 'auto';
1958
+
1959
+ /**
1960
+ * Whether to disable parallel tool use.
1961
+ *
1962
+ * Defaults to `false`. If set to `true`, the model will output at most one tool
1963
+ * use.
1964
+ */
1965
+ disable_parallel_tool_use?: boolean;
1966
+ }
1967
+
1968
+ /**
1969
+ * The model will not be allowed to use tools.
1970
+ */
1971
+ export interface ToolChoiceNone {
1972
+ type: 'none';
1973
+ }
1974
+
1975
+ /**
1976
+ * The model will use the specified tool with `tool_choice.name`.
1977
+ */
1978
+ export interface ToolChoiceTool {
1979
+ /**
1980
+ * The name of the tool to use.
1981
+ */
1982
+ name: string;
1983
+
1984
+ type: 'tool';
1985
+
1986
+ /**
1987
+ * Whether to disable parallel tool use.
1988
+ *
1989
+ * Defaults to `false`. If set to `true`, the model will output exactly one tool
1990
+ * use.
1991
+ */
1992
+ disable_parallel_tool_use?: boolean;
1993
+ }
1994
+
1995
+ export interface ToolReferenceBlock {
1996
+ tool_name: string;
1997
+
1998
+ type: 'tool_reference';
1999
+ }
2000
+
2001
+ /**
2002
+ * Tool reference block that can be included in tool_result content.
2003
+ */
2004
+ export interface ToolReferenceBlockParam {
2005
+ tool_name: string;
2006
+
2007
+ type: 'tool_reference';
2008
+
2009
+ /**
2010
+ * Create a cache control breakpoint at this content block.
2011
+ */
2012
+ cache_control?: CacheControlEphemeral | null;
2013
+ }
2014
+
2015
+ export interface ToolResultBlockParam {
2016
+ tool_use_id: string;
2017
+
2018
+ type: 'tool_result';
2019
+
2020
+ /**
2021
+ * Create a cache control breakpoint at this content block.
2022
+ */
2023
+ cache_control?: CacheControlEphemeral | null;
2024
+
2025
+ content?:
2026
+ | string
2027
+ | Array<
2028
+ | TextBlockParam
2029
+ | ImageBlockParam
2030
+ | SearchResultBlockParam
2031
+ | DocumentBlockParam
2032
+ | ToolReferenceBlockParam
2033
+ >;
2034
+
2035
+ is_error?: boolean;
2036
+ }
2037
+
2038
+ export interface ToolSearchToolBm25_20251119 {
2039
+ /**
2040
+ * Name of the tool.
2041
+ *
2042
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2043
+ */
2044
+ name: 'tool_search_tool_bm25';
2045
+
2046
+ type: 'tool_search_tool_bm25_20251119' | 'tool_search_tool_bm25';
2047
+
2048
+ allowed_callers?: Array<
2049
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2050
+ >;
2051
+
2052
+ /**
2053
+ * Create a cache control breakpoint at this content block.
2054
+ */
2055
+ cache_control?: CacheControlEphemeral | null;
2056
+
2057
+ /**
2058
+ * If true, tool will not be included in initial system prompt. Only loaded when
2059
+ * returned via tool_reference from tool search.
2060
+ */
2061
+ defer_loading?: boolean;
2062
+
2063
+ /**
2064
+ * When true, guarantees schema validation on tool names and inputs
2065
+ */
2066
+ strict?: boolean;
2067
+ }
2068
+
2069
+ export interface ToolSearchToolRegex20251119 {
2070
+ /**
2071
+ * Name of the tool.
2072
+ *
2073
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2074
+ */
2075
+ name: 'tool_search_tool_regex';
2076
+
2077
+ type: 'tool_search_tool_regex_20251119' | 'tool_search_tool_regex';
2078
+
2079
+ allowed_callers?: Array<
2080
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2081
+ >;
2082
+
2083
+ /**
2084
+ * Create a cache control breakpoint at this content block.
2085
+ */
2086
+ cache_control?: CacheControlEphemeral | null;
2087
+
2088
+ /**
2089
+ * If true, tool will not be included in initial system prompt. Only loaded when
2090
+ * returned via tool_reference from tool search.
2091
+ */
2092
+ defer_loading?: boolean;
2093
+
2094
+ /**
2095
+ * When true, guarantees schema validation on tool names and inputs
2096
+ */
2097
+ strict?: boolean;
2098
+ }
2099
+
2100
+ export interface ToolSearchToolResultBlock {
2101
+ content: ToolSearchToolResultError | ToolSearchToolSearchResultBlock;
2102
+
2103
+ tool_use_id: string;
2104
+
2105
+ type: 'tool_search_tool_result';
2106
+ }
2107
+
2108
+ export interface ToolSearchToolResultBlockParam {
2109
+ content: ToolSearchToolResultErrorParam | ToolSearchToolSearchResultBlockParam;
2110
+
2111
+ tool_use_id: string;
2112
+
2113
+ type: 'tool_search_tool_result';
2114
+
2115
+ /**
2116
+ * Create a cache control breakpoint at this content block.
2117
+ */
2118
+ cache_control?: CacheControlEphemeral | null;
2119
+ }
2120
+
2121
+ export interface ToolSearchToolResultError {
2122
+ error_code: ToolSearchToolResultErrorCode;
2123
+
2124
+ error_message: string | null;
2125
+
2126
+ type: 'tool_search_tool_result_error';
2127
+ }
2128
+
2129
+ export type ToolSearchToolResultErrorCode =
2130
+ | 'invalid_tool_input'
2131
+ | 'unavailable'
2132
+ | 'too_many_requests'
2133
+ | 'execution_time_exceeded';
2134
+
2135
+ export interface ToolSearchToolResultErrorParam {
2136
+ error_code: ToolSearchToolResultErrorCode;
2137
+
2138
+ type: 'tool_search_tool_result_error';
2139
+
2140
+ error_message?: string | null;
2141
+ }
2142
+
2143
+ export interface ToolSearchToolSearchResultBlock {
2144
+ tool_references: Array<ToolReferenceBlock>;
2145
+
2146
+ type: 'tool_search_tool_search_result';
2147
+ }
2148
+
2149
+ export interface ToolSearchToolSearchResultBlockParam {
2150
+ tool_references: Array<ToolReferenceBlockParam>;
2151
+
2152
+ type: 'tool_search_tool_search_result';
2153
+ }
2154
+
2155
+ export interface ToolTextEditor20250124 {
2156
+ /**
2157
+ * Name of the tool.
2158
+ *
2159
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2160
+ */
2161
+ name: 'str_replace_editor';
2162
+
2163
+ type: 'text_editor_20250124';
2164
+
2165
+ allowed_callers?: Array<
2166
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2167
+ >;
2168
+
2169
+ /**
2170
+ * Create a cache control breakpoint at this content block.
2171
+ */
2172
+ cache_control?: CacheControlEphemeral | null;
2173
+
2174
+ /**
2175
+ * If true, tool will not be included in initial system prompt. Only loaded when
2176
+ * returned via tool_reference from tool search.
2177
+ */
2178
+ defer_loading?: boolean;
2179
+
2180
+ input_examples?: Array<{ [key: string]: unknown }>;
2181
+
2182
+ /**
2183
+ * When true, guarantees schema validation on tool names and inputs
2184
+ */
2185
+ strict?: boolean;
2186
+ }
2187
+
2188
+ export interface ToolTextEditor20250429 {
2189
+ /**
2190
+ * Name of the tool.
2191
+ *
2192
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2193
+ */
2194
+ name: 'str_replace_based_edit_tool';
2195
+
2196
+ type: 'text_editor_20250429';
2197
+
2198
+ allowed_callers?: Array<
2199
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2200
+ >;
2201
+
2202
+ /**
2203
+ * Create a cache control breakpoint at this content block.
2204
+ */
2205
+ cache_control?: CacheControlEphemeral | null;
2206
+
2207
+ /**
2208
+ * If true, tool will not be included in initial system prompt. Only loaded when
2209
+ * returned via tool_reference from tool search.
2210
+ */
2211
+ defer_loading?: boolean;
2212
+
2213
+ input_examples?: Array<{ [key: string]: unknown }>;
2214
+
2215
+ /**
2216
+ * When true, guarantees schema validation on tool names and inputs
2217
+ */
2218
+ strict?: boolean;
2219
+ }
2220
+
2221
+ export interface ToolTextEditor20250728 {
2222
+ /**
2223
+ * Name of the tool.
2224
+ *
2225
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2226
+ */
2227
+ name: 'str_replace_based_edit_tool';
2228
+
2229
+ type: 'text_editor_20250728';
2230
+
2231
+ allowed_callers?: Array<
2232
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2233
+ >;
2234
+
2235
+ /**
2236
+ * Create a cache control breakpoint at this content block.
2237
+ */
2238
+ cache_control?: CacheControlEphemeral | null;
2239
+
2240
+ /**
2241
+ * If true, tool will not be included in initial system prompt. Only loaded when
2242
+ * returned via tool_reference from tool search.
2243
+ */
2244
+ defer_loading?: boolean;
2245
+
2246
+ input_examples?: Array<{ [key: string]: unknown }>;
2247
+
2248
+ /**
2249
+ * Maximum number of characters to display when viewing a file. If not specified,
2250
+ * defaults to displaying the full file.
2251
+ */
2252
+ max_characters?: number | null;
2253
+
2254
+ /**
2255
+ * When true, guarantees schema validation on tool names and inputs
2256
+ */
2257
+ strict?: boolean;
2258
+ }
2259
+
2260
+ /**
2261
+ * Code execution tool with REPL state persistence (daemon mode + gVisor
2262
+ * checkpoint).
2263
+ */
2264
+ export type ToolUnion =
2265
+ | Tool
2266
+ | ToolBash20250124
2267
+ | CodeExecutionTool20250522
2268
+ | CodeExecutionTool20250825
2269
+ | CodeExecutionTool20260120
2270
+ | CodeExecutionTool20260521
2271
+ | MemoryTool20250818
2272
+ | ToolTextEditor20250124
2273
+ | ToolTextEditor20250429
2274
+ | ToolTextEditor20250728
2275
+ | WebSearchTool20250305
2276
+ | WebFetchTool20250910
2277
+ | WebSearchTool20260209
2278
+ | WebFetchTool20260209
2279
+ | WebFetchTool20260309
2280
+ | WebSearchTool20260318
2281
+ | WebFetchTool20260318
2282
+ | ToolSearchToolBm25_20251119
2283
+ | ToolSearchToolRegex20251119;
2284
+
2285
+ export interface ToolUseBlock {
2286
+ id: string;
2287
+
2288
+ /**
2289
+ * Tool invocation directly from the model.
2290
+ */
2291
+ caller: DirectCaller | ServerToolCaller | ServerToolCaller20260120;
2292
+
2293
+ input: unknown;
2294
+
2295
+ name: string;
2296
+
2297
+ type: 'tool_use';
2298
+ }
2299
+
2300
+ export interface ToolUseBlockParam {
2301
+ id: string;
2302
+
2303
+ input: unknown;
2304
+
2305
+ name: string;
2306
+
2307
+ type: 'tool_use';
2308
+
2309
+ /**
2310
+ * Create a cache control breakpoint at this content block.
2311
+ */
2312
+ cache_control?: CacheControlEphemeral | null;
2313
+
2314
+ /**
2315
+ * Tool invocation directly from the model.
2316
+ */
2317
+ caller?: DirectCaller | ServerToolCaller | ServerToolCaller20260120;
2318
+ }
2319
+
2320
+ export interface URLImageSource {
2321
+ type: 'url';
2322
+
2323
+ url: string;
2324
+ }
2325
+
2326
+ export interface URLPDFSource {
2327
+ type: 'url';
2328
+
2329
+ url: string;
2330
+ }
2331
+
2332
+ export interface Usage {
2333
+ /**
2334
+ * Breakdown of cached tokens by TTL
2335
+ */
2336
+ cache_creation: CacheCreation | null;
2337
+
2338
+ /**
2339
+ * The number of input tokens used to create the cache entry.
2340
+ */
2341
+ cache_creation_input_tokens: number | null;
2342
+
2343
+ /**
2344
+ * The number of input tokens read from the cache.
2345
+ */
2346
+ cache_read_input_tokens: number | null;
2347
+
2348
+ /**
2349
+ * The geographic region where inference was performed for this request.
2350
+ */
2351
+ inference_geo: string | null;
2352
+
2353
+ /**
2354
+ * The number of input tokens which were used.
2355
+ */
2356
+ input_tokens: number;
2357
+
2358
+ /**
2359
+ * The number of output tokens which were used.
2360
+ */
2361
+ output_tokens: number;
2362
+
2363
+ /**
2364
+ * Breakdown of output tokens by category.
2365
+ *
2366
+ * `output_tokens` remains the inclusive, authoritative total used for billing.
2367
+ * This object provides a read-only decomposition for observability — for example,
2368
+ * how many of the billed output tokens were spent on internal reasoning that may
2369
+ * have been summarized before being returned to you.
2370
+ */
2371
+ output_tokens_details: OutputTokensDetails | null;
2372
+
2373
+ /**
2374
+ * The number of server tool requests.
2375
+ */
2376
+ server_tool_use: ServerToolUsage | null;
2377
+
2378
+ /**
2379
+ * If the request used the priority, standard, or batch tier.
2380
+ */
2381
+ service_tier: 'standard' | 'priority' | 'batch' | null;
2382
+ }
2383
+
2384
+ export interface UserLocation {
2385
+ type: 'approximate';
2386
+
2387
+ /**
2388
+ * The city of the user.
2389
+ */
2390
+ city?: string | null;
2391
+
2392
+ /**
2393
+ * The two letter
2394
+ * [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the
2395
+ * user.
2396
+ */
2397
+ country?: string | null;
2398
+
2399
+ /**
2400
+ * The region of the user.
2401
+ */
2402
+ region?: string | null;
2403
+
2404
+ /**
2405
+ * The [IANA timezone](https://nodatime.org/TimeZones) of the user.
2406
+ */
2407
+ timezone?: string | null;
2408
+ }
2409
+
2410
+ export interface WebFetchBlock {
2411
+ content: DocumentBlock;
2412
+
2413
+ /**
2414
+ * ISO 8601 timestamp when the content was retrieved
2415
+ */
2416
+ retrieved_at: string | null;
2417
+
2418
+ type: 'web_fetch_result';
2419
+
2420
+ /**
2421
+ * Fetched content URL
2422
+ */
2423
+ url: string;
2424
+ }
2425
+
2426
+ export interface WebFetchBlockParam {
2427
+ content: DocumentBlockParam;
2428
+
2429
+ type: 'web_fetch_result';
2430
+
2431
+ /**
2432
+ * Fetched content URL
2433
+ */
2434
+ url: string;
2435
+
2436
+ /**
2437
+ * ISO 8601 timestamp when the content was retrieved
2438
+ */
2439
+ retrieved_at?: string | null;
2440
+ }
2441
+
2442
+ export interface WebFetchTool20250910 {
2443
+ /**
2444
+ * Name of the tool.
2445
+ *
2446
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2447
+ */
2448
+ name: 'web_fetch';
2449
+
2450
+ type: 'web_fetch_20250910';
2451
+
2452
+ allowed_callers?: Array<
2453
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2454
+ >;
2455
+
2456
+ /**
2457
+ * List of domains to allow fetching from
2458
+ */
2459
+ allowed_domains?: Array<string> | null;
2460
+
2461
+ /**
2462
+ * List of domains to block fetching from
2463
+ */
2464
+ blocked_domains?: Array<string> | null;
2465
+
2466
+ /**
2467
+ * Create a cache control breakpoint at this content block.
2468
+ */
2469
+ cache_control?: CacheControlEphemeral | null;
2470
+
2471
+ /**
2472
+ * Citations configuration for fetched documents. Citations are disabled by
2473
+ * default.
2474
+ */
2475
+ citations?: CitationsConfigParam | null;
2476
+
2477
+ /**
2478
+ * If true, tool will not be included in initial system prompt. Only loaded when
2479
+ * returned via tool_reference from tool search.
2480
+ */
2481
+ defer_loading?: boolean;
2482
+
2483
+ /**
2484
+ * Maximum number of tokens used by including web page text content in the context.
2485
+ * The limit is approximate and does not apply to binary content such as PDFs.
2486
+ */
2487
+ max_content_tokens?: number | null;
2488
+
2489
+ /**
2490
+ * Maximum number of times the tool can be used in the API request.
2491
+ */
2492
+ max_uses?: number | null;
2493
+
2494
+ /**
2495
+ * When true, guarantees schema validation on tool names and inputs
2496
+ */
2497
+ strict?: boolean;
2498
+ }
2499
+
2500
+ export interface WebFetchTool20260209 {
2501
+ /**
2502
+ * Name of the tool.
2503
+ *
2504
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2505
+ */
2506
+ name: 'web_fetch';
2507
+
2508
+ type: 'web_fetch_20260209';
2509
+
2510
+ allowed_callers?: Array<
2511
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2512
+ >;
2513
+
2514
+ /**
2515
+ * List of domains to allow fetching from
2516
+ */
2517
+ allowed_domains?: Array<string> | null;
2518
+
2519
+ /**
2520
+ * List of domains to block fetching from
2521
+ */
2522
+ blocked_domains?: Array<string> | null;
2523
+
2524
+ /**
2525
+ * Create a cache control breakpoint at this content block.
2526
+ */
2527
+ cache_control?: CacheControlEphemeral | null;
2528
+
2529
+ /**
2530
+ * Citations configuration for fetched documents. Citations are disabled by
2531
+ * default.
2532
+ */
2533
+ citations?: CitationsConfigParam | null;
2534
+
2535
+ /**
2536
+ * If true, tool will not be included in initial system prompt. Only loaded when
2537
+ * returned via tool_reference from tool search.
2538
+ */
2539
+ defer_loading?: boolean;
2540
+
2541
+ /**
2542
+ * Maximum number of tokens used by including web page text content in the context.
2543
+ * The limit is approximate and does not apply to binary content such as PDFs.
2544
+ */
2545
+ max_content_tokens?: number | null;
2546
+
2547
+ /**
2548
+ * Maximum number of times the tool can be used in the API request.
2549
+ */
2550
+ max_uses?: number | null;
2551
+
2552
+ /**
2553
+ * When true, guarantees schema validation on tool names and inputs
2554
+ */
2555
+ strict?: boolean;
2556
+ }
2557
+
2558
+ /**
2559
+ * Web fetch tool with use_cache parameter for bypassing cached content.
2560
+ */
2561
+ export interface WebFetchTool20260309 {
2562
+ /**
2563
+ * Name of the tool.
2564
+ *
2565
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2566
+ */
2567
+ name: 'web_fetch';
2568
+
2569
+ type: 'web_fetch_20260309';
2570
+
2571
+ allowed_callers?: Array<
2572
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2573
+ >;
2574
+
2575
+ /**
2576
+ * List of domains to allow fetching from
2577
+ */
2578
+ allowed_domains?: Array<string> | null;
2579
+
2580
+ /**
2581
+ * List of domains to block fetching from
2582
+ */
2583
+ blocked_domains?: Array<string> | null;
2584
+
2585
+ /**
2586
+ * Create a cache control breakpoint at this content block.
2587
+ */
2588
+ cache_control?: CacheControlEphemeral | null;
2589
+
2590
+ /**
2591
+ * Citations configuration for fetched documents. Citations are disabled by
2592
+ * default.
2593
+ */
2594
+ citations?: CitationsConfigParam | null;
2595
+
2596
+ /**
2597
+ * If true, tool will not be included in initial system prompt. Only loaded when
2598
+ * returned via tool_reference from tool search.
2599
+ */
2600
+ defer_loading?: boolean;
2601
+
2602
+ /**
2603
+ * Maximum number of tokens used by including web page text content in the context.
2604
+ * The limit is approximate and does not apply to binary content such as PDFs.
2605
+ */
2606
+ max_content_tokens?: number | null;
2607
+
2608
+ /**
2609
+ * Maximum number of times the tool can be used in the API request.
2610
+ */
2611
+ max_uses?: number | null;
2612
+
2613
+ /**
2614
+ * When true, guarantees schema validation on tool names and inputs
2615
+ */
2616
+ strict?: boolean;
2617
+
2618
+ /**
2619
+ * Whether to use cached content. Set to false to bypass the cache and fetch fresh
2620
+ * content. Only set to false when the user explicitly requests fresh content or
2621
+ * when fetching rapidly-changing sources.
2622
+ */
2623
+ use_cache?: boolean;
2624
+ }
2625
+
2626
+ export interface WebFetchTool20260318 {
2627
+ /**
2628
+ * Name of the tool.
2629
+ *
2630
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2631
+ */
2632
+ name: 'web_fetch';
2633
+
2634
+ type: 'web_fetch_20260318';
2635
+
2636
+ allowed_callers?: Array<
2637
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2638
+ >;
2639
+
2640
+ /**
2641
+ * List of domains to allow fetching from
2642
+ */
2643
+ allowed_domains?: Array<string> | null;
2644
+
2645
+ /**
2646
+ * List of domains to block fetching from
2647
+ */
2648
+ blocked_domains?: Array<string> | null;
2649
+
2650
+ /**
2651
+ * Create a cache control breakpoint at this content block.
2652
+ */
2653
+ cache_control?: CacheControlEphemeral | null;
2654
+
2655
+ /**
2656
+ * Citations configuration for fetched documents. Citations are disabled by
2657
+ * default.
2658
+ */
2659
+ citations?: CitationsConfigParam | null;
2660
+
2661
+ /**
2662
+ * If true, tool will not be included in initial system prompt. Only loaded when
2663
+ * returned via tool_reference from tool search.
2664
+ */
2665
+ defer_loading?: boolean;
2666
+
2667
+ /**
2668
+ * Maximum number of tokens used by including web page text content in the context.
2669
+ * The limit is approximate and does not apply to binary content such as PDFs.
2670
+ */
2671
+ max_content_tokens?: number | null;
2672
+
2673
+ /**
2674
+ * Maximum number of times the tool can be used in the API request.
2675
+ */
2676
+ max_uses?: number | null;
2677
+
2678
+ /**
2679
+ * How this tool's result blocks appear in the API response when the result was
2680
+ * consumed by a completed code_execution call in the same turn. 'full' returns the
2681
+ * complete content (default). 'excluded' drops the nested server_tool_use and
2682
+ * result block pair entirely. Results from direct calls, or from code_execution
2683
+ * calls that paused before completing, are always returned in full so they can be
2684
+ * sent back on the next turn.
2685
+ */
2686
+ response_inclusion?: 'full' | 'excluded';
2687
+
2688
+ /**
2689
+ * When true, guarantees schema validation on tool names and inputs
2690
+ */
2691
+ strict?: boolean;
2692
+
2693
+ /**
2694
+ * Whether to use cached content. Set to false to bypass the cache and fetch fresh
2695
+ * content. Only set to false when the user explicitly requests fresh content or
2696
+ * when fetching rapidly-changing sources.
2697
+ */
2698
+ use_cache?: boolean;
2699
+ }
2700
+
2701
+ export interface WebFetchToolResultBlock {
2702
+ /**
2703
+ * Tool invocation directly from the model.
2704
+ */
2705
+ caller: DirectCaller | ServerToolCaller | ServerToolCaller20260120;
2706
+
2707
+ content: WebFetchToolResultErrorBlock | WebFetchBlock;
2708
+
2709
+ tool_use_id: string;
2710
+
2711
+ type: 'web_fetch_tool_result';
2712
+ }
2713
+
2714
+ export interface WebFetchToolResultBlockParam {
2715
+ content: WebFetchToolResultErrorBlockParam | WebFetchBlockParam;
2716
+
2717
+ tool_use_id: string;
2718
+
2719
+ type: 'web_fetch_tool_result';
2720
+
2721
+ /**
2722
+ * Create a cache control breakpoint at this content block.
2723
+ */
2724
+ cache_control?: CacheControlEphemeral | null;
2725
+
2726
+ /**
2727
+ * Tool invocation directly from the model.
2728
+ */
2729
+ caller?: DirectCaller | ServerToolCaller | ServerToolCaller20260120;
2730
+ }
2731
+
2732
+ export interface WebFetchToolResultErrorBlock {
2733
+ error_code: WebFetchToolResultErrorCode;
2734
+
2735
+ type: 'web_fetch_tool_result_error';
2736
+ }
2737
+
2738
+ export interface WebFetchToolResultErrorBlockParam {
2739
+ error_code: WebFetchToolResultErrorCode;
2740
+
2741
+ type: 'web_fetch_tool_result_error';
2742
+ }
2743
+
2744
+ export type WebFetchToolResultErrorCode =
2745
+ | 'invalid_tool_input'
2746
+ | 'url_too_long'
2747
+ | 'url_not_allowed'
2748
+ | 'url_not_in_prior_context'
2749
+ | 'url_not_accessible'
2750
+ | 'unsupported_content_type'
2751
+ | 'too_many_requests'
2752
+ | 'max_uses_exceeded'
2753
+ | 'unavailable';
2754
+
2755
+ export interface WebSearchResultBlock {
2756
+ encrypted_content: string;
2757
+
2758
+ page_age: string | null;
2759
+
2760
+ title: string;
2761
+
2762
+ type: 'web_search_result';
2763
+
2764
+ url: string;
2765
+ }
2766
+
2767
+ export interface WebSearchResultBlockParam {
2768
+ encrypted_content: string;
2769
+
2770
+ title: string;
2771
+
2772
+ type: 'web_search_result';
2773
+
2774
+ url: string;
2775
+
2776
+ page_age?: string | null;
2777
+ }
2778
+
2779
+ export interface WebSearchTool20250305 {
2780
+ /**
2781
+ * Name of the tool.
2782
+ *
2783
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2784
+ */
2785
+ name: 'web_search';
2786
+
2787
+ type: 'web_search_20250305';
2788
+
2789
+ allowed_callers?: Array<
2790
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2791
+ >;
2792
+
2793
+ /**
2794
+ * If provided, only these domains will be included in results. Cannot be used
2795
+ * alongside `blocked_domains`.
2796
+ */
2797
+ allowed_domains?: Array<string> | null;
2798
+
2799
+ /**
2800
+ * If provided, these domains will never appear in results. Cannot be used
2801
+ * alongside `allowed_domains`.
2802
+ */
2803
+ blocked_domains?: Array<string> | null;
2804
+
2805
+ /**
2806
+ * Create a cache control breakpoint at this content block.
2807
+ */
2808
+ cache_control?: CacheControlEphemeral | null;
2809
+
2810
+ /**
2811
+ * If true, tool will not be included in initial system prompt. Only loaded when
2812
+ * returned via tool_reference from tool search.
2813
+ */
2814
+ defer_loading?: boolean;
2815
+
2816
+ /**
2817
+ * Maximum number of times the tool can be used in the API request.
2818
+ */
2819
+ max_uses?: number | null;
2820
+
2821
+ /**
2822
+ * When true, guarantees schema validation on tool names and inputs
2823
+ */
2824
+ strict?: boolean;
2825
+
2826
+ /**
2827
+ * Parameters for the user's location. Used to provide more relevant search
2828
+ * results.
2829
+ */
2830
+ user_location?: UserLocation | null;
2831
+ }
2832
+
2833
+ // backward compat
2834
+ export namespace WebSearchTool20250305 {
2835
+ /**
2836
+ * @deprecated Import `UserLocation` from `anthropic` directly instead of using
2837
+ * `WebSearchTool20250305.UserLocation`.
2838
+ */
2839
+ export type UserLocation = Messages.UserLocation;
2840
+ }
2841
+
2842
+ export interface WebSearchTool20260209 {
2843
+ /**
2844
+ * Name of the tool.
2845
+ *
2846
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2847
+ */
2848
+ name: 'web_search';
2849
+
2850
+ type: 'web_search_20260209';
2851
+
2852
+ allowed_callers?: Array<
2853
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2854
+ >;
2855
+
2856
+ /**
2857
+ * If provided, only these domains will be included in results. Cannot be used
2858
+ * alongside `blocked_domains`.
2859
+ */
2860
+ allowed_domains?: Array<string> | null;
2861
+
2862
+ /**
2863
+ * If provided, these domains will never appear in results. Cannot be used
2864
+ * alongside `allowed_domains`.
2865
+ */
2866
+ blocked_domains?: Array<string> | null;
2867
+
2868
+ /**
2869
+ * Create a cache control breakpoint at this content block.
2870
+ */
2871
+ cache_control?: CacheControlEphemeral | null;
2872
+
2873
+ /**
2874
+ * If true, tool will not be included in initial system prompt. Only loaded when
2875
+ * returned via tool_reference from tool search.
2876
+ */
2877
+ defer_loading?: boolean;
2878
+
2879
+ /**
2880
+ * Maximum number of times the tool can be used in the API request.
2881
+ */
2882
+ max_uses?: number | null;
2883
+
2884
+ /**
2885
+ * When true, guarantees schema validation on tool names and inputs
2886
+ */
2887
+ strict?: boolean;
2888
+
2889
+ /**
2890
+ * Parameters for the user's location. Used to provide more relevant search
2891
+ * results.
2892
+ */
2893
+ user_location?: UserLocation | null;
2894
+ }
2895
+
2896
+ // backward compat
2897
+ export namespace WebSearchTool20260209 {
2898
+ /**
2899
+ * @deprecated Import `UserLocation` from `anthropic` directly instead of using
2900
+ * `WebSearchTool20260209.UserLocation`.
2901
+ */
2902
+ export type UserLocation = Messages.UserLocation;
2903
+ }
2904
+
2905
+ export interface WebSearchTool20260318 {
2906
+ /**
2907
+ * Name of the tool.
2908
+ *
2909
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2910
+ */
2911
+ name: 'web_search';
2912
+
2913
+ type: 'web_search_20260318';
2914
+
2915
+ allowed_callers?: Array<
2916
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2917
+ >;
2918
+
2919
+ /**
2920
+ * If provided, only these domains will be included in results. Cannot be used
2921
+ * alongside `blocked_domains`.
2922
+ */
2923
+ allowed_domains?: Array<string> | null;
2924
+
2925
+ /**
2926
+ * If provided, these domains will never appear in results. Cannot be used
2927
+ * alongside `allowed_domains`.
2928
+ */
2929
+ blocked_domains?: Array<string> | null;
2930
+
2931
+ /**
2932
+ * Create a cache control breakpoint at this content block.
2933
+ */
2934
+ cache_control?: CacheControlEphemeral | null;
2935
+
2936
+ /**
2937
+ * If true, tool will not be included in initial system prompt. Only loaded when
2938
+ * returned via tool_reference from tool search.
2939
+ */
2940
+ defer_loading?: boolean;
2941
+
2942
+ /**
2943
+ * Maximum number of times the tool can be used in the API request.
2944
+ */
2945
+ max_uses?: number | null;
2946
+
2947
+ /**
2948
+ * How this tool's result blocks appear in the API response when the result was
2949
+ * consumed by a completed code_execution call in the same turn. 'full' returns the
2950
+ * complete content (default). 'excluded' drops the nested server_tool_use and
2951
+ * result block pair entirely. Results from direct calls, or from code_execution
2952
+ * calls that paused before completing, are always returned in full so they can be
2953
+ * sent back on the next turn.
2954
+ */
2955
+ response_inclusion?: 'full' | 'excluded';
2956
+
2957
+ /**
2958
+ * When true, guarantees schema validation on tool names and inputs
2959
+ */
2960
+ strict?: boolean;
2961
+
2962
+ /**
2963
+ * Parameters for the user's location. Used to provide more relevant search
2964
+ * results.
2965
+ */
2966
+ user_location?: UserLocation | null;
2967
+ }
2968
+
2969
+ export interface WebSearchToolRequestError {
2970
+ error_code: WebSearchToolResultErrorCode;
2971
+
2972
+ type: 'web_search_tool_result_error';
2973
+ }
2974
+
2975
+ export interface WebSearchToolResultBlock {
2976
+ /**
2977
+ * Tool invocation directly from the model.
2978
+ */
2979
+ caller: DirectCaller | ServerToolCaller | ServerToolCaller20260120;
2980
+
2981
+ content: WebSearchToolResultBlockContent;
2982
+
2983
+ tool_use_id: string;
2984
+
2985
+ type: 'web_search_tool_result';
2986
+ }
2987
+
2988
+ export type WebSearchToolResultBlockContent = WebSearchToolResultError | Array<WebSearchResultBlock>;
2989
+
2990
+ export interface WebSearchToolResultBlockParam {
2991
+ content: WebSearchToolResultBlockParamContent;
2992
+
2993
+ tool_use_id: string;
2994
+
2995
+ type: 'web_search_tool_result';
2996
+
2997
+ /**
2998
+ * Create a cache control breakpoint at this content block.
2999
+ */
3000
+ cache_control?: CacheControlEphemeral | null;
3001
+
3002
+ /**
3003
+ * Tool invocation directly from the model.
3004
+ */
3005
+ caller?: DirectCaller | ServerToolCaller | ServerToolCaller20260120;
3006
+ }
3007
+
3008
+ export type WebSearchToolResultBlockParamContent =
3009
+ | Array<WebSearchResultBlockParam>
3010
+ | WebSearchToolRequestError;
3011
+
3012
+ export interface WebSearchToolResultError {
3013
+ error_code: WebSearchToolResultErrorCode;
3014
+
3015
+ type: 'web_search_tool_result_error';
3016
+ }
3017
+
3018
+ export type WebSearchToolResultErrorCode =
3019
+ | 'invalid_tool_input'
3020
+ | 'unavailable'
3021
+ | 'max_uses_exceeded'
3022
+ | 'too_many_requests'
3023
+ | 'query_too_long'
3024
+ | 'request_too_large';
3025
+
3026
+ export type MessageStreamEvent = RawMessageStreamEvent;
3027
+
3028
+ export type MessageStartEvent = RawMessageStartEvent;
3029
+
3030
+ export type MessageDeltaEvent = RawMessageDeltaEvent;
3031
+
3032
+ export type MessageStopEvent = RawMessageStopEvent;
3033
+
3034
+ export type ContentBlockStartEvent = RawContentBlockStartEvent;
3035
+
3036
+ export type ContentBlockDeltaEvent = RawContentBlockDeltaEvent;
3037
+
3038
+ export type ContentBlockStopEvent = RawContentBlockStopEvent;
3039
+
3040
+ export type MessageCreateParams = MessageCreateParamsNonStreaming | MessageCreateParamsStreaming;
3041
+
3042
+ export interface MessageCreateParamsBase {
3043
+ /**
3044
+ * Body param: The maximum number of tokens to generate before stopping.
3045
+ *
3046
+ * Note that our models may stop _before_ reaching this maximum. This parameter
3047
+ * only specifies the absolute maximum number of tokens to generate.
3048
+ *
3049
+ * Set to `0` to populate the
3050
+ * [prompt cache](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pre-warming-the-cache)
3051
+ * without generating a response.
3052
+ *
3053
+ * Different models have different maximum values for this parameter. See
3054
+ * [models](https://platform.claude.com/docs/en/about-claude/models/overview) for
3055
+ * details.
3056
+ */
3057
+ max_tokens: number;
3058
+
3059
+ /**
3060
+ * Body param: Input messages.
3061
+ *
3062
+ * Our models are trained to operate on alternating `user` and `assistant`
3063
+ * conversational turns. When creating a new `Message`, you specify the prior
3064
+ * conversational turns with the `messages` parameter, and the model then generates
3065
+ * the next `Message` in the conversation. Consecutive `user` or `assistant` turns
3066
+ * in your request will be combined into a single turn.
3067
+ *
3068
+ * Each input message must be an object with a `role` and `content`. You can
3069
+ * specify a single `user`-role message, or you can include multiple `user` and
3070
+ * `assistant` messages.
3071
+ *
3072
+ * If the final message uses the `assistant` role, the response content will
3073
+ * continue immediately from the content in that message. This can be used to
3074
+ * constrain part of the model's response.
3075
+ *
3076
+ * Example with a single `user` message:
3077
+ *
3078
+ * ```json
3079
+ * [{ "role": "user", "content": "Hello, Claude" }]
3080
+ * ```
3081
+ *
3082
+ * Example with multiple conversational turns:
3083
+ *
3084
+ * ```json
3085
+ * [
3086
+ * { "role": "user", "content": "Hello there." },
3087
+ * { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
3088
+ * { "role": "user", "content": "Can you explain LLMs in plain English?" }
3089
+ * ]
3090
+ * ```
3091
+ *
3092
+ * Example with a partially-filled response from Claude:
3093
+ *
3094
+ * ```json
3095
+ * [
3096
+ * {
3097
+ * "role": "user",
3098
+ * "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
3099
+ * },
3100
+ * { "role": "assistant", "content": "The best answer is (" }
3101
+ * ]
3102
+ * ```
3103
+ *
3104
+ * Each input message `content` may be either a single `string` or an array of
3105
+ * content blocks, where each block has a specific `type`. Using a `string` for
3106
+ * `content` is shorthand for an array of one content block of type `"text"`. The
3107
+ * following input messages are equivalent:
3108
+ *
3109
+ * ```json
3110
+ * { "role": "user", "content": "Hello, Claude" }
3111
+ * ```
3112
+ *
3113
+ * ```json
3114
+ * { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
3115
+ * ```
3116
+ *
3117
+ * See
3118
+ * [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages).
3119
+ *
3120
+ * Note that if you want to include a
3121
+ * [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role),
3122
+ * you can use the top-level `system` parameter — there is no `"system"` role for
3123
+ * input messages in the Messages API.
3124
+ *
3125
+ * There is a limit of 100,000 messages in a single request.
3126
+ */
3127
+ messages: Array<MessageParam>;
3128
+
3129
+ /**
3130
+ * Body param: The model that will complete your prompt.
3131
+ *
3132
+ * See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
3133
+ * details and options.
3134
+ */
3135
+ model: Model;
3136
+
3137
+ /**
3138
+ * Body param: Top-level cache control automatically applies a cache_control marker
3139
+ * to the last cacheable block in the request.
3140
+ */
3141
+ cache_control?: CacheControlEphemeral | null;
3142
+
3143
+ /**
3144
+ * Body param: Container identifier for reuse across requests.
3145
+ */
3146
+ container?: string | null;
3147
+
3148
+ /**
3149
+ * Body param: Specifies the geographic region for inference processing. If not
3150
+ * specified, the workspace's `default_inference_geo` is used.
3151
+ */
3152
+ inference_geo?: string | null;
3153
+
3154
+ /**
3155
+ * Body param: An object describing metadata about the request.
3156
+ */
3157
+ metadata?: Metadata;
3158
+
3159
+ /**
3160
+ * Body param: Configuration options for the model's output, such as the output
3161
+ * format.
3162
+ */
3163
+ output_config?: OutputConfig;
3164
+
3165
+ /**
3166
+ * Body param: Determines whether to use priority capacity (if available) or
3167
+ * standard capacity for this request.
3168
+ *
3169
+ * Anthropic offers different levels of service for your API requests. See
3170
+ * [service-tiers](https://platform.claude.com/docs/en/api/service-tiers) for
3171
+ * details.
3172
+ */
3173
+ service_tier?: 'auto' | 'standard_only';
3174
+
3175
+ /**
3176
+ * Body param: Custom text sequences that will cause the model to stop generating.
3177
+ *
3178
+ * Our models will normally stop when they have naturally completed their turn,
3179
+ * which will result in a response `stop_reason` of `"end_turn"`.
3180
+ *
3181
+ * If you want the model to stop generating when it encounters custom strings of
3182
+ * text, you can use the `stop_sequences` parameter. If the model encounters one of
3183
+ * the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
3184
+ * and the response `stop_sequence` value will contain the matched stop sequence.
3185
+ */
3186
+ stop_sequences?: Array<string>;
3187
+
3188
+ /**
3189
+ * Body param: Whether to incrementally stream the response using server-sent
3190
+ * events.
3191
+ *
3192
+ * See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming)
3193
+ * for details.
3194
+ */
3195
+ stream?: boolean;
3196
+
3197
+ /**
3198
+ * Body param: System prompt.
3199
+ *
3200
+ * A system prompt is a way of providing context and instructions to Claude, such
3201
+ * as specifying a particular goal or role. See our
3202
+ * [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).
3203
+ */
3204
+ system?: string | Array<TextBlockParam>;
3205
+
3206
+ /**
3207
+ * @deprecated Deprecated. Models released after Claude Opus 4.6 do not support
3208
+ * setting temperature. A value of 1.0 of will be accepted for backwards
3209
+ * compatibility, all other values will be rejected with a 400 error.
3210
+ */
3211
+ temperature?: number;
3212
+
3213
+ /**
3214
+ * Body param: Configuration for enabling Claude's extended thinking.
3215
+ *
3216
+ * When enabled, responses include `thinking` content blocks showing Claude's
3217
+ * thinking process before the final answer. Requires a minimum budget of 1,024
3218
+ * tokens and counts towards your `max_tokens` limit.
3219
+ *
3220
+ * See
3221
+ * [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
3222
+ * for details.
3223
+ */
3224
+ thinking?: ThinkingConfigParam;
3225
+
3226
+ /**
3227
+ * Body param: How the model should use the provided tools. The model can use a
3228
+ * specific tool, any available tool, decide by itself, or not use tools at all.
3229
+ */
3230
+ tool_choice?: ToolChoice;
3231
+
3232
+ /**
3233
+ * Body param: Definitions of tools that the model may use.
3234
+ *
3235
+ * If you include `tools` in your API request, the model may return `tool_use`
3236
+ * content blocks that represent the model's use of those tools. You can then run
3237
+ * those tools using the tool input generated by the model and then optionally
3238
+ * return results back to the model using `tool_result` content blocks.
3239
+ *
3240
+ * There are two types of tools: **client tools** and **server tools**. The
3241
+ * behavior described below applies to client tools. For
3242
+ * [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools),
3243
+ * see their individual documentation as each has its own behavior (e.g., the
3244
+ * [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool)).
3245
+ *
3246
+ * Each tool definition includes:
3247
+ *
3248
+ * - `name`: Name of the tool.
3249
+ * - `description`: Optional, but strongly-recommended description of the tool.
3250
+ * - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
3251
+ * tool `input` shape that the model will produce in `tool_use` output content
3252
+ * blocks.
3253
+ *
3254
+ * For example, if you defined `tools` as:
3255
+ *
3256
+ * ```json
3257
+ * [
3258
+ * {
3259
+ * "name": "get_stock_price",
3260
+ * "description": "Get the current stock price for a given ticker symbol.",
3261
+ * "input_schema": {
3262
+ * "type": "object",
3263
+ * "properties": {
3264
+ * "ticker": {
3265
+ * "type": "string",
3266
+ * "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
3267
+ * }
3268
+ * },
3269
+ * "required": ["ticker"]
3270
+ * }
3271
+ * }
3272
+ * ]
3273
+ * ```
3274
+ *
3275
+ * And then asked the model "What's the S&P 500 at today?", the model might produce
3276
+ * `tool_use` content blocks in the response like this:
3277
+ *
3278
+ * ```json
3279
+ * [
3280
+ * {
3281
+ * "type": "tool_use",
3282
+ * "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
3283
+ * "name": "get_stock_price",
3284
+ * "input": { "ticker": "^GSPC" }
3285
+ * }
3286
+ * ]
3287
+ * ```
3288
+ *
3289
+ * You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
3290
+ * input, and return the following back to the model in a subsequent `user`
3291
+ * message:
3292
+ *
3293
+ * ```json
3294
+ * [
3295
+ * {
3296
+ * "type": "tool_result",
3297
+ * "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
3298
+ * "content": "259.75 USD"
3299
+ * }
3300
+ * ]
3301
+ * ```
3302
+ *
3303
+ * Tools can be used for workflows that include running client-side tools and
3304
+ * functions, or more generally whenever you want the model to produce a particular
3305
+ * JSON structure of output.
3306
+ *
3307
+ * See our
3308
+ * [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview)
3309
+ * for more details.
3310
+ */
3311
+ tools?: Array<ToolUnion>;
3312
+
3313
+ /**
3314
+ * @deprecated Deprecated. Models released after Claude Opus 4.6 do not accept
3315
+ * top_k; any value will be rejected with a 400 error.
3316
+ */
3317
+ top_k?: number;
3318
+
3319
+ /**
3320
+ * @deprecated Deprecated. Models released after Claude Opus 4.6 do not support
3321
+ * setting top_p. A value >= 0.99 will be accepted for backwards compatibility, all
3322
+ * other values will be rejected with a 400 error.
3323
+ */
3324
+ top_p?: number;
3325
+
3326
+ /**
3327
+ * Header param: The user profile ID to attribute this request to. Use when acting
3328
+ * on behalf of a party other than your organization. Requires the `user-profiles`
3329
+ * beta header.
3330
+ */
3331
+ user_profile_id?: string;
3332
+ }
3333
+
3334
+ export namespace MessageCreateParams {
3335
+ export type MessageCreateParamsNonStreaming = MessagesAPI.MessageCreateParamsNonStreaming;
3336
+ export type MessageCreateParamsStreaming = MessagesAPI.MessageCreateParamsStreaming;
3337
+ }
3338
+
3339
+ export interface MessageCreateParamsNonStreaming extends MessageCreateParamsBase {
3340
+ /**
3341
+ * Body param: Whether to incrementally stream the response using server-sent
3342
+ * events.
3343
+ *
3344
+ * See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming)
3345
+ * for details.
3346
+ */
3347
+ stream?: false;
3348
+ }
3349
+
3350
+ export interface MessageCreateParamsStreaming extends MessageCreateParamsBase {
3351
+ /**
3352
+ * Body param: Whether to incrementally stream the response using server-sent
3353
+ * events.
3354
+ *
3355
+ * See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming)
3356
+ * for details.
3357
+ */
3358
+ stream: true;
3359
+ }
3360
+
3361
+ export type MessageStreamParams = ParseableMessageCreateParams;
3362
+
3363
+ export interface MessageCountTokensParams {
3364
+ /**
3365
+ * Body param: Input messages.
3366
+ *
3367
+ * Our models are trained to operate on alternating `user` and `assistant`
3368
+ * conversational turns. When creating a new `Message`, you specify the prior
3369
+ * conversational turns with the `messages` parameter, and the model then generates
3370
+ * the next `Message` in the conversation. Consecutive `user` or `assistant` turns
3371
+ * in your request will be combined into a single turn.
3372
+ *
3373
+ * Each input message must be an object with a `role` and `content`. You can
3374
+ * specify a single `user`-role message, or you can include multiple `user` and
3375
+ * `assistant` messages.
3376
+ *
3377
+ * If the final message uses the `assistant` role, the response content will
3378
+ * continue immediately from the content in that message. This can be used to
3379
+ * constrain part of the model's response.
3380
+ *
3381
+ * Example with a single `user` message:
3382
+ *
3383
+ * ```json
3384
+ * [{ "role": "user", "content": "Hello, Claude" }]
3385
+ * ```
3386
+ *
3387
+ * Example with multiple conversational turns:
3388
+ *
3389
+ * ```json
3390
+ * [
3391
+ * { "role": "user", "content": "Hello there." },
3392
+ * { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
3393
+ * { "role": "user", "content": "Can you explain LLMs in plain English?" }
3394
+ * ]
3395
+ * ```
3396
+ *
3397
+ * Example with a partially-filled response from Claude:
3398
+ *
3399
+ * ```json
3400
+ * [
3401
+ * {
3402
+ * "role": "user",
3403
+ * "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
3404
+ * },
3405
+ * { "role": "assistant", "content": "The best answer is (" }
3406
+ * ]
3407
+ * ```
3408
+ *
3409
+ * Each input message `content` may be either a single `string` or an array of
3410
+ * content blocks, where each block has a specific `type`. Using a `string` for
3411
+ * `content` is shorthand for an array of one content block of type `"text"`. The
3412
+ * following input messages are equivalent:
3413
+ *
3414
+ * ```json
3415
+ * { "role": "user", "content": "Hello, Claude" }
3416
+ * ```
3417
+ *
3418
+ * ```json
3419
+ * { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
3420
+ * ```
3421
+ *
3422
+ * See
3423
+ * [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages).
3424
+ *
3425
+ * Note that if you want to include a
3426
+ * [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role),
3427
+ * you can use the top-level `system` parameter — there is no `"system"` role for
3428
+ * input messages in the Messages API.
3429
+ *
3430
+ * There is a limit of 100,000 messages in a single request.
3431
+ */
3432
+ messages: Array<MessageParam>;
3433
+
3434
+ /**
3435
+ * Body param: The model that will complete your prompt.
3436
+ *
3437
+ * See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
3438
+ * details and options.
3439
+ */
3440
+ model: Model;
3441
+
3442
+ /**
3443
+ * Body param: Top-level cache control automatically applies a cache_control marker
3444
+ * to the last cacheable block in the request.
3445
+ */
3446
+ cache_control?: CacheControlEphemeral | null;
3447
+
3448
+ /**
3449
+ * Body param: Configuration options for the model's output, such as the output
3450
+ * format.
3451
+ */
3452
+ output_config?: OutputConfig;
3453
+
3454
+ /**
3455
+ * Body param: System prompt.
3456
+ *
3457
+ * A system prompt is a way of providing context and instructions to Claude, such
3458
+ * as specifying a particular goal or role. See our
3459
+ * [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).
3460
+ */
3461
+ system?: string | Array<TextBlockParam>;
3462
+
3463
+ /**
3464
+ * Body param: Configuration for enabling Claude's extended thinking.
3465
+ *
3466
+ * When enabled, responses include `thinking` content blocks showing Claude's
3467
+ * thinking process before the final answer. Requires a minimum budget of 1,024
3468
+ * tokens and counts towards your `max_tokens` limit.
3469
+ *
3470
+ * See
3471
+ * [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
3472
+ * for details.
3473
+ */
3474
+ thinking?: ThinkingConfigParam;
3475
+
3476
+ /**
3477
+ * Body param: How the model should use the provided tools. The model can use a
3478
+ * specific tool, any available tool, decide by itself, or not use tools at all.
3479
+ */
3480
+ tool_choice?: ToolChoice;
3481
+
3482
+ /**
3483
+ * Body param: Definitions of tools that the model may use.
3484
+ *
3485
+ * If you include `tools` in your API request, the model may return `tool_use`
3486
+ * content blocks that represent the model's use of those tools. You can then run
3487
+ * those tools using the tool input generated by the model and then optionally
3488
+ * return results back to the model using `tool_result` content blocks.
3489
+ *
3490
+ * There are two types of tools: **client tools** and **server tools**. The
3491
+ * behavior described below applies to client tools. For
3492
+ * [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools),
3493
+ * see their individual documentation as each has its own behavior (e.g., the
3494
+ * [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool)).
3495
+ *
3496
+ * Each tool definition includes:
3497
+ *
3498
+ * - `name`: Name of the tool.
3499
+ * - `description`: Optional, but strongly-recommended description of the tool.
3500
+ * - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
3501
+ * tool `input` shape that the model will produce in `tool_use` output content
3502
+ * blocks.
3503
+ *
3504
+ * For example, if you defined `tools` as:
3505
+ *
3506
+ * ```json
3507
+ * [
3508
+ * {
3509
+ * "name": "get_stock_price",
3510
+ * "description": "Get the current stock price for a given ticker symbol.",
3511
+ * "input_schema": {
3512
+ * "type": "object",
3513
+ * "properties": {
3514
+ * "ticker": {
3515
+ * "type": "string",
3516
+ * "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
3517
+ * }
3518
+ * },
3519
+ * "required": ["ticker"]
3520
+ * }
3521
+ * }
3522
+ * ]
3523
+ * ```
3524
+ *
3525
+ * And then asked the model "What's the S&P 500 at today?", the model might produce
3526
+ * `tool_use` content blocks in the response like this:
3527
+ *
3528
+ * ```json
3529
+ * [
3530
+ * {
3531
+ * "type": "tool_use",
3532
+ * "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
3533
+ * "name": "get_stock_price",
3534
+ * "input": { "ticker": "^GSPC" }
3535
+ * }
3536
+ * ]
3537
+ * ```
3538
+ *
3539
+ * You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
3540
+ * input, and return the following back to the model in a subsequent `user`
3541
+ * message:
3542
+ *
3543
+ * ```json
3544
+ * [
3545
+ * {
3546
+ * "type": "tool_result",
3547
+ * "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
3548
+ * "content": "259.75 USD"
3549
+ * }
3550
+ * ]
3551
+ * ```
3552
+ *
3553
+ * Tools can be used for workflows that include running client-side tools and
3554
+ * functions, or more generally whenever you want the model to produce a particular
3555
+ * JSON structure of output.
3556
+ *
3557
+ * See our
3558
+ * [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview)
3559
+ * for more details.
3560
+ */
3561
+ tools?: Array<MessageCountTokensTool>;
3562
+
3563
+ /**
3564
+ * Header param: The user profile ID to attribute this request to. Use when acting
3565
+ * on behalf of a party other than your organization. Requires the `user-profiles`
3566
+ * beta header.
3567
+ */
3568
+ user_profile_id?: string;
3569
+ }
3570
+
3571
+ Messages.Batches = Batches;
3572
+
3573
+ export declare namespace Messages {
3574
+ export {
3575
+ type Base64ImageSource as Base64ImageSource,
3576
+ type Base64PDFSource as Base64PDFSource,
3577
+ type BashCodeExecutionOutputBlock as BashCodeExecutionOutputBlock,
3578
+ type BashCodeExecutionOutputBlockParam as BashCodeExecutionOutputBlockParam,
3579
+ type BashCodeExecutionResultBlock as BashCodeExecutionResultBlock,
3580
+ type BashCodeExecutionResultBlockParam as BashCodeExecutionResultBlockParam,
3581
+ type BashCodeExecutionToolResultBlock as BashCodeExecutionToolResultBlock,
3582
+ type BashCodeExecutionToolResultBlockParam as BashCodeExecutionToolResultBlockParam,
3583
+ type BashCodeExecutionToolResultError as BashCodeExecutionToolResultError,
3584
+ type BashCodeExecutionToolResultErrorCode as BashCodeExecutionToolResultErrorCode,
3585
+ type BashCodeExecutionToolResultErrorParam as BashCodeExecutionToolResultErrorParam,
3586
+ type CacheControlEphemeral as CacheControlEphemeral,
3587
+ type CacheCreation as CacheCreation,
3588
+ type CitationCharLocation as CitationCharLocation,
3589
+ type CitationCharLocationParam as CitationCharLocationParam,
3590
+ type CitationContentBlockLocation as CitationContentBlockLocation,
3591
+ type CitationContentBlockLocationParam as CitationContentBlockLocationParam,
3592
+ type CitationPageLocation as CitationPageLocation,
3593
+ type CitationPageLocationParam as CitationPageLocationParam,
3594
+ type CitationSearchResultLocationParam as CitationSearchResultLocationParam,
3595
+ type CitationWebSearchResultLocationParam as CitationWebSearchResultLocationParam,
3596
+ type CitationsConfig as CitationsConfig,
3597
+ type CitationsConfigParam as CitationsConfigParam,
3598
+ type CitationsDelta as CitationsDelta,
3599
+ type CitationsSearchResultLocation as CitationsSearchResultLocation,
3600
+ type CitationsWebSearchResultLocation as CitationsWebSearchResultLocation,
3601
+ type CodeExecutionOutputBlock as CodeExecutionOutputBlock,
3602
+ type CodeExecutionOutputBlockParam as CodeExecutionOutputBlockParam,
3603
+ type CodeExecutionResultBlock as CodeExecutionResultBlock,
3604
+ type CodeExecutionResultBlockParam as CodeExecutionResultBlockParam,
3605
+ type CodeExecutionTool20250522 as CodeExecutionTool20250522,
3606
+ type CodeExecutionTool20250825 as CodeExecutionTool20250825,
3607
+ type CodeExecutionTool20260120 as CodeExecutionTool20260120,
3608
+ type CodeExecutionTool20260521 as CodeExecutionTool20260521,
3609
+ type CodeExecutionToolResultBlock as CodeExecutionToolResultBlock,
3610
+ type CodeExecutionToolResultBlockContent as CodeExecutionToolResultBlockContent,
3611
+ type CodeExecutionToolResultBlockParam as CodeExecutionToolResultBlockParam,
3612
+ type CodeExecutionToolResultBlockParamContent as CodeExecutionToolResultBlockParamContent,
3613
+ type CodeExecutionToolResultError as CodeExecutionToolResultError,
3614
+ type CodeExecutionToolResultErrorCode as CodeExecutionToolResultErrorCode,
3615
+ type CodeExecutionToolResultErrorParam as CodeExecutionToolResultErrorParam,
3616
+ type Container as Container,
3617
+ type ContainerUploadBlock as ContainerUploadBlock,
3618
+ type ContainerUploadBlockParam as ContainerUploadBlockParam,
3619
+ type ContentBlock as ContentBlock,
3620
+ type ContentBlockParam as ContentBlockParam,
3621
+ type ContentBlockStartEvent as ContentBlockStartEvent,
3622
+ type ContentBlockStopEvent as ContentBlockStopEvent,
3623
+ type ContentBlockSource as ContentBlockSource,
3624
+ type ContentBlockSourceContent as ContentBlockSourceContent,
3625
+ type DirectCaller as DirectCaller,
3626
+ type DocumentBlock as DocumentBlock,
3627
+ type DocumentBlockParam as DocumentBlockParam,
3628
+ type EncryptedCodeExecutionResultBlock as EncryptedCodeExecutionResultBlock,
3629
+ type EncryptedCodeExecutionResultBlockParam as EncryptedCodeExecutionResultBlockParam,
3630
+ type ImageBlockParam as ImageBlockParam,
3631
+ type InputJSONDelta as InputJSONDelta,
3632
+ type JSONOutputFormat as JSONOutputFormat,
3633
+ type MemoryTool20250818 as MemoryTool20250818,
3634
+ type Message as Message,
3635
+ type MessageCountTokensTool as MessageCountTokensTool,
3636
+ type MessageDeltaEvent as MessageDeltaEvent,
3637
+ type MessageDeltaUsage as MessageDeltaUsage,
3638
+ type MessageParam as MessageParam,
3639
+ type MessageTokensCount as MessageTokensCount,
3640
+ type Metadata as Metadata,
3641
+ type MidConversationSystemBlockParam as MidConversationSystemBlockParam,
3642
+ type Model as Model,
3643
+ type OutputConfig as OutputConfig,
3644
+ type OutputTokensDetails as OutputTokensDetails,
3645
+ type PlainTextSource as PlainTextSource,
3646
+ type RawContentBlockDelta as RawContentBlockDelta,
3647
+ type RawContentBlockDeltaEvent as RawContentBlockDeltaEvent,
3648
+ type RawContentBlockStartEvent as RawContentBlockStartEvent,
3649
+ type RawContentBlockStopEvent as RawContentBlockStopEvent,
3650
+ type RawMessageDeltaEvent as RawMessageDeltaEvent,
3651
+ type RawMessageStartEvent as RawMessageStartEvent,
3652
+ type RawMessageStopEvent as RawMessageStopEvent,
3653
+ type RawMessageStreamEvent as RawMessageStreamEvent,
3654
+ type RedactedThinkingBlock as RedactedThinkingBlock,
3655
+ type RedactedThinkingBlockParam as RedactedThinkingBlockParam,
3656
+ type RefusalStopDetails as RefusalStopDetails,
3657
+ type SearchResultBlockParam as SearchResultBlockParam,
3658
+ type ServerToolCaller as ServerToolCaller,
3659
+ type ServerToolCaller20260120 as ServerToolCaller20260120,
3660
+ type ServerToolUsage as ServerToolUsage,
3661
+ type ServerToolUseBlock as ServerToolUseBlock,
3662
+ type ServerToolUseBlockParam as ServerToolUseBlockParam,
3663
+ type SignatureDelta as SignatureDelta,
3664
+ type StopReason as StopReason,
3665
+ type TextBlock as TextBlock,
3666
+ type TextBlockParam as TextBlockParam,
3667
+ type TextCitation as TextCitation,
3668
+ type TextCitationParam as TextCitationParam,
3669
+ type TextDelta as TextDelta,
3670
+ type TextEditorCodeExecutionCreateResultBlock as TextEditorCodeExecutionCreateResultBlock,
3671
+ type TextEditorCodeExecutionCreateResultBlockParam as TextEditorCodeExecutionCreateResultBlockParam,
3672
+ type TextEditorCodeExecutionStrReplaceResultBlock as TextEditorCodeExecutionStrReplaceResultBlock,
3673
+ type TextEditorCodeExecutionStrReplaceResultBlockParam as TextEditorCodeExecutionStrReplaceResultBlockParam,
3674
+ type TextEditorCodeExecutionToolResultBlock as TextEditorCodeExecutionToolResultBlock,
3675
+ type TextEditorCodeExecutionToolResultBlockParam as TextEditorCodeExecutionToolResultBlockParam,
3676
+ type TextEditorCodeExecutionToolResultError as TextEditorCodeExecutionToolResultError,
3677
+ type TextEditorCodeExecutionToolResultErrorCode as TextEditorCodeExecutionToolResultErrorCode,
3678
+ type TextEditorCodeExecutionToolResultErrorParam as TextEditorCodeExecutionToolResultErrorParam,
3679
+ type TextEditorCodeExecutionViewResultBlock as TextEditorCodeExecutionViewResultBlock,
3680
+ type TextEditorCodeExecutionViewResultBlockParam as TextEditorCodeExecutionViewResultBlockParam,
3681
+ type ThinkingBlock as ThinkingBlock,
3682
+ type ThinkingBlockParam as ThinkingBlockParam,
3683
+ type ThinkingConfigAdaptive as ThinkingConfigAdaptive,
3684
+ type ThinkingConfigDisabled as ThinkingConfigDisabled,
3685
+ type ThinkingConfigEnabled as ThinkingConfigEnabled,
3686
+ type ThinkingConfigParam as ThinkingConfigParam,
3687
+ type ThinkingDelta as ThinkingDelta,
3688
+ type Tool as Tool,
3689
+ type ToolBash20250124 as ToolBash20250124,
3690
+ type ToolChoice as ToolChoice,
3691
+ type ToolChoiceAny as ToolChoiceAny,
3692
+ type ToolChoiceAuto as ToolChoiceAuto,
3693
+ type ToolChoiceNone as ToolChoiceNone,
3694
+ type ToolChoiceTool as ToolChoiceTool,
3695
+ type ToolReferenceBlock as ToolReferenceBlock,
3696
+ type ToolReferenceBlockParam as ToolReferenceBlockParam,
3697
+ type ToolResultBlockParam as ToolResultBlockParam,
3698
+ type ToolSearchToolBm25_20251119 as ToolSearchToolBm25_20251119,
3699
+ type ToolSearchToolRegex20251119 as ToolSearchToolRegex20251119,
3700
+ type ToolSearchToolResultBlock as ToolSearchToolResultBlock,
3701
+ type ToolSearchToolResultBlockParam as ToolSearchToolResultBlockParam,
3702
+ type ToolSearchToolResultError as ToolSearchToolResultError,
3703
+ type ToolSearchToolResultErrorCode as ToolSearchToolResultErrorCode,
3704
+ type ToolSearchToolResultErrorParam as ToolSearchToolResultErrorParam,
3705
+ type ToolSearchToolSearchResultBlock as ToolSearchToolSearchResultBlock,
3706
+ type ToolSearchToolSearchResultBlockParam as ToolSearchToolSearchResultBlockParam,
3707
+ type ToolTextEditor20250124 as ToolTextEditor20250124,
3708
+ type ToolTextEditor20250429 as ToolTextEditor20250429,
3709
+ type ToolTextEditor20250728 as ToolTextEditor20250728,
3710
+ type ToolUnion as ToolUnion,
3711
+ type ToolUseBlock as ToolUseBlock,
3712
+ type ToolUseBlockParam as ToolUseBlockParam,
3713
+ type URLImageSource as URLImageSource,
3714
+ type URLPDFSource as URLPDFSource,
3715
+ type Usage as Usage,
3716
+ type UserLocation as UserLocation,
3717
+ type WebFetchBlock as WebFetchBlock,
3718
+ type WebFetchBlockParam as WebFetchBlockParam,
3719
+ type WebFetchTool20250910 as WebFetchTool20250910,
3720
+ type WebFetchTool20260209 as WebFetchTool20260209,
3721
+ type WebFetchTool20260309 as WebFetchTool20260309,
3722
+ type WebFetchTool20260318 as WebFetchTool20260318,
3723
+ type WebFetchToolResultBlock as WebFetchToolResultBlock,
3724
+ type WebFetchToolResultBlockParam as WebFetchToolResultBlockParam,
3725
+ type WebFetchToolResultErrorBlock as WebFetchToolResultErrorBlock,
3726
+ type WebFetchToolResultErrorBlockParam as WebFetchToolResultErrorBlockParam,
3727
+ type WebFetchToolResultErrorCode as WebFetchToolResultErrorCode,
3728
+ type WebSearchResultBlock as WebSearchResultBlock,
3729
+ type WebSearchResultBlockParam as WebSearchResultBlockParam,
3730
+ type WebSearchTool20250305 as WebSearchTool20250305,
3731
+ type WebSearchTool20260209 as WebSearchTool20260209,
3732
+ type WebSearchTool20260318 as WebSearchTool20260318,
3733
+ type WebSearchToolRequestError as WebSearchToolRequestError,
3734
+ type WebSearchToolResultBlock as WebSearchToolResultBlock,
3735
+ type WebSearchToolResultBlockContent as WebSearchToolResultBlockContent,
3736
+ type WebSearchToolResultBlockParam as WebSearchToolResultBlockParam,
3737
+ type WebSearchToolResultBlockParamContent as WebSearchToolResultBlockParamContent,
3738
+ type WebSearchToolResultError as WebSearchToolResultError,
3739
+ type MessageStreamEvent as MessageStreamEvent,
3740
+ type MessageStartEvent as MessageStartEvent,
3741
+ type MessageStopEvent as MessageStopEvent,
3742
+ type ContentBlockDeltaEvent as ContentBlockDeltaEvent,
3743
+ type MessageCreateParams as MessageCreateParams,
3744
+ type MessageCreateParamsNonStreaming as MessageCreateParamsNonStreaming,
3745
+ type MessageCreateParamsStreaming as MessageCreateParamsStreaming,
3746
+ type MessageStreamParams as MessageStreamParams,
3747
+ type MessageCountTokensParams as MessageCountTokensParams,
3748
+ };
3749
+
3750
+ export {
3751
+ Batches as Batches,
3752
+ type DeletedMessageBatch as DeletedMessageBatch,
3753
+ type MessageBatch as MessageBatch,
3754
+ type MessageBatchCanceledResult as MessageBatchCanceledResult,
3755
+ type MessageBatchErroredResult as MessageBatchErroredResult,
3756
+ type MessageBatchExpiredResult as MessageBatchExpiredResult,
3757
+ type MessageBatchIndividualResponse as MessageBatchIndividualResponse,
3758
+ type MessageBatchRequestCounts as MessageBatchRequestCounts,
3759
+ type MessageBatchResult as MessageBatchResult,
3760
+ type MessageBatchSucceededResult as MessageBatchSucceededResult,
3761
+ type MessageBatchesPage as MessageBatchesPage,
3762
+ type BatchCreateParams as BatchCreateParams,
3763
+ type BatchListParams as BatchListParams,
3764
+ };
3765
+ }