@ainative/cody-sdk 0.1.0

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 (770) hide show
  1. package/.github/logo.svg +3 -0
  2. package/CHANGELOG.md +2345 -0
  3. package/LICENSE +8 -0
  4. package/README.md +45 -0
  5. package/_vendor/partial-json-parser/parser.d.mts +3 -0
  6. package/_vendor/partial-json-parser/parser.d.mts.map +1 -0
  7. package/_vendor/partial-json-parser/parser.d.ts +3 -0
  8. package/_vendor/partial-json-parser/parser.d.ts.map +1 -0
  9. package/_vendor/partial-json-parser/parser.js +226 -0
  10. package/_vendor/partial-json-parser/parser.js.map +1 -0
  11. package/_vendor/partial-json-parser/parser.mjs +223 -0
  12. package/_vendor/partial-json-parser/parser.mjs.map +1 -0
  13. package/ainative.d.mts +32 -0
  14. package/ainative.d.mts.map +1 -0
  15. package/ainative.d.ts +32 -0
  16. package/ainative.d.ts.map +1 -0
  17. package/ainative.js +78 -0
  18. package/ainative.js.map +1 -0
  19. package/ainative.mjs +71 -0
  20. package/ainative.mjs.map +1 -0
  21. package/api-promise.d.mts +2 -0
  22. package/api-promise.d.mts.map +1 -0
  23. package/api-promise.d.ts +2 -0
  24. package/api-promise.d.ts.map +1 -0
  25. package/api-promise.js +6 -0
  26. package/api-promise.js.map +1 -0
  27. package/api-promise.mjs +2 -0
  28. package/api-promise.mjs.map +1 -0
  29. package/bin/cli +53 -0
  30. package/bin/migration-config.json +82 -0
  31. package/client.d.mts +247 -0
  32. package/client.d.mts.map +1 -0
  33. package/client.d.ts +247 -0
  34. package/client.d.ts.map +1 -0
  35. package/client.js +567 -0
  36. package/client.js.map +1 -0
  37. package/client.mjs +562 -0
  38. package/client.mjs.map +1 -0
  39. package/core/api-promise.d.mts +49 -0
  40. package/core/api-promise.d.mts.map +1 -0
  41. package/core/api-promise.d.ts +49 -0
  42. package/core/api-promise.d.ts.map +1 -0
  43. package/core/api-promise.js +76 -0
  44. package/core/api-promise.js.map +1 -0
  45. package/core/api-promise.mjs +72 -0
  46. package/core/api-promise.mjs.map +1 -0
  47. package/core/error.d.mts +50 -0
  48. package/core/error.d.mts.map +1 -0
  49. package/core/error.d.ts +50 -0
  50. package/core/error.d.ts.map +1 -0
  51. package/core/error.js +116 -0
  52. package/core/error.js.map +1 -0
  53. package/core/error.mjs +100 -0
  54. package/core/error.mjs.map +1 -0
  55. package/core/pagination.d.mts +105 -0
  56. package/core/pagination.d.mts.map +1 -0
  57. package/core/pagination.d.ts +105 -0
  58. package/core/pagination.d.ts.map +1 -0
  59. package/core/pagination.js +185 -0
  60. package/core/pagination.js.map +1 -0
  61. package/core/pagination.mjs +177 -0
  62. package/core/pagination.mjs.map +1 -0
  63. package/core/resource.d.mts +6 -0
  64. package/core/resource.d.mts.map +1 -0
  65. package/core/resource.d.ts +6 -0
  66. package/core/resource.d.ts.map +1 -0
  67. package/core/resource.js +11 -0
  68. package/core/resource.js.map +1 -0
  69. package/core/resource.mjs +7 -0
  70. package/core/resource.mjs.map +1 -0
  71. package/core/streaming.d.mts +33 -0
  72. package/core/streaming.d.mts.map +1 -0
  73. package/core/streaming.d.ts +33 -0
  74. package/core/streaming.d.ts.map +1 -0
  75. package/core/streaming.js +290 -0
  76. package/core/streaming.js.map +1 -0
  77. package/core/streaming.mjs +285 -0
  78. package/core/streaming.mjs.map +1 -0
  79. package/core/uploads.d.mts +3 -0
  80. package/core/uploads.d.mts.map +1 -0
  81. package/core/uploads.d.ts +3 -0
  82. package/core/uploads.d.ts.map +1 -0
  83. package/core/uploads.js +6 -0
  84. package/core/uploads.js.map +1 -0
  85. package/core/uploads.mjs +2 -0
  86. package/core/uploads.mjs.map +1 -0
  87. package/error.d.mts +2 -0
  88. package/error.d.mts.map +1 -0
  89. package/error.d.ts +2 -0
  90. package/error.d.ts.map +1 -0
  91. package/error.js +6 -0
  92. package/error.js.map +1 -0
  93. package/error.mjs +2 -0
  94. package/error.mjs.map +1 -0
  95. package/helpers/beta/json-schema.d.mts +31 -0
  96. package/helpers/beta/json-schema.d.mts.map +1 -0
  97. package/helpers/beta/json-schema.d.ts +31 -0
  98. package/helpers/beta/json-schema.d.ts.map +1 -0
  99. package/helpers/beta/json-schema.js +56 -0
  100. package/helpers/beta/json-schema.js.map +1 -0
  101. package/helpers/beta/json-schema.mjs +52 -0
  102. package/helpers/beta/json-schema.mjs.map +1 -0
  103. package/helpers/beta/mcp.d.mts +303 -0
  104. package/helpers/beta/mcp.d.mts.map +1 -0
  105. package/helpers/beta/mcp.d.ts +303 -0
  106. package/helpers/beta/mcp.d.ts.map +1 -0
  107. package/helpers/beta/mcp.js +419 -0
  108. package/helpers/beta/mcp.js.map +1 -0
  109. package/helpers/beta/mcp.mjs +406 -0
  110. package/helpers/beta/mcp.mjs.map +1 -0
  111. package/helpers/beta/memory.d.mts +11 -0
  112. package/helpers/beta/memory.d.mts.map +1 -0
  113. package/helpers/beta/memory.d.ts +11 -0
  114. package/helpers/beta/memory.d.ts.map +1 -0
  115. package/helpers/beta/memory.js +18 -0
  116. package/helpers/beta/memory.js.map +1 -0
  117. package/helpers/beta/memory.mjs +15 -0
  118. package/helpers/beta/memory.mjs.map +1 -0
  119. package/helpers/beta/zod.d.mts +27 -0
  120. package/helpers/beta/zod.d.mts.map +1 -0
  121. package/helpers/beta/zod.d.ts +27 -0
  122. package/helpers/beta/zod.d.ts.map +1 -0
  123. package/helpers/beta/zod.js +57 -0
  124. package/helpers/beta/zod.js.map +1 -0
  125. package/helpers/beta/zod.mjs +52 -0
  126. package/helpers/beta/zod.mjs.map +1 -0
  127. package/helpers/index.d.mts +3 -0
  128. package/helpers/index.d.mts.map +1 -0
  129. package/helpers/index.d.ts +3 -0
  130. package/helpers/index.d.ts.map +1 -0
  131. package/helpers/index.js +8 -0
  132. package/helpers/index.js.map +1 -0
  133. package/helpers/index.mjs +3 -0
  134. package/helpers/index.mjs.map +1 -0
  135. package/helpers/json-schema.d.mts +18 -0
  136. package/helpers/json-schema.d.mts.map +1 -0
  137. package/helpers/json-schema.d.ts +18 -0
  138. package/helpers/json-schema.d.ts.map +1 -0
  139. package/helpers/json-schema.js +37 -0
  140. package/helpers/json-schema.js.map +1 -0
  141. package/helpers/json-schema.mjs +34 -0
  142. package/helpers/json-schema.mjs.map +1 -0
  143. package/helpers/zod.d.mts +13 -0
  144. package/helpers/zod.d.mts.map +1 -0
  145. package/helpers/zod.d.ts +13 -0
  146. package/helpers/zod.d.ts.map +1 -0
  147. package/helpers/zod.js +47 -0
  148. package/helpers/zod.js.map +1 -0
  149. package/helpers/zod.mjs +43 -0
  150. package/helpers/zod.mjs.map +1 -0
  151. package/index.d.mts +9 -0
  152. package/index.d.mts.map +1 -0
  153. package/index.d.ts +9 -0
  154. package/index.d.ts.map +1 -0
  155. package/index.js +42 -0
  156. package/index.js.map +1 -0
  157. package/index.mjs +9 -0
  158. package/index.mjs.map +1 -0
  159. package/internal/builtin-types.d.mts +73 -0
  160. package/internal/builtin-types.d.mts.map +1 -0
  161. package/internal/builtin-types.d.ts +73 -0
  162. package/internal/builtin-types.d.ts.map +1 -0
  163. package/internal/builtin-types.js +4 -0
  164. package/internal/builtin-types.js.map +1 -0
  165. package/internal/builtin-types.mjs +3 -0
  166. package/internal/builtin-types.mjs.map +1 -0
  167. package/internal/constants.d.mts +5 -0
  168. package/internal/constants.d.mts.map +1 -0
  169. package/internal/constants.d.ts +5 -0
  170. package/internal/constants.d.ts.map +1 -0
  171. package/internal/constants.js +18 -0
  172. package/internal/constants.js.map +1 -0
  173. package/internal/constants.mjs +15 -0
  174. package/internal/constants.mjs.map +1 -0
  175. package/internal/decoders/jsonl.d.mts +10 -0
  176. package/internal/decoders/jsonl.d.mts.map +1 -0
  177. package/internal/decoders/jsonl.d.ts +10 -0
  178. package/internal/decoders/jsonl.d.ts.map +1 -0
  179. package/internal/decoders/jsonl.js +39 -0
  180. package/internal/decoders/jsonl.js.map +1 -0
  181. package/internal/decoders/jsonl.mjs +35 -0
  182. package/internal/decoders/jsonl.mjs.map +1 -0
  183. package/internal/decoders/line.d.mts +17 -0
  184. package/internal/decoders/line.d.mts.map +1 -0
  185. package/internal/decoders/line.d.ts +17 -0
  186. package/internal/decoders/line.d.ts.map +1 -0
  187. package/internal/decoders/line.js +113 -0
  188. package/internal/decoders/line.js.map +1 -0
  189. package/internal/decoders/line.mjs +108 -0
  190. package/internal/decoders/line.mjs.map +1 -0
  191. package/internal/detect-platform.d.mts +15 -0
  192. package/internal/detect-platform.d.mts.map +1 -0
  193. package/internal/detect-platform.d.ts +15 -0
  194. package/internal/detect-platform.d.ts.map +1 -0
  195. package/internal/detect-platform.js +162 -0
  196. package/internal/detect-platform.js.map +1 -0
  197. package/internal/detect-platform.mjs +157 -0
  198. package/internal/detect-platform.mjs.map +1 -0
  199. package/internal/errors.d.mts +3 -0
  200. package/internal/errors.d.mts.map +1 -0
  201. package/internal/errors.d.ts +3 -0
  202. package/internal/errors.d.ts.map +1 -0
  203. package/internal/errors.js +41 -0
  204. package/internal/errors.js.map +1 -0
  205. package/internal/errors.mjs +36 -0
  206. package/internal/errors.mjs.map +1 -0
  207. package/internal/headers.d.mts +22 -0
  208. package/internal/headers.d.mts.map +1 -0
  209. package/internal/headers.d.ts +22 -0
  210. package/internal/headers.d.ts.map +1 -0
  211. package/internal/headers.js +79 -0
  212. package/internal/headers.js.map +1 -0
  213. package/internal/headers.mjs +74 -0
  214. package/internal/headers.mjs.map +1 -0
  215. package/internal/parse.d.mts +17 -0
  216. package/internal/parse.d.mts.map +1 -0
  217. package/internal/parse.d.ts +17 -0
  218. package/internal/parse.d.ts.map +1 -0
  219. package/internal/parse.js +60 -0
  220. package/internal/parse.js.map +1 -0
  221. package/internal/parse.mjs +56 -0
  222. package/internal/parse.mjs.map +1 -0
  223. package/internal/request-options.d.mts +77 -0
  224. package/internal/request-options.d.mts.map +1 -0
  225. package/internal/request-options.d.ts +77 -0
  226. package/internal/request-options.d.ts.map +1 -0
  227. package/internal/request-options.js +14 -0
  228. package/internal/request-options.js.map +1 -0
  229. package/internal/request-options.mjs +10 -0
  230. package/internal/request-options.mjs.map +1 -0
  231. package/internal/shim-types.d.mts +17 -0
  232. package/internal/shim-types.d.mts.map +1 -0
  233. package/internal/shim-types.d.ts +17 -0
  234. package/internal/shim-types.d.ts.map +1 -0
  235. package/internal/shim-types.js +4 -0
  236. package/internal/shim-types.js.map +1 -0
  237. package/internal/shim-types.mjs +3 -0
  238. package/internal/shim-types.mjs.map +1 -0
  239. package/internal/shims.d.mts +20 -0
  240. package/internal/shims.d.mts.map +1 -0
  241. package/internal/shims.d.ts +20 -0
  242. package/internal/shims.d.ts.map +1 -0
  243. package/internal/shims.js +92 -0
  244. package/internal/shims.js.map +1 -0
  245. package/internal/shims.mjs +85 -0
  246. package/internal/shims.mjs.map +1 -0
  247. package/internal/stream-utils.d.mts +8 -0
  248. package/internal/stream-utils.d.mts.map +1 -0
  249. package/internal/stream-utils.d.ts +8 -0
  250. package/internal/stream-utils.d.ts.map +1 -0
  251. package/internal/stream-utils.js +38 -0
  252. package/internal/stream-utils.js.map +1 -0
  253. package/internal/stream-utils.mjs +35 -0
  254. package/internal/stream-utils.mjs.map +1 -0
  255. package/internal/to-file.d.mts +45 -0
  256. package/internal/to-file.d.mts.map +1 -0
  257. package/internal/to-file.d.ts +45 -0
  258. package/internal/to-file.d.ts.map +1 -0
  259. package/internal/to-file.js +96 -0
  260. package/internal/to-file.js.map +1 -0
  261. package/internal/to-file.mjs +93 -0
  262. package/internal/to-file.mjs.map +1 -0
  263. package/internal/tslib.js +81 -0
  264. package/internal/tslib.mjs +17 -0
  265. package/internal/types.d.mts +69 -0
  266. package/internal/types.d.mts.map +1 -0
  267. package/internal/types.d.ts +69 -0
  268. package/internal/types.d.ts.map +1 -0
  269. package/internal/types.js +4 -0
  270. package/internal/types.js.map +1 -0
  271. package/internal/types.mjs +3 -0
  272. package/internal/types.mjs.map +1 -0
  273. package/internal/uploads.d.mts +42 -0
  274. package/internal/uploads.d.mts.map +1 -0
  275. package/internal/uploads.d.ts +42 -0
  276. package/internal/uploads.d.ts.map +1 -0
  277. package/internal/uploads.js +145 -0
  278. package/internal/uploads.js.map +1 -0
  279. package/internal/uploads.mjs +135 -0
  280. package/internal/uploads.mjs.map +1 -0
  281. package/internal/utils/base64.d.mts +3 -0
  282. package/internal/utils/base64.d.mts.map +1 -0
  283. package/internal/utils/base64.d.ts +3 -0
  284. package/internal/utils/base64.d.ts.map +1 -0
  285. package/internal/utils/base64.js +38 -0
  286. package/internal/utils/base64.js.map +1 -0
  287. package/internal/utils/base64.mjs +33 -0
  288. package/internal/utils/base64.mjs.map +1 -0
  289. package/internal/utils/bytes.d.mts +4 -0
  290. package/internal/utils/bytes.d.mts.map +1 -0
  291. package/internal/utils/bytes.d.ts +4 -0
  292. package/internal/utils/bytes.d.ts.map +1 -0
  293. package/internal/utils/bytes.js +31 -0
  294. package/internal/utils/bytes.js.map +1 -0
  295. package/internal/utils/bytes.mjs +26 -0
  296. package/internal/utils/bytes.mjs.map +1 -0
  297. package/internal/utils/env.d.mts +9 -0
  298. package/internal/utils/env.d.mts.map +1 -0
  299. package/internal/utils/env.d.ts +9 -0
  300. package/internal/utils/env.d.ts.map +1 -0
  301. package/internal/utils/env.js +22 -0
  302. package/internal/utils/env.js.map +1 -0
  303. package/internal/utils/env.mjs +18 -0
  304. package/internal/utils/env.mjs.map +1 -0
  305. package/internal/utils/log.d.mts +37 -0
  306. package/internal/utils/log.d.mts.map +1 -0
  307. package/internal/utils/log.d.ts +37 -0
  308. package/internal/utils/log.d.ts.map +1 -0
  309. package/internal/utils/log.js +86 -0
  310. package/internal/utils/log.js.map +1 -0
  311. package/internal/utils/log.mjs +80 -0
  312. package/internal/utils/log.mjs.map +1 -0
  313. package/internal/utils/path.d.mts +15 -0
  314. package/internal/utils/path.d.mts.map +1 -0
  315. package/internal/utils/path.d.ts +15 -0
  316. package/internal/utils/path.d.ts.map +1 -0
  317. package/internal/utils/path.js +79 -0
  318. package/internal/utils/path.js.map +1 -0
  319. package/internal/utils/path.mjs +74 -0
  320. package/internal/utils/path.mjs.map +1 -0
  321. package/internal/utils/query.d.mts +5 -0
  322. package/internal/utils/query.d.mts.map +1 -0
  323. package/internal/utils/query.d.ts +5 -0
  324. package/internal/utils/query.d.ts.map +1 -0
  325. package/internal/utils/query.js +23 -0
  326. package/internal/utils/query.js.map +1 -0
  327. package/internal/utils/query.mjs +20 -0
  328. package/internal/utils/query.mjs.map +1 -0
  329. package/internal/utils/sleep.d.mts +2 -0
  330. package/internal/utils/sleep.d.mts.map +1 -0
  331. package/internal/utils/sleep.d.ts +2 -0
  332. package/internal/utils/sleep.d.ts.map +1 -0
  333. package/internal/utils/sleep.js +7 -0
  334. package/internal/utils/sleep.js.map +1 -0
  335. package/internal/utils/sleep.mjs +3 -0
  336. package/internal/utils/sleep.mjs.map +1 -0
  337. package/internal/utils/uuid.d.mts +5 -0
  338. package/internal/utils/uuid.d.mts.map +1 -0
  339. package/internal/utils/uuid.d.ts +5 -0
  340. package/internal/utils/uuid.d.ts.map +1 -0
  341. package/internal/utils/uuid.js +19 -0
  342. package/internal/utils/uuid.js.map +1 -0
  343. package/internal/utils/uuid.mjs +15 -0
  344. package/internal/utils/uuid.mjs.map +1 -0
  345. package/internal/utils/values.d.mts +19 -0
  346. package/internal/utils/values.d.mts.map +1 -0
  347. package/internal/utils/values.d.ts +19 -0
  348. package/internal/utils/values.d.ts.map +1 -0
  349. package/internal/utils/values.js +119 -0
  350. package/internal/utils/values.js.map +1 -0
  351. package/internal/utils/values.mjs +100 -0
  352. package/internal/utils/values.mjs.map +1 -0
  353. package/internal/utils.d.mts +8 -0
  354. package/internal/utils.d.mts.map +1 -0
  355. package/internal/utils.d.ts +8 -0
  356. package/internal/utils.d.ts.map +1 -0
  357. package/internal/utils.js +12 -0
  358. package/internal/utils.js.map +1 -0
  359. package/internal/utils.mjs +9 -0
  360. package/internal/utils.mjs.map +1 -0
  361. package/lib/BetaMessageStream.d.mts +122 -0
  362. package/lib/BetaMessageStream.d.mts.map +1 -0
  363. package/lib/BetaMessageStream.d.ts +122 -0
  364. package/lib/BetaMessageStream.d.ts.map +1 -0
  365. package/lib/BetaMessageStream.js +620 -0
  366. package/lib/BetaMessageStream.js.map +1 -0
  367. package/lib/BetaMessageStream.mjs +616 -0
  368. package/lib/BetaMessageStream.mjs.map +1 -0
  369. package/lib/MessageStream.d.mts +121 -0
  370. package/lib/MessageStream.d.mts.map +1 -0
  371. package/lib/MessageStream.d.ts +121 -0
  372. package/lib/MessageStream.d.ts.map +1 -0
  373. package/lib/MessageStream.js +595 -0
  374. package/lib/MessageStream.js.map +1 -0
  375. package/lib/MessageStream.mjs +591 -0
  376. package/lib/MessageStream.mjs.map +1 -0
  377. package/lib/beta-parser.d.mts +37 -0
  378. package/lib/beta-parser.d.mts.map +1 -0
  379. package/lib/beta-parser.d.ts +37 -0
  380. package/lib/beta-parser.d.ts.map +1 -0
  381. package/lib/beta-parser.js +79 -0
  382. package/lib/beta-parser.js.map +1 -0
  383. package/lib/beta-parser.mjs +75 -0
  384. package/lib/beta-parser.mjs.map +1 -0
  385. package/lib/parser.d.mts +32 -0
  386. package/lib/parser.d.mts.map +1 -0
  387. package/lib/parser.d.ts +32 -0
  388. package/lib/parser.d.ts.map +1 -0
  389. package/lib/parser.js +66 -0
  390. package/lib/parser.js.map +1 -0
  391. package/lib/parser.mjs +62 -0
  392. package/lib/parser.mjs.map +1 -0
  393. package/lib/stainless-helper-header.d.mts +34 -0
  394. package/lib/stainless-helper-header.d.mts.map +1 -0
  395. package/lib/stainless-helper-header.d.ts +34 -0
  396. package/lib/stainless-helper-header.d.ts.map +1 -0
  397. package/lib/stainless-helper-header.js +70 -0
  398. package/lib/stainless-helper-header.js.map +1 -0
  399. package/lib/stainless-helper-header.mjs +63 -0
  400. package/lib/stainless-helper-header.mjs.map +1 -0
  401. package/lib/tools/BetaRunnableTool.d.mts +12 -0
  402. package/lib/tools/BetaRunnableTool.d.mts.map +1 -0
  403. package/lib/tools/BetaRunnableTool.d.ts +12 -0
  404. package/lib/tools/BetaRunnableTool.d.ts.map +1 -0
  405. package/lib/tools/BetaRunnableTool.js +3 -0
  406. package/lib/tools/BetaRunnableTool.js.map +1 -0
  407. package/lib/tools/BetaRunnableTool.mjs +2 -0
  408. package/lib/tools/BetaRunnableTool.mjs.map +1 -0
  409. package/lib/tools/BetaToolRunner.d.mts +141 -0
  410. package/lib/tools/BetaToolRunner.d.mts.map +1 -0
  411. package/lib/tools/BetaToolRunner.d.ts +141 -0
  412. package/lib/tools/BetaToolRunner.d.ts.map +1 -0
  413. package/lib/tools/BetaToolRunner.js +381 -0
  414. package/lib/tools/BetaToolRunner.js.map +1 -0
  415. package/lib/tools/BetaToolRunner.mjs +377 -0
  416. package/lib/tools/BetaToolRunner.mjs.map +1 -0
  417. package/lib/tools/CompactionControl.d.mts +30 -0
  418. package/lib/tools/CompactionControl.d.mts.map +1 -0
  419. package/lib/tools/CompactionControl.d.ts +30 -0
  420. package/lib/tools/CompactionControl.d.ts.map +1 -0
  421. package/lib/tools/CompactionControl.js +28 -0
  422. package/lib/tools/CompactionControl.js.map +1 -0
  423. package/lib/tools/CompactionControl.mjs +25 -0
  424. package/lib/tools/CompactionControl.mjs.map +1 -0
  425. package/lib/tools/ToolError.d.mts +33 -0
  426. package/lib/tools/ToolError.d.mts.map +1 -0
  427. package/lib/tools/ToolError.d.ts +33 -0
  428. package/lib/tools/ToolError.d.ts.map +1 -0
  429. package/lib/tools/ToolError.js +42 -0
  430. package/lib/tools/ToolError.js.map +1 -0
  431. package/lib/tools/ToolError.mjs +38 -0
  432. package/lib/tools/ToolError.mjs.map +1 -0
  433. package/lib/tools/ToolRunner.d.mts +132 -0
  434. package/lib/tools/ToolRunner.d.mts.map +1 -0
  435. package/lib/tools/ToolRunner.d.ts +132 -0
  436. package/lib/tools/ToolRunner.d.ts.map +1 -0
  437. package/lib/tools/ToolRunner.js +294 -0
  438. package/lib/tools/ToolRunner.js.map +1 -0
  439. package/lib/tools/ToolRunner.mjs +290 -0
  440. package/lib/tools/ToolRunner.mjs.map +1 -0
  441. package/lib/transform-json-schema.d.mts +3 -0
  442. package/lib/transform-json-schema.d.mts.map +1 -0
  443. package/lib/transform-json-schema.d.ts +3 -0
  444. package/lib/transform-json-schema.d.ts.map +1 -0
  445. package/lib/transform-json-schema.js +114 -0
  446. package/lib/transform-json-schema.js.map +1 -0
  447. package/lib/transform-json-schema.mjs +111 -0
  448. package/lib/transform-json-schema.mjs.map +1 -0
  449. package/package.json +246 -0
  450. package/pagination.d.mts +2 -0
  451. package/pagination.d.mts.map +1 -0
  452. package/pagination.d.ts +2 -0
  453. package/pagination.d.ts.map +1 -0
  454. package/pagination.js +6 -0
  455. package/pagination.js.map +1 -0
  456. package/pagination.mjs +2 -0
  457. package/pagination.mjs.map +1 -0
  458. package/resource.d.mts +2 -0
  459. package/resource.d.mts.map +1 -0
  460. package/resource.d.ts +2 -0
  461. package/resource.d.ts.map +1 -0
  462. package/resource.js +6 -0
  463. package/resource.js.map +1 -0
  464. package/resource.mjs +2 -0
  465. package/resource.mjs.map +1 -0
  466. package/resources/beta/beta.d.mts +66 -0
  467. package/resources/beta/beta.d.mts.map +1 -0
  468. package/resources/beta/beta.d.ts +66 -0
  469. package/resources/beta/beta.d.ts.map +1 -0
  470. package/resources/beta/beta.js +29 -0
  471. package/resources/beta/beta.js.map +1 -0
  472. package/resources/beta/beta.mjs +24 -0
  473. package/resources/beta/beta.mjs.map +1 -0
  474. package/resources/beta/files.d.mts +151 -0
  475. package/resources/beta/files.d.mts.map +1 -0
  476. package/resources/beta/files.d.ts +151 -0
  477. package/resources/beta/files.d.ts.map +1 -0
  478. package/resources/beta/files.js +124 -0
  479. package/resources/beta/files.js.map +1 -0
  480. package/resources/beta/files.mjs +120 -0
  481. package/resources/beta/files.mjs.map +1 -0
  482. package/resources/beta/index.d.mts +6 -0
  483. package/resources/beta/index.d.mts.map +1 -0
  484. package/resources/beta/index.d.ts +6 -0
  485. package/resources/beta/index.d.ts.map +1 -0
  486. package/resources/beta/index.js +15 -0
  487. package/resources/beta/index.js.map +1 -0
  488. package/resources/beta/index.mjs +7 -0
  489. package/resources/beta/index.mjs.map +1 -0
  490. package/resources/beta/messages/batches.d.mts +646 -0
  491. package/resources/beta/messages/batches.d.mts.map +1 -0
  492. package/resources/beta/messages/batches.d.ts +646 -0
  493. package/resources/beta/messages/batches.d.ts.map +1 -0
  494. package/resources/beta/messages/batches.js +204 -0
  495. package/resources/beta/messages/batches.js.map +1 -0
  496. package/resources/beta/messages/batches.mjs +200 -0
  497. package/resources/beta/messages/batches.mjs.map +1 -0
  498. package/resources/beta/messages/index.d.mts +4 -0
  499. package/resources/beta/messages/index.d.mts.map +1 -0
  500. package/resources/beta/messages/index.d.ts +4 -0
  501. package/resources/beta/messages/index.d.ts.map +1 -0
  502. package/resources/beta/messages/index.js +12 -0
  503. package/resources/beta/messages/index.js.map +1 -0
  504. package/resources/beta/messages/index.mjs +5 -0
  505. package/resources/beta/messages/index.mjs.map +1 -0
  506. package/resources/beta/messages/messages.d.mts +2993 -0
  507. package/resources/beta/messages/messages.d.mts.map +1 -0
  508. package/resources/beta/messages/messages.d.ts +2993 -0
  509. package/resources/beta/messages/messages.d.ts.map +1 -0
  510. package/resources/beta/messages/messages.js +163 -0
  511. package/resources/beta/messages/messages.js.map +1 -0
  512. package/resources/beta/messages/messages.mjs +156 -0
  513. package/resources/beta/messages/messages.mjs.map +1 -0
  514. package/resources/beta/messages.d.mts +2 -0
  515. package/resources/beta/messages.d.mts.map +1 -0
  516. package/resources/beta/messages.d.ts +2 -0
  517. package/resources/beta/messages.d.ts.map +1 -0
  518. package/resources/beta/messages.js +6 -0
  519. package/resources/beta/messages.js.map +1 -0
  520. package/resources/beta/messages.mjs +3 -0
  521. package/resources/beta/messages.mjs.map +1 -0
  522. package/resources/beta/models.d.mts +208 -0
  523. package/resources/beta/models.d.mts.map +1 -0
  524. package/resources/beta/models.d.ts +208 -0
  525. package/resources/beta/models.d.ts.map +1 -0
  526. package/resources/beta/models.js +60 -0
  527. package/resources/beta/models.js.map +1 -0
  528. package/resources/beta/models.mjs +56 -0
  529. package/resources/beta/models.mjs.map +1 -0
  530. package/resources/beta/skills/index.d.mts +3 -0
  531. package/resources/beta/skills/index.d.mts.map +1 -0
  532. package/resources/beta/skills/index.d.ts +3 -0
  533. package/resources/beta/skills/index.d.ts.map +1 -0
  534. package/resources/beta/skills/index.js +9 -0
  535. package/resources/beta/skills/index.js.map +1 -0
  536. package/resources/beta/skills/index.mjs +4 -0
  537. package/resources/beta/skills/index.mjs.map +1 -0
  538. package/resources/beta/skills/skills.d.mts +249 -0
  539. package/resources/beta/skills/skills.d.mts.map +1 -0
  540. package/resources/beta/skills/skills.d.ts +249 -0
  541. package/resources/beta/skills/skills.d.ts.map +1 -0
  542. package/resources/beta/skills/skills.js +98 -0
  543. package/resources/beta/skills/skills.js.map +1 -0
  544. package/resources/beta/skills/skills.mjs +93 -0
  545. package/resources/beta/skills/skills.mjs.map +1 -0
  546. package/resources/beta/skills/versions.d.mts +257 -0
  547. package/resources/beta/skills/versions.d.mts.map +1 -0
  548. package/resources/beta/skills/versions.d.ts +257 -0
  549. package/resources/beta/skills/versions.d.ts.map +1 -0
  550. package/resources/beta/skills/versions.js +100 -0
  551. package/resources/beta/skills/versions.js.map +1 -0
  552. package/resources/beta/skills/versions.mjs +96 -0
  553. package/resources/beta/skills/versions.mjs.map +1 -0
  554. package/resources/beta/skills.d.mts +2 -0
  555. package/resources/beta/skills.d.mts.map +1 -0
  556. package/resources/beta/skills.d.ts +2 -0
  557. package/resources/beta/skills.d.ts.map +1 -0
  558. package/resources/beta/skills.js +6 -0
  559. package/resources/beta/skills.js.map +1 -0
  560. package/resources/beta/skills.mjs +3 -0
  561. package/resources/beta/skills.mjs.map +1 -0
  562. package/resources/beta.d.mts +2 -0
  563. package/resources/beta.d.mts.map +1 -0
  564. package/resources/beta.d.ts +2 -0
  565. package/resources/beta.d.ts.map +1 -0
  566. package/resources/beta.js +6 -0
  567. package/resources/beta.js.map +1 -0
  568. package/resources/beta.mjs +3 -0
  569. package/resources/beta.mjs.map +1 -0
  570. package/resources/completions.d.mts +182 -0
  571. package/resources/completions.d.mts.map +1 -0
  572. package/resources/completions.d.ts +182 -0
  573. package/resources/completions.d.ts.map +1 -0
  574. package/resources/completions.js +23 -0
  575. package/resources/completions.js.map +1 -0
  576. package/resources/completions.mjs +19 -0
  577. package/resources/completions.mjs.map +1 -0
  578. package/resources/index.d.mts +6 -0
  579. package/resources/index.d.mts.map +1 -0
  580. package/resources/index.d.ts +6 -0
  581. package/resources/index.d.ts.map +1 -0
  582. package/resources/index.js +15 -0
  583. package/resources/index.js.map +1 -0
  584. package/resources/index.mjs +7 -0
  585. package/resources/index.mjs.map +1 -0
  586. package/resources/messages/batches.d.mts +304 -0
  587. package/resources/messages/batches.d.mts.map +1 -0
  588. package/resources/messages/batches.d.ts +304 -0
  589. package/resources/messages/batches.d.ts.map +1 -0
  590. package/resources/messages/batches.js +153 -0
  591. package/resources/messages/batches.js.map +1 -0
  592. package/resources/messages/batches.mjs +149 -0
  593. package/resources/messages/batches.mjs.map +1 -0
  594. package/resources/messages/index.d.mts +3 -0
  595. package/resources/messages/index.d.mts.map +1 -0
  596. package/resources/messages/index.d.ts +3 -0
  597. package/resources/messages/index.d.ts.map +1 -0
  598. package/resources/messages/index.js +9 -0
  599. package/resources/messages/index.js.map +1 -0
  600. package/resources/messages/index.mjs +4 -0
  601. package/resources/messages/index.mjs.map +1 -0
  602. package/resources/messages/messages.d.mts +2285 -0
  603. package/resources/messages/messages.d.mts.map +1 -0
  604. package/resources/messages/messages.d.ts +2285 -0
  605. package/resources/messages/messages.d.ts.map +1 -0
  606. package/resources/messages/messages.js +128 -0
  607. package/resources/messages/messages.js.map +1 -0
  608. package/resources/messages/messages.mjs +123 -0
  609. package/resources/messages/messages.mjs.map +1 -0
  610. package/resources/messages.d.mts +2 -0
  611. package/resources/messages.d.mts.map +1 -0
  612. package/resources/messages.d.ts +2 -0
  613. package/resources/messages.d.ts.map +1 -0
  614. package/resources/messages.js +6 -0
  615. package/resources/messages.js.map +1 -0
  616. package/resources/messages.mjs +3 -0
  617. package/resources/messages.mjs.map +1 -0
  618. package/resources/models.d.mts +193 -0
  619. package/resources/models.d.mts.map +1 -0
  620. package/resources/models.d.ts +193 -0
  621. package/resources/models.d.ts.map +1 -0
  622. package/resources/models.js +45 -0
  623. package/resources/models.js.map +1 -0
  624. package/resources/models.mjs +41 -0
  625. package/resources/models.mjs.map +1 -0
  626. package/resources/shared.d.mts +44 -0
  627. package/resources/shared.d.mts.map +1 -0
  628. package/resources/shared.d.ts +44 -0
  629. package/resources/shared.d.ts.map +1 -0
  630. package/resources/shared.js +4 -0
  631. package/resources/shared.js.map +1 -0
  632. package/resources/shared.mjs +3 -0
  633. package/resources/shared.mjs.map +1 -0
  634. package/resources/top-level.d.mts +2 -0
  635. package/resources/top-level.d.mts.map +1 -0
  636. package/resources/top-level.d.ts +2 -0
  637. package/resources/top-level.d.ts.map +1 -0
  638. package/resources/top-level.js +4 -0
  639. package/resources/top-level.js.map +1 -0
  640. package/resources/top-level.mjs +3 -0
  641. package/resources/top-level.mjs.map +1 -0
  642. package/resources.d.mts +2 -0
  643. package/resources.d.mts.map +1 -0
  644. package/resources.d.ts +2 -0
  645. package/resources.d.ts.map +1 -0
  646. package/resources.js +5 -0
  647. package/resources.js.map +1 -0
  648. package/resources.mjs +2 -0
  649. package/resources.mjs.map +1 -0
  650. package/src/_vendor/partial-json-parser/README.md +3 -0
  651. package/src/_vendor/partial-json-parser/parser.ts +264 -0
  652. package/src/ainative.ts +85 -0
  653. package/src/api-promise.ts +2 -0
  654. package/src/client.ts +1326 -0
  655. package/src/core/README.md +3 -0
  656. package/src/core/api-promise.ts +101 -0
  657. package/src/core/error.ts +145 -0
  658. package/src/core/pagination.ts +331 -0
  659. package/src/core/resource.ts +11 -0
  660. package/src/core/streaming.ts +348 -0
  661. package/src/core/uploads.ts +2 -0
  662. package/src/error.ts +2 -0
  663. package/src/helpers/beta/json-schema.ts +75 -0
  664. package/src/helpers/beta/mcp.ts +624 -0
  665. package/src/helpers/beta/memory.ts +28 -0
  666. package/src/helpers/beta/zod.ts +72 -0
  667. package/src/helpers/index.ts +2 -0
  668. package/src/helpers/json-schema.ts +48 -0
  669. package/src/helpers/zod.ts +58 -0
  670. package/src/index.ts +40 -0
  671. package/src/internal/README.md +3 -0
  672. package/src/internal/builtin-types.ts +93 -0
  673. package/src/internal/constants.ts +15 -0
  674. package/src/internal/decoders/jsonl.ts +48 -0
  675. package/src/internal/decoders/line.ts +135 -0
  676. package/src/internal/detect-platform.ts +196 -0
  677. package/src/internal/errors.ts +33 -0
  678. package/src/internal/headers.ts +99 -0
  679. package/src/internal/parse.ts +90 -0
  680. package/src/internal/request-options.ts +93 -0
  681. package/src/internal/shim-types.ts +26 -0
  682. package/src/internal/shims.ts +107 -0
  683. package/src/internal/stream-utils.ts +32 -0
  684. package/src/internal/to-file.ts +159 -0
  685. package/src/internal/types.ts +95 -0
  686. package/src/internal/uploads.ts +204 -0
  687. package/src/internal/utils/base64.ts +40 -0
  688. package/src/internal/utils/bytes.ts +32 -0
  689. package/src/internal/utils/env.ts +18 -0
  690. package/src/internal/utils/log.ts +127 -0
  691. package/src/internal/utils/path.ts +88 -0
  692. package/src/internal/utils/query.ts +23 -0
  693. package/src/internal/utils/sleep.ts +3 -0
  694. package/src/internal/utils/uuid.ts +17 -0
  695. package/src/internal/utils/values.ts +112 -0
  696. package/src/internal/utils.ts +9 -0
  697. package/src/lib/.keep +4 -0
  698. package/src/lib/BetaMessageStream.ts +764 -0
  699. package/src/lib/MessageStream.ts +743 -0
  700. package/src/lib/beta-parser.ts +148 -0
  701. package/src/lib/parser.ts +125 -0
  702. package/src/lib/stainless-helper-header.ts +80 -0
  703. package/src/lib/tools/BetaRunnableTool.ts +40 -0
  704. package/src/lib/tools/BetaToolRunner.ts +494 -0
  705. package/src/lib/tools/CompactionControl.ts +57 -0
  706. package/src/lib/tools/ToolError.ts +47 -0
  707. package/src/lib/tools/ToolRunner.ts +381 -0
  708. package/src/lib/transform-json-schema.ts +124 -0
  709. package/src/pagination.ts +2 -0
  710. package/src/resource.ts +2 -0
  711. package/src/resources/beta/beta.ts +603 -0
  712. package/src/resources/beta/files.ts +261 -0
  713. package/src/resources/beta/index.ts +259 -0
  714. package/src/resources/beta/messages/batches.ts +827 -0
  715. package/src/resources/beta/messages/index.ts +229 -0
  716. package/src/resources/beta/messages/messages.ts +4372 -0
  717. package/src/resources/beta/messages.ts +3 -0
  718. package/src/resources/beta/models.ts +284 -0
  719. package/src/resources/beta/skills/index.ts +26 -0
  720. package/src/resources/beta/skills/skills.ts +384 -0
  721. package/src/resources/beta/skills/versions.ts +374 -0
  722. package/src/resources/beta/skills.ts +3 -0
  723. package/src/resources/beta.ts +3 -0
  724. package/src/resources/completions.ts +230 -0
  725. package/src/resources/index.ts +206 -0
  726. package/src/resources/messages/batches.ts +396 -0
  727. package/src/resources/messages/index.ts +189 -0
  728. package/src/resources/messages/messages.ts +3361 -0
  729. package/src/resources/messages.ts +3 -0
  730. package/src/resources/models.ts +269 -0
  731. package/src/resources/shared.ts +85 -0
  732. package/src/resources/top-level.ts +3 -0
  733. package/src/resources.ts +1 -0
  734. package/src/streaming.ts +2 -0
  735. package/src/tools/memory/node.ts +392 -0
  736. package/src/tsconfig.json +11 -0
  737. package/src/uploads.ts +2 -0
  738. package/src/version.ts +1 -0
  739. package/streaming.d.mts +2 -0
  740. package/streaming.d.mts.map +1 -0
  741. package/streaming.d.ts +2 -0
  742. package/streaming.d.ts.map +1 -0
  743. package/streaming.js +6 -0
  744. package/streaming.js.map +1 -0
  745. package/streaming.mjs +2 -0
  746. package/streaming.mjs.map +1 -0
  747. package/tools/memory/node.d.mts +18 -0
  748. package/tools/memory/node.d.mts.map +1 -0
  749. package/tools/memory/node.d.ts +18 -0
  750. package/tools/memory/node.d.ts.map +1 -0
  751. package/tools/memory/node.js +324 -0
  752. package/tools/memory/node.js.map +1 -0
  753. package/tools/memory/node.mjs +318 -0
  754. package/tools/memory/node.mjs.map +1 -0
  755. package/uploads.d.mts +2 -0
  756. package/uploads.d.mts.map +1 -0
  757. package/uploads.d.ts +2 -0
  758. package/uploads.d.ts.map +1 -0
  759. package/uploads.js +6 -0
  760. package/uploads.js.map +1 -0
  761. package/uploads.mjs +2 -0
  762. package/uploads.mjs.map +1 -0
  763. package/version.d.mts +2 -0
  764. package/version.d.mts.map +1 -0
  765. package/version.d.ts +2 -0
  766. package/version.d.ts.map +1 -0
  767. package/version.js +5 -0
  768. package/version.js.map +1 -0
  769. package/version.mjs +2 -0
  770. package/version.mjs.map +1 -0
