Skip to content

Commit b26134b

Browse files
feat(api): add claude-opus-4-7, token budgets and user_profiles
1 parent 0fe984d commit b26134b

File tree

17 files changed

+545
-11
lines changed

17 files changed

+545
-11
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 72
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-f4d4f18820ecfbe244fb1bbc2232939afca73dfcb21ce23bc296571ee7320e3a.yml
3-
openapi_spec_hash: d849fdf2c4dd6631a60c4340e9bc1322
4-
config_hash: 2e9a2fd5355db62857f6be16f46a3ccc
1+
configured_endpoints: 77
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-e0696f59ae07dc1a9c5a8fc87a4eb05eb35afabaac0b5ff0ea38810fa9dd4a74.yml
3+
openapi_spec_hash: 69278ebbb0d1aa0b322bbbd5128bcec5
4+
config_hash: b0dbd234c2752507397c139a416f6cba

MIGRATION.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ client.example.list(undefined, { headers: { ... } });
135135
- `client.beta.skills.delete()`
136136
- `client.beta.skills.versions.create()`
137137
- `client.beta.skills.versions.list()`
138+
- `client.beta.userProfiles.retrieve()`
139+
- `client.beta.userProfiles.list()`
140+
- `client.beta.userProfiles.createEnrollmentURL()`
138141

139142
</details>
140143

api.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ Types:
426426
- <code><a href="./src/resources/beta/messages/messages.ts">BetaThinkingConfigParam</a></code>
427427
- <code><a href="./src/resources/beta/messages/messages.ts">BetaThinkingDelta</a></code>
428428
- <code><a href="./src/resources/beta/messages/messages.ts">BetaThinkingTurns</a></code>
429+
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTokenTaskBudget</a></code>
429430
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTool</a></code>
430431
- <code><a href="./src/resources/beta/messages/messages.ts">BetaToolBash20241022</a></code>
431432
- <code><a href="./src/resources/beta/messages/messages.ts">BetaToolBash20250124</a></code>
@@ -785,3 +786,19 @@ Methods:
785786
- <code title="get /v1/skills/{skill_id}/versions/{version}?beta=true">client.beta.skills.versions.<a href="./src/resources/beta/skills/versions.ts">retrieve</a>(version, { ...params }) -> VersionRetrieveResponse</code>
786787
- <code title="get /v1/skills/{skill_id}/versions?beta=true">client.beta.skills.versions.<a href="./src/resources/beta/skills/versions.ts">list</a>(skillID, { ...params }) -> VersionListResponsesPageCursor</code>
787788
- <code title="delete /v1/skills/{skill_id}/versions/{version}?beta=true">client.beta.skills.versions.<a href="./src/resources/beta/skills/versions.ts">delete</a>(version, { ...params }) -> VersionDeleteResponse</code>
789+
790+
## UserProfiles
791+
792+
Types:
793+
794+
- <code><a href="./src/resources/beta/user-profiles.ts">BetaUserProfile</a></code>
795+
- <code><a href="./src/resources/beta/user-profiles.ts">BetaUserProfileEnrollmentURL</a></code>
796+
- <code><a href="./src/resources/beta/user-profiles.ts">BetaUserProfileTrustGrant</a></code>
797+
798+
Methods:
799+
800+
- <code title="post /v1/user_profiles?beta=true">client.beta.userProfiles.<a href="./src/resources/beta/user-profiles.ts">create</a>({ ...params }) -> BetaUserProfile</code>
801+
- <code title="get /v1/user_profiles/{user_profile_id}?beta=true">client.beta.userProfiles.<a href="./src/resources/beta/user-profiles.ts">retrieve</a>(userProfileID, { ...params }) -> BetaUserProfile</code>
802+
- <code title="post /v1/user_profiles/{user_profile_id}?beta=true">client.beta.userProfiles.<a href="./src/resources/beta/user-profiles.ts">update</a>(userProfileID, { ...params }) -> BetaUserProfile</code>
803+
- <code title="get /v1/user_profiles?beta=true">client.beta.userProfiles.<a href="./src/resources/beta/user-profiles.ts">list</a>({ ...params }) -> BetaUserProfilesPageCursor</code>
804+
- <code title="post /v1/user_profiles/{user_profile_id}/enrollment_url?beta=true">client.beta.userProfiles.<a href="./src/resources/beta/user-profiles.ts">createEnrollmentURL</a>(userProfileID, { ...params }) -> BetaUserProfileEnrollmentURL</code>

scripts/detect-breaking-changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ TEST_PATHS=(
2626
tests/api-resources/beta/files.test.ts
2727
tests/api-resources/beta/skills/skills.test.ts
2828
tests/api-resources/beta/skills/versions.test.ts
29+
tests/api-resources/beta/user-profiles.test.ts
2930
tests/index.test.ts
3031
)
3132

