@anthropic-ai/sdk 0.89.0 → 0.91.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 (151) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/bin/migration-config.json +185 -0
  3. package/package.json +1 -1
  4. package/resources/beta/agents/agents.d.mts +1 -1
  5. package/resources/beta/agents/agents.d.mts.map +1 -1
  6. package/resources/beta/agents/agents.d.ts +1 -1
  7. package/resources/beta/agents/agents.d.ts.map +1 -1
  8. package/resources/beta/agents/agents.js.map +1 -1
  9. package/resources/beta/agents/agents.mjs.map +1 -1
  10. package/resources/beta/beta.d.mts +13 -5
  11. package/resources/beta/beta.d.mts.map +1 -1
  12. package/resources/beta/beta.d.ts +13 -5
  13. package/resources/beta/beta.d.ts.map +1 -1
  14. package/resources/beta/beta.js +8 -0
  15. package/resources/beta/beta.js.map +1 -1
  16. package/resources/beta/beta.mjs +8 -0
  17. package/resources/beta/beta.mjs.map +1 -1
  18. package/resources/beta/index.d.mts +4 -2
  19. package/resources/beta/index.d.mts.map +1 -1
  20. package/resources/beta/index.d.ts +4 -2
  21. package/resources/beta/index.d.ts.map +1 -1
  22. package/resources/beta/index.js +13 -9
  23. package/resources/beta/index.js.map +1 -1
  24. package/resources/beta/index.mjs +2 -0
  25. package/resources/beta/index.mjs.map +1 -1
  26. package/resources/beta/memory-stores/index.d.mts +4 -0
  27. package/resources/beta/memory-stores/index.d.mts.map +1 -0
  28. package/resources/beta/memory-stores/index.d.ts +4 -0
  29. package/resources/beta/memory-stores/index.d.ts.map +1 -0
  30. package/resources/beta/memory-stores/index.js +11 -0
  31. package/resources/beta/memory-stores/index.js.map +1 -0
  32. package/resources/beta/memory-stores/index.mjs +5 -0
  33. package/resources/beta/memory-stores/index.mjs.map +1 -0
  34. package/resources/beta/memory-stores/memories.d.mts +232 -0
  35. package/resources/beta/memory-stores/memories.d.mts.map +1 -0
  36. package/resources/beta/memory-stores/memories.d.ts +232 -0
  37. package/resources/beta/memory-stores/memories.d.ts.map +1 -0
  38. package/resources/beta/memory-stores/memories.js +130 -0
  39. package/resources/beta/memory-stores/memories.js.map +1 -0
  40. package/resources/beta/memory-stores/memories.mjs +126 -0
  41. package/resources/beta/memory-stores/memories.mjs.map +1 -0
  42. package/resources/beta/memory-stores/memory-stores.d.mts +187 -0
  43. package/resources/beta/memory-stores/memory-stores.d.mts.map +1 -0
  44. package/resources/beta/memory-stores/memory-stores.d.ts +187 -0
  45. package/resources/beta/memory-stores/memory-stores.d.ts.map +1 -0
  46. package/resources/beta/memory-stores/memory-stores.js +145 -0
  47. package/resources/beta/memory-stores/memory-stores.js.map +1 -0
  48. package/resources/beta/memory-stores/memory-stores.mjs +140 -0
  49. package/resources/beta/memory-stores/memory-stores.mjs.map +1 -0
  50. package/resources/beta/memory-stores/memory-versions.d.mts +152 -0
  51. package/resources/beta/memory-stores/memory-versions.d.mts.map +1 -0
  52. package/resources/beta/memory-stores/memory-versions.d.ts +152 -0
  53. package/resources/beta/memory-stores/memory-versions.d.ts.map +1 -0
  54. package/resources/beta/memory-stores/memory-versions.js +81 -0
  55. package/resources/beta/memory-stores/memory-versions.js.map +1 -0
  56. package/resources/beta/memory-stores/memory-versions.mjs +77 -0
  57. package/resources/beta/memory-stores/memory-versions.mjs.map +1 -0
  58. package/resources/beta/memory-stores.d.mts +2 -0
  59. package/resources/beta/memory-stores.d.mts.map +1 -0
  60. package/resources/beta/memory-stores.d.ts +2 -0
  61. package/resources/beta/memory-stores.d.ts.map +1 -0
  62. package/resources/beta/memory-stores.js +6 -0
  63. package/resources/beta/memory-stores.js.map +1 -0
  64. package/resources/beta/memory-stores.mjs +3 -0
  65. package/resources/beta/memory-stores.mjs.map +1 -0
  66. package/resources/beta/messages/batches.d.mts +5 -0
  67. package/resources/beta/messages/batches.d.mts.map +1 -1
  68. package/resources/beta/messages/batches.d.ts +5 -0
  69. package/resources/beta/messages/batches.d.ts.map +1 -1
  70. package/resources/beta/messages/index.d.mts +1 -1
  71. package/resources/beta/messages/index.d.mts.map +1 -1
  72. package/resources/beta/messages/index.d.ts +1 -1
  73. package/resources/beta/messages/index.d.ts.map +1 -1
  74. package/resources/beta/messages/index.js.map +1 -1
  75. package/resources/beta/messages/index.mjs.map +1 -1
  76. package/resources/beta/messages/messages.d.mts +41 -2
  77. package/resources/beta/messages/messages.d.mts.map +1 -1
  78. package/resources/beta/messages/messages.d.ts +41 -2
  79. package/resources/beta/messages/messages.d.ts.map +1 -1
  80. package/resources/beta/messages/messages.js +2 -2
  81. package/resources/beta/messages/messages.js.map +1 -1
  82. package/resources/beta/messages/messages.mjs +2 -2
  83. package/resources/beta/messages/messages.mjs.map +1 -1
  84. package/resources/beta/models.d.mts +4 -0
  85. package/resources/beta/models.d.mts.map +1 -1
  86. package/resources/beta/models.d.ts +4 -0
  87. package/resources/beta/models.d.ts.map +1 -1
  88. package/resources/beta/sessions/index.d.mts +2 -2
  89. package/resources/beta/sessions/index.d.mts.map +1 -1
  90. package/resources/beta/sessions/index.d.ts +2 -2
  91. package/resources/beta/sessions/index.d.ts.map +1 -1
  92. package/resources/beta/sessions/index.js.map +1 -1
  93. package/resources/beta/sessions/index.mjs.map +1 -1
  94. package/resources/beta/sessions/resources.d.mts +42 -4
  95. package/resources/beta/sessions/resources.d.mts.map +1 -1
  96. package/resources/beta/sessions/resources.d.ts +42 -4
  97. package/resources/beta/sessions/resources.d.ts.map +1 -1
  98. package/resources/beta/sessions/sessions.d.mts +24 -4
  99. package/resources/beta/sessions/sessions.d.mts.map +1 -1
  100. package/resources/beta/sessions/sessions.d.ts +24 -4
  101. package/resources/beta/sessions/sessions.d.ts.map +1 -1
  102. package/resources/beta/sessions/sessions.js.map +1 -1
  103. package/resources/beta/sessions/sessions.mjs.map +1 -1
  104. package/resources/beta/user-profiles.d.mts +187 -0
  105. package/resources/beta/user-profiles.d.mts.map +1 -0
  106. package/resources/beta/user-profiles.d.ts +187 -0
  107. package/resources/beta/user-profiles.d.ts.map +1 -0
  108. package/resources/beta/user-profiles.js +118 -0
  109. package/resources/beta/user-profiles.js.map +1 -0
  110. package/resources/beta/user-profiles.mjs +114 -0
  111. package/resources/beta/user-profiles.mjs.map +1 -0
  112. package/resources/completions.d.mts +8 -24
  113. package/resources/completions.d.mts.map +1 -1
  114. package/resources/completions.d.ts +8 -24
  115. package/resources/completions.d.ts.map +1 -1
  116. package/resources/messages/messages.d.mts +2 -2
  117. package/resources/messages/messages.d.mts.map +1 -1
  118. package/resources/messages/messages.d.ts +2 -2
  119. package/resources/messages/messages.d.ts.map +1 -1
  120. package/resources/messages/messages.js +2 -2
  121. package/resources/messages/messages.js.map +1 -1
  122. package/resources/messages/messages.mjs +2 -2
  123. package/resources/messages/messages.mjs.map +1 -1
  124. package/resources/models.d.mts +4 -0
  125. package/resources/models.d.mts.map +1 -1
  126. package/resources/models.d.ts +4 -0
  127. package/resources/models.d.ts.map +1 -1
  128. package/src/resources/beta/agents/agents.ts +1 -0
  129. package/src/resources/beta/beta.ts +61 -0
  130. package/src/resources/beta/index.ts +26 -0
  131. package/src/resources/beta/memory-stores/index.ts +47 -0
  132. package/src/resources/beta/memory-stores/memories.ts +399 -0
  133. package/src/resources/beta/memory-stores/memory-stores.ts +374 -0
  134. package/src/resources/beta/memory-stores/memory-versions.ts +259 -0
  135. package/src/resources/beta/memory-stores.ts +3 -0
  136. package/src/resources/beta/messages/batches.ts +6 -0
  137. package/src/resources/beta/messages/index.ts +1 -0
  138. package/src/resources/beta/messages/messages.ts +51 -3
  139. package/src/resources/beta/models.ts +5 -0
  140. package/src/resources/beta/sessions/index.ts +2 -0
  141. package/src/resources/beta/sessions/resources.ts +52 -3
  142. package/src/resources/beta/sessions/sessions.ts +32 -1
  143. package/src/resources/beta/user-profiles.ts +283 -0
  144. package/src/resources/completions.ts +8 -24
  145. package/src/resources/messages/messages.ts +4 -3
  146. package/src/resources/models.ts +5 -0
  147. package/src/version.ts +1 -1
  148. package/version.d.mts +1 -1
  149. package/version.d.ts +1 -1
  150. package/version.js +1 -1
  151. package/version.mjs +1 -1
