@anthropic-ai/sdk 0.123.0 → 0.124.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 (358) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/client.d.mts +6 -5
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +6 -5
  5. package/client.d.ts.map +1 -1
  6. package/client.js +2 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs +2 -1
  9. package/client.mjs.map +1 -1
  10. package/core/streaming.js +4 -2
  11. package/core/streaming.js.map +1 -1
  12. package/core/streaming.mjs +4 -2
  13. package/core/streaming.mjs.map +1 -1
  14. package/package.json +1 -1
  15. package/resources/beta/agents/agents.d.mts +45 -0
  16. package/resources/beta/agents/agents.d.mts.map +1 -1
  17. package/resources/beta/agents/agents.d.ts +45 -0
  18. package/resources/beta/agents/agents.d.ts.map +1 -1
  19. package/resources/beta/agents/agents.js +25 -10
  20. package/resources/beta/agents/agents.js.map +1 -1
  21. package/resources/beta/agents/agents.mjs +25 -10
  22. package/resources/beta/agents/agents.mjs.map +1 -1
  23. package/resources/beta/agents/versions.d.mts +9 -0
  24. package/resources/beta/agents/versions.d.mts.map +1 -1
  25. package/resources/beta/agents/versions.d.ts +9 -0
  26. package/resources/beta/agents/versions.d.ts.map +1 -1
  27. package/resources/beta/agents/versions.js +5 -2
  28. package/resources/beta/agents/versions.js.map +1 -1
  29. package/resources/beta/agents/versions.mjs +5 -2
  30. package/resources/beta/agents/versions.mjs.map +1 -1
  31. package/resources/beta/deployment-runs.d.mts +18 -0
  32. package/resources/beta/deployment-runs.d.mts.map +1 -1
  33. package/resources/beta/deployment-runs.d.ts +18 -0
  34. package/resources/beta/deployment-runs.d.ts.map +1 -1
  35. package/resources/beta/deployment-runs.js +10 -4
  36. package/resources/beta/deployment-runs.js.map +1 -1
  37. package/resources/beta/deployment-runs.mjs +10 -4
  38. package/resources/beta/deployment-runs.mjs.map +1 -1
  39. package/resources/beta/deployments.d.mts +72 -0
  40. package/resources/beta/deployments.d.mts.map +1 -1
  41. package/resources/beta/deployments.d.ts +72 -0
  42. package/resources/beta/deployments.d.ts.map +1 -1
  43. package/resources/beta/deployments.js +40 -16
  44. package/resources/beta/deployments.js.map +1 -1
  45. package/resources/beta/deployments.mjs +40 -16
  46. package/resources/beta/deployments.mjs.map +1 -1
  47. package/resources/beta/dreams.d.mts +45 -0
  48. package/resources/beta/dreams.d.mts.map +1 -1
  49. package/resources/beta/dreams.d.ts +45 -0
  50. package/resources/beta/dreams.d.ts.map +1 -1
  51. package/resources/beta/dreams.js +25 -10
  52. package/resources/beta/dreams.js.map +1 -1
  53. package/resources/beta/dreams.mjs +25 -10
  54. package/resources/beta/dreams.mjs.map +1 -1
  55. package/resources/beta/environments/environments.d.mts +54 -0
  56. package/resources/beta/environments/environments.d.mts.map +1 -1
  57. package/resources/beta/environments/environments.d.ts +54 -0
  58. package/resources/beta/environments/environments.d.ts.map +1 -1
  59. package/resources/beta/environments/environments.js +30 -12
  60. package/resources/beta/environments/environments.js.map +1 -1
  61. package/resources/beta/environments/environments.mjs +30 -12
  62. package/resources/beta/environments/environments.mjs.map +1 -1
  63. package/resources/beta/environments/work.d.mts +36 -0
  64. package/resources/beta/environments/work.d.mts.map +1 -1
  65. package/resources/beta/environments/work.d.ts +36 -0
  66. package/resources/beta/environments/work.d.ts.map +1 -1
  67. package/resources/beta/environments/work.js +20 -8
  68. package/resources/beta/environments/work.js.map +1 -1
  69. package/resources/beta/environments/work.mjs +20 -8
  70. package/resources/beta/environments/work.mjs.map +1 -1
  71. package/resources/beta/files.d.mts +48 -1
  72. package/resources/beta/files.d.mts.map +1 -1
  73. package/resources/beta/files.d.ts +48 -1
  74. package/resources/beta/files.d.ts.map +1 -1
  75. package/resources/beta/files.js +22 -9
  76. package/resources/beta/files.js.map +1 -1
  77. package/resources/beta/files.mjs +22 -9
  78. package/resources/beta/files.mjs.map +1 -1
  79. package/resources/beta/memory-stores/memories.d.mts +45 -0
  80. package/resources/beta/memory-stores/memories.d.mts.map +1 -1
  81. package/resources/beta/memory-stores/memories.d.ts +45 -0
  82. package/resources/beta/memory-stores/memories.d.ts.map +1 -1
  83. package/resources/beta/memory-stores/memories.js +25 -10
  84. package/resources/beta/memory-stores/memories.js.map +1 -1
  85. package/resources/beta/memory-stores/memories.mjs +25 -10
  86. package/resources/beta/memory-stores/memories.mjs.map +1 -1
  87. package/resources/beta/memory-stores/memory-stores.d.mts +54 -0
  88. package/resources/beta/memory-stores/memory-stores.d.mts.map +1 -1
  89. package/resources/beta/memory-stores/memory-stores.d.ts +54 -0
  90. package/resources/beta/memory-stores/memory-stores.d.ts.map +1 -1
  91. package/resources/beta/memory-stores/memory-stores.js +30 -12
  92. package/resources/beta/memory-stores/memory-stores.js.map +1 -1
  93. package/resources/beta/memory-stores/memory-stores.mjs +30 -12
  94. package/resources/beta/memory-stores/memory-stores.mjs.map +1 -1
  95. package/resources/beta/memory-stores/memory-versions.d.mts +31 -4
  96. package/resources/beta/memory-stores/memory-versions.d.mts.map +1 -1
  97. package/resources/beta/memory-stores/memory-versions.d.ts +31 -4
  98. package/resources/beta/memory-stores/memory-versions.d.ts.map +1 -1
  99. package/resources/beta/memory-stores/memory-versions.js +15 -6
  100. package/resources/beta/memory-stores/memory-versions.js.map +1 -1
  101. package/resources/beta/memory-stores/memory-versions.mjs +15 -6
  102. package/resources/beta/memory-stores/memory-versions.mjs.map +1 -1
  103. package/resources/beta/messages/batches.d.mts +54 -0
  104. package/resources/beta/messages/batches.d.mts.map +1 -1
  105. package/resources/beta/messages/batches.d.ts +54 -0
  106. package/resources/beta/messages/batches.d.ts.map +1 -1
  107. package/resources/beta/messages/batches.js +25 -11
  108. package/resources/beta/messages/batches.js.map +1 -1
  109. package/resources/beta/messages/batches.mjs +25 -11
  110. package/resources/beta/messages/batches.mjs.map +1 -1
  111. package/resources/beta/messages/messages.d.mts +18 -0
  112. package/resources/beta/messages/messages.d.mts.map +1 -1
  113. package/resources/beta/messages/messages.d.ts +18 -0
  114. package/resources/beta/messages/messages.d.ts.map +1 -1
  115. package/resources/beta/messages/messages.js +4 -2
  116. package/resources/beta/messages/messages.js.map +1 -1
  117. package/resources/beta/messages/messages.mjs +4 -2
  118. package/resources/beta/messages/messages.mjs.map +1 -1
  119. package/resources/beta/models.d.mts +18 -0
  120. package/resources/beta/models.d.mts.map +1 -1
  121. package/resources/beta/models.d.ts +18 -0
  122. package/resources/beta/models.d.ts.map +1 -1
  123. package/resources/beta/models.js +10 -4
  124. package/resources/beta/models.js.map +1 -1
  125. package/resources/beta/models.mjs +10 -4
  126. package/resources/beta/models.mjs.map +1 -1
  127. package/resources/beta/organization/compliance-settings.d.mts +5 -3
  128. package/resources/beta/organization/compliance-settings.d.mts.map +1 -1
  129. package/resources/beta/organization/compliance-settings.d.ts +5 -3
  130. package/resources/beta/organization/compliance-settings.d.ts.map +1 -1
  131. package/resources/beta/organization/index.d.mts +1 -1
  132. package/resources/beta/organization/index.d.mts.map +1 -1
  133. package/resources/beta/organization/index.d.ts +1 -1
  134. package/resources/beta/organization/index.d.ts.map +1 -1
  135. package/resources/beta/organization/index.js.map +1 -1
  136. package/resources/beta/organization/index.mjs.map +1 -1
  137. package/resources/beta/organization/organization.d.mts +2 -2
  138. package/resources/beta/organization/organization.d.mts.map +1 -1
  139. package/resources/beta/organization/organization.d.ts +2 -2
  140. package/resources/beta/organization/organization.d.ts.map +1 -1
  141. package/resources/beta/organization/organization.js.map +1 -1
  142. package/resources/beta/organization/organization.mjs.map +1 -1
  143. package/resources/beta/sessions/events.d.mts +27 -0
  144. package/resources/beta/sessions/events.d.mts.map +1 -1
  145. package/resources/beta/sessions/events.d.ts +27 -0
  146. package/resources/beta/sessions/events.d.ts.map +1 -1
  147. package/resources/beta/sessions/events.js +15 -6
  148. package/resources/beta/sessions/events.js.map +1 -1
  149. package/resources/beta/sessions/events.mjs +15 -6
  150. package/resources/beta/sessions/events.mjs.map +1 -1
  151. package/resources/beta/sessions/resources.d.mts +45 -0
  152. package/resources/beta/sessions/resources.d.mts.map +1 -1
  153. package/resources/beta/sessions/resources.d.ts +45 -0
  154. package/resources/beta/sessions/resources.d.ts.map +1 -1
  155. package/resources/beta/sessions/resources.js +25 -10
  156. package/resources/beta/sessions/resources.js.map +1 -1
  157. package/resources/beta/sessions/resources.mjs +25 -10
  158. package/resources/beta/sessions/resources.mjs.map +1 -1
  159. package/resources/beta/sessions/sessions.d.mts +54 -0
  160. package/resources/beta/sessions/sessions.d.mts.map +1 -1
  161. package/resources/beta/sessions/sessions.d.ts +54 -0
  162. package/resources/beta/sessions/sessions.d.ts.map +1 -1
  163. package/resources/beta/sessions/sessions.js +30 -12
  164. package/resources/beta/sessions/sessions.js.map +1 -1
  165. package/resources/beta/sessions/sessions.mjs +30 -12
  166. package/resources/beta/sessions/sessions.mjs.map +1 -1
  167. package/resources/beta/sessions/threads/events.d.mts +18 -0
  168. package/resources/beta/sessions/threads/events.d.mts.map +1 -1
  169. package/resources/beta/sessions/threads/events.d.ts +18 -0
  170. package/resources/beta/sessions/threads/events.d.ts.map +1 -1
  171. package/resources/beta/sessions/threads/events.js +10 -4
  172. package/resources/beta/sessions/threads/events.js.map +1 -1
  173. package/resources/beta/sessions/threads/events.mjs +10 -4
  174. package/resources/beta/sessions/threads/events.mjs.map +1 -1
  175. package/resources/beta/sessions/threads/threads.d.mts +27 -0
  176. package/resources/beta/sessions/threads/threads.d.mts.map +1 -1
  177. package/resources/beta/sessions/threads/threads.d.ts +27 -0
  178. package/resources/beta/sessions/threads/threads.d.ts.map +1 -1
  179. package/resources/beta/sessions/threads/threads.js +15 -6
  180. package/resources/beta/sessions/threads/threads.js.map +1 -1
  181. package/resources/beta/sessions/threads/threads.mjs +15 -6
  182. package/resources/beta/sessions/threads/threads.mjs.map +1 -1
  183. package/resources/beta/skills/skills.d.mts +36 -0
  184. package/resources/beta/skills/skills.d.mts.map +1 -1
  185. package/resources/beta/skills/skills.d.ts +36 -0
  186. package/resources/beta/skills/skills.d.ts.map +1 -1
  187. package/resources/beta/skills/skills.js +20 -8
  188. package/resources/beta/skills/skills.js.map +1 -1
  189. package/resources/beta/skills/skills.mjs +20 -8
  190. package/resources/beta/skills/skills.mjs.map +1 -1
  191. package/resources/beta/skills/versions.d.mts +45 -0
  192. package/resources/beta/skills/versions.d.mts.map +1 -1
  193. package/resources/beta/skills/versions.d.ts +45 -0
  194. package/resources/beta/skills/versions.d.ts.map +1 -1
  195. package/resources/beta/skills/versions.js +22 -9
  196. package/resources/beta/skills/versions.js.map +1 -1
  197. package/resources/beta/skills/versions.mjs +22 -9
  198. package/resources/beta/skills/versions.mjs.map +1 -1
  199. package/resources/beta/tunnels/certificates.d.mts +36 -0
  200. package/resources/beta/tunnels/certificates.d.mts.map +1 -1
  201. package/resources/beta/tunnels/certificates.d.ts +36 -0
  202. package/resources/beta/tunnels/certificates.d.ts.map +1 -1
  203. package/resources/beta/tunnels/certificates.js +20 -8
  204. package/resources/beta/tunnels/certificates.js.map +1 -1
  205. package/resources/beta/tunnels/certificates.mjs +20 -8
  206. package/resources/beta/tunnels/certificates.mjs.map +1 -1
  207. package/resources/beta/tunnels/tunnels.d.mts +54 -0
  208. package/resources/beta/tunnels/tunnels.d.mts.map +1 -1
  209. package/resources/beta/tunnels/tunnels.d.ts +54 -0
  210. package/resources/beta/tunnels/tunnels.d.ts.map +1 -1
  211. package/resources/beta/tunnels/tunnels.js +30 -12
  212. package/resources/beta/tunnels/tunnels.js.map +1 -1
  213. package/resources/beta/tunnels/tunnels.mjs +30 -12
  214. package/resources/beta/tunnels/tunnels.mjs.map +1 -1
  215. package/resources/beta/vaults/credentials.d.mts +63 -0
  216. package/resources/beta/vaults/credentials.d.mts.map +1 -1
  217. package/resources/beta/vaults/credentials.d.ts +63 -0
  218. package/resources/beta/vaults/credentials.d.ts.map +1 -1
  219. package/resources/beta/vaults/credentials.js +35 -14
  220. package/resources/beta/vaults/credentials.js.map +1 -1
  221. package/resources/beta/vaults/credentials.mjs +35 -14
  222. package/resources/beta/vaults/credentials.mjs.map +1 -1
  223. package/resources/beta/vaults/vaults.d.mts +54 -0
  224. package/resources/beta/vaults/vaults.d.mts.map +1 -1
  225. package/resources/beta/vaults/vaults.d.ts +54 -0
  226. package/resources/beta/vaults/vaults.d.ts.map +1 -1
  227. package/resources/beta/vaults/vaults.js +30 -12
  228. package/resources/beta/vaults/vaults.js.map +1 -1
  229. package/resources/beta/vaults/vaults.mjs +30 -12
  230. package/resources/beta/vaults/vaults.mjs.map +1 -1
  231. package/resources/completions.d.mts +9 -0
  232. package/resources/completions.d.mts.map +1 -1
  233. package/resources/completions.d.ts +9 -0
  234. package/resources/completions.d.ts.map +1 -1
  235. package/resources/completions.js +5 -2
  236. package/resources/completions.js.map +1 -1
  237. package/resources/completions.mjs +5 -2
  238. package/resources/completions.mjs.map +1 -1
  239. package/resources/files.d.mts +104 -15
  240. package/resources/files.d.mts.map +1 -1
  241. package/resources/files.d.ts +104 -15
  242. package/resources/files.d.ts.map +1 -1
  243. package/resources/files.js +79 -10
  244. package/resources/files.js.map +1 -1
  245. package/resources/files.mjs +79 -10
  246. package/resources/files.mjs.map +1 -1
  247. package/resources/index.d.mts +2 -2
  248. package/resources/index.d.mts.map +1 -1
  249. package/resources/index.d.ts +2 -2
  250. package/resources/index.d.ts.map +1 -1
  251. package/resources/index.js.map +1 -1
  252. package/resources/index.mjs.map +1 -1
  253. package/resources/messages/batches.d.mts +68 -6
  254. package/resources/messages/batches.d.mts.map +1 -1
  255. package/resources/messages/batches.d.ts +68 -6
  256. package/resources/messages/batches.d.ts.map +1 -1
  257. package/resources/messages/batches.js +52 -13
  258. package/resources/messages/batches.js.map +1 -1
  259. package/resources/messages/batches.mjs +52 -13
  260. package/resources/messages/batches.mjs.map +1 -1
  261. package/resources/messages/index.d.mts +1 -1
  262. package/resources/messages/index.d.mts.map +1 -1
  263. package/resources/messages/index.d.ts +1 -1
  264. package/resources/messages/index.d.ts.map +1 -1
  265. package/resources/messages/index.js.map +1 -1
  266. package/resources/messages/index.mjs.map +1 -1
  267. package/resources/messages/messages.d.mts +20 -2
  268. package/resources/messages/messages.d.mts.map +1 -1
  269. package/resources/messages/messages.d.ts +20 -2
  270. package/resources/messages/messages.d.ts.map +1 -1
  271. package/resources/messages/messages.js +10 -4
  272. package/resources/messages/messages.js.map +1 -1
  273. package/resources/messages/messages.mjs +10 -4
  274. package/resources/messages/messages.mjs.map +1 -1
  275. package/resources/models.d.mts +31 -0
  276. package/resources/models.d.mts.map +1 -1
  277. package/resources/models.d.ts +31 -0
  278. package/resources/models.d.ts.map +1 -1
  279. package/resources/models.js +23 -4
  280. package/resources/models.js.map +1 -1
  281. package/resources/models.mjs +23 -4
  282. package/resources/models.mjs.map +1 -1
  283. package/resources/skills/index.d.mts +1 -1
  284. package/resources/skills/index.d.mts.map +1 -1
  285. package/resources/skills/index.d.ts +1 -1
  286. package/resources/skills/index.d.ts.map +1 -1
  287. package/resources/skills/index.js.map +1 -1
  288. package/resources/skills/index.mjs.map +1 -1
  289. package/resources/skills/skills.d.mts +75 -10
  290. package/resources/skills/skills.d.mts.map +1 -1
  291. package/resources/skills/skills.d.ts +75 -10
  292. package/resources/skills/skills.d.ts.map +1 -1
  293. package/resources/skills/skills.js +64 -8
  294. package/resources/skills/skills.js.map +1 -1
  295. package/resources/skills/skills.mjs +64 -8
  296. package/resources/skills/skills.mjs.map +1 -1
  297. package/resources/skills/versions.d.mts +75 -5
  298. package/resources/skills/versions.d.mts.map +1 -1
  299. package/resources/skills/versions.d.ts +75 -5
  300. package/resources/skills/versions.d.ts.map +1 -1
  301. package/resources/skills/versions.js +67 -7
  302. package/resources/skills/versions.js.map +1 -1
  303. package/resources/skills/versions.mjs +67 -7
  304. package/resources/skills/versions.mjs.map +1 -1
  305. package/src/client.ts +12 -1
  306. package/src/core/streaming.ts +4 -2
  307. package/src/resources/beta/agents/agents.ts +75 -10
  308. package/src/resources/beta/agents/versions.ts +15 -2
  309. package/src/resources/beta/deployment-runs.ts +30 -4
  310. package/src/resources/beta/deployments.ts +120 -16
  311. package/src/resources/beta/dreams.ts +75 -10
  312. package/src/resources/beta/environments/environments.ts +90 -12
  313. package/src/resources/beta/environments/work.ts +60 -8
  314. package/src/resources/beta/files.ts +75 -11
  315. package/src/resources/beta/memory-stores/memories.ts +75 -10
  316. package/src/resources/beta/memory-stores/memory-stores.ts +90 -12
  317. package/src/resources/beta/memory-stores/memory-versions.ts +49 -10
  318. package/src/resources/beta/messages/batches.ts +85 -11
  319. package/src/resources/beta/messages/messages.ts +24 -2
  320. package/src/resources/beta/models.ts +30 -4
  321. package/src/resources/beta/organization/compliance-settings.ts +12 -2
  322. package/src/resources/beta/organization/index.ts +2 -0
  323. package/src/resources/beta/organization/organization.ts +4 -0
  324. package/src/resources/beta/sessions/events.ts +45 -6
  325. package/src/resources/beta/sessions/resources.ts +75 -10
  326. package/src/resources/beta/sessions/sessions.ts +90 -12
  327. package/src/resources/beta/sessions/threads/events.ts +30 -4
  328. package/src/resources/beta/sessions/threads/threads.ts +45 -6
  329. package/src/resources/beta/skills/skills.ts +60 -8
  330. package/src/resources/beta/skills/versions.ts +72 -9
  331. package/src/resources/beta/tunnels/certificates.ts +60 -8
  332. package/src/resources/beta/tunnels/tunnels.ts +90 -12
  333. package/src/resources/beta/vaults/credentials.ts +105 -14
  334. package/src/resources/beta/vaults/vaults.ts +90 -12
  335. package/src/resources/completions.ts +15 -2
  336. package/src/resources/files.ts +161 -18
  337. package/src/resources/index.ts +5 -0
  338. package/src/resources/messages/batches.ts +137 -13
  339. package/src/resources/messages/index.ts +4 -0
  340. package/src/resources/messages/messages.ts +38 -4
  341. package/src/resources/models.ts +43 -4
  342. package/src/resources/skills/index.ts +2 -0
  343. package/src/resources/skills/skills.ts +127 -13
  344. package/src/resources/skills/versions.ts +115 -11
  345. package/src/tools/agent-toolset/fs-util.ts +16 -4
  346. package/src/version.ts +1 -1
  347. package/tools/agent-toolset/fs-util.d.mts +11 -4
  348. package/tools/agent-toolset/fs-util.d.mts.map +1 -1
  349. package/tools/agent-toolset/fs-util.d.ts +11 -4
  350. package/tools/agent-toolset/fs-util.d.ts.map +1 -1
  351. package/tools/agent-toolset/fs-util.js +14 -4
  352. package/tools/agent-toolset/fs-util.js.map +1 -1
  353. package/tools/agent-toolset/fs-util.mjs +14 -4
  354. package/tools/agent-toolset/fs-util.mjs.map +1 -1
  355. package/version.d.mts +1 -1
  356. package/version.d.ts +1 -1
  357. package/version.js +1 -1
  358. package/version.mjs +1 -1