src/resources/beta/agents/agents.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ export interface BetaManagedAgentsMCPToolsetParams {
540540
* details and options.
541541
*/
542542
export type BetaManagedAgentsModel =
543+
| 'claude-opus-4-7'
543544
| 'claude-opus-4-6'
544545
| 'claude-sonnet-4-6'
545546
| 'claude-haiku-4-5'

src/resources/beta/beta.ts

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ import {
4848
ModelRetrieveParams,
4949
Models,
5050
} from './models';
51+
import * as UserProfilesAPI from './user-profiles';
52+
import {
53+
BetaUserProfile,
54+
BetaUserProfileEnrollmentURL,
55+
BetaUserProfileTrustGrant,
56+
BetaUserProfilesPageCursor,
57+
UserProfileCreateEnrollmentURLParams,
58+
UserProfileCreateParams,
59+
UserProfileListParams,
60+
UserProfileRetrieveParams,
61+
UserProfileUpdateParams,
62+
UserProfiles,
63+
} from './user-profiles';
5164
import * as AgentsAPI from './agents/agents';
5265
import {
5366
AgentArchiveParams,
@@ -238,6 +251,7 @@ import {
238251
BetaThinkingConfigParam,
239252
BetaThinkingDelta,
240253
BetaThinkingTurns,
254+
BetaTokenTaskBudget,
241255
BetaTool,
242256
BetaToolBash20241022,
243257
BetaToolBash20250124,
@@ -352,6 +366,7 @@ export class Beta extends APIResource {
352366
vaults: VaultsAPI.Vaults = new VaultsAPI.Vaults(this._client);
353367
files: FilesAPI.Files = new FilesAPI.Files(this._client);
354368
skills: SkillsAPI.Skills = new SkillsAPI.Skills(this._client);
369+
userProfiles: UserProfilesAPI.UserProfiles = new UserProfilesAPI.UserProfiles(this._client);
355370
}
356371

357372
export type AnthropicBeta =
@@ -377,7 +392,8 @@ export type AnthropicBeta =
377392
| 'skills-2025-10-02'
378393
| 'fast-mode-2026-02-01'
379394
| 'output-300k-2026-03-24'
380-
| 'advisor-tool-2026-03-01';
395+
| 'advisor-tool-2026-03-01'
396+
| 'user-profiles-2026-03-24';
381397

382398
export interface BetaAPIError {
383399
message: string;
@@ -460,6 +476,7 @@ Beta.Sessions = Sessions;
460476
Beta.Vaults = Vaults;
461477
Beta.Files = Files;
462478
Beta.Skills = Skills;
479+
Beta.UserProfiles = UserProfiles;
463480

464481
export declare namespace Beta {
465482
export {
@@ -644,6 +661,7 @@ export declare namespace Beta {
644661
type BetaThinkingConfigParam as BetaThinkingConfigParam,
645662
type BetaThinkingDelta as BetaThinkingDelta,
646663
type BetaThinkingTurns as BetaThinkingTurns,
664+
type BetaTokenTaskBudget as BetaTokenTaskBudget,
647665
type BetaTool as BetaTool,
648666
type BetaToolBash20241022 as BetaToolBash20241022,
649667
type BetaToolBash20250124 as BetaToolBash20250124,
@@ -817,4 +835,17 @@ export declare namespace Beta {
817835
type SkillListParams as SkillListParams,
818836
type SkillDeleteParams as SkillDeleteParams,
819837
};
838+
839+
export {
840+
UserProfiles as UserProfiles,
841+
type BetaUserProfile as BetaUserProfile,
842+
type BetaUserProfileEnrollmentURL as BetaUserProfileEnrollmentURL,
843+
type BetaUserProfileTrustGrant as BetaUserProfileTrustGrant,
844+
type BetaUserProfilesPageCursor as BetaUserProfilesPageCursor,
845+
type UserProfileCreateParams as UserProfileCreateParams,
846+
type UserProfileRetrieveParams as UserProfileRetrieveParams,
847+
type UserProfileUpdateParams as UserProfileUpdateParams,
848+
type UserProfileListParams as UserProfileListParams,
849+
type UserProfileCreateEnrollmentURLParams as UserProfileCreateEnrollmentURLParams,
850+
};
820851
}

src/resources/beta/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ export {
236236
type BetaThinkingConfigParam,
237237
type BetaThinkingDelta,
238238
type BetaThinkingTurns,
239+
type BetaTokenTaskBudget,
239240
type BetaTool,
240241
type BetaToolBash20241022,
241242
type BetaToolBash20250124,
@@ -345,6 +346,18 @@ export {
345346
type SkillDeleteParams,
346347
type SkillListResponsesPageCursor,
347348
} from './skills/index';
349+
export {
350+
UserProfiles,
351+
type BetaUserProfile,
352+
type BetaUserProfileEnrollmentURL,
353+
type BetaUserProfileTrustGrant,
354+
type UserProfileCreateParams,
355+
type UserProfileRetrieveParams,
356+
type UserProfileUpdateParams,
357+
type UserProfileListParams,
358+
type UserProfileCreateEnrollmentURLParams,
359+
type BetaUserProfilesPageCursor,
360+
} from './user-profiles';
348361
export {
349362
Vaults,
350363
type BetaManagedAgentsDeletedVault,

src/resources/beta/messages/batches.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,12 @@ export namespace BatchCreateParams {
750750
* other values will be rejected with a 400 error.
751751
*/
752752
top_p?: number;
753+
754+
/**
755+
* The user profile ID to attribute this request to. Use when acting on behalf of a
756+
* party other than your organization.
757+
*/
758+
user_profile_id?: string | null;
753759
}
754760
}
755761
}

src/resources/beta/messages/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ export {
170170
type BetaThinkingConfigParam,
171171
type BetaThinkingDelta,
172172
type BetaThinkingTurns,
173+
type BetaTokenTaskBudget,
173174
type BetaTool,
174175
type BetaToolBash20241022,
175176
type BetaToolBash20250124,

src/resources/beta/messages/messages.ts

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const DEPRECATED_MODELS: {
6262
'claude-3-7-sonnet-20250219': 'February 19th, 2026',
6363
};
6464

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'];
6666

6767
export class Messages extends APIResource {
6868
batches: BatchesAPI.Batches = new BatchesAPI.Batches(this._client);
@@ -113,7 +113,7 @@ export class Messages extends APIResource {
113113
}
114114

115115
if (
116-
body.model in MODELS_TO_WARN_WITH_THINKING_ENABLED &&
116+
MODELS_TO_WARN_WITH_THINKING_ENABLED.includes(body.model) &&
117117
body.thinking &&
118118
body.thinking.type === 'enabled'
119119
) {
@@ -1025,6 +1025,11 @@ export interface BetaCompactionBlock {
10251025
*/
10261026
content: string | null;
10271027

1028+
/**
1029+
* Opaque metadata from prior compaction, to be round-tripped verbatim
1030+
*/
1031+
encrypted_content: string | null;
1032+
10281033
type: 'compaction';
10291034
}
10301035

@@ -1049,11 +1054,21 @@ export interface BetaCompactionBlockParam {
10491054
* Create a cache control breakpoint at this content block.
10501055
*/
10511056
cache_control?: BetaCacheControlEphemeral | null;
1057+
1058+
/**
1059+
* Opaque metadata from prior compaction, to be round-tripped verbatim
1060+
*/
1061+
encrypted_content?: string | null;
10521062
}
10531063

10541064
export interface BetaCompactionContentBlockDelta {
10551065
content: string | null;
10561066

1067+
/**
1068+
* Opaque metadata from prior compaction, to be round-tripped verbatim
1069+
*/
1070+
encrypted_content: string | null;
1071+
10571072
type: 'compaction_delta';
10581073
}
10591074

@@ -1824,13 +1839,18 @@ export interface BetaOutputConfig {
18241839
/**
18251840
* All possible effort levels.
18261841
*/
1827-
effort?: 'low' | 'medium' | 'high' | 'max' | null;
1842+
effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | null;
18281843

18291844
/**
18301845
* A schema to specify Claude's output format in responses. See
18311846
* [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
18321847
*/
18331848
format?: BetaJSONOutputFormat | null;
1849+
1850+
/**
1851+
* User-configurable total token budget across contexts.
1852+
*/
1853+
task_budget?: BetaTokenTaskBudget | null;
18341854
}
18351855

18361856
export interface BetaPlainTextSource {
@@ -2453,6 +2473,27 @@ export interface BetaThinkingTurns {
24532473
value: number;
24542474
}
24552475

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+
24562497
export interface BetaTool {
24572498
/**
24582499
* [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
@@ -4008,6 +4049,12 @@ export interface MessageCreateParamsBase {
40084049
*/
40094050
top_p?: number;
40104051

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+
40114058
/**
40124059
* Header param: Optional header to specify the beta version(s) you want to use.
40134060
*/
@@ -4455,6 +4502,7 @@ export declare namespace Messages {
44554502
type BetaThinkingConfigParam as BetaThinkingConfigParam,
44564503
type BetaThinkingDelta as BetaThinkingDelta,
44574504
type BetaThinkingTurns as BetaThinkingTurns,
4505+
type BetaTokenTaskBudget as BetaTokenTaskBudget,
44584506
type BetaTool as BetaTool,
44594507
type BetaToolBash20241022 as BetaToolBash20241022,
44604508
type BetaToolBash20250124 as BetaToolBash20250124,

0 commit comments

Comments
 (0)