@@ -62,7 +62,7 @@ const DEPRECATED_MODELS: {
62
62
  'claude-3-7-sonnet-20250219': 'February 19th, 2026',
63
63
  };
64
64
 
65
- const MODELS_TO_WARN_WITH_THINKING_ENABLED: Model[] = ['claude-opus-4-6'];
65
+ const MODELS_TO_WARN_WITH_THINKING_ENABLED: Model[] = ['claude-mythos-preview', 'claude-opus-4-6'];
66
66
 
67
67
  export class Messages extends APIResource {
68
68
  batches: BatchesAPI.Batches = new BatchesAPI.Batches(this._client);
@@ -113,7 +113,7 @@ export class Messages extends APIResource {
113
113
  }
114
114
 
115
115
  if (
116
- body.model in MODELS_TO_WARN_WITH_THINKING_ENABLED &&
116
+ MODELS_TO_WARN_WITH_THINKING_ENABLED.includes(body.model) &&
117
117
  body.thinking &&
118
118
  body.thinking.type === 'enabled'
119
119
  ) {
@@ -1025,6 +1025,11 @@ export interface BetaCompactionBlock {
1025
1025
  */
1026
1026
  content: string | null;
1027
1027
 
1028
+ /**
1029
+ * Opaque metadata from prior compaction, to be round-tripped verbatim
1030
+ */
1031
+ encrypted_content: string | null;
1032
+
1028
1033
  type: 'compaction';
1029
1034
  }
1030
1035
 
@@ -1049,11 +1054,21 @@ export interface BetaCompactionBlockParam {
1049
1054
  * Create a cache control breakpoint at this content block.
1050
1055
  */
1051
1056
  cache_control?: BetaCacheControlEphemeral | null;
1057
+
1058
+ /**
1059
+ * Opaque metadata from prior compaction, to be round-tripped verbatim
1060
+ */
1061
+ encrypted_content?: string | null;
1052
1062
  }
1053
1063
 
1054
1064
  export interface BetaCompactionContentBlockDelta {
1055
1065
  content: string | null;
1056
1066
 
1067
+ /**
1068
+ * Opaque metadata from prior compaction, to be round-tripped verbatim
1069
+ */
1070
+ encrypted_content: string | null;
1071
+
1057
1072
  type: 'compaction_delta';
1058
1073
  }
1059
1074
 
@@ -1824,13 +1839,18 @@ export interface BetaOutputConfig {
1824
1839
  /**
1825
1840
  * All possible effort levels.
1826
1841
  */
1827
- effort?: 'low' | 'medium' | 'high' | 'max' | null;
1842
+ effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | null;
1828
1843
 
1829
1844
  /**
1830
1845
  * A schema to specify Claude's output format in responses. See
1831
1846
  * [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
1832
1847
  */
1833
1848
  format?: BetaJSONOutputFormat | null;
1849
+
1850
+ /**
1851
+ * User-configurable total token budget across contexts.
1852
+ */
1853
+ task_budget?: BetaTokenTaskBudget | null;
1834
1854
  }
1835
1855
 
1836
1856
  export interface BetaPlainTextSource {
@@ -2453,6 +2473,27 @@ export interface BetaThinkingTurns {
2453
2473
  value: number;
2454
2474
  }
2455
2475
 
2476
+ /**
2477
+ * User-configurable total token budget across contexts.
2478
+ */
2479
+ export interface BetaTokenTaskBudget {
2480
+ /**
2481
+ * Total token budget across all contexts in the session.
2482
+ */
2483
+ total: number;
2484
+
2485
+ /**
2486
+ * The budget type. Currently only 'tokens' is supported.
2487
+ */
2488
+ type: 'tokens';
2489
+
2490
+ /**
2491
+ * Remaining tokens in the budget. Use this to track usage across contexts when
2492
+ * implementing compaction client-side. Defaults to total if not provided.
2493
+ */
2494
+ remaining?: number | null;
2495
+ }
2496
+
2456
2497
  export interface BetaTool {
2457
2498
  /**
2458
2499
  * [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
@@ -4008,6 +4049,12 @@ export interface MessageCreateParamsBase {
4008
4049
  */
4009
4050
  top_p?: number;
4010
4051
 
4052
+ /**
4053
+ * Body param: The user profile ID to attribute this request to. Use when acting on
4054
+ * behalf of a party other than your organization.
4055
+ */
4056
+ user_profile_id?: string | null;
4057
+
4011
4058
  /**
4012
4059
  * Header param: Optional header to specify the beta version(s) you want to use.
4013
4060
  */
@@ -4455,6 +4502,7 @@ export declare namespace Messages {
4455
4502
  type BetaThinkingConfigParam as BetaThinkingConfigParam,
4456
4503
  type BetaThinkingDelta as BetaThinkingDelta,
4457
4504
  type BetaThinkingTurns as BetaThinkingTurns,
4505
+ type BetaTokenTaskBudget as BetaTokenTaskBudget,
4458
4506
  type BetaTool as BetaTool,
4459
4507
  type BetaToolBash20241022 as BetaToolBash20241022,
4460
4508
  type BetaToolBash20250124 as BetaToolBash20250124,
@@ -132,6 +132,11 @@ export interface BetaEffortCapability {
132
132
  * Whether this capability is supported by the model.
133
133
  */
134
134
  supported: boolean;
135
+
136
+ /**
137
+ * Indicates whether a capability is supported.
138
+ */
139
+ xhigh: BetaCapabilitySupport | null;
135
140
  }
136
141
 
137
142
  /**
@@ -64,6 +64,7 @@ export {
64
64
  type BetaManagedAgentsDeleteSessionResource,
65
65
  type BetaManagedAgentsFileResource,
66
66
  type BetaManagedAgentsGitHubRepositoryResource,
67
+ type BetaManagedAgentsMemoryStoreResource,
67
68
  type BetaManagedAgentsSessionResource,
68
69
  type ResourceRetrieveResponse,
69
70
  type ResourceUpdateResponse,
@@ -83,6 +84,7 @@ export {
83
84
  type BetaManagedAgentsDeletedSession,
84
85
  type BetaManagedAgentsFileResourceParams,
85
86
  type BetaManagedAgentsGitHubRepositoryResourceParams,
87
+ type BetaManagedAgentsMemoryStoreResourceParam,
86
88
  type BetaManagedAgentsSession,
87
89
  type BetaManagedAgentsSessionAgent,
88
90
  type BetaManagedAgentsSessionStats,
@@ -213,23 +213,71 @@ export interface BetaManagedAgentsGitHubRepositoryResource {
213
213
  checkout?: SessionsAPI.BetaManagedAgentsBranchCheckout | SessionsAPI.BetaManagedAgentsCommitCheckout | null;
214
214
  }
215
215
 
216
+ /**
217
+ * A memory store attached to an agent session.
218
+ */
219
+ export interface BetaManagedAgentsMemoryStoreResource {
220
+ /**
221
+ * The memory store ID (memstore\_...). Must belong to the caller's organization
222
+ * and workspace.
223
+ */
224
+ memory_store_id: string;
225
+
226
+ type: 'memory_store';
227
+
228
+ /**
229
+ * Access mode for an attached memory store.
230
+ */
231
+ access?: 'read_write' | 'read_only' | null;
232
+
233
+ /**
234
+ * Description of the memory store, snapshotted at attach time. Rendered into the
235
+ * agent's system prompt. Empty string when the store has no description.
236
+ */
237
+ description?: string;
238
+
239
+ /**
240
+ * Per-attachment guidance for the agent on how to use this store. Rendered into
241
+ * the memory section of the system prompt. Max 4096 chars.
242
+ */
243
+ instructions?: string | null;
244
+
245
+ /**
246
+ * Filesystem path where the store is mounted in the session container, e.g.
247
+ * /mnt/memory/user-preferences. Derived from the store's name. Output-only.
248
+ */
249
+ mount_path?: string | null;
250
+
251
+ /**
252
+ * Display name of the memory store, snapshotted at attach time. Later edits to the
253
+ * store's name do not propagate to this resource.
254
+ */
255
+ name?: string | null;
256
+ }
257
+
258
+ /**
259
+ * A memory store attached to an agent session.
260
+ */
216
261
  export type BetaManagedAgentsSessionResource =
217
262
  | BetaManagedAgentsGitHubRepositoryResource
218
- | BetaManagedAgentsFileResource;
263
+ | BetaManagedAgentsFileResource
264
+ | BetaManagedAgentsMemoryStoreResource;
219
265
 
220
266
  /**
221
267
  * The requested session resource.
222
268
  */
223
269
  export type ResourceRetrieveResponse =
224
270
  | BetaManagedAgentsGitHubRepositoryResource
225
- | BetaManagedAgentsFileResource;
271
+ | BetaManagedAgentsFileResource
272
+ | BetaManagedAgentsMemoryStoreResource;
226
273
 
227
274
  /**
228
275
  * The updated session resource.
229
276
  */
230
277
  export type ResourceUpdateResponse =
231
278
  | BetaManagedAgentsGitHubRepositoryResource
232
- | BetaManagedAgentsFileResource;
279
+ | BetaManagedAgentsFileResource
280
+ | BetaManagedAgentsMemoryStoreResource;
233
281
 
234
282
  export interface ResourceRetrieveParams {
235
283
  /**
@@ -308,6 +356,7 @@ export declare namespace Resources {
308
356
  type BetaManagedAgentsDeleteSessionResource as BetaManagedAgentsDeleteSessionResource,
309
357
  type BetaManagedAgentsFileResource as BetaManagedAgentsFileResource,
310
358
  type BetaManagedAgentsGitHubRepositoryResource as BetaManagedAgentsGitHubRepositoryResource,
359
+ type BetaManagedAgentsMemoryStoreResource as BetaManagedAgentsMemoryStoreResource,
311
360
  type BetaManagedAgentsSessionResource as BetaManagedAgentsSessionResource,
312
361
  type ResourceRetrieveResponse as ResourceRetrieveResponse,
313
362
  type ResourceUpdateResponse as ResourceUpdateResponse,
@@ -68,6 +68,7 @@ import {
68
68
  BetaManagedAgentsDeleteSessionResource,
69
69
  BetaManagedAgentsFileResource,
70
70
  BetaManagedAgentsGitHubRepositoryResource,
71
+ BetaManagedAgentsMemoryStoreResource,
71
72
  BetaManagedAgentsSessionResource,
72
73
  BetaManagedAgentsSessionResourcesPageCursor,
73
74
  ResourceAddParams,
@@ -352,6 +353,30 @@ export interface BetaManagedAgentsGitHubRepositoryResourceParams {
352
353
  mount_path?: string | null;
353
354
  }
354
355
 
356
+ /**
357
+ * Parameters for attaching a memory store to an agent session.
358
+ */
359
+ export interface BetaManagedAgentsMemoryStoreResourceParam {
360
+ /**
361
+ * The memory store ID (memstore\_...). Must belong to the caller's organization
362
+ * and workspace.
363
+ */
364
+ memory_store_id: string;
365
+
366
+ type: 'memory_store';
367
+
368
+ /**
369
+ * Access mode for an attached memory store.
370
+ */
371
+ access?: 'read_write' | 'read_only' | null;
372
+
373
+ /**
374
+ * Per-attachment guidance for the agent on how to use this store. Rendered into
375
+ * the memory section of the system prompt. Max 4096 chars.
376
+ */
377
+ instructions?: string | null;
378
+ }
379
+
355
380
  /**
356
381
  * A Managed Agents `session`.
357
382
  */
@@ -510,7 +535,11 @@ export interface SessionCreateParams {
510
535
  * Body param: Resources (e.g. repositories, files) to mount into the session's
511
536
  * container.
512
537
  */
513
- resources?: Array<BetaManagedAgentsGitHubRepositoryResourceParams | BetaManagedAgentsFileResourceParams>;
538
+ resources?: Array<
539
+ | BetaManagedAgentsGitHubRepositoryResourceParams
540
+ | BetaManagedAgentsFileResourceParams
541
+ | BetaManagedAgentsMemoryStoreResourceParam
542
+ >;
514
543
 
515
544
  /**
516
545
  * Body param: Human-readable session title.
@@ -635,6 +664,7 @@ export declare namespace Sessions {
635
664
  type BetaManagedAgentsDeletedSession as BetaManagedAgentsDeletedSession,
636
665
  type BetaManagedAgentsFileResourceParams as BetaManagedAgentsFileResourceParams,
637
666
  type BetaManagedAgentsGitHubRepositoryResourceParams as BetaManagedAgentsGitHubRepositoryResourceParams,
667
+ type BetaManagedAgentsMemoryStoreResourceParam as BetaManagedAgentsMemoryStoreResourceParam,
638
668
  type BetaManagedAgentsSession as BetaManagedAgentsSession,
639
669
  type BetaManagedAgentsSessionAgent as BetaManagedAgentsSessionAgent,
640
670
  type BetaManagedAgentsSessionStats as BetaManagedAgentsSessionStats,
@@ -713,6 +743,7 @@ export declare namespace Sessions {
713
743
  type BetaManagedAgentsDeleteSessionResource as BetaManagedAgentsDeleteSessionResource,
714
744
  type BetaManagedAgentsFileResource as BetaManagedAgentsFileResource,
715
745
  type BetaManagedAgentsGitHubRepositoryResource as BetaManagedAgentsGitHubRepositoryResource,
746
+ type BetaManagedAgentsMemoryStoreResource as BetaManagedAgentsMemoryStoreResource,
716
747
  type BetaManagedAgentsSessionResource as BetaManagedAgentsSessionResource,
717
748
  type ResourceRetrieveResponse as ResourceRetrieveResponse,
718
749
  type ResourceUpdateResponse as ResourceUpdateResponse,
@@ -0,0 +1,283 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as BetaAPI from './beta';
5
+ import { APIPromise } from '../../core/api-promise';
6
+ import { PageCursor, type PageCursorParams, PagePromise } from '../../core/pagination';
7
+ import { buildHeaders } from '../../internal/headers';
8
+ import { RequestOptions } from '../../internal/request-options';
9
+ import { path } from '../../internal/utils/path';
10
+
11
+ export class UserProfiles extends APIResource {
12
+ /**
13
+ * Create User Profile
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const betaUserProfile =
18
+ * await client.beta.userProfiles.create();
19
+ * ```
20
+ */
21
+ create(params: UserProfileCreateParams, options?: RequestOptions): APIPromise<BetaUserProfile> {
22
+ const { betas, ...body } = params;
23
+ return this._client.post('/v1/user_profiles?beta=true', {
24
+ body,
25
+ ...options,
26
+ headers: buildHeaders([
27
+ { 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-03-24'].toString() },
28
+ options?.headers,
29
+ ]),
30
+ });
31
+ }
32
+
33
+ /**
34
+ * Get User Profile
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const betaUserProfile =
39
+ * await client.beta.userProfiles.retrieve(
40
+ * 'uprof_011CZkZCu8hGbp5mYRQgUmz9',
41
+ * );
42
+ * ```
43
+ */
44
+ retrieve(
45
+ userProfileID: string,
46
+ params: UserProfileRetrieveParams | null | undefined = {},
47
+ options?: RequestOptions,
48
+ ): APIPromise<BetaUserProfile> {
49
+ const { betas } = params ?? {};
50
+ return this._client.get(path`/v1/user_profiles/${userProfileID}?beta=true`, {
51
+ ...options,
52
+ headers: buildHeaders([
53
+ { 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-03-24'].toString() },
54
+ options?.headers,
55
+ ]),
56
+ });
57
+ }
58
+
59
+ /**
60
+ * Update User Profile
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const betaUserProfile =
65
+ * await client.beta.userProfiles.update(
66
+ * 'uprof_011CZkZCu8hGbp5mYRQgUmz9',
67
+ * );
68
+ * ```
69
+ */
70
+ update(
71
+ userProfileID: string,
72
+ params: UserProfileUpdateParams,
73
+ options?: RequestOptions,
74
+ ): APIPromise<BetaUserProfile> {
75
+ const { betas, ...body } = params;
76
+ return this._client.post(path`/v1/user_profiles/${userProfileID}?beta=true`, {
77
+ body,
78
+ ...options,
79
+ headers: buildHeaders([
80
+ { 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-03-24'].toString() },
81
+ options?.headers,
82
+ ]),
83
+ });
84
+ }
85
+
86
+ /**
87
+ * List User Profiles
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * // Automatically fetches more pages as needed.
92
+ * for await (const betaUserProfile of client.beta.userProfiles.list()) {
93
+ * // ...
94
+ * }
95
+ * ```
96
+ */
97
+ list(
98
+ params: UserProfileListParams | null | undefined = {},
99
+ options?: RequestOptions,
100
+ ): PagePromise<BetaUserProfilesPageCursor, BetaUserProfile> {
101
+ const { betas, ...query } = params ?? {};
102
+ return this._client.getAPIList('/v1/user_profiles?beta=true', PageCursor<BetaUserProfile>, {
103
+ query,
104
+ ...options,
105
+ headers: buildHeaders([
106
+ { 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-03-24'].toString() },
107
+ options?.headers,
108
+ ]),
109
+ });
110
+ }
111
+
112
+ /**
113
+ * Create Enrollment URL
114
+ *
115
+ * @example
116
+ * ```ts
117
+ * const betaUserProfileEnrollmentURL =
118
+ * await client.beta.userProfiles.createEnrollmentURL(
119
+ * 'uprof_011CZkZCu8hGbp5mYRQgUmz9',
120
+ * );
121
+ * ```
122
+ */
123
+ createEnrollmentURL(
124
+ userProfileID: string,
125
+ params: UserProfileCreateEnrollmentURLParams | null | undefined = {},
126
+ options?: RequestOptions,
127
+ ): APIPromise<BetaUserProfileEnrollmentURL> {
128
+ const { betas } = params ?? {};
129
+ return this._client.post(path`/v1/user_profiles/${userProfileID}/enrollment_url?beta=true`, {
130
+ ...options,
131
+ headers: buildHeaders([
132
+ { 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-03-24'].toString() },
133
+ options?.headers,
134
+ ]),
135
+ });
136
+ }
137
+ }
138
+
139
+ export type BetaUserProfilesPageCursor = PageCursor<BetaUserProfile>;
140
+
141
+ export interface BetaUserProfile {
142
+ /**
143
+ * Unique identifier for this user profile, prefixed `uprof_`.
144
+ */
145
+ id: string;
146
+
147
+ /**
148
+ * A timestamp in RFC 3339 format
149
+ */
150
+ created_at: string;
151
+
152
+ /**
153
+ * Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up
154
+ * to 512 chars.
155
+ */
156
+ metadata: { [key: string]: string };
157
+
158
+ /**
159
+ * Trust grants for this profile, keyed by grant name. Key omitted when no grant is
160
+ * active or in flight.
161
+ */
162
+ trust_grants: { [key: string]: BetaUserProfileTrustGrant };
163
+
164
+ /**
165
+ * Object type. Always `user_profile`.
166
+ */
167
+ type: 'user_profile';
168
+
169
+ /**
170
+ * A timestamp in RFC 3339 format
171
+ */
172
+ updated_at: string;
173
+
174
+ /**
175
+ * Platform's own identifier for this user. Not enforced unique.
176
+ */
177
+ external_id?: string | null;
178
+ }
179
+
180
+ export interface BetaUserProfileEnrollmentURL {
181
+ /**
182
+ * A timestamp in RFC 3339 format
183
+ */
184
+ expires_at: string;
185
+
186
+ /**
187
+ * Object type. Always `enrollment_url`.
188
+ */
189
+ type: 'enrollment_url';
190
+
191
+ /**
192
+ * Enrollment URL to send to the end user. Valid until `expires_at`.
193
+ */
194
+ url: string;
195
+ }
196
+
197
+ export interface BetaUserProfileTrustGrant {
198
+ /**
199
+ * Status of the trust grant.
200
+ */
201
+ status: 'active' | 'pending' | 'rejected';
202
+ }
203
+
204
+ export interface UserProfileCreateParams {
205
+ /**
206
+ * Body param: Platform's own identifier for this user. Not enforced unique.
207
+ * Maximum 255 characters.
208
+ */
209
+ external_id?: string | null;
210
+
211
+ /**
212
+ * Body param: Free-form key-value data to attach to this user profile. Maximum 16
213
+ * keys, with keys up to 64 characters and values up to 512 characters. Values must
214
+ * be non-empty strings.
215
+ */
216
+ metadata?: { [key: string]: string };
217
+
218
+ /**
219
+ * Header param: Optional header to specify the beta version(s) you want to use.
220
+ */
221
+ betas?: Array<BetaAPI.AnthropicBeta>;
222
+ }
223
+
224
+ export interface UserProfileRetrieveParams {
225
+ /**
226
+ * Optional header to specify the beta version(s) you want to use.
227
+ */
228
+ betas?: Array<BetaAPI.AnthropicBeta>;
229
+ }
230
+
231
+ export interface UserProfileUpdateParams {
232
+ /**
233
+ * Body param: If present, replaces the stored external_id. Omit to leave
234
+ * unchanged. Maximum 255 characters.
235
+ */
236
+ external_id?: string | null;
237
+
238
+ /**
239
+ * Body param: Key-value pairs to merge into the stored metadata. Keys provided
240
+ * overwrite existing values. To remove a key, set its value to an empty string.
241
+ * Keys not provided are left unchanged. Maximum 16 keys, with keys up to 64
242
+ * characters and values up to 512 characters.
243
+ */
244
+ metadata?: { [key: string]: string };
245
+
246
+ /**
247
+ * Header param: Optional header to specify the beta version(s) you want to use.
248
+ */
249
+ betas?: Array<BetaAPI.AnthropicBeta>;
250
+ }
251
+
252
+ export interface UserProfileListParams extends PageCursorParams {
253
+ /**
254
+ * Query param: Query parameter for order
255
+ */
256
+ order?: 'asc' | 'desc';
257
+
258
+ /**
259
+ * Header param: Optional header to specify the beta version(s) you want to use.
260
+ */
261
+ betas?: Array<BetaAPI.AnthropicBeta>;
262
+ }
263
+
264
+ export interface UserProfileCreateEnrollmentURLParams {
265
+ /**
266
+ * Optional header to specify the beta version(s) you want to use.
267
+ */
268
+ betas?: Array<BetaAPI.AnthropicBeta>;
269
+ }
270
+
271
+ export declare namespace UserProfiles {
272
+ export {
273
+ type BetaUserProfile as BetaUserProfile,
274
+ type BetaUserProfileEnrollmentURL as BetaUserProfileEnrollmentURL,
275
+ type BetaUserProfileTrustGrant as BetaUserProfileTrustGrant,
276
+ type BetaUserProfilesPageCursor as BetaUserProfilesPageCursor,
277
+ type UserProfileCreateParams as UserProfileCreateParams,
278
+ type UserProfileRetrieveParams as UserProfileRetrieveParams,
279
+ type UserProfileUpdateParams as UserProfileUpdateParams,
280
+ type UserProfileListParams as UserProfileListParams,
281
+ type UserProfileCreateEnrollmentURLParams as UserProfileCreateEnrollmentURLParams,
282
+ };
283
+ }
@@ -149,38 +149,22 @@ export interface CompletionCreateParamsBase {
149
149
  stream?: boolean;
150
150
 
151
151
  /**
152
- * Body param: Amount of randomness injected into the response.
153
- *
154
- * Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
155
- * for analytical / multiple choice, and closer to `1.0` for creative and
156
- * generative tasks.
157
- *
158
- * Note that even with `temperature` of `0.0`, the results will not be fully
159
- * deterministic.
152
+ * @deprecated Deprecated. Models released after Claude Opus 4.6 do not support
153
+ * setting temperature. A value of 1.0 of will be accepted for backwards
154
+ * compatibility, all other values will be rejected with a 400 error.
160
155
  */
161
156
  temperature?: number;
162
157
 
163
158
  /**
164
- * Body param: Only sample from the top K options for each subsequent token.
165
- *
166
- * Used to remove "long tail" low probability responses.
167
- * [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
168
- *
169
- * Recommended for advanced use cases only. You usually only need to use
170
- * `temperature`.
159
+ * @deprecated Deprecated. Models released after Claude Opus 4.6 do not accept
160
+ * top_k; any value will be rejected with a 400 error.
171
161
  */
172
162
  top_k?: number;
173
163
 
174
164
  /**
175
- * Body param: Use nucleus sampling.
176
- *
177
- * In nucleus sampling, we compute the cumulative distribution over all the options
178
- * for each subsequent token in decreasing probability order and cut it off once it
179
- * reaches a particular probability specified by `top_p`. You should either alter
180
- * `temperature` or `top_p`, but not both.
181
- *
182
- * Recommended for advanced use cases only. You usually only need to use
183
- * `temperature`.
165
+ * @deprecated Deprecated. Models released after Claude Opus 4.6 do not support
166
+ * setting top_p. A value >= 0.99 will be accepted for backwards compatibility, all
167
+ * other values will be rejected with a 400 error.
184
168
  */
185
169
  top_p?: number;
186
170
 
@@ -76,7 +76,7 @@ export class Messages extends APIResource {
76
76
  );
77
77
  }
78
78
  if (
79
- body.model in MODELS_TO_WARN_WITH_THINKING_ENABLED &&
79
+ MODELS_TO_WARN_WITH_THINKING_ENABLED.includes(body.model) &&
80
80
  body.thinking &&
81
81
  body.thinking.type === 'enabled'
82
82
  ) {
@@ -1075,6 +1075,7 @@ export interface Metadata {
1075
1075
  * details and options.
1076
1076
  */
1077
1077
  export type Model =
1078
+ | 'claude-opus-4-7'
1078
1079
  | 'claude-mythos-preview'
1079
1080
  | 'claude-opus-4-6'
1080
1081
  | 'claude-sonnet-4-6'
@@ -1097,7 +1098,7 @@ export interface OutputConfig {
1097
1098
  /**
1098
1099
  * All possible effort levels.
1099
1100
  */
1100
- effort?: 'low' | 'medium' | 'high' | 'max' | null;
1101
+ effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | null;
1101
1102
 
1102
1103
  /**
1103
1104
  * A schema to specify Claude's output format in responses. See
@@ -1128,7 +1129,7 @@ const DEPRECATED_MODELS: {
1128
1129
  'claude-sonnet-4-20250514': 'June 15th, 2026',
1129
1130
  };
1130
1131
 
1131
- const MODELS_TO_WARN_WITH_THINKING_ENABLED: Model[] = ['claude-opus-4-6'];
1132
+ const MODELS_TO_WARN_WITH_THINKING_ENABLED: Model[] = ['claude-mythos-preview', 'claude-opus-4-6'];
1132
1133
 
1133
1134
  export interface PlainTextSource {
1134
1135
  data: string;
@@ -117,6 +117,11 @@ export interface EffortCapability {
117
117
  * Whether this capability is supported by the model.
118
118
  */
119
119
  supported: boolean;
120
+
121
+ /**
122
+ * Indicates whether a capability is supported.
123
+ */
124
+ xhigh: CapabilitySupport | null;
120
125
  }
121
126
 
122
127
  /**
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.89.0'; // x-release-please-version
1
+ export const VERSION = '0.91.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.89.0";
1
+ export declare const VERSION = "0.91.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.89.0";
1
+ export declare const VERSION = "0.91.0";
2
2
  //# sourceMappingURL=version.d.ts.map