@@ -13,50 +13,131 @@ import { path } from '../internal/utils/path';
13
13
  export class Files extends APIResource {
14
14
  /**
15
15
  * List Files
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * // Automatically fetches more pages as needed.
20
+ * for await (const fileMetadata of client.files.list()) {
21
+ * // ...
22
+ * }
23
+ * ```
16
24
  */
17
25
  list(
18
- query: FileListParams | null | undefined = {},
26
+ params: FileListParams | null | undefined = {},
19
27
  options?: RequestOptions,
20
28
  ): PagePromise<FileMetadataPageCursor, FileMetadata> {
21
- return this._client.getAPIList('/v1/files', PageCursor<FileMetadata>, { query, ...options });
29
+ const { workspace_id, ...query } = params ?? {};
30
+ return this._client.getAPIList('/v1/files', PageCursor<FileMetadata>, {
31
+ query,
32
+ ...options,
33
+ headers: buildHeaders([
34
+ { ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
35
+ options?.headers,
36
+ ]),
37
+ });
22
38
  }
23
39
 
24
40
  /**
25
41
  * Delete File
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const deletedFile = await client.files.delete('file_id');
46
+ * ```
26
47
  */
27
- delete(fileID: string, options?: RequestOptions): APIPromise<DeletedFile> {
28
- return this._client.delete(path`/v1/files/${fileID}`, options);
48
+ delete(
49
+ fileID: string,
50
+ params: FileDeleteParams | null | undefined = {},
51
+ options?: RequestOptions,
52
+ ): APIPromise<DeletedFile> {
53
+ const { workspace_id } = params ?? {};
54
+ return this._client.delete(path`/v1/files/${fileID}`, {
55
+ ...options,
56
+ headers: buildHeaders([
57
+ { ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
58
+ options?.headers,
59
+ ]),
60
+ });
29
61
  }
30
62
 
31
63
  /**
32
64
  * Download File
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * const response = await client.files.download('file_id');
69
+ *
70
+ * const content = await response.blob();
71
+ * console.log(content);
72
+ * ```
33
73
  */
34
- download(fileID: string, options?: RequestOptions): APIPromise<Response> {
74
+ download(
75
+ fileID: string,
76
+ params: FileDownloadParams | null | undefined = {},
77
+ options?: RequestOptions,
78
+ ): APIPromise<Response> {
79
+ const { workspace_id } = params ?? {};
35
80
  return this._client.get(path`/v1/files/${fileID}/content`, {
36
81
  ...options,
37
- headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
82
+ headers: buildHeaders([
83
+ {
84
+ Accept: 'application/binary',
85
+ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
86
+ },
87
+ options?.headers,
88
+ ]),
38
89
  __binaryResponse: true,
39
90
  });
40
91
  }
41
92
 
42
93
  /**
43
94
  * Get File Metadata
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * const fileMetadata = await client.files.retrieveMetadata(
99
+ * 'file_id',
100
+ * );
101
+ * ```
44
102
  */
45
- retrieveMetadata(fileID: string, options?: RequestOptions): APIPromise<FileMetadata> {
46
- return this._client.get(path`/v1/files/${fileID}`, options);
103
+ retrieveMetadata(
104
+ fileID: string,
105
+ params: FileRetrieveMetadataParams | null | undefined = {},
106
+ options?: RequestOptions,
107
+ ): APIPromise<FileMetadata> {
108
+ const { workspace_id } = params ?? {};
109
+ return this._client.get(path`/v1/files/${fileID}`, {
110
+ ...options,
111
+ headers: buildHeaders([
112
+ { ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
113
+ options?.headers,
114
+ ]),
115
+ });
47
116
  }
48
117
 
49
118
  /**
50
119
  * Upload File
120
+ *
121
+ * @example
122
+ * ```ts
123
+ * const fileMetadata = await client.files.upload({
124
+ * file: fs.createReadStream('path/to/file'),
125
+ * });
126
+ * ```
51
127
  */
52
- upload(body: FileUploadParams, options?: RequestOptions): APIPromise<FileMetadata> {
128
+ upload(params: FileUploadParams, options?: RequestOptions): APIPromise<FileMetadata> {
129
+ const { workspace_id, ...body } = params;
53
130
  return this._client.post(
54
131
  '/v1/files',
55
132
  multipartFormRequestOptions(
56
133
  {
57
134
  body,
58
135
  ...options,
59
- headers: buildHeaders([stainlessHelperHeaderFromFile(body.file), options?.headers]),
136
+ headers: buildHeaders([
137
+ { ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
138
+ stainlessHelperHeaderFromFile(body.file),
139
+ options?.headers,
140
+ ]),
60
141
  },
61
142
  this._client,
62
143
  ),
@@ -130,26 +211,85 @@ export interface FileMetadata {
130
211
 
131
212
  export interface FileListParams extends PageCursorParams {
132
213
  /**
133
- * Restrict the result set to Files whose `id` is in this list. At most 100 entries
134
- * (after de-duplication). Mutually exclusive with `page` and `limit`. When
135
- * supplied, the response is always a single page (`next_page` is null). IDs that
136
- * do not resolve to a visible File — including deleted Files — are silently
137
- * omitted.
214
+ * Query param: Restrict the result set to Files whose `id` is in this list. At
215
+ * most 100 entries (after de-duplication). Mutually exclusive with `page` and
216
+ * `limit`. When supplied, the response is always a single page (`next_page` is
217
+ * null). IDs that do not resolve to a visible File — including deleted Files — are
218
+ * silently omitted.
138
219
  */
139
220
  ids?: Array<string> | null;
221
+
222
+ /**
223
+ * Header param: Optional header to select the Workspace for this request. The
224
+ * value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
225
+ *
226
+ * Only needed for credentials that can act on more than one Workspace. A
227
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
228
+ * match that Workspace.
229
+ */
230
+ workspace_id?: string;
231
+ }
232
+
233
+ export interface FileDeleteParams {
234
+ /**
235
+ * Optional header to select the Workspace for this request. The value is a
236
+ * Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
237
+ *
238
+ * Only needed for credentials that can act on more than one Workspace. A
239
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
240
+ * match that Workspace.
241
+ */
242
+ workspace_id?: string;
243
+ }
244
+
245
+ export interface FileDownloadParams {
246
+ /**
247
+ * Optional header to select the Workspace for this request. The value is a
248
+ * Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
249
+ *
250
+ * Only needed for credentials that can act on more than one Workspace. A
251
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
252
+ * match that Workspace.
253
+ */
254
+ workspace_id?: string;
255
+ }
256
+
257
+ export interface FileRetrieveMetadataParams {
258
+ /**
259
+ * Optional header to select the Workspace for this request. The value is a
260
+ * Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
261
+ *
262
+ * Only needed for credentials that can act on more than one Workspace. A
263
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
264
+ * match that Workspace.
265
+ */
266
+ workspace_id?: string;
140
267
  }
141
268
 
142
269
  export interface FileUploadParams {
143
270
  /**
144
- * The file to upload
271
+ * Body param: The file to upload. Only the final path component of the part's
272
+ * `filename` is kept; an absent or empty `filename` is replaced with `unnamed`
273
+ * plus the extension for the file's stored `mime_type`, when known.
145
274
  */
146
275
  file: Uploadable;
147
276
 
148
277
  /**
149
- * Seconds from upload until the file expires and its bytes become permanently
150
- * unavailable. Must be between 3600 (one hour) and 7776000 (ninety days).
278
+ * Body param: Seconds from upload until the file expires and its bytes become
279
+ * permanently unavailable. Must be between 3600 (one hour) and 7776000 (ninety
280
+ * days).
151
281
  */
152
282
  expires_in_seconds?: number;
283
+
284
+ /**
285
+ * Header param: Optional header to select the Workspace for this request. The
286
+ * value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
287
+ *
288
+ * Only needed for credentials that can act on more than one Workspace. A
289
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
290
+ * match that Workspace.
291
+ */
292
+ workspace_id?: string;
153
293
  }
154
294
 
155
295
  export declare namespace Files {
@@ -158,6 +298,9 @@ export declare namespace Files {
158
298
  type FileMetadata as FileMetadata,
159
299
  type FileMetadataPageCursor as FileMetadataPageCursor,
160
300
  type FileListParams as FileListParams,
301
+ type FileDeleteParams as FileDeleteParams,
302
+ type FileDownloadParams as FileDownloadParams,
303
+ type FileRetrieveMetadataParams as FileRetrieveMetadataParams,
161
304
  type FileUploadParams as FileUploadParams,
162
305
  };
163
306
  }
@@ -30,6 +30,9 @@ export {
30
30
  type DeletedFile,
31
31
  type FileMetadata,
32
32
  type FileListParams,
33
+ type FileDeleteParams,
34
+ type FileDownloadParams,
35
+ type FileRetrieveMetadataParams,
33
36
  type FileUploadParams,
34
37
  type FileMetadataPageCursor,
35
38
  } from './files';
@@ -290,6 +293,8 @@ export {
290
293
  type Skill,
291
294
  type SkillSource,
292
295
  type SkillCreateParams,
296
+ type SkillRetrieveParams,
293
297
  type SkillListParams,
298
+ type SkillDeleteParams,
294
299
  type SkillsPageCursor,
295
300
  } from './skills/skills';
@@ -41,12 +41,15 @@ export class Batches extends APIResource {
41
41
  * ```
42
42
  */
43
43
  create(params: BatchCreateParams, options?: RequestOptions): APIPromise<MessageBatch> {
44
- const { user_profile_id, ...body } = params;
44
+ const { user_profile_id, workspace_id, ...body } = params;
45
45
  return this._client.post('/v1/messages/batches', {
46
46
  body,
47
47
  ...options,
48
48
  headers: buildHeaders([
49
- { ...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined) },
49
+ {
50
+ ...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined),
51
+ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
52
+ },
50
53
  options?.headers,
51
54
  ]),
52
55
  });
@@ -67,8 +70,19 @@ export class Batches extends APIResource {
67
70
  * );
68
71
  * ```
69
72
  */
70
- retrieve(messageBatchID: string, options?: RequestOptions): APIPromise<MessageBatch> {
71
- return this._client.get(path`/v1/messages/batches/${messageBatchID}`, options);
73
+ retrieve(
74
+ messageBatchID: string,
75
+ params: BatchRetrieveParams | null | undefined = {},
76
+ options?: RequestOptions,
77
+ ): APIPromise<MessageBatch> {
78
+ const { workspace_id } = params ?? {};
79
+ return this._client.get(path`/v1/messages/batches/${messageBatchID}`, {
80
+ ...options,
81
+ headers: buildHeaders([
82
+ { ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
83
+ options?.headers,
84
+ ]),
85
+ });
72
86
  }
73
87
 
74
88
  /**
@@ -87,10 +101,18 @@ export class Batches extends APIResource {
87
101
  * ```
88
102
  */
89
103
  list(
90
- query: BatchListParams | null | undefined = {},
104
+ params: BatchListParams | null | undefined = {},
91
105
  options?: RequestOptions,
92
106
  ): PagePromise<MessageBatchesPage, MessageBatch> {
93
- return this._client.getAPIList('/v1/messages/batches', Page<MessageBatch>, { query, ...options });
107
+ const { workspace_id, ...query } = params ?? {};
108
+ return this._client.getAPIList('/v1/messages/batches', Page<MessageBatch>, {
109
+ query,
110
+ ...options,
111
+ headers: buildHeaders([
112
+ { ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
113
+ options?.headers,
114
+ ]),
115
+ });
94
116
  }
95
117
 
96
118
  /**
@@ -108,8 +130,19 @@ export class Batches extends APIResource {
108
130
  * await client.messages.batches.delete('message_batch_id');
109
131
  * ```
110
132
  */
111
- delete(messageBatchID: string, options?: RequestOptions): APIPromise<DeletedMessageBatch> {
112
- return this._client.delete(path`/v1/messages/batches/${messageBatchID}`, options);
133
+ delete(
134
+ messageBatchID: string,
135
+ params: BatchDeleteParams | null | undefined = {},
136
+ options?: RequestOptions,
137
+ ): APIPromise<DeletedMessageBatch> {
138
+ const { workspace_id } = params ?? {};
139
+ return this._client.delete(path`/v1/messages/batches/${messageBatchID}`, {
140
+ ...options,
141
+ headers: buildHeaders([
142
+ { ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
143
+ options?.headers,
144
+ ]),
145
+ });
113
146
  }
114
147
 
115
148
  /**
@@ -133,8 +166,19 @@ export class Batches extends APIResource {
133
166
  * );
134
167
  * ```
135
168
  */
136
- cancel(messageBatchID: string, options?: RequestOptions): APIPromise<MessageBatch> {
137
- return this._client.post(path`/v1/messages/batches/${messageBatchID}/cancel`, options);
169
+ cancel(
170
+ messageBatchID: string,
171
+ params: BatchCancelParams | null | undefined = {},
172
+ options?: RequestOptions,
173
+ ): APIPromise<MessageBatch> {
174
+ const { workspace_id } = params ?? {};
175
+ return this._client.post(path`/v1/messages/batches/${messageBatchID}/cancel`, {
176
+ ...options,
177
+ headers: buildHeaders([
178
+ { ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
179
+ options?.headers,
180
+ ]),
181
+ });
138
182
  }
139
183
 
140
184
  /**
@@ -155,19 +199,27 @@ export class Batches extends APIResource {
155
199
  */
156
200
  async results(
157
201
  messageBatchID: string,
202
+ params: BatchResultsParams | undefined = {},
158
203
  options?: RequestOptions,
159
204
  ): Promise<JSONLDecoder<MessageBatchIndividualResponse>> {
160
- const batch = await this.retrieve(messageBatchID);
205
+ const batch = await this.retrieve(messageBatchID, params, options);
161
206
  if (!batch.results_url) {
162
207
  throw new AnthropicError(
163
208
  `No batch \`results_url\`; Has it finished processing? ${batch.processing_status} - ${batch.id}`,
164
209
  );
165
210
  }
166
211
 
212
+ const { workspace_id } = params ?? {};
167
213
  return this._client
168
214
  .get(batch.results_url, {
169
215
  ...options,
170
- headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
216
+ headers: buildHeaders([
217
+ {
218
+ Accept: 'application/binary',
219
+ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
220
+ },
221
+ options?.headers,
222
+ ]),
171
223
  stream: true,
172
224
  __binaryResponse: true,
173
225
  })
@@ -371,6 +423,16 @@ export interface BatchCreateParams {
371
423
  * is errored.
372
424
  */
373
425
  user_profile_id?: string;
426
+
427
+ /**
428
+ * Header param: Optional header to select the Workspace for this request. The
429
+ * value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
430
+ *
431
+ * Only needed for credentials that can act on more than one Workspace. A
432
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
433
+ * match that Workspace.
434
+ */
435
+ workspace_id?: string;
374
436
  }
375
437
 
376
438
  export namespace BatchCreateParams {
@@ -394,7 +456,65 @@ export namespace BatchCreateParams {
394
456
  }
395
457
  }
396
458
 
397
- export interface BatchListParams extends PageParams {}
459
+ export interface BatchRetrieveParams {
460
+ /**
461
+ * Optional header to select the Workspace for this request. The value is a
462
+ * Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
463
+ *
464
+ * Only needed for credentials that can act on more than one Workspace. A
465
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
466
+ * match that Workspace.
467
+ */
468
+ workspace_id?: string;
469
+ }
470
+
471
+ export interface BatchListParams extends PageParams {
472
+ /**
473
+ * Header param: Optional header to select the Workspace for this request. The
474
+ * value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
475
+ *
476
+ * Only needed for credentials that can act on more than one Workspace. A
477
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
478
+ * match that Workspace.
479
+ */
480
+ workspace_id?: string;
481
+ }
482
+
483
+ export interface BatchDeleteParams {
484
+ /**
485
+ * Optional header to select the Workspace for this request. The value is a
486
+ * Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
487
+ *
488
+ * Only needed for credentials that can act on more than one Workspace. A
489
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
490
+ * match that Workspace.
491
+ */
492
+ workspace_id?: string;
493
+ }
494
+
495
+ export interface BatchCancelParams {
496
+ /**
497
+ * Optional header to select the Workspace for this request. The value is a
498
+ * Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
499
+ *
500
+ * Only needed for credentials that can act on more than one Workspace. A
501
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
502
+ * match that Workspace.
503
+ */
504
+ workspace_id?: string;
505
+ }
506
+
507
+ export interface BatchResultsParams {
508
+ /**
509
+ * Optional header to select the Workspace for this request. The value is a
510
+ * Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
511
+ *
512
+ * Only needed for credentials that can act on more than one Workspace. A
513
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
514
+ * match that Workspace.
515
+ */
516
+ workspace_id?: string;
517
+ }
398
518
 
399
519
  export declare namespace Batches {
400
520
  export {
@@ -409,6 +529,10 @@ export declare namespace Batches {
409
529
  type MessageBatchSucceededResult as MessageBatchSucceededResult,
410
530
  type MessageBatchesPage as MessageBatchesPage,
411
531
  type BatchCreateParams as BatchCreateParams,
532
+ type BatchRetrieveParams as BatchRetrieveParams,
412
533
  type BatchListParams as BatchListParams,
534
+ type BatchDeleteParams as BatchDeleteParams,
535
+ type BatchCancelParams as BatchCancelParams,
536
+ type BatchResultsParams as BatchResultsParams,
413
537
  };
414
538
  }
@@ -12,7 +12,11 @@ export {
12
12
  type MessageBatchResult,
13
13
  type MessageBatchSucceededResult,
14
14
  type BatchCreateParams,
15
+ type BatchRetrieveParams,
15
16
  type BatchListParams,
17
+ type BatchDeleteParams,
18
+ type BatchCancelParams,
19
+ type BatchResultsParams,
16
20
  type MessageBatchesPage,
17
21
  } from './batches';
18
22
  export {
@@ -15,8 +15,12 @@ import {
15
15
  } from '../../lib/parser';
16
16
  import * as BatchesAPI from './batches';
17
17
  import {
18
+ BatchCancelParams,
18
19
  BatchCreateParams,
20
+ BatchDeleteParams,
19
21
  BatchListParams,
22
+ BatchResultsParams,
23
+ BatchRetrieveParams,
20
24
  Batches,
21
25
  DeletedMessageBatch,
22
26
  MessageBatch,
@@ -68,7 +72,7 @@ export class Messages extends APIResource {
68
72
  params: MessageCreateParams,
69
73
  options?: RequestOptions,
70
74
  ): APIPromise<Message> | APIPromise<Stream<RawMessageStreamEvent>> {
71
- const { user_profile_id, ...body } = params;
75
+ const { user_profile_id, workspace_id, ...body } = params;
72
76
  if (body.model in DEPRECATED_MODELS) {
73
77
  console.warn(
74
78
  `The model '${body.model}' is deprecated and will reach end-of-life on ${
@@ -99,7 +103,10 @@ export class Messages extends APIResource {
99
103
  timeout: timeout ?? 600000,
100
104
  ...options,
101
105
  headers: buildHeaders([
102
- { ...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined) },
106
+ {
107
+ ...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined),
108
+ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
109
+ },
103
110
  helperHeader,
104
111
  options?.headers,
105
112
  ]),
@@ -186,12 +193,15 @@ export class Messages extends APIResource {
186
193
  * ```
187
194
  */
188
195
  countTokens(params: MessageCountTokensParams, options?: RequestOptions): APIPromise<MessageTokensCount> {
189
- const { user_profile_id, ...body } = params;
196
+ const { user_profile_id, workspace_id, ...body } = params;
190
197
  return this._client.post('/v1/messages/count_tokens', {
191
198
  body,
192
199
  ...options,
193
200
  headers: buildHeaders([
194
- { ...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined) },
201
+ {
202
+ ...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined),
203
+ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
204
+ },
195
205
  options?.headers,
196
206
  ]),
197
207
  });
@@ -4820,6 +4830,16 @@ export interface MessageCreateParamsBase {
4820
4830
  * beta header.
4821
4831
  */
4822
4832
  user_profile_id?: string;
4833
+
4834
+ /**
4835
+ * Header param: Optional header to select the Workspace for this request. The
4836
+ * value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
4837
+ *
4838
+ * Only needed for credentials that can act on more than one Workspace. A
4839
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
4840
+ * match that Workspace.
4841
+ */
4842
+ workspace_id?: string;
4823
4843
  }
4824
4844
 
4825
4845
  export namespace MessageCreateParams {
@@ -5057,6 +5077,16 @@ export interface MessageCountTokensParams {
5057
5077
  * beta header.
5058
5078
  */
5059
5079
  user_profile_id?: string;
5080
+
5081
+ /**
5082
+ * Header param: Optional header to select the Workspace for this request. The
5083
+ * value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
5084
+ *
5085
+ * Only needed for credentials that can act on more than one Workspace. A
5086
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
5087
+ * match that Workspace.
5088
+ */
5089
+ workspace_id?: string;
5060
5090
  }
5061
5091
 
5062
5092
  Messages.Batches = Batches;
@@ -5316,6 +5346,10 @@ export declare namespace Messages {
5316
5346
  type MessageBatchSucceededResult as MessageBatchSucceededResult,
5317
5347
  type MessageBatchesPage as MessageBatchesPage,
5318
5348
  type BatchCreateParams as BatchCreateParams,
5349
+ type BatchRetrieveParams as BatchRetrieveParams,
5319
5350
  type BatchListParams as BatchListParams,
5351
+ type BatchDeleteParams as BatchDeleteParams,
5352
+ type BatchCancelParams as BatchCancelParams,
5353
+ type BatchResultsParams as BatchResultsParams,
5320
5354
  };
5321
5355
  }
@@ -14,17 +14,25 @@ export class Models extends APIResource {
14
14
  *
15
15
  * The Models API response can be used to determine information about a specific
16
16
  * model or resolve a model alias to a model ID.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const modelInfo = await client.models.retrieve('model_id');
21
+ * ```
17
22
  */
18
23
  retrieve(
19
24
  modelID: string,
20
25
  params: ModelRetrieveParams | null | undefined = {},
21
26
  options?: RequestOptions,
22
27
  ): APIPromise<ModelInfo> {
23
- const { betas } = params ?? {};
28
+ const { betas, workspace_id } = params ?? {};
24
29
  return this._client.get(path`/v1/models/${modelID}`, {
25
30
  ...options,
26
31
  headers: buildHeaders([
27
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
32
+ {
33
+ ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined),
34
+ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
35
+ },
28
36
  options?.headers,
29
37
  ]),
30
38
  });
@@ -35,17 +43,28 @@ export class Models extends APIResource {
35
43
  *
36
44
  * The Models API response can be used to determine which models are available for
37
45
  * use in the API. More recently released models are listed first.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * // Automatically fetches more pages as needed.
50
+ * for await (const modelInfo of client.models.list()) {
51
+ * // ...
52
+ * }
53
+ * ```
38
54
  */
39
55
  list(
40
56
  params: ModelListParams | null | undefined = {},
41
57
  options?: RequestOptions,
42
58
  ): PagePromise<ModelInfosPage, ModelInfo> {
43
- const { betas, ...query } = params ?? {};
59
+ const { betas, workspace_id, ...query } = params ?? {};
44
60
  return this._client.getAPIList('/v1/models', Page<ModelInfo>, {
45
61
  query,
46
62
  ...options,
47
63
  headers: buildHeaders([
48
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
64
+ {
65
+ ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined),
66
+ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
67
+ },
49
68
  options?.headers,
50
69
  ]),
51
70
  });
@@ -249,6 +268,16 @@ export interface ModelRetrieveParams {
249
268
  * Optional header to specify the beta version(s) you want to use.
250
269
  */
251
270
  betas?: Array<BetaAPI.AnthropicBeta>;
271
+
272
+ /**
273
+ * Optional header to select the Workspace for this request. The value is a
274
+ * Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
275
+ *
276
+ * Only needed for credentials that can act on more than one Workspace. A
277
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
278
+ * match that Workspace.
279
+ */
280
+ workspace_id?: string;
252
281
  }
253
282
 
254
283
  export interface ModelListParams extends PageParams {
@@ -256,6 +285,16 @@ export interface ModelListParams extends PageParams {
256
285
  * Header param: Optional header to specify the beta version(s) you want to use.
257
286
  */
258
287
  betas?: Array<BetaAPI.AnthropicBeta>;
288
+
289
+ /**
290
+ * Header param: Optional header to select the Workspace for this request. The
291
+ * value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
292
+ *
293
+ * Only needed for credentials that can act on more than one Workspace. A
294
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
295
+ * match that Workspace.
296
+ */
297
+ workspace_id?: string;
259
298
  }
260
299
 
261
300
  export declare namespace Models {