diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml deleted file mode 100644 index 226e51c8..00000000 --- a/.github/workflows/release-doctor.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Release Doctor -on: - push: - branches: - - main - workflow_dispatch: - -jobs: - release_doctor: - name: release doctor - runs-on: ubuntu-latest - environment: production-release - if: github.repository == 'anthropics/anthropic-sdk-typescript' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') - - steps: - - uses: actions/checkout@v6 - - - name: Check release environment - run: | - bash ./bin/check-release-environment - env: - STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }} - NPM_TOKEN: ${{ secrets.ANTHROPIC_NPM_TOKEN || secrets.NPM_TOKEN }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2f95c2f4..cefcbcc0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,5 +1,5 @@ { - ".": "0.89.0", + ".": "0.90.0", "packages/vertex-sdk": "0.16.0", "packages/bedrock-sdk": "0.28.1", "packages/foundry-sdk": "0.2.3", diff --git a/.stats.yml b/.stats.yml index 9eacfff8..d44995ad 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 72 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-f4d4f18820ecfbe244fb1bbc2232939afca73dfcb21ce23bc296571ee7320e3a.yml -openapi_spec_hash: d849fdf2c4dd6631a60c4340e9bc1322 -config_hash: 2e9a2fd5355db62857f6be16f46a3ccc +configured_endpoints: 77 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-e0696f59ae07dc1a9c5a8fc87a4eb05eb35afabaac0b5ff0ea38810fa9dd4a74.yml +openapi_spec_hash: 69278ebbb0d1aa0b322bbbd5128bcec5 +config_hash: b0dbd234c2752507397c139a416f6cba diff --git a/CHANGELOG.md b/CHANGELOG.md index f10b8968..a777db73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.90.0 (2026-04-16) + +Full Changelog: [sdk-v0.89.0...sdk-v0.90.0](https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.89.0...sdk-v0.90.0) + +### Features + +* **api:** add claude-opus-4-7, token budgets and user_profiles ([b26134b](https://github.com/anthropics/anthropic-sdk-typescript/commit/b26134bb17508494b5588dab770d93bf16cbdeb1)) + + +### Chores + +* actually delete release-doctor.yml ([0fe984d](https://github.com/anthropics/anthropic-sdk-typescript/commit/0fe984d1f66e9dbf88cadbe010e00f02316396b1)) +* **ci:** remove release-doctor workflow ([08e58bd](https://github.com/anthropics/anthropic-sdk-typescript/commit/08e58bd0bbb04d47116e731b475d684fc1f98906)) + ## 0.89.0 (2026-04-14) Full Changelog: [sdk-v0.88.0...sdk-v0.89.0](https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.88.0...sdk-v0.89.0) diff --git a/MIGRATION.md b/MIGRATION.md index 1fc6ed63..13eadf9a 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -135,6 +135,9 @@ client.example.list(undefined, { headers: { ... } }); - `client.beta.skills.delete()` - `client.beta.skills.versions.create()` - `client.beta.skills.versions.list()` +- `client.beta.userProfiles.retrieve()` +- `client.beta.userProfiles.list()` +- `client.beta.userProfiles.createEnrollmentURL()` diff --git a/api.md b/api.md index 304f0146..3490e280 100644 --- a/api.md +++ b/api.md @@ -426,6 +426,7 @@ Types: - BetaThinkingConfigParam - BetaThinkingDelta - BetaThinkingTurns +- BetaTokenTaskBudget - BetaTool - BetaToolBash20241022 - BetaToolBash20250124 @@ -785,3 +786,19 @@ Methods: - client.beta.skills.versions.retrieve(version, { ...params }) -> VersionRetrieveResponse - client.beta.skills.versions.list(skillID, { ...params }) -> VersionListResponsesPageCursor - client.beta.skills.versions.delete(version, { ...params }) -> VersionDeleteResponse + +## UserProfiles + +Types: + +- BetaUserProfile +- BetaUserProfileEnrollmentURL +- BetaUserProfileTrustGrant + +Methods: + +- client.beta.userProfiles.create({ ...params }) -> BetaUserProfile +- client.beta.userProfiles.retrieve(userProfileID, { ...params }) -> BetaUserProfile +- client.beta.userProfiles.update(userProfileID, { ...params }) -> BetaUserProfile +- client.beta.userProfiles.list({ ...params }) -> BetaUserProfilesPageCursor +- client.beta.userProfiles.createEnrollmentURL(userProfileID, { ...params }) -> BetaUserProfileEnrollmentURL diff --git a/bin/check-release-environment b/bin/check-release-environment deleted file mode 100644 index bcf856d1..00000000 --- a/bin/check-release-environment +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -errors=() - -if [ -z "${STAINLESS_API_KEY}" ]; then - errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.") -fi - -if [ -z "${NPM_TOKEN}" ]; then - errors+=("The NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") -fi - -lenErrors=${#errors[@]} - -if [[ lenErrors -gt 0 ]]; then - echo -e "Found the following errors in the release environment:\n" - - for error in "${errors[@]}"; do - echo -e "- $error\n" - done - - exit 1 -fi - -echo "The environment is ready to push releases!" - diff --git a/package.json b/package.json index f9d248b9..1f64d4ad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@anthropic-ai/sdk", - "version": "0.89.0", + "version": "0.90.0", "description": "The official TypeScript library for the Anthropic API", "author": "Anthropic ", "types": "dist/index.d.ts", diff --git a/packages/vertex-sdk/yarn.lock b/packages/vertex-sdk/yarn.lock index f7c0542a..52bb4e71 100644 --- a/packages/vertex-sdk/yarn.lock +++ b/packages/vertex-sdk/yarn.lock @@ -17,7 +17,7 @@ "@anthropic-ai/sdk@file:../../dist": # x-release-please-start-version - version "0.89.0" + version "0.90.0" # x-release-please-end-version dependencies: json-schema-to-ts "^3.1.1" diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index 636287ad..1414fb97 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -26,6 +26,7 @@ TEST_PATHS=( tests/api-resources/beta/files.test.ts tests/api-resources/beta/skills/skills.test.ts tests/api-resources/beta/skills/versions.test.ts + tests/api-resources/beta/user-profiles.test.ts tests/index.test.ts ) diff --git a/src/resources/beta/agents/agents.ts b/src/resources/beta/agents/agents.ts index bba68e41..bb765ef2 100644 --- a/src/resources/beta/agents/agents.ts +++ b/src/resources/beta/agents/agents.ts @@ -540,6 +540,7 @@ export interface BetaManagedAgentsMCPToolsetParams { * details and options. */ export type BetaManagedAgentsModel = + | 'claude-opus-4-7' | 'claude-opus-4-6' | 'claude-sonnet-4-6' | 'claude-haiku-4-5' diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index 52f5c0c8..5fe0ce67 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -48,6 +48,19 @@ import { ModelRetrieveParams, Models, } from './models'; +import * as UserProfilesAPI from './user-profiles'; +import { + BetaUserProfile, + BetaUserProfileEnrollmentURL, + BetaUserProfileTrustGrant, + BetaUserProfilesPageCursor, + UserProfileCreateEnrollmentURLParams, + UserProfileCreateParams, + UserProfileListParams, + UserProfileRetrieveParams, + UserProfileUpdateParams, + UserProfiles, +} from './user-profiles'; import * as AgentsAPI from './agents/agents'; import { AgentArchiveParams, @@ -238,6 +251,7 @@ import { BetaThinkingConfigParam, BetaThinkingDelta, BetaThinkingTurns, + BetaTokenTaskBudget, BetaTool, BetaToolBash20241022, BetaToolBash20250124, @@ -352,6 +366,7 @@ export class Beta extends APIResource { vaults: VaultsAPI.Vaults = new VaultsAPI.Vaults(this._client); files: FilesAPI.Files = new FilesAPI.Files(this._client); skills: SkillsAPI.Skills = new SkillsAPI.Skills(this._client); + userProfiles: UserProfilesAPI.UserProfiles = new UserProfilesAPI.UserProfiles(this._client); } export type AnthropicBeta = @@ -377,7 +392,8 @@ export type AnthropicBeta = | 'skills-2025-10-02' | 'fast-mode-2026-02-01' | 'output-300k-2026-03-24' - | 'advisor-tool-2026-03-01'; + | 'advisor-tool-2026-03-01' + | 'user-profiles-2026-03-24'; export interface BetaAPIError { message: string; @@ -460,6 +476,7 @@ Beta.Sessions = Sessions; Beta.Vaults = Vaults; Beta.Files = Files; Beta.Skills = Skills; +Beta.UserProfiles = UserProfiles; export declare namespace Beta { export { @@ -644,6 +661,7 @@ export declare namespace Beta { type BetaThinkingConfigParam as BetaThinkingConfigParam, type BetaThinkingDelta as BetaThinkingDelta, type BetaThinkingTurns as BetaThinkingTurns, + type BetaTokenTaskBudget as BetaTokenTaskBudget, type BetaTool as BetaTool, type BetaToolBash20241022 as BetaToolBash20241022, type BetaToolBash20250124 as BetaToolBash20250124, @@ -817,4 +835,17 @@ export declare namespace Beta { type SkillListParams as SkillListParams, type SkillDeleteParams as SkillDeleteParams, }; + + export { + UserProfiles as UserProfiles, + type BetaUserProfile as BetaUserProfile, + type BetaUserProfileEnrollmentURL as BetaUserProfileEnrollmentURL, + type BetaUserProfileTrustGrant as BetaUserProfileTrustGrant, + type BetaUserProfilesPageCursor as BetaUserProfilesPageCursor, + type UserProfileCreateParams as UserProfileCreateParams, + type UserProfileRetrieveParams as UserProfileRetrieveParams, + type UserProfileUpdateParams as UserProfileUpdateParams, + type UserProfileListParams as UserProfileListParams, + type UserProfileCreateEnrollmentURLParams as UserProfileCreateEnrollmentURLParams, + }; } diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index 9456e075..8aa3f419 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -236,6 +236,7 @@ export { type BetaThinkingConfigParam, type BetaThinkingDelta, type BetaThinkingTurns, + type BetaTokenTaskBudget, type BetaTool, type BetaToolBash20241022, type BetaToolBash20250124, @@ -345,6 +346,18 @@ export { type SkillDeleteParams, type SkillListResponsesPageCursor, } from './skills/index'; +export { + UserProfiles, + type BetaUserProfile, + type BetaUserProfileEnrollmentURL, + type BetaUserProfileTrustGrant, + type UserProfileCreateParams, + type UserProfileRetrieveParams, + type UserProfileUpdateParams, + type UserProfileListParams, + type UserProfileCreateEnrollmentURLParams, + type BetaUserProfilesPageCursor, +} from './user-profiles'; export { Vaults, type BetaManagedAgentsDeletedVault, diff --git a/src/resources/beta/messages/batches.ts b/src/resources/beta/messages/batches.ts index 1a9b9924..554658ca 100644 --- a/src/resources/beta/messages/batches.ts +++ b/src/resources/beta/messages/batches.ts @@ -750,6 +750,12 @@ export namespace BatchCreateParams { * other values will be rejected with a 400 error. */ top_p?: number; + + /** + * The user profile ID to attribute this request to. Use when acting on behalf of a + * party other than your organization. + */ + user_profile_id?: string | null; } } } diff --git a/src/resources/beta/messages/index.ts b/src/resources/beta/messages/index.ts index 818c22ee..c5ade671 100644 --- a/src/resources/beta/messages/index.ts +++ b/src/resources/beta/messages/index.ts @@ -170,6 +170,7 @@ export { type BetaThinkingConfigParam, type BetaThinkingDelta, type BetaThinkingTurns, + type BetaTokenTaskBudget, type BetaTool, type BetaToolBash20241022, type BetaToolBash20250124, diff --git a/src/resources/beta/messages/messages.ts b/src/resources/beta/messages/messages.ts index b5329be9..cfbeeac2 100644 --- a/src/resources/beta/messages/messages.ts +++ b/src/resources/beta/messages/messages.ts @@ -62,7 +62,7 @@ const DEPRECATED_MODELS: { 'claude-3-7-sonnet-20250219': 'February 19th, 2026', }; -const MODELS_TO_WARN_WITH_THINKING_ENABLED: Model[] = ['claude-opus-4-6']; +const MODELS_TO_WARN_WITH_THINKING_ENABLED: Model[] = ['claude-mythos-preview', 'claude-opus-4-6']; export class Messages extends APIResource { batches: BatchesAPI.Batches = new BatchesAPI.Batches(this._client); @@ -113,7 +113,7 @@ export class Messages extends APIResource { } if ( - body.model in MODELS_TO_WARN_WITH_THINKING_ENABLED && + MODELS_TO_WARN_WITH_THINKING_ENABLED.includes(body.model) && body.thinking && body.thinking.type === 'enabled' ) { @@ -1025,6 +1025,11 @@ export interface BetaCompactionBlock { */ content: string | null; + /** + * Opaque metadata from prior compaction, to be round-tripped verbatim + */ + encrypted_content: string | null; + type: 'compaction'; } @@ -1049,11 +1054,21 @@ export interface BetaCompactionBlockParam { * Create a cache control breakpoint at this content block. */ cache_control?: BetaCacheControlEphemeral | null; + + /** + * Opaque metadata from prior compaction, to be round-tripped verbatim + */ + encrypted_content?: string | null; } export interface BetaCompactionContentBlockDelta { content: string | null; + /** + * Opaque metadata from prior compaction, to be round-tripped verbatim + */ + encrypted_content: string | null; + type: 'compaction_delta'; } @@ -1824,13 +1839,18 @@ export interface BetaOutputConfig { /** * All possible effort levels. */ - effort?: 'low' | 'medium' | 'high' | 'max' | null; + effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | null; /** * A schema to specify Claude's output format in responses. See * [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) */ format?: BetaJSONOutputFormat | null; + + /** + * User-configurable total token budget across contexts. + */ + task_budget?: BetaTokenTaskBudget | null; } export interface BetaPlainTextSource { @@ -2453,6 +2473,27 @@ export interface BetaThinkingTurns { value: number; } +/** + * User-configurable total token budget across contexts. + */ +export interface BetaTokenTaskBudget { + /** + * Total token budget across all contexts in the session. + */ + total: number; + + /** + * The budget type. Currently only 'tokens' is supported. + */ + type: 'tokens'; + + /** + * Remaining tokens in the budget. Use this to track usage across contexts when + * implementing compaction client-side. Defaults to total if not provided. + */ + remaining?: number | null; +} + export interface BetaTool { /** * [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. @@ -4008,6 +4049,12 @@ export interface MessageCreateParamsBase { */ top_p?: number; + /** + * Body param: The user profile ID to attribute this request to. Use when acting on + * behalf of a party other than your organization. + */ + user_profile_id?: string | null; + /** * Header param: Optional header to specify the beta version(s) you want to use. */ @@ -4455,6 +4502,7 @@ export declare namespace Messages { type BetaThinkingConfigParam as BetaThinkingConfigParam, type BetaThinkingDelta as BetaThinkingDelta, type BetaThinkingTurns as BetaThinkingTurns, + type BetaTokenTaskBudget as BetaTokenTaskBudget, type BetaTool as BetaTool, type BetaToolBash20241022 as BetaToolBash20241022, type BetaToolBash20250124 as BetaToolBash20250124, diff --git a/src/resources/beta/models.ts b/src/resources/beta/models.ts index 6ddb9000..3828b16d 100644 --- a/src/resources/beta/models.ts +++ b/src/resources/beta/models.ts @@ -132,6 +132,11 @@ export interface BetaEffortCapability { * Whether this capability is supported by the model. */ supported: boolean; + + /** + * Indicates whether a capability is supported. + */ + xhigh: BetaCapabilitySupport | null; } /** diff --git a/src/resources/beta/user-profiles.ts b/src/resources/beta/user-profiles.ts new file mode 100644 index 00000000..7a6bdffb --- /dev/null +++ b/src/resources/beta/user-profiles.ts @@ -0,0 +1,283 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import * as BetaAPI from './beta'; +import { APIPromise } from '../../core/api-promise'; +import { PageCursor, type PageCursorParams, PagePromise } from '../../core/pagination'; +import { buildHeaders } from '../../internal/headers'; +import { RequestOptions } from '../../internal/request-options'; +import { path } from '../../internal/utils/path'; + +export class UserProfiles extends APIResource { + /** + * Create User Profile + * + * @example + * ```ts + * const betaUserProfile = + * await client.beta.userProfiles.create(); + * ``` + */ + create(params: UserProfileCreateParams, options?: RequestOptions): APIPromise { + const { betas, ...body } = params; + return this._client.post('/v1/user_profiles?beta=true', { + body, + ...options, + headers: buildHeaders([ + { 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-03-24'].toString() }, + options?.headers, + ]), + }); + } + + /** + * Get User Profile + * + * @example + * ```ts + * const betaUserProfile = + * await client.beta.userProfiles.retrieve( + * 'uprof_011CZkZCu8hGbp5mYRQgUmz9', + * ); + * ``` + */ + retrieve( + userProfileID: string, + params: UserProfileRetrieveParams | null | undefined = {}, + options?: RequestOptions, + ): APIPromise { + const { betas } = params ?? {}; + return this._client.get(path`/v1/user_profiles/${userProfileID}?beta=true`, { + ...options, + headers: buildHeaders([ + { 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-03-24'].toString() }, + options?.headers, + ]), + }); + } + + /** + * Update User Profile + * + * @example + * ```ts + * const betaUserProfile = + * await client.beta.userProfiles.update( + * 'uprof_011CZkZCu8hGbp5mYRQgUmz9', + * ); + * ``` + */ + update( + userProfileID: string, + params: UserProfileUpdateParams, + options?: RequestOptions, + ): APIPromise { + const { betas, ...body } = params; + return this._client.post(path`/v1/user_profiles/${userProfileID}?beta=true`, { + body, + ...options, + headers: buildHeaders([ + { 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-03-24'].toString() }, + options?.headers, + ]), + }); + } + + /** + * List User Profiles + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const betaUserProfile of client.beta.userProfiles.list()) { + * // ... + * } + * ``` + */ + list( + params: UserProfileListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + const { betas, ...query } = params ?? {}; + return this._client.getAPIList('/v1/user_profiles?beta=true', PageCursor, { + query, + ...options, + headers: buildHeaders([ + { 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-03-24'].toString() }, + options?.headers, + ]), + }); + } + + /** + * Create Enrollment URL + * + * @example + * ```ts + * const betaUserProfileEnrollmentURL = + * await client.beta.userProfiles.createEnrollmentURL( + * 'uprof_011CZkZCu8hGbp5mYRQgUmz9', + * ); + * ``` + */ + createEnrollmentURL( + userProfileID: string, + params: UserProfileCreateEnrollmentURLParams | null | undefined = {}, + options?: RequestOptions, + ): APIPromise { + const { betas } = params ?? {}; + return this._client.post(path`/v1/user_profiles/${userProfileID}/enrollment_url?beta=true`, { + ...options, + headers: buildHeaders([ + { 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-03-24'].toString() }, + options?.headers, + ]), + }); + } +} + +export type BetaUserProfilesPageCursor = PageCursor; + +export interface BetaUserProfile { + /** + * Unique identifier for this user profile, prefixed `uprof_`. + */ + id: string; + + /** + * A timestamp in RFC 3339 format + */ + created_at: string; + + /** + * Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up + * to 512 chars. + */ + metadata: { [key: string]: string }; + + /** + * Trust grants for this profile, keyed by grant name. Key omitted when no grant is + * active or in flight. + */ + trust_grants: { [key: string]: BetaUserProfileTrustGrant }; + + /** + * Object type. Always `user_profile`. + */ + type: 'user_profile'; + + /** + * A timestamp in RFC 3339 format + */ + updated_at: string; + + /** + * Platform's own identifier for this user. Not enforced unique. + */ + external_id?: string | null; +} + +export interface BetaUserProfileEnrollmentURL { + /** + * A timestamp in RFC 3339 format + */ + expires_at: string; + + /** + * Object type. Always `enrollment_url`. + */ + type: 'enrollment_url'; + + /** + * Enrollment URL to send to the end user. Valid until `expires_at`. + */ + url: string; +} + +export interface BetaUserProfileTrustGrant { + /** + * Status of the trust grant. + */ + status: 'active' | 'pending' | 'rejected'; +} + +export interface UserProfileCreateParams { + /** + * Body param: Platform's own identifier for this user. Not enforced unique. + * Maximum 255 characters. + */ + external_id?: string | null; + + /** + * Body param: Free-form key-value data to attach to this user profile. Maximum 16 + * keys, with keys up to 64 characters and values up to 512 characters. Values must + * be non-empty strings. + */ + metadata?: { [key: string]: string }; + + /** + * Header param: Optional header to specify the beta version(s) you want to use. + */ + betas?: Array; +} + +export interface UserProfileRetrieveParams { + /** + * Optional header to specify the beta version(s) you want to use. + */ + betas?: Array; +} + +export interface UserProfileUpdateParams { + /** + * Body param: If present, replaces the stored external_id. Omit to leave + * unchanged. Maximum 255 characters. + */ + external_id?: string | null; + + /** + * Body param: Key-value pairs to merge into the stored metadata. Keys provided + * overwrite existing values. To remove a key, set its value to an empty string. + * Keys not provided are left unchanged. Maximum 16 keys, with keys up to 64 + * characters and values up to 512 characters. + */ + metadata?: { [key: string]: string }; + + /** + * Header param: Optional header to specify the beta version(s) you want to use. + */ + betas?: Array; +} + +export interface UserProfileListParams extends PageCursorParams { + /** + * Query param: Query parameter for order + */ + order?: 'asc' | 'desc'; + + /** + * Header param: Optional header to specify the beta version(s) you want to use. + */ + betas?: Array; +} + +export interface UserProfileCreateEnrollmentURLParams { + /** + * Optional header to specify the beta version(s) you want to use. + */ + betas?: Array; +} + +export declare namespace UserProfiles { + export { + type BetaUserProfile as BetaUserProfile, + type BetaUserProfileEnrollmentURL as BetaUserProfileEnrollmentURL, + type BetaUserProfileTrustGrant as BetaUserProfileTrustGrant, + type BetaUserProfilesPageCursor as BetaUserProfilesPageCursor, + type UserProfileCreateParams as UserProfileCreateParams, + type UserProfileRetrieveParams as UserProfileRetrieveParams, + type UserProfileUpdateParams as UserProfileUpdateParams, + type UserProfileListParams as UserProfileListParams, + type UserProfileCreateEnrollmentURLParams as UserProfileCreateEnrollmentURLParams, + }; +} diff --git a/src/resources/messages/messages.ts b/src/resources/messages/messages.ts index 3df4dd98..ae91e5f8 100644 --- a/src/resources/messages/messages.ts +++ b/src/resources/messages/messages.ts @@ -76,7 +76,7 @@ export class Messages extends APIResource { ); } if ( - body.model in MODELS_TO_WARN_WITH_THINKING_ENABLED && + MODELS_TO_WARN_WITH_THINKING_ENABLED.includes(body.model) && body.thinking && body.thinking.type === 'enabled' ) { @@ -1075,6 +1075,7 @@ export interface Metadata { * details and options. */ export type Model = + | 'claude-opus-4-7' | 'claude-mythos-preview' | 'claude-opus-4-6' | 'claude-sonnet-4-6' @@ -1097,7 +1098,7 @@ export interface OutputConfig { /** * All possible effort levels. */ - effort?: 'low' | 'medium' | 'high' | 'max' | null; + effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | null; /** * A schema to specify Claude's output format in responses. See @@ -1128,7 +1129,7 @@ const DEPRECATED_MODELS: { 'claude-sonnet-4-20250514': 'June 15th, 2026', }; -const MODELS_TO_WARN_WITH_THINKING_ENABLED: Model[] = ['claude-opus-4-6']; +const MODELS_TO_WARN_WITH_THINKING_ENABLED: Model[] = ['claude-mythos-preview', 'claude-opus-4-6']; export interface PlainTextSource { data: string; diff --git a/src/resources/models.ts b/src/resources/models.ts index c8fd5b1b..69964893 100644 --- a/src/resources/models.ts +++ b/src/resources/models.ts @@ -117,6 +117,11 @@ export interface EffortCapability { * Whether this capability is supported by the model. */ supported: boolean; + + /** + * Indicates whether a capability is supported. + */ + xhigh: CapabilitySupport | null; } /** diff --git a/src/version.ts b/src/version.ts index 2a87eb59..f99c21e4 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.89.0'; // x-release-please-version +export const VERSION = '0.90.0'; // x-release-please-version diff --git a/tests/api-resources/beta/messages/batches.test.ts b/tests/api-resources/beta/messages/batches.test.ts index 8b05723a..718975eb 100644 --- a/tests/api-resources/beta/messages/batches.test.ts +++ b/tests/api-resources/beta/messages/batches.test.ts @@ -80,6 +80,11 @@ describe('resource batches', () => { schema: { foo: 'bar' }, type: 'json_schema', }, + task_budget: { + total: 1024, + type: 'tokens', + remaining: 0, + }, }, output_format: { schema: { foo: 'bar' }, @@ -129,6 +134,7 @@ describe('resource batches', () => { ], top_k: 5, top_p: 0.7, + user_profile_id: 'user_profile_id', }, }, ], diff --git a/tests/api-resources/beta/messages/messages.test.ts b/tests/api-resources/beta/messages/messages.test.ts index 016eedc7..67b1eb63 100644 --- a/tests/api-resources/beta/messages/messages.test.ts +++ b/tests/api-resources/beta/messages/messages.test.ts @@ -68,6 +68,11 @@ describe('resource messages', () => { schema: { foo: 'bar' }, type: 'json_schema', }, + task_budget: { + total: 1024, + type: 'tokens', + remaining: 0, + }, }, service_tier: 'auto', speed: 'standard', @@ -113,6 +118,7 @@ describe('resource messages', () => { ], top_k: 5, top_p: 0.7, + user_profile_id: 'user_profile_id', betas: ['message-batches-2024-09-24'], }); }); @@ -163,6 +169,11 @@ describe('resource messages', () => { schema: { foo: 'bar' }, type: 'json_schema', }, + task_budget: { + total: 1024, + type: 'tokens', + remaining: 0, + }, }, speed: 'standard', system: [ diff --git a/tests/api-resources/beta/user-profiles.test.ts b/tests/api-resources/beta/user-profiles.test.ts new file mode 100644 index 00000000..a5b2c918 --- /dev/null +++ b/tests/api-resources/beta/user-profiles.test.ts @@ -0,0 +1,102 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: 'my-anthropic-api-key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource userProfiles', () => { + test('create', async () => { + const responsePromise = client.beta.userProfiles.create({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('retrieve', async () => { + const responsePromise = client.beta.userProfiles.retrieve('uprof_011CZkZCu8hGbp5mYRQgUmz9'); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('retrieve: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.beta.userProfiles.retrieve( + 'uprof_011CZkZCu8hGbp5mYRQgUmz9', + { betas: ['message-batches-2024-09-24'] }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Anthropic.NotFoundError); + }); + + test('update', async () => { + const responsePromise = client.beta.userProfiles.update('uprof_011CZkZCu8hGbp5mYRQgUmz9', {}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list', async () => { + const responsePromise = client.beta.userProfiles.list(); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.beta.userProfiles.list( + { + limit: 0, + order: 'asc', + page: 'page', + betas: ['message-batches-2024-09-24'], + }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Anthropic.NotFoundError); + }); + + test('createEnrollmentURL', async () => { + const responsePromise = client.beta.userProfiles.createEnrollmentURL('uprof_011CZkZCu8hGbp5mYRQgUmz9'); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('createEnrollmentURL: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.beta.userProfiles.createEnrollmentURL( + 'uprof_011CZkZCu8hGbp5mYRQgUmz9', + { betas: ['message-batches-2024-09-24'] }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Anthropic.NotFoundError); + }); +});