@@ -0,0 +1,2285 @@
1
+ import { APIPromise } from "../../core/api-promise.mjs";
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import { Stream } from "../../core/streaming.mjs";
4
+ import { RequestOptions } from "../../internal/request-options.mjs";
5
+ import { MessageStream } from "../../lib/MessageStream.mjs";
6
+ import { type ExtractParsedContentFromParams, type ParseableMessageCreateParams, type ParsedMessage } from "../../lib/parser.mjs";
7
+ import * as BatchesAPI from "./batches.mjs";
8
+ import { BatchCreateParams, BatchListParams, Batches, DeletedMessageBatch, MessageBatch, MessageBatchCanceledResult, MessageBatchErroredResult, MessageBatchExpiredResult, MessageBatchIndividualResponse, MessageBatchRequestCounts, MessageBatchResult, MessageBatchSucceededResult, MessageBatchesPage } from "./batches.mjs";
9
+ import * as MessagesAPI from "./messages.mjs";
10
+ export declare class Messages extends APIResource {
11
+ batches: BatchesAPI.Batches;
12
+ /**
13
+ * Send a structured list of input messages with text and/or image content, and the
14
+ * model will generate the next message in the conversation.
15
+ *
16
+ * The Messages API can be used for either single queries or stateless multi-turn
17
+ * conversations.
18
+ *
19
+ * Learn more about the Messages API in our
20
+ * [user guide](https://docs.claude.com/en/docs/initial-setup)
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const message = await client.messages.create({
25
+ * max_tokens: 1024,
26
+ * messages: [{ content: 'Hello, world', role: 'user' }],
27
+ * model: 'claude-opus-4-6',
28
+ * });
29
+ * ```
30
+ */
31
+ create(body: MessageCreateParamsNonStreaming, options?: RequestOptions): APIPromise<Message>;
32
+ create(body: MessageCreateParamsStreaming, options?: RequestOptions): APIPromise<Stream<RawMessageStreamEvent>>;
33
+ create(body: MessageCreateParamsBase, options?: RequestOptions): APIPromise<Stream<RawMessageStreamEvent> | Message>;
34
+ /**
35
+ * Send a structured list of input messages with text and/or image content, along with an expected `output_config.format` and
36
+ * the response will be automatically parsed and available in the `parsed_output` property of the message.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const message = await client.messages.parse({
41
+ * model: 'claude-sonnet-4-5-20250929',
42
+ * max_tokens: 1024,
43
+ * messages: [{ role: 'user', content: 'What is 2+2?' }],
44
+ * output_config: {
45
+ * format: zodOutputFormat(z.object({ answer: z.number() })),
46
+ * },
47
+ * });
48
+ *
49
+ * console.log(message.parsed_output?.answer); // 4
50
+ * ```
51
+ */
52
+ parse<Params extends MessageCreateParamsNonStreaming>(params: Params, options?: RequestOptions): APIPromise<ParsedMessage<ExtractParsedContentFromParams<Params>>>;
53
+ /**
54
+ * Create a Message stream.
55
+ *
56
+ * If `output_config.format` is provided with a parseable format (like `zodOutputFormat()`),
57
+ * the final message will include a `parsed_output` property with the parsed content.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const stream = client.messages.stream({
62
+ * model: 'claude-sonnet-4-5-20250929',
63
+ * max_tokens: 1024,
64
+ * messages: [{ role: 'user', content: 'What is 2+2?' }],
65
+ * output_config: {
66
+ * format: zodOutputFormat(z.object({ answer: z.number() })),
67
+ * },
68
+ * });
69
+ *
70
+ * const message = await stream.finalMessage();
71
+ * console.log(message.parsed_output?.answer); // 4
72
+ * ```
73
+ */
74
+ stream<Params extends MessageStreamParams>(body: Params, options?: RequestOptions): MessageStream<ExtractParsedContentFromParams<Params>>;
75
+ /**
76
+ * Count the number of tokens in a Message.
77
+ *
78
+ * The Token Count API can be used to count the number of tokens in a Message,
79
+ * including tools, images, and documents, without creating it.
80
+ *
81
+ * Learn more about token counting in our
82
+ * [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting)
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * const messageTokensCount =
87
+ * await client.messages.countTokens({
88
+ * messages: [{ content: 'string', role: 'user' }],
89
+ * model: 'claude-opus-4-6',
90
+ * });
91
+ * ```
92
+ */
93
+ countTokens(body: MessageCountTokensParams, options?: RequestOptions): APIPromise<MessageTokensCount>;
94
+ }
95
+ export interface Base64ImageSource {
96
+ data: string;
97
+ media_type: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
98
+ type: 'base64';
99
+ }
100
+ export interface Base64PDFSource {
101
+ data: string;
102
+ media_type: 'application/pdf';
103
+ type: 'base64';
104
+ }
105
+ export interface BashCodeExecutionOutputBlock {
106
+ file_id: string;
107
+ type: 'bash_code_execution_output';
108
+ }
109
+ export interface BashCodeExecutionOutputBlockParam {
110
+ file_id: string;
111
+ type: 'bash_code_execution_output';
112
+ }
113
+ export interface BashCodeExecutionResultBlock {
114
+ content: Array<BashCodeExecutionOutputBlock>;
115
+ return_code: number;
116
+ stderr: string;
117
+ stdout: string;
118
+ type: 'bash_code_execution_result';
119
+ }
120
+ export interface BashCodeExecutionResultBlockParam {
121
+ content: Array<BashCodeExecutionOutputBlockParam>;
122
+ return_code: number;
123
+ stderr: string;
124
+ stdout: string;
125
+ type: 'bash_code_execution_result';
126
+ }
127
+ export interface BashCodeExecutionToolResultBlock {
128
+ content: BashCodeExecutionToolResultError | BashCodeExecutionResultBlock;
129
+ tool_use_id: string;
130
+ type: 'bash_code_execution_tool_result';
131
+ }
132
+ export interface BashCodeExecutionToolResultBlockParam {
133
+ content: BashCodeExecutionToolResultErrorParam | BashCodeExecutionResultBlockParam;
134
+ tool_use_id: string;
135
+ type: 'bash_code_execution_tool_result';
136
+ /**
137
+ * Create a cache control breakpoint at this content block.
138
+ */
139
+ cache_control?: CacheControlEphemeral | null;
140
+ }
141
+ export interface BashCodeExecutionToolResultError {
142
+ error_code: BashCodeExecutionToolResultErrorCode;
143
+ type: 'bash_code_execution_tool_result_error';
144
+ }
145
+ export type BashCodeExecutionToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded' | 'output_file_too_large';
146
+ export interface BashCodeExecutionToolResultErrorParam {
147
+ error_code: BashCodeExecutionToolResultErrorCode;
148
+ type: 'bash_code_execution_tool_result_error';
149
+ }
150
+ export interface CacheControlEphemeral {
151
+ type: 'ephemeral';
152
+ /**
153
+ * The time-to-live for the cache control breakpoint.
154
+ *
155
+ * This may be one the following values:
156
+ *
157
+ * - `5m`: 5 minutes
158
+ * - `1h`: 1 hour
159
+ *
160
+ * Defaults to `5m`.
161
+ */
162
+ ttl?: '5m' | '1h';
163
+ }
164
+ export interface CacheCreation {
165
+ /**
166
+ * The number of input tokens used to create the 1 hour cache entry.
167
+ */
168
+ ephemeral_1h_input_tokens: number;
169
+ /**
170
+ * The number of input tokens used to create the 5 minute cache entry.
171
+ */
172
+ ephemeral_5m_input_tokens: number;
173
+ }
174
+ export interface CitationCharLocation {
175
+ cited_text: string;
176
+ document_index: number;
177
+ document_title: string | null;
178
+ end_char_index: number;
179
+ file_id: string | null;
180
+ start_char_index: number;
181
+ type: 'char_location';
182
+ }
183
+ export interface CitationCharLocationParam {
184
+ cited_text: string;
185
+ document_index: number;
186
+ document_title: string | null;
187
+ end_char_index: number;
188
+ start_char_index: number;
189
+ type: 'char_location';
190
+ }
191
+ export interface CitationContentBlockLocation {
192
+ cited_text: string;
193
+ document_index: number;
194
+ document_title: string | null;
195
+ end_block_index: number;
196
+ file_id: string | null;
197
+ start_block_index: number;
198
+ type: 'content_block_location';
199
+ }
200
+ export interface CitationContentBlockLocationParam {
201
+ cited_text: string;
202
+ document_index: number;
203
+ document_title: string | null;
204
+ end_block_index: number;
205
+ start_block_index: number;
206
+ type: 'content_block_location';
207
+ }
208
+ export interface CitationPageLocation {
209
+ cited_text: string;
210
+ document_index: number;
211
+ document_title: string | null;
212
+ end_page_number: number;
213
+ file_id: string | null;
214
+ start_page_number: number;
215
+ type: 'page_location';
216
+ }
217
+ export interface CitationPageLocationParam {
218
+ cited_text: string;
219
+ document_index: number;
220
+ document_title: string | null;
221
+ end_page_number: number;
222
+ start_page_number: number;
223
+ type: 'page_location';
224
+ }
225
+ export interface CitationSearchResultLocationParam {
226
+ cited_text: string;
227
+ end_block_index: number;
228
+ search_result_index: number;
229
+ source: string;
230
+ start_block_index: number;
231
+ title: string | null;
232
+ type: 'search_result_location';
233
+ }
234
+ export interface CitationWebSearchResultLocationParam {
235
+ cited_text: string;
236
+ encrypted_index: string;
237
+ title: string | null;
238
+ type: 'web_search_result_location';
239
+ url: string;
240
+ }
241
+ export interface CitationsConfig {
242
+ enabled: boolean;
243
+ }
244
+ export interface CitationsConfigParam {
245
+ enabled?: boolean;
246
+ }
247
+ export interface CitationsDelta {
248
+ citation: CitationCharLocation | CitationPageLocation | CitationContentBlockLocation | CitationsWebSearchResultLocation | CitationsSearchResultLocation;
249
+ type: 'citations_delta';
250
+ }
251
+ export interface CitationsSearchResultLocation {
252
+ cited_text: string;
253
+ end_block_index: number;
254
+ search_result_index: number;
255
+ source: string;
256
+ start_block_index: number;
257
+ title: string | null;
258
+ type: 'search_result_location';
259
+ }
260
+ export interface CitationsWebSearchResultLocation {
261
+ cited_text: string;
262
+ encrypted_index: string;
263
+ title: string | null;
264
+ type: 'web_search_result_location';
265
+ url: string;
266
+ }
267
+ export interface CodeExecutionOutputBlock {
268
+ file_id: string;
269
+ type: 'code_execution_output';
270
+ }
271
+ export interface CodeExecutionOutputBlockParam {
272
+ file_id: string;
273
+ type: 'code_execution_output';
274
+ }
275
+ export interface CodeExecutionResultBlock {
276
+ content: Array<CodeExecutionOutputBlock>;
277
+ return_code: number;
278
+ stderr: string;
279
+ stdout: string;
280
+ type: 'code_execution_result';
281
+ }
282
+ export interface CodeExecutionResultBlockParam {
283
+ content: Array<CodeExecutionOutputBlockParam>;
284
+ return_code: number;
285
+ stderr: string;
286
+ stdout: string;
287
+ type: 'code_execution_result';
288
+ }
289
+ export interface CodeExecutionTool20250522 {
290
+ /**
291
+ * Name of the tool.
292
+ *
293
+ * This is how the tool will be called by the model and in `tool_use` blocks.
294
+ */
295
+ name: 'code_execution';
296
+ type: 'code_execution_20250522';
297
+ allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
298
+ /**
299
+ * Create a cache control breakpoint at this content block.
300
+ */
301
+ cache_control?: CacheControlEphemeral | null;
302
+ /**
303
+ * If true, tool will not be included in initial system prompt. Only loaded when
304
+ * returned via tool_reference from tool search.
305
+ */
306
+ defer_loading?: boolean;
307
+ /**
308
+ * When true, guarantees schema validation on tool names and inputs
309
+ */
310
+ strict?: boolean;
311
+ }
312
+ export interface CodeExecutionTool20250825 {
313
+ /**
314
+ * Name of the tool.
315
+ *
316
+ * This is how the tool will be called by the model and in `tool_use` blocks.
317
+ */
318
+ name: 'code_execution';
319
+ type: 'code_execution_20250825';
320
+ allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
321
+ /**
322
+ * Create a cache control breakpoint at this content block.
323
+ */
324
+ cache_control?: CacheControlEphemeral | null;
325
+ /**
326
+ * If true, tool will not be included in initial system prompt. Only loaded when
327
+ * returned via tool_reference from tool search.
328
+ */
329
+ defer_loading?: boolean;
330
+ /**
331
+ * When true, guarantees schema validation on tool names and inputs
332
+ */
333
+ strict?: boolean;
334
+ }
335
+ /**
336
+ * Code execution tool with REPL state persistence (daemon mode + gVisor
337
+ * checkpoint).
338
+ */
339
+ export interface CodeExecutionTool20260120 {
340
+ /**
341
+ * Name of the tool.
342
+ *
343
+ * This is how the tool will be called by the model and in `tool_use` blocks.
344
+ */
345
+ name: 'code_execution';
346
+ type: 'code_execution_20260120';
347
+ allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
348
+ /**
349
+ * Create a cache control breakpoint at this content block.
350
+ */
351
+ cache_control?: CacheControlEphemeral | null;
352
+ /**
353
+ * If true, tool will not be included in initial system prompt. Only loaded when
354
+ * returned via tool_reference from tool search.
355
+ */
356
+ defer_loading?: boolean;
357
+ /**
358
+ * When true, guarantees schema validation on tool names and inputs
359
+ */
360
+ strict?: boolean;
361
+ }
362
+ export interface CodeExecutionToolResultBlock {
363
+ /**
364
+ * Code execution result with encrypted stdout for PFC + web_search results.
365
+ */
366
+ content: CodeExecutionToolResultBlockContent;
367
+ tool_use_id: string;
368
+ type: 'code_execution_tool_result';
369
+ }
370
+ /**
371
+ * Code execution result with encrypted stdout for PFC + web_search results.
372
+ */
373
+ export type CodeExecutionToolResultBlockContent = CodeExecutionToolResultError | CodeExecutionResultBlock | EncryptedCodeExecutionResultBlock;
374
+ export interface CodeExecutionToolResultBlockParam {
375
+ /**
376
+ * Code execution result with encrypted stdout for PFC + web_search results.
377
+ */
378
+ content: CodeExecutionToolResultBlockParamContent;
379
+ tool_use_id: string;
380
+ type: 'code_execution_tool_result';
381
+ /**
382
+ * Create a cache control breakpoint at this content block.
383
+ */
384
+ cache_control?: CacheControlEphemeral | null;
385
+ }
386
+ /**
387
+ * Code execution result with encrypted stdout for PFC + web_search results.
388
+ */
389
+ export type CodeExecutionToolResultBlockParamContent = CodeExecutionToolResultErrorParam | CodeExecutionResultBlockParam | EncryptedCodeExecutionResultBlockParam;
390
+ export interface CodeExecutionToolResultError {
391
+ error_code: CodeExecutionToolResultErrorCode;
392
+ type: 'code_execution_tool_result_error';
393
+ }
394
+ export type CodeExecutionToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded';
395
+ export interface CodeExecutionToolResultErrorParam {
396
+ error_code: CodeExecutionToolResultErrorCode;
397
+ type: 'code_execution_tool_result_error';
398
+ }
399
+ /**
400
+ * Information about the container used in the request (for the code execution
401
+ * tool)
402
+ */
403
+ export interface Container {
404
+ /**
405
+ * Identifier for the container used in this request
406
+ */
407
+ id: string;
408
+ /**
409
+ * The time at which the container will expire.
410
+ */
411
+ expires_at: string;
412
+ }
413
+ /**
414
+ * Response model for a file uploaded to the container.
415
+ */
416
+ export interface ContainerUploadBlock {
417
+ file_id: string;
418
+ type: 'container_upload';
419
+ }
420
+ /**
421
+ * A content block that represents a file to be uploaded to the container Files
422
+ * uploaded via this block will be available in the container's input directory.
423
+ */
424
+ export interface ContainerUploadBlockParam {
425
+ file_id: string;
426
+ type: 'container_upload';
427
+ /**
428
+ * Create a cache control breakpoint at this content block.
429
+ */
430
+ cache_control?: CacheControlEphemeral | null;
431
+ }
432
+ /**
433
+ * Response model for a file uploaded to the container.
434
+ */
435
+ export type ContentBlock = TextBlock | ThinkingBlock | RedactedThinkingBlock | ToolUseBlock | ServerToolUseBlock | WebSearchToolResultBlock | WebFetchToolResultBlock | CodeExecutionToolResultBlock | BashCodeExecutionToolResultBlock | TextEditorCodeExecutionToolResultBlock | ToolSearchToolResultBlock | ContainerUploadBlock;
436
+ /**
437
+ * Regular text content.
438
+ */
439
+ export type ContentBlockParam = TextBlockParam | ImageBlockParam | DocumentBlockParam | SearchResultBlockParam | ThinkingBlockParam | RedactedThinkingBlockParam | ToolUseBlockParam | ToolResultBlockParam | ServerToolUseBlockParam | WebSearchToolResultBlockParam | WebFetchToolResultBlockParam | CodeExecutionToolResultBlockParam | BashCodeExecutionToolResultBlockParam | TextEditorCodeExecutionToolResultBlockParam | ToolSearchToolResultBlockParam | ContainerUploadBlockParam;
440
+ export interface ContentBlockSource {
441
+ content: string | Array<ContentBlockSourceContent>;
442
+ type: 'content';
443
+ }
444
+ export type ContentBlockSourceContent = TextBlockParam | ImageBlockParam;
445
+ /**
446
+ * Tool invocation directly from the model.
447
+ */
448
+ export interface DirectCaller {
449
+ type: 'direct';
450
+ }
451
+ export interface DocumentBlock {
452
+ /**
453
+ * Citation configuration for the document
454
+ */
455
+ citations: CitationsConfig | null;
456
+ source: Base64PDFSource | PlainTextSource;
457
+ /**
458
+ * The title of the document
459
+ */
460
+ title: string | null;
461
+ type: 'document';
462
+ }
463
+ export interface DocumentBlockParam {
464
+ source: Base64PDFSource | PlainTextSource | ContentBlockSource | URLPDFSource;
465
+ type: 'document';
466
+ /**
467
+ * Create a cache control breakpoint at this content block.
468
+ */
469
+ cache_control?: CacheControlEphemeral | null;
470
+ citations?: CitationsConfigParam | null;
471
+ context?: string | null;
472
+ title?: string | null;
473
+ }
474
+ /**
475
+ * Code execution result with encrypted stdout for PFC + web_search results.
476
+ */
477
+ export interface EncryptedCodeExecutionResultBlock {
478
+ content: Array<CodeExecutionOutputBlock>;
479
+ encrypted_stdout: string;
480
+ return_code: number;
481
+ stderr: string;
482
+ type: 'encrypted_code_execution_result';
483
+ }
484
+ /**
485
+ * Code execution result with encrypted stdout for PFC + web_search results.
486
+ */
487
+ export interface EncryptedCodeExecutionResultBlockParam {
488
+ content: Array<CodeExecutionOutputBlockParam>;
489
+ encrypted_stdout: string;
490
+ return_code: number;
491
+ stderr: string;
492
+ type: 'encrypted_code_execution_result';
493
+ }
494
+ export interface ImageBlockParam {
495
+ source: Base64ImageSource | URLImageSource;
496
+ type: 'image';
497
+ /**
498
+ * Create a cache control breakpoint at this content block.
499
+ */
500
+ cache_control?: CacheControlEphemeral | null;
501
+ }
502
+ export interface InputJSONDelta {
503
+ partial_json: string;
504
+ type: 'input_json_delta';
505
+ }
506
+ export interface JSONOutputFormat {
507
+ /**
508
+ * The JSON schema of the format
509
+ */
510
+ schema: {
511
+ [key: string]: unknown;
512
+ };
513
+ type: 'json_schema';
514
+ }
515
+ export interface MemoryTool20250818 {
516
+ /**
517
+ * Name of the tool.
518
+ *
519
+ * This is how the tool will be called by the model and in `tool_use` blocks.
520
+ */
521
+ name: 'memory';
522
+ type: 'memory_20250818';
523
+ allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
524
+ /**
525
+ * Create a cache control breakpoint at this content block.
526
+ */
527
+ cache_control?: CacheControlEphemeral | null;
528
+ /**
529
+ * If true, tool will not be included in initial system prompt. Only loaded when
530
+ * returned via tool_reference from tool search.
531
+ */
532
+ defer_loading?: boolean;
533
+ input_examples?: Array<{
534
+ [key: string]: unknown;
535
+ }>;
536
+ /**
537
+ * When true, guarantees schema validation on tool names and inputs
538
+ */
539
+ strict?: boolean;
540
+ }
541
+ export interface Message {
542
+ /**
543
+ * Unique object identifier.
544
+ *
545
+ * The format and length of IDs may change over time.
546
+ */
547
+ id: string;
548
+ /**
549
+ * Information about the container used in the request (for the code execution
550
+ * tool)
551
+ */
552
+ container: Container | null;
553
+ /**
554
+ * Content generated by the model.
555
+ *
556
+ * This is an array of content blocks, each of which has a `type` that determines
557
+ * its shape.
558
+ *
559
+ * Example:
560
+ *
561
+ * ```json
562
+ * [{ "type": "text", "text": "Hi, I'm Claude." }]
563
+ * ```
564
+ *
565
+ * If the request input `messages` ended with an `assistant` turn, then the
566
+ * response `content` will continue directly from that last turn. You can use this
567
+ * to constrain the model's output.
568
+ *
569
+ * For example, if the input `messages` were:
570
+ *
571
+ * ```json
572
+ * [
573
+ * {
574
+ * "role": "user",
575
+ * "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
576
+ * },
577
+ * { "role": "assistant", "content": "The best answer is (" }
578
+ * ]
579
+ * ```
580
+ *
581
+ * Then the response `content` might be:
582
+ *
583
+ * ```json
584
+ * [{ "type": "text", "text": "B)" }]
585
+ * ```
586
+ */
587
+ content: Array<ContentBlock>;
588
+ /**
589
+ * The model that will complete your prompt.\n\nSee
590
+ * [models](https://docs.anthropic.com/en/docs/models-overview) for additional
591
+ * details and options.
592
+ */
593
+ model: Model;
594
+ /**
595
+ * Conversational role of the generated message.
596
+ *
597
+ * This will always be `"assistant"`.
598
+ */
599
+ role: 'assistant';
600
+ /**
601
+ * Structured information about a refusal.
602
+ */
603
+ stop_details: RefusalStopDetails | null;
604
+ /**
605
+ * The reason that we stopped.
606
+ *
607
+ * This may be one the following values:
608
+ *
609
+ * - `"end_turn"`: the model reached a natural stopping point
610
+ * - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
611
+ * - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
612
+ * - `"tool_use"`: the model invoked one or more tools
613
+ * - `"pause_turn"`: we paused a long-running turn. You may provide the response
614
+ * back as-is in a subsequent request to let the model continue.
615
+ * - `"refusal"`: when streaming classifiers intervene to handle potential policy
616
+ * violations
617
+ *
618
+ * In non-streaming mode this value is always non-null. In streaming mode, it is
619
+ * null in the `message_start` event and non-null otherwise.
620
+ */
621
+ stop_reason: StopReason | null;
622
+ /**
623
+ * Which custom stop sequence was generated, if any.
624
+ *
625
+ * This value will be a non-null string if one of your custom stop sequences was
626
+ * generated.
627
+ */
628
+ stop_sequence: string | null;
629
+ /**
630
+ * Object type.
631
+ *
632
+ * For Messages, this is always `"message"`.
633
+ */
634
+ type: 'message';
635
+ /**
636
+ * Billing and rate-limit usage.
637
+ *
638
+ * Anthropic's API bills and rate-limits by token counts, as tokens represent the
639
+ * underlying cost to our systems.
640
+ *
641
+ * Under the hood, the API transforms requests into a format suitable for the
642
+ * model. The model's output then goes through a parsing stage before becoming an
643
+ * API response. As a result, the token counts in `usage` will not match one-to-one
644
+ * with the exact visible content of an API request or response.
645
+ *
646
+ * For example, `output_tokens` will be non-zero, even for an empty string response
647
+ * from Claude.
648
+ *
649
+ * Total input tokens in a request is the summation of `input_tokens`,
650
+ * `cache_creation_input_tokens`, and `cache_read_input_tokens`.
651
+ */
652
+ usage: Usage;
653
+ }
654
+ /**
655
+ * Code execution tool with REPL state persistence (daemon mode + gVisor
656
+ * checkpoint).
657
+ */
658
+ export type MessageCountTokensTool = Tool | ToolBash20250124 | CodeExecutionTool20250522 | CodeExecutionTool20250825 | CodeExecutionTool20260120 | MemoryTool20250818 | ToolTextEditor20250124 | ToolTextEditor20250429 | ToolTextEditor20250728 | WebSearchTool20250305 | WebFetchTool20250910 | WebSearchTool20260209 | WebFetchTool20260209 | WebFetchTool20260309 | ToolSearchToolBm25_20251119 | ToolSearchToolRegex20251119;
659
+ export interface MessageDeltaUsage {
660
+ /**
661
+ * The cumulative number of input tokens used to create the cache entry.
662
+ */
663
+ cache_creation_input_tokens: number | null;
664
+ /**
665
+ * The cumulative number of input tokens read from the cache.
666
+ */
667
+ cache_read_input_tokens: number | null;
668
+ /**
669
+ * The cumulative number of input tokens which were used.
670
+ */
671
+ input_tokens: number | null;
672
+ /**
673
+ * The cumulative number of output tokens which were used.
674
+ */
675
+ output_tokens: number;
676
+ /**
677
+ * The number of server tool requests.
678
+ */
679
+ server_tool_use: ServerToolUsage | null;
680
+ }
681
+ export interface MessageParam {
682
+ content: string | Array<ContentBlockParam>;
683
+ role: 'user' | 'assistant';
684
+ }
685
+ export interface MessageTokensCount {
686
+ /**
687
+ * The total number of tokens across the provided list of messages, system prompt,
688
+ * and tools.
689
+ */
690
+ input_tokens: number;
691
+ }
692
+ export interface Metadata {
693
+ /**
694
+ * An external identifier for the user who is associated with the request.
695
+ *
696
+ * This should be a uuid, hash value, or other opaque identifier. Anthropic may use
697
+ * this id to help detect abuse. Do not include any identifying information such as
698
+ * name, email address, or phone number.
699
+ */
700
+ user_id?: string | null;
701
+ }
702
+ /**
703
+ * The model that will complete your prompt.\n\nSee
704
+ * [models](https://docs.anthropic.com/en/docs/models-overview) for additional
705
+ * details and options.
706
+ */
707
+ export type Model = 'claude-opus-4-6' | 'claude-sonnet-4-6' | 'claude-haiku-4-5' | 'claude-haiku-4-5-20251001' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-1-20250805' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-3-haiku-20240307' | (string & {});
708
+ export interface OutputConfig {
709
+ /**
710
+ * All possible effort levels.
711
+ */
712
+ effort?: 'low' | 'medium' | 'high' | 'max' | null;
713
+ /**
714
+ * A schema to specify Claude's output format in responses. See
715
+ * [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
716
+ */
717
+ format?: JSONOutputFormat | null;
718
+ }
719
+ export interface PlainTextSource {
720
+ data: string;
721
+ media_type: 'text/plain';
722
+ type: 'text';
723
+ }
724
+ export type RawContentBlockDelta = TextDelta | InputJSONDelta | CitationsDelta | ThinkingDelta | SignatureDelta;
725
+ export interface RawContentBlockDeltaEvent {
726
+ delta: RawContentBlockDelta;
727
+ index: number;
728
+ type: 'content_block_delta';
729
+ }
730
+ export interface RawContentBlockStartEvent {
731
+ /**
732
+ * Response model for a file uploaded to the container.
733
+ */
734
+ content_block: TextBlock | ThinkingBlock | RedactedThinkingBlock | ToolUseBlock | ServerToolUseBlock | WebSearchToolResultBlock | WebFetchToolResultBlock | CodeExecutionToolResultBlock | BashCodeExecutionToolResultBlock | TextEditorCodeExecutionToolResultBlock | ToolSearchToolResultBlock | ContainerUploadBlock;
735
+ index: number;
736
+ type: 'content_block_start';
737
+ }
738
+ export interface RawContentBlockStopEvent {
739
+ index: number;
740
+ type: 'content_block_stop';
741
+ }
742
+ export interface RawMessageDeltaEvent {
743
+ delta: RawMessageDeltaEvent.Delta;
744
+ type: 'message_delta';
745
+ /**
746
+ * Billing and rate-limit usage.
747
+ *
748
+ * Anthropic's API bills and rate-limits by token counts, as tokens represent the
749
+ * underlying cost to our systems.
750
+ *
751
+ * Under the hood, the API transforms requests into a format suitable for the
752
+ * model. The model's output then goes through a parsing stage before becoming an
753
+ * API response. As a result, the token counts in `usage` will not match one-to-one
754
+ * with the exact visible content of an API request or response.
755
+ *
756
+ * For example, `output_tokens` will be non-zero, even for an empty string response
757
+ * from Claude.
758
+ *
759
+ * Total input tokens in a request is the summation of `input_tokens`,
760
+ * `cache_creation_input_tokens`, and `cache_read_input_tokens`.
761
+ */
762
+ usage: MessageDeltaUsage;
763
+ }
764
+ export declare namespace RawMessageDeltaEvent {
765
+ interface Delta {
766
+ /**
767
+ * Information about the container used in the request (for the code execution
768
+ * tool)
769
+ */
770
+ container: MessagesAPI.Container | null;
771
+ /**
772
+ * Structured information about a refusal.
773
+ */
774
+ stop_details: MessagesAPI.RefusalStopDetails | null;
775
+ stop_reason: MessagesAPI.StopReason | null;
776
+ stop_sequence: string | null;
777
+ }
778
+ }
779
+ export interface RawMessageStartEvent {
780
+ message: Message;
781
+ type: 'message_start';
782
+ }
783
+ export interface RawMessageStopEvent {
784
+ type: 'message_stop';
785
+ }
786
+ export type RawMessageStreamEvent = RawMessageStartEvent | RawMessageDeltaEvent | RawMessageStopEvent | RawContentBlockStartEvent | RawContentBlockDeltaEvent | RawContentBlockStopEvent;
787
+ export interface RedactedThinkingBlock {
788
+ data: string;
789
+ type: 'redacted_thinking';
790
+ }
791
+ export interface RedactedThinkingBlockParam {
792
+ data: string;
793
+ type: 'redacted_thinking';
794
+ }
795
+ /**
796
+ * Structured information about a refusal.
797
+ */
798
+ export interface RefusalStopDetails {
799
+ /**
800
+ * The policy category that triggered the refusal.
801
+ *
802
+ * `null` when the refusal doesn't map to a named category.
803
+ */
804
+ category: 'cyber' | 'bio' | null;
805
+ /**
806
+ * Human-readable explanation of the refusal.
807
+ *
808
+ * This text is not guaranteed to be stable. `null` when no explanation is
809
+ * available for the category.
810
+ */
811
+ explanation: string | null;
812
+ type: 'refusal';
813
+ }
814
+ export interface SearchResultBlockParam {
815
+ content: Array<TextBlockParam>;
816
+ source: string;
817
+ title: string;
818
+ type: 'search_result';
819
+ /**
820
+ * Create a cache control breakpoint at this content block.
821
+ */
822
+ cache_control?: CacheControlEphemeral | null;
823
+ citations?: CitationsConfigParam;
824
+ }
825
+ /**
826
+ * Tool invocation generated by a server-side tool.
827
+ */
828
+ export interface ServerToolCaller {
829
+ tool_id: string;
830
+ type: 'code_execution_20250825';
831
+ }
832
+ export interface ServerToolCaller20260120 {
833
+ tool_id: string;
834
+ type: 'code_execution_20260120';
835
+ }
836
+ export interface ServerToolUsage {
837
+ /**
838
+ * The number of web fetch tool requests.
839
+ */
840
+ web_fetch_requests: number;
841
+ /**
842
+ * The number of web search tool requests.
843
+ */
844
+ web_search_requests: number;
845
+ }
846
+ export interface ServerToolUseBlock {
847
+ id: string;
848
+ /**
849
+ * Tool invocation directly from the model.
850
+ */
851
+ caller: DirectCaller | ServerToolCaller | ServerToolCaller20260120;
852
+ input: unknown;
853
+ name: 'web_search' | 'web_fetch' | 'code_execution' | 'bash_code_execution' | 'text_editor_code_execution' | 'tool_search_tool_regex' | 'tool_search_tool_bm25';
854
+ type: 'server_tool_use';
855
+ }
856
+ export interface ServerToolUseBlockParam {
857
+ id: string;
858
+ input: unknown;
859
+ name: 'web_search' | 'web_fetch' | 'code_execution' | 'bash_code_execution' | 'text_editor_code_execution' | 'tool_search_tool_regex' | 'tool_search_tool_bm25';
860
+ type: 'server_tool_use';
861
+ /**
862
+ * Create a cache control breakpoint at this content block.
863
+ */
864
+ cache_control?: CacheControlEphemeral | null;
865
+ /**
866
+ * Tool invocation directly from the model.
867
+ */
868
+ caller?: DirectCaller | ServerToolCaller | ServerToolCaller20260120;
869
+ }
870
+ export interface SignatureDelta {
871
+ signature: string;
872
+ type: 'signature_delta';
873
+ }
874
+ export type StopReason = 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | 'pause_turn' | 'refusal';
875
+ export interface TextBlock {
876
+ /**
877
+ * Citations supporting the text block.
878
+ *
879
+ * The type of citation returned will depend on the type of document being cited.
880
+ * Citing a PDF results in `page_location`, plain text results in `char_location`,
881
+ * and content document results in `content_block_location`.
882
+ */
883
+ citations: Array<TextCitation> | null;
884
+ text: string;
885
+ type: 'text';
886
+ }
887
+ export interface TextBlockParam {
888
+ text: string;
889
+ type: 'text';
890
+ /**
891
+ * Create a cache control breakpoint at this content block.
892
+ */
893
+ cache_control?: CacheControlEphemeral | null;
894
+ citations?: Array<TextCitationParam> | null;
895
+ }
896
+ export type TextCitation = CitationCharLocation | CitationPageLocation | CitationContentBlockLocation | CitationsWebSearchResultLocation | CitationsSearchResultLocation;
897
+ export type TextCitationParam = CitationCharLocationParam | CitationPageLocationParam | CitationContentBlockLocationParam | CitationWebSearchResultLocationParam | CitationSearchResultLocationParam;
898
+ export interface TextDelta {
899
+ text: string;
900
+ type: 'text_delta';
901
+ }
902
+ export interface TextEditorCodeExecutionCreateResultBlock {
903
+ is_file_update: boolean;
904
+ type: 'text_editor_code_execution_create_result';
905
+ }
906
+ export interface TextEditorCodeExecutionCreateResultBlockParam {
907
+ is_file_update: boolean;
908
+ type: 'text_editor_code_execution_create_result';
909
+ }
910
+ export interface TextEditorCodeExecutionStrReplaceResultBlock {
911
+ lines: Array<string> | null;
912
+ new_lines: number | null;
913
+ new_start: number | null;
914
+ old_lines: number | null;
915
+ old_start: number | null;
916
+ type: 'text_editor_code_execution_str_replace_result';
917
+ }
918
+ export interface TextEditorCodeExecutionStrReplaceResultBlockParam {
919
+ type: 'text_editor_code_execution_str_replace_result';
920
+ lines?: Array<string> | null;
921
+ new_lines?: number | null;
922
+ new_start?: number | null;
923
+ old_lines?: number | null;
924
+ old_start?: number | null;
925
+ }
926
+ export interface TextEditorCodeExecutionToolResultBlock {
927
+ content: TextEditorCodeExecutionToolResultError | TextEditorCodeExecutionViewResultBlock | TextEditorCodeExecutionCreateResultBlock | TextEditorCodeExecutionStrReplaceResultBlock;
928
+ tool_use_id: string;
929
+ type: 'text_editor_code_execution_tool_result';
930
+ }
931
+ export interface TextEditorCodeExecutionToolResultBlockParam {
932
+ content: TextEditorCodeExecutionToolResultErrorParam | TextEditorCodeExecutionViewResultBlockParam | TextEditorCodeExecutionCreateResultBlockParam | TextEditorCodeExecutionStrReplaceResultBlockParam;
933
+ tool_use_id: string;
934
+ type: 'text_editor_code_execution_tool_result';
935
+ /**
936
+ * Create a cache control breakpoint at this content block.
937
+ */
938
+ cache_control?: CacheControlEphemeral | null;
939
+ }
940
+ export interface TextEditorCodeExecutionToolResultError {
941
+ error_code: TextEditorCodeExecutionToolResultErrorCode;
942
+ error_message: string | null;
943
+ type: 'text_editor_code_execution_tool_result_error';
944
+ }
945
+ export type TextEditorCodeExecutionToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded' | 'file_not_found';
946
+ export interface TextEditorCodeExecutionToolResultErrorParam {
947
+ error_code: TextEditorCodeExecutionToolResultErrorCode;
948
+ type: 'text_editor_code_execution_tool_result_error';
949
+ error_message?: string | null;
950
+ }
951
+ export interface TextEditorCodeExecutionViewResultBlock {
952
+ content: string;
953
+ file_type: 'text' | 'image' | 'pdf';
954
+ num_lines: number | null;
955
+ start_line: number | null;
956
+ total_lines: number | null;
957
+ type: 'text_editor_code_execution_view_result';
958
+ }
959
+ export interface TextEditorCodeExecutionViewResultBlockParam {
960
+ content: string;
961
+ file_type: 'text' | 'image' | 'pdf';
962
+ type: 'text_editor_code_execution_view_result';
963
+ num_lines?: number | null;
964
+ start_line?: number | null;
965
+ total_lines?: number | null;
966
+ }
967
+ export interface ThinkingBlock {
968
+ signature: string;
969
+ thinking: string;
970
+ type: 'thinking';
971
+ }
972
+ export interface ThinkingBlockParam {
973
+ signature: string;
974
+ thinking: string;
975
+ type: 'thinking';
976
+ }
977
+ export interface ThinkingConfigAdaptive {
978
+ type: 'adaptive';
979
+ /**
980
+ * Controls how thinking content appears in the response. When set to `summarized`,
981
+ * thinking is returned normally. When set to `omitted`, thinking content is
982
+ * redacted but a signature is returned for multi-turn continuity. Defaults to
983
+ * `summarized`.
984
+ */
985
+ display?: 'summarized' | 'omitted' | null;
986
+ }
987
+ export interface ThinkingConfigDisabled {
988
+ type: 'disabled';
989
+ }
990
+ export interface ThinkingConfigEnabled {
991
+ /**
992
+ * Determines how many tokens Claude can use for its internal reasoning process.
993
+ * Larger budgets can enable more thorough analysis for complex problems, improving
994
+ * response quality.
995
+ *
996
+ * Must be ≥1024 and less than `max_tokens`.
997
+ *
998
+ * See
999
+ * [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
1000
+ * for details.
1001
+ */
1002
+ budget_tokens: number;
1003
+ type: 'enabled';
1004
+ /**
1005
+ * Controls how thinking content appears in the response. When set to `summarized`,
1006
+ * thinking is returned normally. When set to `omitted`, thinking content is
1007
+ * redacted but a signature is returned for multi-turn continuity. Defaults to
1008
+ * `summarized`.
1009
+ */
1010
+ display?: 'summarized' | 'omitted' | null;
1011
+ }
1012
+ /**
1013
+ * Configuration for enabling Claude's extended thinking.
1014
+ *
1015
+ * When enabled, responses include `thinking` content blocks showing Claude's
1016
+ * thinking process before the final answer. Requires a minimum budget of 1,024
1017
+ * tokens and counts towards your `max_tokens` limit.
1018
+ *
1019
+ * See
1020
+ * [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
1021
+ * for details.
1022
+ */
1023
+ export type ThinkingConfigParam = ThinkingConfigEnabled | ThinkingConfigDisabled | ThinkingConfigAdaptive;
1024
+ export interface ThinkingDelta {
1025
+ thinking: string;
1026
+ type: 'thinking_delta';
1027
+ }
1028
+ export interface Tool {
1029
+ /**
1030
+ * [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
1031
+ *
1032
+ * This defines the shape of the `input` that your tool accepts and that the model
1033
+ * will produce.
1034
+ */
1035
+ input_schema: Tool.InputSchema;
1036
+ /**
1037
+ * Name of the tool.
1038
+ *
1039
+ * This is how the tool will be called by the model and in `tool_use` blocks.
1040
+ */
1041
+ name: string;
1042
+ allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
1043
+ /**
1044
+ * Create a cache control breakpoint at this content block.
1045
+ */
1046
+ cache_control?: CacheControlEphemeral | null;
1047
+ /**
1048
+ * If true, tool will not be included in initial system prompt. Only loaded when
1049
+ * returned via tool_reference from tool search.
1050
+ */
1051
+ defer_loading?: boolean;
1052
+ /**
1053
+ * Description of what this tool does.
1054
+ *
1055
+ * Tool descriptions should be as detailed as possible. The more information that
1056
+ * the model has about what the tool is and how to use it, the better it will
1057
+ * perform. You can use natural language descriptions to reinforce important
1058
+ * aspects of the tool input JSON schema.
1059
+ */
1060
+ description?: string;
1061
+ /**
1062
+ * Enable eager input streaming for this tool. When true, tool input parameters
1063
+ * will be streamed incrementally as they are generated, and types will be inferred
1064
+ * on-the-fly rather than buffering the full JSON output. When false, streaming is
1065
+ * disabled for this tool even if the fine-grained-tool-streaming beta is active.
1066
+ * When null (default), uses the default behavior based on beta headers.
1067
+ */
1068
+ eager_input_streaming?: boolean | null;
1069
+ input_examples?: Array<{
1070
+ [key: string]: unknown;
1071
+ }>;
1072
+ /**
1073
+ * When true, guarantees schema validation on tool names and inputs
1074
+ */
1075
+ strict?: boolean;
1076
+ type?: 'custom' | null;
1077
+ }
1078
+ export declare namespace Tool {
1079
+ /**
1080
+ * [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
1081
+ *
1082
+ * This defines the shape of the `input` that your tool accepts and that the model
1083
+ * will produce.
1084
+ */
1085
+ interface InputSchema {
1086
+ type: 'object';
1087
+ properties?: unknown | null;
1088
+ required?: Array<string> | null;
1089
+ [k: string]: unknown;
1090
+ }
1091
+ }
1092
+ export interface ToolBash20250124 {
1093
+ /**
1094
+ * Name of the tool.
1095
+ *
1096
+ * This is how the tool will be called by the model and in `tool_use` blocks.
1097
+ */
1098
+ name: 'bash';
1099
+ type: 'bash_20250124';
1100
+ allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
1101
+ /**
1102
+ * Create a cache control breakpoint at this content block.
1103
+ */
1104
+ cache_control?: CacheControlEphemeral | null;
1105
+ /**
1106
+ * If true, tool will not be included in initial system prompt. Only loaded when
1107
+ * returned via tool_reference from tool search.
1108
+ */
1109
+ defer_loading?: boolean;
1110
+ input_examples?: Array<{
1111
+ [key: string]: unknown;
1112
+ }>;
1113
+ /**
1114
+ * When true, guarantees schema validation on tool names and inputs
1115
+ */
1116
+ strict?: boolean;
1117
+ }
1118
+ /**
1119
+ * How the model should use the provided tools. The model can use a specific tool,
1120
+ * any available tool, decide by itself, or not use tools at all.
1121
+ */
1122
+ export type ToolChoice = ToolChoiceAuto | ToolChoiceAny | ToolChoiceTool | ToolChoiceNone;
1123
+ /**
1124
+ * The model will use any available tools.
1125
+ */
1126
+ export interface ToolChoiceAny {
1127
+ type: 'any';
1128
+ /**
1129
+ * Whether to disable parallel tool use.
1130
+ *
1131
+ * Defaults to `false`. If set to `true`, the model will output exactly one tool
1132
+ * use.
1133
+ */
1134
+ disable_parallel_tool_use?: boolean;
1135
+ }
1136
+ /**
1137
+ * The model will automatically decide whether to use tools.
1138
+ */
1139
+ export interface ToolChoiceAuto {
1140
+ type: 'auto';
1141
+ /**
1142
+ * Whether to disable parallel tool use.
1143
+ *
1144
+ * Defaults to `false`. If set to `true`, the model will output at most one tool
1145
+ * use.
1146
+ */
1147
+ disable_parallel_tool_use?: boolean;
1148
+ }
1149
+ /**
1150
+ * The model will not be allowed to use tools.
1151
+ */
1152
+ export interface ToolChoiceNone {
1153
+ type: 'none';
1154
+ }
1155
+ /**
1156
+ * The model will use the specified tool with `tool_choice.name`.
1157
+ */
1158
+ export interface ToolChoiceTool {
1159
+ /**
1160
+ * The name of the tool to use.
1161
+ */
1162
+ name: string;
1163
+ type: 'tool';
1164
+ /**
1165
+ * Whether to disable parallel tool use.
1166
+ *
1167
+ * Defaults to `false`. If set to `true`, the model will output exactly one tool
1168
+ * use.
1169
+ */
1170
+ disable_parallel_tool_use?: boolean;
1171
+ }
1172
+ export interface ToolReferenceBlock {
1173
+ tool_name: string;
1174
+ type: 'tool_reference';
1175
+ }
1176
+ /**
1177
+ * Tool reference block that can be included in tool_result content.
1178
+ */
1179
+ export interface ToolReferenceBlockParam {
1180
+ tool_name: string;
1181
+ type: 'tool_reference';
1182
+ /**
1183
+ * Create a cache control breakpoint at this content block.
1184
+ */
1185
+ cache_control?: CacheControlEphemeral | null;
1186
+ }
1187
+ export interface ToolResultBlockParam {
1188
+ tool_use_id: string;
1189
+ type: 'tool_result';
1190
+ /**
1191
+ * Create a cache control breakpoint at this content block.
1192
+ */
1193
+ cache_control?: CacheControlEphemeral | null;
1194
+ content?: string | Array<TextBlockParam | ImageBlockParam | SearchResultBlockParam | DocumentBlockParam | ToolReferenceBlockParam>;
1195
+ is_error?: boolean;
1196
+ }
1197
+ export interface ToolSearchToolBm25_20251119 {
1198
+ /**
1199
+ * Name of the tool.
1200
+ *
1201
+ * This is how the tool will be called by the model and in `tool_use` blocks.
1202
+ */
1203
+ name: 'tool_search_tool_bm25';
1204
+ type: 'tool_search_tool_bm25_20251119' | 'tool_search_tool_bm25';
1205
+ allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
1206
+ /**
1207
+ * Create a cache control breakpoint at this content block.
1208
+ */
1209
+ cache_control?: CacheControlEphemeral | null;
1210
+ /**
1211
+ * If true, tool will not be included in initial system prompt. Only loaded when
1212
+ * returned via tool_reference from tool search.
1213
+ */
1214
+ defer_loading?: boolean;
1215
+ /**
1216
+ * When true, guarantees schema validation on tool names and inputs
1217
+ */
1218
+ strict?: boolean;
1219
+ }
1220
+ export interface ToolSearchToolRegex20251119 {
1221
+ /**
1222
+ * Name of the tool.
1223
+ *
1224
+ * This is how the tool will be called by the model and in `tool_use` blocks.
1225
+ */
1226
+ name: 'tool_search_tool_regex';
1227
+ type: 'tool_search_tool_regex_20251119' | 'tool_search_tool_regex';
1228
+ allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
1229
+ /**
1230
+ * Create a cache control breakpoint at this content block.
1231
+ */
1232
+ cache_control?: CacheControlEphemeral | null;
1233
+ /**
1234
+ * If true, tool will not be included in initial system prompt. Only loaded when
1235
+ * returned via tool_reference from tool search.
1236
+ */
1237
+ defer_loading?: boolean;
1238
+ /**
1239
+ * When true, guarantees schema validation on tool names and inputs
1240
+ */
1241
+ strict?: boolean;
1242
+ }
1243
+ export interface ToolSearchToolResultBlock {
1244
+ content: ToolSearchToolResultError | ToolSearchToolSearchResultBlock;
1245
+ tool_use_id: string;
1246
+ type: 'tool_search_tool_result';
1247
+ }
1248
+ export interface ToolSearchToolResultBlockParam {
1249
+ content: ToolSearchToolResultErrorParam | ToolSearchToolSearchResultBlockParam;
1250
+ tool_use_id: string;
1251
+ type: 'tool_search_tool_result';
1252
+ /**
1253
+ * Create a cache control breakpoint at this content block.
1254
+ */
1255
+ cache_control?: CacheControlEphemeral | null;
1256
+ }
1257
+ export interface ToolSearchToolResultError {
1258
+ error_code: ToolSearchToolResultErrorCode;
1259
+ error_message: string | null;
1260
+ type: 'tool_search_tool_result_error';
1261
+ }
1262
+ export type ToolSearchToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded';
1263
+ export interface ToolSearchToolResultErrorParam {
1264
+ error_code: ToolSearchToolResultErrorCode;
1265
+ type: 'tool_search_tool_result_error';
1266
+ }
1267
+ export interface ToolSearchToolSearchResultBlock {
1268
+ tool_references: Array<ToolReferenceBlock>;
1269
+ type: 'tool_search_tool_search_result';
1270
+ }
1271
+ export interface ToolSearchToolSearchResultBlockParam {
1272
+ tool_references: Array<ToolReferenceBlockParam>;
1273
+ type: 'tool_search_tool_search_result';
1274
+ }
1275
+ export interface ToolTextEditor20250124 {
1276
+ /**
1277
+ * Name of the tool.
1278
+ *
1279
+ * This is how the tool will be called by the model and in `tool_use` blocks.
1280
+ */
1281
+ name: 'str_replace_editor';
1282
+ type: 'text_editor_20250124';
1283
+ allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
1284
+ /**
1285
+ * Create a cache control breakpoint at this content block.
1286
+ */
1287
+ cache_control?: CacheControlEphemeral | null;
1288
+ /**
1289
+ * If true, tool will not be included in initial system prompt. Only loaded when
1290
+ * returned via tool_reference from tool search.
1291
+ */
1292
+ defer_loading?: boolean;
1293
+ input_examples?: Array<{
1294
+ [key: string]: unknown;
1295
+ }>;
1296
+ /**
1297
+ * When true, guarantees schema validation on tool names and inputs
1298
+ */
1299
+ strict?: boolean;
1300
+ }
1301
+ export interface ToolTextEditor20250429 {
1302
+ /**
1303
+ * Name of the tool.
1304
+ *
1305
+ * This is how the tool will be called by the model and in `tool_use` blocks.
1306
+ */
1307
+ name: 'str_replace_based_edit_tool';
1308
+ type: 'text_editor_20250429';
1309
+ allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
1310
+ /**
1311
+ * Create a cache control breakpoint at this content block.
1312
+ */
1313
+ cache_control?: CacheControlEphemeral | null;
1314
+ /**
1315
+ * If true, tool will not be included in initial system prompt. Only loaded when
1316
+ * returned via tool_reference from tool search.
1317
+ */
1318
+ defer_loading?: boolean;
1319
+ input_examples?: Array<{
1320
+ [key: string]: unknown;
1321
+ }>;
1322
+ /**
1323
+ * When true, guarantees schema validation on tool names and inputs
1324
+ */
1325
+ strict?: boolean;
1326
+ }
1327
+ export interface ToolTextEditor20250728 {
1328
+ /**
1329
+ * Name of the tool.
1330
+ *
1331
+ * This is how the tool will be called by the model and in `tool_use` blocks.
1332
+ */
1333
+ name: 'str_replace_based_edit_tool';
1334
+ type: 'text_editor_20250728';
1335
+ allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
1336
+ /**
1337
+ * Create a cache control breakpoint at this content block.
1338
+ */
1339
+ cache_control?: CacheControlEphemeral | null;
1340
+ /**
1341
+ * If true, tool will not be included in initial system prompt. Only loaded when
1342
+ * returned via tool_reference from tool search.
1343
+ */
1344
+ defer_loading?: boolean;
1345
+ input_examples?: Array<{
1346
+ [key: string]: unknown;
1347
+ }>;
1348
+ /**
1349
+ * Maximum number of characters to display when viewing a file. If not specified,
1350
+ * defaults to displaying the full file.
1351
+ */
1352
+ max_characters?: number | null;
1353
+ /**
1354
+ * When true, guarantees schema validation on tool names and inputs
1355
+ */
1356
+ strict?: boolean;
1357
+ }
1358
+ /**
1359
+ * Code execution tool with REPL state persistence (daemon mode + gVisor
1360
+ * checkpoint).
1361
+ */
1362
+ export type ToolUnion = Tool | ToolBash20250124 | CodeExecutionTool20250522 | CodeExecutionTool20250825 | CodeExecutionTool20260120 | MemoryTool20250818 | ToolTextEditor20250124 | ToolTextEditor20250429 | ToolTextEditor20250728 | WebSearchTool20250305 | WebFetchTool20250910 | WebSearchTool20260209 | WebFetchTool20260209 | WebFetchTool20260309 | ToolSearchToolBm25_20251119 | ToolSearchToolRegex20251119;
1363
+ export interface ToolUseBlock {
1364
+ id: string;
1365
+ /**
1366
+ * Tool invocation directly from the model.
1367
+ */
1368
+ caller: DirectCaller | ServerToolCaller | ServerToolCaller20260120;
1369
+ input: unknown;
1370
+ name: string;
1371
+ type: 'tool_use';
1372
+ }
1373
+ export interface ToolUseBlockParam {
1374
+ id: string;
1375
+ input: unknown;
1376
+ name: string;
1377
+ type: 'tool_use';
1378
+ /**
1379
+ * Create a cache control breakpoint at this content block.
1380
+ */
1381
+ cache_control?: CacheControlEphemeral | null;
1382
+ /**
1383
+ * Tool invocation directly from the model.
1384
+ */
1385
+ caller?: DirectCaller | ServerToolCaller | ServerToolCaller20260120;
1386
+ }
1387
+ export interface URLImageSource {
1388
+ type: 'url';
1389
+ url: string;
1390
+ }
1391
+ export interface URLPDFSource {
1392
+ type: 'url';
1393
+ url: string;
1394
+ }
1395
+ export interface Usage {
1396
+ /**
1397
+ * Breakdown of cached tokens by TTL
1398
+ */
1399
+ cache_creation: CacheCreation | null;
1400
+ /**
1401
+ * The number of input tokens used to create the cache entry.
1402
+ */
1403
+ cache_creation_input_tokens: number | null;
1404
+ /**
1405
+ * The number of input tokens read from the cache.
1406
+ */
1407
+ cache_read_input_tokens: number | null;
1408
+ /**
1409
+ * The geographic region where inference was performed for this request.
1410
+ */
1411
+ inference_geo: string | null;
1412
+ /**
1413
+ * The number of input tokens which were used.
1414
+ */
1415
+ input_tokens: number;
1416
+ /**
1417
+ * The number of output tokens which were used.
1418
+ */
1419
+ output_tokens: number;
1420
+ /**
1421
+ * The number of server tool requests.
1422
+ */
1423
+ server_tool_use: ServerToolUsage | null;
1424
+ /**
1425
+ * If the request used the priority, standard, or batch tier.
1426
+ */
1427
+ service_tier: 'standard' | 'priority' | 'batch' | null;
1428
+ }
1429
+ export interface UserLocation {
1430
+ type: 'approximate';
1431
+ /**
1432
+ * The city of the user.
1433
+ */
1434
+ city?: string | null;
1435
+ /**
1436
+ * The two letter
1437
+ * [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the
1438
+ * user.
1439
+ */
1440
+ country?: string | null;
1441
+ /**
1442
+ * The region of the user.
1443
+ */
1444
+ region?: string | null;
1445
+ /**
1446
+ * The [IANA timezone](https://nodatime.org/TimeZones) of the user.
1447
+ */
1448
+ timezone?: string | null;
1449
+ }
1450
+ export interface WebFetchBlock {
1451
+ content: DocumentBlock;
1452
+ /**
1453
+ * ISO 8601 timestamp when the content was retrieved
1454
+ */
1455
+ retrieved_at: string | null;
1456
+ type: 'web_fetch_result';
1457
+ /**
1458
+ * Fetched content URL
1459
+ */
1460
+ url: string;
1461
+ }
1462
+ export interface WebFetchBlockParam {
1463
+ content: DocumentBlockParam;
1464
+ type: 'web_fetch_result';
1465
+ /**
1466
+ * Fetched content URL
1467
+ */
1468
+ url: string;
1469
+ /**
1470
+ * ISO 8601 timestamp when the content was retrieved
1471
+ */
1472
+ retrieved_at?: string | null;
1473
+ }
1474
+ export interface WebFetchTool20250910 {
1475
+ /**
1476
+ * Name of the tool.
1477
+ *
1478
+ * This is how the tool will be called by the model and in `tool_use` blocks.
1479
+ */
1480
+ name: 'web_fetch';
1481
+ type: 'web_fetch_20250910';
1482
+ allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
1483
+ /**
1484
+ * List of domains to allow fetching from
1485
+ */
1486
+ allowed_domains?: Array<string> | null;
1487
+ /**
1488
+ * List of domains to block fetching from
1489
+ */
1490
+ blocked_domains?: Array<string> | null;
1491
+ /**
1492
+ * Create a cache control breakpoint at this content block.
1493
+ */
1494
+ cache_control?: CacheControlEphemeral | null;
1495
+ /**
1496
+ * Citations configuration for fetched documents. Citations are disabled by
1497
+ * default.
1498
+ */
1499
+ citations?: CitationsConfigParam | null;
1500
+ /**
1501
+ * If true, tool will not be included in initial system prompt. Only loaded when
1502
+ * returned via tool_reference from tool search.
1503
+ */
1504
+ defer_loading?: boolean;
1505
+ /**
1506
+ * Maximum number of tokens used by including web page text content in the context.
1507
+ * The limit is approximate and does not apply to binary content such as PDFs.
1508
+ */
1509
+ max_content_tokens?: number | null;
1510
+ /**
1511
+ * Maximum number of times the tool can be used in the API request.
1512
+ */
1513
+ max_uses?: number | null;
1514
+ /**
1515
+ * When true, guarantees schema validation on tool names and inputs
1516
+ */
1517
+ strict?: boolean;
1518
+ }
1519
+ export interface WebFetchTool20260209 {
1520
+ /**
1521
+ * Name of the tool.
1522
+ *
1523
+ * This is how the tool will be called by the model and in `tool_use` blocks.
1524
+ */
1525
+ name: 'web_fetch';
1526
+ type: 'web_fetch_20260209';
1527
+ allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
1528
+ /**
1529
+ * List of domains to allow fetching from
1530
+ */
1531
+ allowed_domains?: Array<string> | null;
1532
+ /**
1533
+ * List of domains to block fetching from
1534
+ */
1535
+ blocked_domains?: Array<string> | null;
1536
+ /**
1537
+ * Create a cache control breakpoint at this content block.
1538
+ */
1539
+ cache_control?: CacheControlEphemeral | null;
1540
+ /**
1541
+ * Citations configuration for fetched documents. Citations are disabled by
1542
+ * default.
1543
+ */
1544
+ citations?: CitationsConfigParam | null;
1545
+ /**
1546
+ * If true, tool will not be included in initial system prompt. Only loaded when
1547
+ * returned via tool_reference from tool search.
1548
+ */
1549
+ defer_loading?: boolean;
1550
+ /**
1551
+ * Maximum number of tokens used by including web page text content in the context.
1552
+ * The limit is approximate and does not apply to binary content such as PDFs.
1553
+ */
1554
+ max_content_tokens?: number | null;
1555
+ /**
1556
+ * Maximum number of times the tool can be used in the API request.
1557
+ */
1558
+ max_uses?: number | null;
1559
+ /**
1560
+ * When true, guarantees schema validation on tool names and inputs
1561
+ */
1562
+ strict?: boolean;
1563
+ }
1564
+ /**
1565
+ * Web fetch tool with use_cache parameter for bypassing cached content.
1566
+ */
1567
+ export interface WebFetchTool20260309 {
1568
+ /**
1569
+ * Name of the tool.
1570
+ *
1571
+ * This is how the tool will be called by the model and in `tool_use` blocks.
1572
+ */
1573
+ name: 'web_fetch';
1574
+ type: 'web_fetch_20260309';
1575
+ allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
1576
+ /**
1577
+ * List of domains to allow fetching from
1578
+ */
1579
+ allowed_domains?: Array<string> | null;
1580
+ /**
1581
+ * List of domains to block fetching from
1582
+ */
1583
+ blocked_domains?: Array<string> | null;
1584
+ /**
1585
+ * Create a cache control breakpoint at this content block.
1586
+ */
1587
+ cache_control?: CacheControlEphemeral | null;
1588
+ /**
1589
+ * Citations configuration for fetched documents. Citations are disabled by
1590
+ * default.
1591
+ */
1592
+ citations?: CitationsConfigParam | null;
1593
+ /**
1594
+ * If true, tool will not be included in initial system prompt. Only loaded when
1595
+ * returned via tool_reference from tool search.
1596
+ */
1597
+ defer_loading?: boolean;
1598
+ /**
1599
+ * Maximum number of tokens used by including web page text content in the context.
1600
+ * The limit is approximate and does not apply to binary content such as PDFs.
1601
+ */
1602
+ max_content_tokens?: number | null;
1603
+ /**
1604
+ * Maximum number of times the tool can be used in the API request.
1605
+ */
1606
+ max_uses?: number | null;
1607
+ /**
1608
+ * When true, guarantees schema validation on tool names and inputs
1609
+ */
1610
+ strict?: boolean;
1611
+ /**
1612
+ * Whether to use cached content. Set to false to bypass the cache and fetch fresh
1613
+ * content. Only set to false when the user explicitly requests fresh content or
1614
+ * when fetching rapidly-changing sources.
1615
+ */
1616
+ use_cache?: boolean;
1617
+ }
1618
+ export interface WebFetchToolResultBlock {
1619
+ /**
1620
+ * Tool invocation directly from the model.
1621
+ */
1622
+ caller: DirectCaller | ServerToolCaller | ServerToolCaller20260120;
1623
+ content: WebFetchToolResultErrorBlock | WebFetchBlock;
1624
+ tool_use_id: string;
1625
+ type: 'web_fetch_tool_result';
1626
+ }
1627
+ export interface WebFetchToolResultBlockParam {
1628
+ content: WebFetchToolResultErrorBlockParam | WebFetchBlockParam;
1629
+ tool_use_id: string;
1630
+ type: 'web_fetch_tool_result';
1631
+ /**
1632
+ * Create a cache control breakpoint at this content block.
1633
+ */
1634
+ cache_control?: CacheControlEphemeral | null;
1635
+ /**
1636
+ * Tool invocation directly from the model.
1637
+ */
1638
+ caller?: DirectCaller | ServerToolCaller | ServerToolCaller20260120;
1639
+ }
1640
+ export interface WebFetchToolResultErrorBlock {
1641
+ error_code: WebFetchToolResultErrorCode;
1642
+ type: 'web_fetch_tool_result_error';
1643
+ }
1644
+ export interface WebFetchToolResultErrorBlockParam {
1645
+ error_code: WebFetchToolResultErrorCode;
1646
+ type: 'web_fetch_tool_result_error';
1647
+ }
1648
+ export type WebFetchToolResultErrorCode = 'invalid_tool_input' | 'url_too_long' | 'url_not_allowed' | 'url_not_accessible' | 'unsupported_content_type' | 'too_many_requests' | 'max_uses_exceeded' | 'unavailable';
1649
+ export interface WebSearchResultBlock {
1650
+ encrypted_content: string;
1651
+ page_age: string | null;
1652
+ title: string;
1653
+ type: 'web_search_result';
1654
+ url: string;
1655
+ }
1656
+ export interface WebSearchResultBlockParam {
1657
+ encrypted_content: string;
1658
+ title: string;
1659
+ type: 'web_search_result';
1660
+ url: string;
1661
+ page_age?: string | null;
1662
+ }
1663
+ export interface WebSearchTool20250305 {
1664
+ /**
1665
+ * Name of the tool.
1666
+ *
1667
+ * This is how the tool will be called by the model and in `tool_use` blocks.
1668
+ */
1669
+ name: 'web_search';
1670
+ type: 'web_search_20250305';
1671
+ allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
1672
+ /**
1673
+ * If provided, only these domains will be included in results. Cannot be used
1674
+ * alongside `blocked_domains`.
1675
+ */
1676
+ allowed_domains?: Array<string> | null;
1677
+ /**
1678
+ * If provided, these domains will never appear in results. Cannot be used
1679
+ * alongside `allowed_domains`.
1680
+ */
1681
+ blocked_domains?: Array<string> | null;
1682
+ /**
1683
+ * Create a cache control breakpoint at this content block.
1684
+ */
1685
+ cache_control?: CacheControlEphemeral | null;
1686
+ /**
1687
+ * If true, tool will not be included in initial system prompt. Only loaded when
1688
+ * returned via tool_reference from tool search.
1689
+ */
1690
+ defer_loading?: boolean;
1691
+ /**
1692
+ * Maximum number of times the tool can be used in the API request.
1693
+ */
1694
+ max_uses?: number | null;
1695
+ /**
1696
+ * When true, guarantees schema validation on tool names and inputs
1697
+ */
1698
+ strict?: boolean;
1699
+ /**
1700
+ * Parameters for the user's location. Used to provide more relevant search
1701
+ * results.
1702
+ */
1703
+ user_location?: UserLocation | null;
1704
+ }
1705
+ export declare namespace WebSearchTool20250305 {
1706
+ /**
1707
+ * @deprecated Import `UserLocation` from `anthropic` directly instead of using
1708
+ * `WebSearchTool20250305.UserLocation`.
1709
+ */
1710
+ type UserLocation = Messages.UserLocation;
1711
+ }
1712
+ export interface WebSearchTool20260209 {
1713
+ /**
1714
+ * Name of the tool.
1715
+ *
1716
+ * This is how the tool will be called by the model and in `tool_use` blocks.
1717
+ */
1718
+ name: 'web_search';
1719
+ type: 'web_search_20260209';
1720
+ allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
1721
+ /**
1722
+ * If provided, only these domains will be included in results. Cannot be used
1723
+ * alongside `blocked_domains`.
1724
+ */
1725
+ allowed_domains?: Array<string> | null;
1726
+ /**
1727
+ * If provided, these domains will never appear in results. Cannot be used
1728
+ * alongside `allowed_domains`.
1729
+ */
1730
+ blocked_domains?: Array<string> | null;
1731
+ /**
1732
+ * Create a cache control breakpoint at this content block.
1733
+ */
1734
+ cache_control?: CacheControlEphemeral | null;
1735
+ /**
1736
+ * If true, tool will not be included in initial system prompt. Only loaded when
1737
+ * returned via tool_reference from tool search.
1738
+ */
1739
+ defer_loading?: boolean;
1740
+ /**
1741
+ * Maximum number of times the tool can be used in the API request.
1742
+ */
1743
+ max_uses?: number | null;
1744
+ /**
1745
+ * When true, guarantees schema validation on tool names and inputs
1746
+ */
1747
+ strict?: boolean;
1748
+ /**
1749
+ * Parameters for the user's location. Used to provide more relevant search
1750
+ * results.
1751
+ */
1752
+ user_location?: UserLocation | null;
1753
+ }
1754
+ export declare namespace WebSearchTool20260209 {
1755
+ /**
1756
+ * @deprecated Import `UserLocation` from `anthropic` directly instead of using
1757
+ * `WebSearchTool20260209.UserLocation`.
1758
+ */
1759
+ type UserLocation = Messages.UserLocation;
1760
+ }
1761
+ export interface WebSearchToolRequestError {
1762
+ error_code: WebSearchToolResultErrorCode;
1763
+ type: 'web_search_tool_result_error';
1764
+ }
1765
+ export interface WebSearchToolResultBlock {
1766
+ /**
1767
+ * Tool invocation directly from the model.
1768
+ */
1769
+ caller: DirectCaller | ServerToolCaller | ServerToolCaller20260120;
1770
+ content: WebSearchToolResultBlockContent;
1771
+ tool_use_id: string;
1772
+ type: 'web_search_tool_result';
1773
+ }
1774
+ export type WebSearchToolResultBlockContent = WebSearchToolResultError | Array<WebSearchResultBlock>;
1775
+ export interface WebSearchToolResultBlockParam {
1776
+ content: WebSearchToolResultBlockParamContent;
1777
+ tool_use_id: string;
1778
+ type: 'web_search_tool_result';
1779
+ /**
1780
+ * Create a cache control breakpoint at this content block.
1781
+ */
1782
+ cache_control?: CacheControlEphemeral | null;
1783
+ /**
1784
+ * Tool invocation directly from the model.
1785
+ */
1786
+ caller?: DirectCaller | ServerToolCaller | ServerToolCaller20260120;
1787
+ }
1788
+ export type WebSearchToolResultBlockParamContent = Array<WebSearchResultBlockParam> | WebSearchToolRequestError;
1789
+ export interface WebSearchToolResultError {
1790
+ error_code: WebSearchToolResultErrorCode;
1791
+ type: 'web_search_tool_result_error';
1792
+ }
1793
+ export type WebSearchToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'max_uses_exceeded' | 'too_many_requests' | 'query_too_long' | 'request_too_large';
1794
+ export type MessageStreamEvent = RawMessageStreamEvent;
1795
+ export type MessageStartEvent = RawMessageStartEvent;
1796
+ export type MessageDeltaEvent = RawMessageDeltaEvent;
1797
+ export type MessageStopEvent = RawMessageStopEvent;
1798
+ export type ContentBlockStartEvent = RawContentBlockStartEvent;
1799
+ export type ContentBlockDeltaEvent = RawContentBlockDeltaEvent;
1800
+ export type ContentBlockStopEvent = RawContentBlockStopEvent;
1801
+ export type MessageCreateParams = MessageCreateParamsNonStreaming | MessageCreateParamsStreaming;
1802
+ export interface MessageCreateParamsBase {
1803
+ /**
1804
+ * The maximum number of tokens to generate before stopping.
1805
+ *
1806
+ * Note that our models may stop _before_ reaching this maximum. This parameter
1807
+ * only specifies the absolute maximum number of tokens to generate.
1808
+ *
1809
+ * Different models have different maximum values for this parameter. See
1810
+ * [models](https://docs.claude.com/en/docs/models-overview) for details.
1811
+ */
1812
+ max_tokens: number;
1813
+ /**
1814
+ * Input messages.
1815
+ *
1816
+ * Our models are trained to operate on alternating `user` and `assistant`
1817
+ * conversational turns. When creating a new `Message`, you specify the prior
1818
+ * conversational turns with the `messages` parameter, and the model then generates
1819
+ * the next `Message` in the conversation. Consecutive `user` or `assistant` turns
1820
+ * in your request will be combined into a single turn.
1821
+ *
1822
+ * Each input message must be an object with a `role` and `content`. You can
1823
+ * specify a single `user`-role message, or you can include multiple `user` and
1824
+ * `assistant` messages.
1825
+ *
1826
+ * If the final message uses the `assistant` role, the response content will
1827
+ * continue immediately from the content in that message. This can be used to
1828
+ * constrain part of the model's response.
1829
+ *
1830
+ * Example with a single `user` message:
1831
+ *
1832
+ * ```json
1833
+ * [{ "role": "user", "content": "Hello, Claude" }]
1834
+ * ```
1835
+ *
1836
+ * Example with multiple conversational turns:
1837
+ *
1838
+ * ```json
1839
+ * [
1840
+ * { "role": "user", "content": "Hello there." },
1841
+ * { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
1842
+ * { "role": "user", "content": "Can you explain LLMs in plain English?" }
1843
+ * ]
1844
+ * ```
1845
+ *
1846
+ * Example with a partially-filled response from Claude:
1847
+ *
1848
+ * ```json
1849
+ * [
1850
+ * {
1851
+ * "role": "user",
1852
+ * "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
1853
+ * },
1854
+ * { "role": "assistant", "content": "The best answer is (" }
1855
+ * ]
1856
+ * ```
1857
+ *
1858
+ * Each input message `content` may be either a single `string` or an array of
1859
+ * content blocks, where each block has a specific `type`. Using a `string` for
1860
+ * `content` is shorthand for an array of one content block of type `"text"`. The
1861
+ * following input messages are equivalent:
1862
+ *
1863
+ * ```json
1864
+ * { "role": "user", "content": "Hello, Claude" }
1865
+ * ```
1866
+ *
1867
+ * ```json
1868
+ * { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
1869
+ * ```
1870
+ *
1871
+ * See [input examples](https://docs.claude.com/en/api/messages-examples).
1872
+ *
1873
+ * Note that if you want to include a
1874
+ * [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the
1875
+ * top-level `system` parameter — there is no `"system"` role for input messages in
1876
+ * the Messages API.
1877
+ *
1878
+ * There is a limit of 100,000 messages in a single request.
1879
+ */
1880
+ messages: Array<MessageParam>;
1881
+ /**
1882
+ * The model that will complete your prompt.\n\nSee
1883
+ * [models](https://docs.anthropic.com/en/docs/models-overview) for additional
1884
+ * details and options.
1885
+ */
1886
+ model: Model;
1887
+ /**
1888
+ * Top-level cache control automatically applies a cache_control marker to the last
1889
+ * cacheable block in the request.
1890
+ */
1891
+ cache_control?: CacheControlEphemeral | null;
1892
+ /**
1893
+ * Container identifier for reuse across requests.
1894
+ */
1895
+ container?: string | null;
1896
+ /**
1897
+ * Specifies the geographic region for inference processing. If not specified, the
1898
+ * workspace's `default_inference_geo` is used.
1899
+ */
1900
+ inference_geo?: string | null;
1901
+ /**
1902
+ * An object describing metadata about the request.
1903
+ */
1904
+ metadata?: Metadata;
1905
+ /**
1906
+ * Configuration options for the model's output, such as the output format.
1907
+ */
1908
+ output_config?: OutputConfig;
1909
+ /**
1910
+ * Determines whether to use priority capacity (if available) or standard capacity
1911
+ * for this request.
1912
+ *
1913
+ * Anthropic offers different levels of service for your API requests. See
1914
+ * [service-tiers](https://docs.claude.com/en/api/service-tiers) for details.
1915
+ */
1916
+ service_tier?: 'auto' | 'standard_only';
1917
+ /**
1918
+ * Custom text sequences that will cause the model to stop generating.
1919
+ *
1920
+ * Our models will normally stop when they have naturally completed their turn,
1921
+ * which will result in a response `stop_reason` of `"end_turn"`.
1922
+ *
1923
+ * If you want the model to stop generating when it encounters custom strings of
1924
+ * text, you can use the `stop_sequences` parameter. If the model encounters one of
1925
+ * the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
1926
+ * and the response `stop_sequence` value will contain the matched stop sequence.
1927
+ */
1928
+ stop_sequences?: Array<string>;
1929
+ /**
1930
+ * Whether to incrementally stream the response using server-sent events.
1931
+ *
1932
+ * See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
1933
+ */
1934
+ stream?: boolean;
1935
+ /**
1936
+ * System prompt.
1937
+ *
1938
+ * A system prompt is a way of providing context and instructions to Claude, such
1939
+ * as specifying a particular goal or role. See our
1940
+ * [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
1941
+ */
1942
+ system?: string | Array<TextBlockParam>;
1943
+ /**
1944
+ * Amount of randomness injected into the response.
1945
+ *
1946
+ * Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
1947
+ * for analytical / multiple choice, and closer to `1.0` for creative and
1948
+ * generative tasks.
1949
+ *
1950
+ * Note that even with `temperature` of `0.0`, the results will not be fully
1951
+ * deterministic.
1952
+ */
1953
+ temperature?: number;
1954
+ /**
1955
+ * Configuration for enabling Claude's extended thinking.
1956
+ *
1957
+ * When enabled, responses include `thinking` content blocks showing Claude's
1958
+ * thinking process before the final answer. Requires a minimum budget of 1,024
1959
+ * tokens and counts towards your `max_tokens` limit.
1960
+ *
1961
+ * See
1962
+ * [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
1963
+ * for details.
1964
+ */
1965
+ thinking?: ThinkingConfigParam;
1966
+ /**
1967
+ * How the model should use the provided tools. The model can use a specific tool,
1968
+ * any available tool, decide by itself, or not use tools at all.
1969
+ */
1970
+ tool_choice?: ToolChoice;
1971
+ /**
1972
+ * Definitions of tools that the model may use.
1973
+ *
1974
+ * If you include `tools` in your API request, the model may return `tool_use`
1975
+ * content blocks that represent the model's use of those tools. You can then run
1976
+ * those tools using the tool input generated by the model and then optionally
1977
+ * return results back to the model using `tool_result` content blocks.
1978
+ *
1979
+ * There are two types of tools: **client tools** and **server tools**. The
1980
+ * behavior described below applies to client tools. For
1981
+ * [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
1982
+ * see their individual documentation as each has its own behavior (e.g., the
1983
+ * [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
1984
+ *
1985
+ * Each tool definition includes:
1986
+ *
1987
+ * - `name`: Name of the tool.
1988
+ * - `description`: Optional, but strongly-recommended description of the tool.
1989
+ * - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
1990
+ * tool `input` shape that the model will produce in `tool_use` output content
1991
+ * blocks.
1992
+ *
1993
+ * For example, if you defined `tools` as:
1994
+ *
1995
+ * ```json
1996
+ * [
1997
+ * {
1998
+ * "name": "get_stock_price",
1999
+ * "description": "Get the current stock price for a given ticker symbol.",
2000
+ * "input_schema": {
2001
+ * "type": "object",
2002
+ * "properties": {
2003
+ * "ticker": {
2004
+ * "type": "string",
2005
+ * "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
2006
+ * }
2007
+ * },
2008
+ * "required": ["ticker"]
2009
+ * }
2010
+ * }
2011
+ * ]
2012
+ * ```
2013
+ *
2014
+ * And then asked the model "What's the S&P 500 at today?", the model might produce
2015
+ * `tool_use` content blocks in the response like this:
2016
+ *
2017
+ * ```json
2018
+ * [
2019
+ * {
2020
+ * "type": "tool_use",
2021
+ * "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
2022
+ * "name": "get_stock_price",
2023
+ * "input": { "ticker": "^GSPC" }
2024
+ * }
2025
+ * ]
2026
+ * ```
2027
+ *
2028
+ * You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
2029
+ * input, and return the following back to the model in a subsequent `user`
2030
+ * message:
2031
+ *
2032
+ * ```json
2033
+ * [
2034
+ * {
2035
+ * "type": "tool_result",
2036
+ * "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
2037
+ * "content": "259.75 USD"
2038
+ * }
2039
+ * ]
2040
+ * ```
2041
+ *
2042
+ * Tools can be used for workflows that include running client-side tools and
2043
+ * functions, or more generally whenever you want the model to produce a particular
2044
+ * JSON structure of output.
2045
+ *
2046
+ * See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
2047
+ */
2048
+ tools?: Array<ToolUnion>;
2049
+ /**
2050
+ * Only sample from the top K options for each subsequent token.
2051
+ *
2052
+ * Used to remove "long tail" low probability responses.
2053
+ * [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
2054
+ *
2055
+ * Recommended for advanced use cases only. You usually only need to use
2056
+ * `temperature`.
2057
+ */
2058
+ top_k?: number;
2059
+ /**
2060
+ * Use nucleus sampling.
2061
+ *
2062
+ * In nucleus sampling, we compute the cumulative distribution over all the options
2063
+ * for each subsequent token in decreasing probability order and cut it off once it
2064
+ * reaches a particular probability specified by `top_p`. You should either alter
2065
+ * `temperature` or `top_p`, but not both.
2066
+ *
2067
+ * Recommended for advanced use cases only. You usually only need to use
2068
+ * `temperature`.
2069
+ */
2070
+ top_p?: number;
2071
+ }
2072
+ export declare namespace MessageCreateParams {
2073
+ type MessageCreateParamsNonStreaming = MessagesAPI.MessageCreateParamsNonStreaming;
2074
+ type MessageCreateParamsStreaming = MessagesAPI.MessageCreateParamsStreaming;
2075
+ }
2076
+ export interface MessageCreateParamsNonStreaming extends MessageCreateParamsBase {
2077
+ /**
2078
+ * Whether to incrementally stream the response using server-sent events.
2079
+ *
2080
+ * See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
2081
+ */
2082
+ stream?: false;
2083
+ }
2084
+ export interface MessageCreateParamsStreaming extends MessageCreateParamsBase {
2085
+ /**
2086
+ * Whether to incrementally stream the response using server-sent events.
2087
+ *
2088
+ * See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
2089
+ */
2090
+ stream: true;
2091
+ }
2092
+ export type MessageStreamParams = ParseableMessageCreateParams;
2093
+ export interface MessageCountTokensParams {
2094
+ /**
2095
+ * Input messages.
2096
+ *
2097
+ * Our models are trained to operate on alternating `user` and `assistant`
2098
+ * conversational turns. When creating a new `Message`, you specify the prior
2099
+ * conversational turns with the `messages` parameter, and the model then generates
2100
+ * the next `Message` in the conversation. Consecutive `user` or `assistant` turns
2101
+ * in your request will be combined into a single turn.
2102
+ *
2103
+ * Each input message must be an object with a `role` and `content`. You can
2104
+ * specify a single `user`-role message, or you can include multiple `user` and
2105
+ * `assistant` messages.
2106
+ *
2107
+ * If the final message uses the `assistant` role, the response content will
2108
+ * continue immediately from the content in that message. This can be used to
2109
+ * constrain part of the model's response.
2110
+ *
2111
+ * Example with a single `user` message:
2112
+ *
2113
+ * ```json
2114
+ * [{ "role": "user", "content": "Hello, Claude" }]
2115
+ * ```
2116
+ *
2117
+ * Example with multiple conversational turns:
2118
+ *
2119
+ * ```json
2120
+ * [
2121
+ * { "role": "user", "content": "Hello there." },
2122
+ * { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
2123
+ * { "role": "user", "content": "Can you explain LLMs in plain English?" }
2124
+ * ]
2125
+ * ```
2126
+ *
2127
+ * Example with a partially-filled response from Claude:
2128
+ *
2129
+ * ```json
2130
+ * [
2131
+ * {
2132
+ * "role": "user",
2133
+ * "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
2134
+ * },
2135
+ * { "role": "assistant", "content": "The best answer is (" }
2136
+ * ]
2137
+ * ```
2138
+ *
2139
+ * Each input message `content` may be either a single `string` or an array of
2140
+ * content blocks, where each block has a specific `type`. Using a `string` for
2141
+ * `content` is shorthand for an array of one content block of type `"text"`. The
2142
+ * following input messages are equivalent:
2143
+ *
2144
+ * ```json
2145
+ * { "role": "user", "content": "Hello, Claude" }
2146
+ * ```
2147
+ *
2148
+ * ```json
2149
+ * { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
2150
+ * ```
2151
+ *
2152
+ * See [input examples](https://docs.claude.com/en/api/messages-examples).
2153
+ *
2154
+ * Note that if you want to include a
2155
+ * [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the
2156
+ * top-level `system` parameter — there is no `"system"` role for input messages in
2157
+ * the Messages API.
2158
+ *
2159
+ * There is a limit of 100,000 messages in a single request.
2160
+ */
2161
+ messages: Array<MessageParam>;
2162
+ /**
2163
+ * The model that will complete your prompt.\n\nSee
2164
+ * [models](https://docs.anthropic.com/en/docs/models-overview) for additional
2165
+ * details and options.
2166
+ */
2167
+ model: Model;
2168
+ /**
2169
+ * Top-level cache control automatically applies a cache_control marker to the last
2170
+ * cacheable block in the request.
2171
+ */
2172
+ cache_control?: CacheControlEphemeral | null;
2173
+ /**
2174
+ * Configuration options for the model's output, such as the output format.
2175
+ */
2176
+ output_config?: OutputConfig;
2177
+ /**
2178
+ * System prompt.
2179
+ *
2180
+ * A system prompt is a way of providing context and instructions to Claude, such
2181
+ * as specifying a particular goal or role. See our
2182
+ * [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
2183
+ */
2184
+ system?: string | Array<TextBlockParam>;
2185
+ /**
2186
+ * Configuration for enabling Claude's extended thinking.
2187
+ *
2188
+ * When enabled, responses include `thinking` content blocks showing Claude's
2189
+ * thinking process before the final answer. Requires a minimum budget of 1,024
2190
+ * tokens and counts towards your `max_tokens` limit.
2191
+ *
2192
+ * See
2193
+ * [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
2194
+ * for details.
2195
+ */
2196
+ thinking?: ThinkingConfigParam;
2197
+ /**
2198
+ * How the model should use the provided tools. The model can use a specific tool,
2199
+ * any available tool, decide by itself, or not use tools at all.
2200
+ */
2201
+ tool_choice?: ToolChoice;
2202
+ /**
2203
+ * Definitions of tools that the model may use.
2204
+ *
2205
+ * If you include `tools` in your API request, the model may return `tool_use`
2206
+ * content blocks that represent the model's use of those tools. You can then run
2207
+ * those tools using the tool input generated by the model and then optionally
2208
+ * return results back to the model using `tool_result` content blocks.
2209
+ *
2210
+ * There are two types of tools: **client tools** and **server tools**. The
2211
+ * behavior described below applies to client tools. For
2212
+ * [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
2213
+ * see their individual documentation as each has its own behavior (e.g., the
2214
+ * [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
2215
+ *
2216
+ * Each tool definition includes:
2217
+ *
2218
+ * - `name`: Name of the tool.
2219
+ * - `description`: Optional, but strongly-recommended description of the tool.
2220
+ * - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
2221
+ * tool `input` shape that the model will produce in `tool_use` output content
2222
+ * blocks.
2223
+ *
2224
+ * For example, if you defined `tools` as:
2225
+ *
2226
+ * ```json
2227
+ * [
2228
+ * {
2229
+ * "name": "get_stock_price",
2230
+ * "description": "Get the current stock price for a given ticker symbol.",
2231
+ * "input_schema": {
2232
+ * "type": "object",
2233
+ * "properties": {
2234
+ * "ticker": {
2235
+ * "type": "string",
2236
+ * "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
2237
+ * }
2238
+ * },
2239
+ * "required": ["ticker"]
2240
+ * }
2241
+ * }
2242
+ * ]
2243
+ * ```
2244
+ *
2245
+ * And then asked the model "What's the S&P 500 at today?", the model might produce
2246
+ * `tool_use` content blocks in the response like this:
2247
+ *
2248
+ * ```json
2249
+ * [
2250
+ * {
2251
+ * "type": "tool_use",
2252
+ * "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
2253
+ * "name": "get_stock_price",
2254
+ * "input": { "ticker": "^GSPC" }
2255
+ * }
2256
+ * ]
2257
+ * ```
2258
+ *
2259
+ * You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
2260
+ * input, and return the following back to the model in a subsequent `user`
2261
+ * message:
2262
+ *
2263
+ * ```json
2264
+ * [
2265
+ * {
2266
+ * "type": "tool_result",
2267
+ * "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
2268
+ * "content": "259.75 USD"
2269
+ * }
2270
+ * ]
2271
+ * ```
2272
+ *
2273
+ * Tools can be used for workflows that include running client-side tools and
2274
+ * functions, or more generally whenever you want the model to produce a particular
2275
+ * JSON structure of output.
2276
+ *
2277
+ * See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
2278
+ */
2279
+ tools?: Array<MessageCountTokensTool>;
2280
+ }
2281
+ export declare namespace Messages {
2282
+ export { type Base64ImageSource as Base64ImageSource, type Base64PDFSource as Base64PDFSource, type BashCodeExecutionOutputBlock as BashCodeExecutionOutputBlock, type BashCodeExecutionOutputBlockParam as BashCodeExecutionOutputBlockParam, type BashCodeExecutionResultBlock as BashCodeExecutionResultBlock, type BashCodeExecutionResultBlockParam as BashCodeExecutionResultBlockParam, type BashCodeExecutionToolResultBlock as BashCodeExecutionToolResultBlock, type BashCodeExecutionToolResultBlockParam as BashCodeExecutionToolResultBlockParam, type BashCodeExecutionToolResultError as BashCodeExecutionToolResultError, type BashCodeExecutionToolResultErrorCode as BashCodeExecutionToolResultErrorCode, type BashCodeExecutionToolResultErrorParam as BashCodeExecutionToolResultErrorParam, type CacheControlEphemeral as CacheControlEphemeral, type CacheCreation as CacheCreation, type CitationCharLocation as CitationCharLocation, type CitationCharLocationParam as CitationCharLocationParam, type CitationContentBlockLocation as CitationContentBlockLocation, type CitationContentBlockLocationParam as CitationContentBlockLocationParam, type CitationPageLocation as CitationPageLocation, type CitationPageLocationParam as CitationPageLocationParam, type CitationSearchResultLocationParam as CitationSearchResultLocationParam, type CitationWebSearchResultLocationParam as CitationWebSearchResultLocationParam, type CitationsConfig as CitationsConfig, type CitationsConfigParam as CitationsConfigParam, type CitationsDelta as CitationsDelta, type CitationsSearchResultLocation as CitationsSearchResultLocation, type CitationsWebSearchResultLocation as CitationsWebSearchResultLocation, type CodeExecutionOutputBlock as CodeExecutionOutputBlock, type CodeExecutionOutputBlockParam as CodeExecutionOutputBlockParam, type CodeExecutionResultBlock as CodeExecutionResultBlock, type CodeExecutionResultBlockParam as CodeExecutionResultBlockParam, type CodeExecutionTool20250522 as CodeExecutionTool20250522, type CodeExecutionTool20250825 as CodeExecutionTool20250825, type CodeExecutionTool20260120 as CodeExecutionTool20260120, type CodeExecutionToolResultBlock as CodeExecutionToolResultBlock, type CodeExecutionToolResultBlockContent as CodeExecutionToolResultBlockContent, type CodeExecutionToolResultBlockParam as CodeExecutionToolResultBlockParam, type CodeExecutionToolResultBlockParamContent as CodeExecutionToolResultBlockParamContent, type CodeExecutionToolResultError as CodeExecutionToolResultError, type CodeExecutionToolResultErrorCode as CodeExecutionToolResultErrorCode, type CodeExecutionToolResultErrorParam as CodeExecutionToolResultErrorParam, type Container as Container, type ContainerUploadBlock as ContainerUploadBlock, type ContainerUploadBlockParam as ContainerUploadBlockParam, type ContentBlock as ContentBlock, type ContentBlockParam as ContentBlockParam, type ContentBlockStartEvent as ContentBlockStartEvent, type ContentBlockStopEvent as ContentBlockStopEvent, type ContentBlockSource as ContentBlockSource, type ContentBlockSourceContent as ContentBlockSourceContent, type DirectCaller as DirectCaller, type DocumentBlock as DocumentBlock, type DocumentBlockParam as DocumentBlockParam, type EncryptedCodeExecutionResultBlock as EncryptedCodeExecutionResultBlock, type EncryptedCodeExecutionResultBlockParam as EncryptedCodeExecutionResultBlockParam, type ImageBlockParam as ImageBlockParam, type InputJSONDelta as InputJSONDelta, type JSONOutputFormat as JSONOutputFormat, type MemoryTool20250818 as MemoryTool20250818, type Message as Message, type MessageCountTokensTool as MessageCountTokensTool, type MessageDeltaEvent as MessageDeltaEvent, type MessageDeltaUsage as MessageDeltaUsage, type MessageParam as MessageParam, type MessageTokensCount as MessageTokensCount, type Metadata as Metadata, type Model as Model, type OutputConfig as OutputConfig, type PlainTextSource as PlainTextSource, type RawContentBlockDelta as RawContentBlockDelta, type RawContentBlockDeltaEvent as RawContentBlockDeltaEvent, type RawContentBlockStartEvent as RawContentBlockStartEvent, type RawContentBlockStopEvent as RawContentBlockStopEvent, type RawMessageDeltaEvent as RawMessageDeltaEvent, type RawMessageStartEvent as RawMessageStartEvent, type RawMessageStopEvent as RawMessageStopEvent, type RawMessageStreamEvent as RawMessageStreamEvent, type RedactedThinkingBlock as RedactedThinkingBlock, type RedactedThinkingBlockParam as RedactedThinkingBlockParam, type RefusalStopDetails as RefusalStopDetails, type SearchResultBlockParam as SearchResultBlockParam, type ServerToolCaller as ServerToolCaller, type ServerToolCaller20260120 as ServerToolCaller20260120, type ServerToolUsage as ServerToolUsage, type ServerToolUseBlock as ServerToolUseBlock, type ServerToolUseBlockParam as ServerToolUseBlockParam, type SignatureDelta as SignatureDelta, type StopReason as StopReason, type TextBlock as TextBlock, type TextBlockParam as TextBlockParam, type TextCitation as TextCitation, type TextCitationParam as TextCitationParam, type TextDelta as TextDelta, type TextEditorCodeExecutionCreateResultBlock as TextEditorCodeExecutionCreateResultBlock, type TextEditorCodeExecutionCreateResultBlockParam as TextEditorCodeExecutionCreateResultBlockParam, type TextEditorCodeExecutionStrReplaceResultBlock as TextEditorCodeExecutionStrReplaceResultBlock, type TextEditorCodeExecutionStrReplaceResultBlockParam as TextEditorCodeExecutionStrReplaceResultBlockParam, type TextEditorCodeExecutionToolResultBlock as TextEditorCodeExecutionToolResultBlock, type TextEditorCodeExecutionToolResultBlockParam as TextEditorCodeExecutionToolResultBlockParam, type TextEditorCodeExecutionToolResultError as TextEditorCodeExecutionToolResultError, type TextEditorCodeExecutionToolResultErrorCode as TextEditorCodeExecutionToolResultErrorCode, type TextEditorCodeExecutionToolResultErrorParam as TextEditorCodeExecutionToolResultErrorParam, type TextEditorCodeExecutionViewResultBlock as TextEditorCodeExecutionViewResultBlock, type TextEditorCodeExecutionViewResultBlockParam as TextEditorCodeExecutionViewResultBlockParam, type ThinkingBlock as ThinkingBlock, type ThinkingBlockParam as ThinkingBlockParam, type ThinkingConfigAdaptive as ThinkingConfigAdaptive, type ThinkingConfigDisabled as ThinkingConfigDisabled, type ThinkingConfigEnabled as ThinkingConfigEnabled, type ThinkingConfigParam as ThinkingConfigParam, type ThinkingDelta as ThinkingDelta, type Tool as Tool, type ToolBash20250124 as ToolBash20250124, type ToolChoice as ToolChoice, type ToolChoiceAny as ToolChoiceAny, type ToolChoiceAuto as ToolChoiceAuto, type ToolChoiceNone as ToolChoiceNone, type ToolChoiceTool as ToolChoiceTool, type ToolReferenceBlock as ToolReferenceBlock, type ToolReferenceBlockParam as ToolReferenceBlockParam, type ToolResultBlockParam as ToolResultBlockParam, type ToolSearchToolBm25_20251119 as ToolSearchToolBm25_20251119, type ToolSearchToolRegex20251119 as ToolSearchToolRegex20251119, type ToolSearchToolResultBlock as ToolSearchToolResultBlock, type ToolSearchToolResultBlockParam as ToolSearchToolResultBlockParam, type ToolSearchToolResultError as ToolSearchToolResultError, type ToolSearchToolResultErrorCode as ToolSearchToolResultErrorCode, type ToolSearchToolResultErrorParam as ToolSearchToolResultErrorParam, type ToolSearchToolSearchResultBlock as ToolSearchToolSearchResultBlock, type ToolSearchToolSearchResultBlockParam as ToolSearchToolSearchResultBlockParam, type ToolTextEditor20250124 as ToolTextEditor20250124, type ToolTextEditor20250429 as ToolTextEditor20250429, type ToolTextEditor20250728 as ToolTextEditor20250728, type ToolUnion as ToolUnion, type ToolUseBlock as ToolUseBlock, type ToolUseBlockParam as ToolUseBlockParam, type URLImageSource as URLImageSource, type URLPDFSource as URLPDFSource, type Usage as Usage, type UserLocation as UserLocation, type WebFetchBlock as WebFetchBlock, type WebFetchBlockParam as WebFetchBlockParam, type WebFetchTool20250910 as WebFetchTool20250910, type WebFetchTool20260209 as WebFetchTool20260209, type WebFetchTool20260309 as WebFetchTool20260309, type WebFetchToolResultBlock as WebFetchToolResultBlock, type WebFetchToolResultBlockParam as WebFetchToolResultBlockParam, type WebFetchToolResultErrorBlock as WebFetchToolResultErrorBlock, type WebFetchToolResultErrorBlockParam as WebFetchToolResultErrorBlockParam, type WebFetchToolResultErrorCode as WebFetchToolResultErrorCode, type WebSearchResultBlock as WebSearchResultBlock, type WebSearchResultBlockParam as WebSearchResultBlockParam, type WebSearchTool20250305 as WebSearchTool20250305, type WebSearchTool20260209 as WebSearchTool20260209, type WebSearchToolRequestError as WebSearchToolRequestError, type WebSearchToolResultBlock as WebSearchToolResultBlock, type WebSearchToolResultBlockContent as WebSearchToolResultBlockContent, type WebSearchToolResultBlockParam as WebSearchToolResultBlockParam, type WebSearchToolResultBlockParamContent as WebSearchToolResultBlockParamContent, type WebSearchToolResultError as WebSearchToolResultError, type MessageStreamEvent as MessageStreamEvent, type MessageStartEvent as MessageStartEvent, type MessageStopEvent as MessageStopEvent, type ContentBlockDeltaEvent as ContentBlockDeltaEvent, type MessageCreateParams as MessageCreateParams, type MessageCreateParamsNonStreaming as MessageCreateParamsNonStreaming, type MessageCreateParamsStreaming as MessageCreateParamsStreaming, type MessageStreamParams as MessageStreamParams, type MessageCountTokensParams as MessageCountTokensParams, };
2283
+ export { Batches as Batches, type DeletedMessageBatch as DeletedMessageBatch, type MessageBatch as MessageBatch, type MessageBatchCanceledResult as MessageBatchCanceledResult, type MessageBatchErroredResult as MessageBatchErroredResult, type MessageBatchExpiredResult as MessageBatchExpiredResult, type MessageBatchIndividualResponse as MessageBatchIndividualResponse, type MessageBatchRequestCounts as MessageBatchRequestCounts, type MessageBatchResult as MessageBatchResult, type MessageBatchSucceededResult as MessageBatchSucceededResult, type MessageBatchesPage as MessageBatchesPage, type BatchCreateParams as BatchCreateParams, type BatchListParams as BatchListParams, };
2284
+ }
2285
+ //# sourceMappingURL=messages.d.mts.map