@ainative/cody-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/logo.svg +3 -0
- package/CHANGELOG.md +2345 -0
- package/LICENSE +8 -0
- package/README.md +45 -0
- package/_vendor/partial-json-parser/parser.d.mts +3 -0
- package/_vendor/partial-json-parser/parser.d.mts.map +1 -0
- package/_vendor/partial-json-parser/parser.d.ts +3 -0
- package/_vendor/partial-json-parser/parser.d.ts.map +1 -0
- package/_vendor/partial-json-parser/parser.js +226 -0
- package/_vendor/partial-json-parser/parser.js.map +1 -0
- package/_vendor/partial-json-parser/parser.mjs +223 -0
- package/_vendor/partial-json-parser/parser.mjs.map +1 -0
- package/ainative.d.mts +32 -0
- package/ainative.d.mts.map +1 -0
- package/ainative.d.ts +32 -0
- package/ainative.d.ts.map +1 -0
- package/ainative.js +78 -0
- package/ainative.js.map +1 -0
- package/ainative.mjs +71 -0
- package/ainative.mjs.map +1 -0
- package/api-promise.d.mts +2 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +2 -0
- package/api-promise.d.ts.map +1 -0
- package/api-promise.js +6 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +2 -0
- package/api-promise.mjs.map +1 -0
- package/bin/cli +53 -0
- package/bin/migration-config.json +82 -0
- package/client.d.mts +247 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +247 -0
- package/client.d.ts.map +1 -0
- package/client.js +567 -0
- package/client.js.map +1 -0
- package/client.mjs +562 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +49 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +49 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +76 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +72 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +50 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +50 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +116 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +100 -0
- package/core/error.mjs.map +1 -0
- package/core/pagination.d.mts +105 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +105 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +185 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +177 -0
- package/core/pagination.mjs.map +1 -0
- package/core/resource.d.mts +6 -0
- package/core/resource.d.mts.map +1 -0
- package/core/resource.d.ts +6 -0
- package/core/resource.d.ts.map +1 -0
- package/core/resource.js +11 -0
- package/core/resource.js.map +1 -0
- package/core/resource.mjs +7 -0
- package/core/resource.mjs.map +1 -0
- package/core/streaming.d.mts +33 -0
- package/core/streaming.d.mts.map +1 -0
- package/core/streaming.d.ts +33 -0
- package/core/streaming.d.ts.map +1 -0
- package/core/streaming.js +290 -0
- package/core/streaming.js.map +1 -0
- package/core/streaming.mjs +285 -0
- package/core/streaming.mjs.map +1 -0
- package/core/uploads.d.mts +3 -0
- package/core/uploads.d.mts.map +1 -0
- package/core/uploads.d.ts +3 -0
- package/core/uploads.d.ts.map +1 -0
- package/core/uploads.js +6 -0
- package/core/uploads.js.map +1 -0
- package/core/uploads.mjs +2 -0
- package/core/uploads.mjs.map +1 -0
- package/error.d.mts +2 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +2 -0
- package/error.d.ts.map +1 -0
- package/error.js +6 -0
- package/error.js.map +1 -0
- package/error.mjs +2 -0
- package/error.mjs.map +1 -0
- package/helpers/beta/json-schema.d.mts +31 -0
- package/helpers/beta/json-schema.d.mts.map +1 -0
- package/helpers/beta/json-schema.d.ts +31 -0
- package/helpers/beta/json-schema.d.ts.map +1 -0
- package/helpers/beta/json-schema.js +56 -0
- package/helpers/beta/json-schema.js.map +1 -0
- package/helpers/beta/json-schema.mjs +52 -0
- package/helpers/beta/json-schema.mjs.map +1 -0
- package/helpers/beta/mcp.d.mts +303 -0
- package/helpers/beta/mcp.d.mts.map +1 -0
- package/helpers/beta/mcp.d.ts +303 -0
- package/helpers/beta/mcp.d.ts.map +1 -0
- package/helpers/beta/mcp.js +419 -0
- package/helpers/beta/mcp.js.map +1 -0
- package/helpers/beta/mcp.mjs +406 -0
- package/helpers/beta/mcp.mjs.map +1 -0
- package/helpers/beta/memory.d.mts +11 -0
- package/helpers/beta/memory.d.mts.map +1 -0
- package/helpers/beta/memory.d.ts +11 -0
- package/helpers/beta/memory.d.ts.map +1 -0
- package/helpers/beta/memory.js +18 -0
- package/helpers/beta/memory.js.map +1 -0
- package/helpers/beta/memory.mjs +15 -0
- package/helpers/beta/memory.mjs.map +1 -0
- package/helpers/beta/zod.d.mts +27 -0
- package/helpers/beta/zod.d.mts.map +1 -0
- package/helpers/beta/zod.d.ts +27 -0
- package/helpers/beta/zod.d.ts.map +1 -0
- package/helpers/beta/zod.js +57 -0
- package/helpers/beta/zod.js.map +1 -0
- package/helpers/beta/zod.mjs +52 -0
- package/helpers/beta/zod.mjs.map +1 -0
- package/helpers/index.d.mts +3 -0
- package/helpers/index.d.mts.map +1 -0
- package/helpers/index.d.ts +3 -0
- package/helpers/index.d.ts.map +1 -0
- package/helpers/index.js +8 -0
- package/helpers/index.js.map +1 -0
- package/helpers/index.mjs +3 -0
- package/helpers/index.mjs.map +1 -0
- package/helpers/json-schema.d.mts +18 -0
- package/helpers/json-schema.d.mts.map +1 -0
- package/helpers/json-schema.d.ts +18 -0
- package/helpers/json-schema.d.ts.map +1 -0
- package/helpers/json-schema.js +37 -0
- package/helpers/json-schema.js.map +1 -0
- package/helpers/json-schema.mjs +34 -0
- package/helpers/json-schema.mjs.map +1 -0
- package/helpers/zod.d.mts +13 -0
- package/helpers/zod.d.mts.map +1 -0
- package/helpers/zod.d.ts +13 -0
- package/helpers/zod.d.ts.map +1 -0
- package/helpers/zod.js +47 -0
- package/helpers/zod.js.map +1 -0
- package/helpers/zod.mjs +43 -0
- package/helpers/zod.mjs.map +1 -0
- package/index.d.mts +9 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +9 -0
- package/index.d.ts.map +1 -0
- package/index.js +42 -0
- package/index.js.map +1 -0
- package/index.mjs +9 -0
- package/index.mjs.map +1 -0
- package/internal/builtin-types.d.mts +73 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +73 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/constants.d.mts +5 -0
- package/internal/constants.d.mts.map +1 -0
- package/internal/constants.d.ts +5 -0
- package/internal/constants.d.ts.map +1 -0
- package/internal/constants.js +18 -0
- package/internal/constants.js.map +1 -0
- package/internal/constants.mjs +15 -0
- package/internal/constants.mjs.map +1 -0
- package/internal/decoders/jsonl.d.mts +10 -0
- package/internal/decoders/jsonl.d.mts.map +1 -0
- package/internal/decoders/jsonl.d.ts +10 -0
- package/internal/decoders/jsonl.d.ts.map +1 -0
- package/internal/decoders/jsonl.js +39 -0
- package/internal/decoders/jsonl.js.map +1 -0
- package/internal/decoders/jsonl.mjs +35 -0
- package/internal/decoders/jsonl.mjs.map +1 -0
- package/internal/decoders/line.d.mts +17 -0
- package/internal/decoders/line.d.mts.map +1 -0
- package/internal/decoders/line.d.ts +17 -0
- package/internal/decoders/line.d.ts.map +1 -0
- package/internal/decoders/line.js +113 -0
- package/internal/decoders/line.js.map +1 -0
- package/internal/decoders/line.mjs +108 -0
- package/internal/decoders/line.mjs.map +1 -0
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +41 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +36 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +22 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +22 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +79 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +74 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +17 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +17 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +60 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +56 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/request-options.d.mts +77 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +77 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +14 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +10 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +17 -0
- package/internal/shim-types.d.mts.map +1 -0
- package/internal/shim-types.d.ts +17 -0
- package/internal/shim-types.d.ts.map +1 -0
- package/internal/shim-types.js +4 -0
- package/internal/shim-types.js.map +1 -0
- package/internal/shim-types.mjs +3 -0
- package/internal/shim-types.mjs.map +1 -0
- package/internal/shims.d.mts +20 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +20 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +92 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +85 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/stream-utils.d.mts +8 -0
- package/internal/stream-utils.d.mts.map +1 -0
- package/internal/stream-utils.d.ts +8 -0
- package/internal/stream-utils.d.ts.map +1 -0
- package/internal/stream-utils.js +38 -0
- package/internal/stream-utils.js.map +1 -0
- package/internal/stream-utils.mjs +35 -0
- package/internal/stream-utils.mjs.map +1 -0
- package/internal/to-file.d.mts +45 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +45 -0
- package/internal/to-file.d.ts.map +1 -0
- package/internal/to-file.js +96 -0
- package/internal/to-file.js.map +1 -0
- package/internal/to-file.mjs +93 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/tslib.js +81 -0
- package/internal/tslib.mjs +17 -0
- package/internal/types.d.mts +69 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +69 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/uploads.d.mts +42 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +42 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +145 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +135 -0
- package/internal/uploads.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +38 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +33 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/bytes.d.mts +4 -0
- package/internal/utils/bytes.d.mts.map +1 -0
- package/internal/utils/bytes.d.ts +4 -0
- package/internal/utils/bytes.d.ts.map +1 -0
- package/internal/utils/bytes.js +31 -0
- package/internal/utils/bytes.js.map +1 -0
- package/internal/utils/bytes.mjs +26 -0
- package/internal/utils/bytes.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +37 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +37 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +86 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +80 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/path.d.mts +15 -0
- package/internal/utils/path.d.mts.map +1 -0
- package/internal/utils/path.d.ts +15 -0
- package/internal/utils/path.d.ts.map +1 -0
- package/internal/utils/path.js +79 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +74 -0
- package/internal/utils/path.mjs.map +1 -0
- package/internal/utils/query.d.mts +5 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +5 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +23 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +20 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +19 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +15 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +19 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +19 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +119 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +100 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +8 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +8 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +12 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +9 -0
- package/internal/utils.mjs.map +1 -0
- package/lib/BetaMessageStream.d.mts +122 -0
- package/lib/BetaMessageStream.d.mts.map +1 -0
- package/lib/BetaMessageStream.d.ts +122 -0
- package/lib/BetaMessageStream.d.ts.map +1 -0
- package/lib/BetaMessageStream.js +620 -0
- package/lib/BetaMessageStream.js.map +1 -0
- package/lib/BetaMessageStream.mjs +616 -0
- package/lib/BetaMessageStream.mjs.map +1 -0
- package/lib/MessageStream.d.mts +121 -0
- package/lib/MessageStream.d.mts.map +1 -0
- package/lib/MessageStream.d.ts +121 -0
- package/lib/MessageStream.d.ts.map +1 -0
- package/lib/MessageStream.js +595 -0
- package/lib/MessageStream.js.map +1 -0
- package/lib/MessageStream.mjs +591 -0
- package/lib/MessageStream.mjs.map +1 -0
- package/lib/beta-parser.d.mts +37 -0
- package/lib/beta-parser.d.mts.map +1 -0
- package/lib/beta-parser.d.ts +37 -0
- package/lib/beta-parser.d.ts.map +1 -0
- package/lib/beta-parser.js +79 -0
- package/lib/beta-parser.js.map +1 -0
- package/lib/beta-parser.mjs +75 -0
- package/lib/beta-parser.mjs.map +1 -0
- package/lib/parser.d.mts +32 -0
- package/lib/parser.d.mts.map +1 -0
- package/lib/parser.d.ts +32 -0
- package/lib/parser.d.ts.map +1 -0
- package/lib/parser.js +66 -0
- package/lib/parser.js.map +1 -0
- package/lib/parser.mjs +62 -0
- package/lib/parser.mjs.map +1 -0
- package/lib/stainless-helper-header.d.mts +34 -0
- package/lib/stainless-helper-header.d.mts.map +1 -0
- package/lib/stainless-helper-header.d.ts +34 -0
- package/lib/stainless-helper-header.d.ts.map +1 -0
- package/lib/stainless-helper-header.js +70 -0
- package/lib/stainless-helper-header.js.map +1 -0
- package/lib/stainless-helper-header.mjs +63 -0
- package/lib/stainless-helper-header.mjs.map +1 -0
- package/lib/tools/BetaRunnableTool.d.mts +12 -0
- package/lib/tools/BetaRunnableTool.d.mts.map +1 -0
- package/lib/tools/BetaRunnableTool.d.ts +12 -0
- package/lib/tools/BetaRunnableTool.d.ts.map +1 -0
- package/lib/tools/BetaRunnableTool.js +3 -0
- package/lib/tools/BetaRunnableTool.js.map +1 -0
- package/lib/tools/BetaRunnableTool.mjs +2 -0
- package/lib/tools/BetaRunnableTool.mjs.map +1 -0
- package/lib/tools/BetaToolRunner.d.mts +141 -0
- package/lib/tools/BetaToolRunner.d.mts.map +1 -0
- package/lib/tools/BetaToolRunner.d.ts +141 -0
- package/lib/tools/BetaToolRunner.d.ts.map +1 -0
- package/lib/tools/BetaToolRunner.js +381 -0
- package/lib/tools/BetaToolRunner.js.map +1 -0
- package/lib/tools/BetaToolRunner.mjs +377 -0
- package/lib/tools/BetaToolRunner.mjs.map +1 -0
- package/lib/tools/CompactionControl.d.mts +30 -0
- package/lib/tools/CompactionControl.d.mts.map +1 -0
- package/lib/tools/CompactionControl.d.ts +30 -0
- package/lib/tools/CompactionControl.d.ts.map +1 -0
- package/lib/tools/CompactionControl.js +28 -0
- package/lib/tools/CompactionControl.js.map +1 -0
- package/lib/tools/CompactionControl.mjs +25 -0
- package/lib/tools/CompactionControl.mjs.map +1 -0
- package/lib/tools/ToolError.d.mts +33 -0
- package/lib/tools/ToolError.d.mts.map +1 -0
- package/lib/tools/ToolError.d.ts +33 -0
- package/lib/tools/ToolError.d.ts.map +1 -0
- package/lib/tools/ToolError.js +42 -0
- package/lib/tools/ToolError.js.map +1 -0
- package/lib/tools/ToolError.mjs +38 -0
- package/lib/tools/ToolError.mjs.map +1 -0
- package/lib/tools/ToolRunner.d.mts +132 -0
- package/lib/tools/ToolRunner.d.mts.map +1 -0
- package/lib/tools/ToolRunner.d.ts +132 -0
- package/lib/tools/ToolRunner.d.ts.map +1 -0
- package/lib/tools/ToolRunner.js +294 -0
- package/lib/tools/ToolRunner.js.map +1 -0
- package/lib/tools/ToolRunner.mjs +290 -0
- package/lib/tools/ToolRunner.mjs.map +1 -0
- package/lib/transform-json-schema.d.mts +3 -0
- package/lib/transform-json-schema.d.mts.map +1 -0
- package/lib/transform-json-schema.d.ts +3 -0
- package/lib/transform-json-schema.d.ts.map +1 -0
- package/lib/transform-json-schema.js +114 -0
- package/lib/transform-json-schema.js.map +1 -0
- package/lib/transform-json-schema.mjs +111 -0
- package/lib/transform-json-schema.mjs.map +1 -0
- package/package.json +246 -0
- package/pagination.d.mts +2 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +2 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +6 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +2 -0
- package/pagination.mjs.map +1 -0
- package/resource.d.mts +2 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +2 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +6 -0
- package/resource.js.map +1 -0
- package/resource.mjs +2 -0
- package/resource.mjs.map +1 -0
- package/resources/beta/beta.d.mts +66 -0
- package/resources/beta/beta.d.mts.map +1 -0
- package/resources/beta/beta.d.ts +66 -0
- package/resources/beta/beta.d.ts.map +1 -0
- package/resources/beta/beta.js +29 -0
- package/resources/beta/beta.js.map +1 -0
- package/resources/beta/beta.mjs +24 -0
- package/resources/beta/beta.mjs.map +1 -0
- package/resources/beta/files.d.mts +151 -0
- package/resources/beta/files.d.mts.map +1 -0
- package/resources/beta/files.d.ts +151 -0
- package/resources/beta/files.d.ts.map +1 -0
- package/resources/beta/files.js +124 -0
- package/resources/beta/files.js.map +1 -0
- package/resources/beta/files.mjs +120 -0
- package/resources/beta/files.mjs.map +1 -0
- package/resources/beta/index.d.mts +6 -0
- package/resources/beta/index.d.mts.map +1 -0
- package/resources/beta/index.d.ts +6 -0
- package/resources/beta/index.d.ts.map +1 -0
- package/resources/beta/index.js +15 -0
- package/resources/beta/index.js.map +1 -0
- package/resources/beta/index.mjs +7 -0
- package/resources/beta/index.mjs.map +1 -0
- package/resources/beta/messages/batches.d.mts +646 -0
- package/resources/beta/messages/batches.d.mts.map +1 -0
- package/resources/beta/messages/batches.d.ts +646 -0
- package/resources/beta/messages/batches.d.ts.map +1 -0
- package/resources/beta/messages/batches.js +204 -0
- package/resources/beta/messages/batches.js.map +1 -0
- package/resources/beta/messages/batches.mjs +200 -0
- package/resources/beta/messages/batches.mjs.map +1 -0
- package/resources/beta/messages/index.d.mts +4 -0
- package/resources/beta/messages/index.d.mts.map +1 -0
- package/resources/beta/messages/index.d.ts +4 -0
- package/resources/beta/messages/index.d.ts.map +1 -0
- package/resources/beta/messages/index.js +12 -0
- package/resources/beta/messages/index.js.map +1 -0
- package/resources/beta/messages/index.mjs +5 -0
- package/resources/beta/messages/index.mjs.map +1 -0
- package/resources/beta/messages/messages.d.mts +2993 -0
- package/resources/beta/messages/messages.d.mts.map +1 -0
- package/resources/beta/messages/messages.d.ts +2993 -0
- package/resources/beta/messages/messages.d.ts.map +1 -0
- package/resources/beta/messages/messages.js +163 -0
- package/resources/beta/messages/messages.js.map +1 -0
- package/resources/beta/messages/messages.mjs +156 -0
- package/resources/beta/messages/messages.mjs.map +1 -0
- package/resources/beta/messages.d.mts +2 -0
- package/resources/beta/messages.d.mts.map +1 -0
- package/resources/beta/messages.d.ts +2 -0
- package/resources/beta/messages.d.ts.map +1 -0
- package/resources/beta/messages.js +6 -0
- package/resources/beta/messages.js.map +1 -0
- package/resources/beta/messages.mjs +3 -0
- package/resources/beta/messages.mjs.map +1 -0
- package/resources/beta/models.d.mts +208 -0
- package/resources/beta/models.d.mts.map +1 -0
- package/resources/beta/models.d.ts +208 -0
- package/resources/beta/models.d.ts.map +1 -0
- package/resources/beta/models.js +60 -0
- package/resources/beta/models.js.map +1 -0
- package/resources/beta/models.mjs +56 -0
- package/resources/beta/models.mjs.map +1 -0
- package/resources/beta/skills/index.d.mts +3 -0
- package/resources/beta/skills/index.d.mts.map +1 -0
- package/resources/beta/skills/index.d.ts +3 -0
- package/resources/beta/skills/index.d.ts.map +1 -0
- package/resources/beta/skills/index.js +9 -0
- package/resources/beta/skills/index.js.map +1 -0
- package/resources/beta/skills/index.mjs +4 -0
- package/resources/beta/skills/index.mjs.map +1 -0
- package/resources/beta/skills/skills.d.mts +249 -0
- package/resources/beta/skills/skills.d.mts.map +1 -0
- package/resources/beta/skills/skills.d.ts +249 -0
- package/resources/beta/skills/skills.d.ts.map +1 -0
- package/resources/beta/skills/skills.js +98 -0
- package/resources/beta/skills/skills.js.map +1 -0
- package/resources/beta/skills/skills.mjs +93 -0
- package/resources/beta/skills/skills.mjs.map +1 -0
- package/resources/beta/skills/versions.d.mts +257 -0
- package/resources/beta/skills/versions.d.mts.map +1 -0
- package/resources/beta/skills/versions.d.ts +257 -0
- package/resources/beta/skills/versions.d.ts.map +1 -0
- package/resources/beta/skills/versions.js +100 -0
- package/resources/beta/skills/versions.js.map +1 -0
- package/resources/beta/skills/versions.mjs +96 -0
- package/resources/beta/skills/versions.mjs.map +1 -0
- package/resources/beta/skills.d.mts +2 -0
- package/resources/beta/skills.d.mts.map +1 -0
- package/resources/beta/skills.d.ts +2 -0
- package/resources/beta/skills.d.ts.map +1 -0
- package/resources/beta/skills.js +6 -0
- package/resources/beta/skills.js.map +1 -0
- package/resources/beta/skills.mjs +3 -0
- package/resources/beta/skills.mjs.map +1 -0
- package/resources/beta.d.mts +2 -0
- package/resources/beta.d.mts.map +1 -0
- package/resources/beta.d.ts +2 -0
- package/resources/beta.d.ts.map +1 -0
- package/resources/beta.js +6 -0
- package/resources/beta.js.map +1 -0
- package/resources/beta.mjs +3 -0
- package/resources/beta.mjs.map +1 -0
- package/resources/completions.d.mts +182 -0
- package/resources/completions.d.mts.map +1 -0
- package/resources/completions.d.ts +182 -0
- package/resources/completions.d.ts.map +1 -0
- package/resources/completions.js +23 -0
- package/resources/completions.js.map +1 -0
- package/resources/completions.mjs +19 -0
- package/resources/completions.mjs.map +1 -0
- package/resources/index.d.mts +6 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +6 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +15 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +7 -0
- package/resources/index.mjs.map +1 -0
- package/resources/messages/batches.d.mts +304 -0
- package/resources/messages/batches.d.mts.map +1 -0
- package/resources/messages/batches.d.ts +304 -0
- package/resources/messages/batches.d.ts.map +1 -0
- package/resources/messages/batches.js +153 -0
- package/resources/messages/batches.js.map +1 -0
- package/resources/messages/batches.mjs +149 -0
- package/resources/messages/batches.mjs.map +1 -0
- package/resources/messages/index.d.mts +3 -0
- package/resources/messages/index.d.mts.map +1 -0
- package/resources/messages/index.d.ts +3 -0
- package/resources/messages/index.d.ts.map +1 -0
- package/resources/messages/index.js +9 -0
- package/resources/messages/index.js.map +1 -0
- package/resources/messages/index.mjs +4 -0
- package/resources/messages/index.mjs.map +1 -0
- package/resources/messages/messages.d.mts +2285 -0
- package/resources/messages/messages.d.mts.map +1 -0
- package/resources/messages/messages.d.ts +2285 -0
- package/resources/messages/messages.d.ts.map +1 -0
- package/resources/messages/messages.js +128 -0
- package/resources/messages/messages.js.map +1 -0
- package/resources/messages/messages.mjs +123 -0
- package/resources/messages/messages.mjs.map +1 -0
- package/resources/messages.d.mts +2 -0
- package/resources/messages.d.mts.map +1 -0
- package/resources/messages.d.ts +2 -0
- package/resources/messages.d.ts.map +1 -0
- package/resources/messages.js +6 -0
- package/resources/messages.js.map +1 -0
- package/resources/messages.mjs +3 -0
- package/resources/messages.mjs.map +1 -0
- package/resources/models.d.mts +193 -0
- package/resources/models.d.mts.map +1 -0
- package/resources/models.d.ts +193 -0
- package/resources/models.d.ts.map +1 -0
- package/resources/models.js +45 -0
- package/resources/models.js.map +1 -0
- package/resources/models.mjs +41 -0
- package/resources/models.mjs.map +1 -0
- package/resources/shared.d.mts +44 -0
- package/resources/shared.d.mts.map +1 -0
- package/resources/shared.d.ts +44 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/resources/top-level.d.mts +2 -0
- package/resources/top-level.d.mts.map +1 -0
- package/resources/top-level.d.ts +2 -0
- package/resources/top-level.d.ts.map +1 -0
- package/resources/top-level.js +4 -0
- package/resources/top-level.js.map +1 -0
- package/resources/top-level.mjs +3 -0
- package/resources/top-level.mjs.map +1 -0
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts +2 -0
- package/resources.d.ts.map +1 -0
- package/resources.js +5 -0
- package/resources.js.map +1 -0
- package/resources.mjs +2 -0
- package/resources.mjs.map +1 -0
- package/src/_vendor/partial-json-parser/README.md +3 -0
- package/src/_vendor/partial-json-parser/parser.ts +264 -0
- package/src/ainative.ts +85 -0
- package/src/api-promise.ts +2 -0
- package/src/client.ts +1326 -0
- package/src/core/README.md +3 -0
- package/src/core/api-promise.ts +101 -0
- package/src/core/error.ts +145 -0
- package/src/core/pagination.ts +331 -0
- package/src/core/resource.ts +11 -0
- package/src/core/streaming.ts +348 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -0
- package/src/helpers/beta/json-schema.ts +75 -0
- package/src/helpers/beta/mcp.ts +624 -0
- package/src/helpers/beta/memory.ts +28 -0
- package/src/helpers/beta/zod.ts +72 -0
- package/src/helpers/index.ts +2 -0
- package/src/helpers/json-schema.ts +48 -0
- package/src/helpers/zod.ts +58 -0
- package/src/index.ts +40 -0
- package/src/internal/README.md +3 -0
- package/src/internal/builtin-types.ts +93 -0
- package/src/internal/constants.ts +15 -0
- package/src/internal/decoders/jsonl.ts +48 -0
- package/src/internal/decoders/line.ts +135 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +33 -0
- package/src/internal/headers.ts +99 -0
- package/src/internal/parse.ts +90 -0
- package/src/internal/request-options.ts +93 -0
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/stream-utils.ts +32 -0
- package/src/internal/to-file.ts +159 -0
- package/src/internal/types.ts +95 -0
- package/src/internal/uploads.ts +204 -0
- package/src/internal/utils/base64.ts +40 -0
- package/src/internal/utils/bytes.ts +32 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +127 -0
- package/src/internal/utils/path.ts +88 -0
- package/src/internal/utils/query.ts +23 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +17 -0
- package/src/internal/utils/values.ts +112 -0
- package/src/internal/utils.ts +9 -0
- package/src/lib/.keep +4 -0
- package/src/lib/BetaMessageStream.ts +764 -0
- package/src/lib/MessageStream.ts +743 -0
- package/src/lib/beta-parser.ts +148 -0
- package/src/lib/parser.ts +125 -0
- package/src/lib/stainless-helper-header.ts +80 -0
- package/src/lib/tools/BetaRunnableTool.ts +40 -0
- package/src/lib/tools/BetaToolRunner.ts +494 -0
- package/src/lib/tools/CompactionControl.ts +57 -0
- package/src/lib/tools/ToolError.ts +47 -0
- package/src/lib/tools/ToolRunner.ts +381 -0
- package/src/lib/transform-json-schema.ts +124 -0
- package/src/pagination.ts +2 -0
- package/src/resource.ts +2 -0
- package/src/resources/beta/beta.ts +603 -0
- package/src/resources/beta/files.ts +261 -0
- package/src/resources/beta/index.ts +259 -0
- package/src/resources/beta/messages/batches.ts +827 -0
- package/src/resources/beta/messages/index.ts +229 -0
- package/src/resources/beta/messages/messages.ts +4372 -0
- package/src/resources/beta/messages.ts +3 -0
- package/src/resources/beta/models.ts +284 -0
- package/src/resources/beta/skills/index.ts +26 -0
- package/src/resources/beta/skills/skills.ts +384 -0
- package/src/resources/beta/skills/versions.ts +374 -0
- package/src/resources/beta/skills.ts +3 -0
- package/src/resources/beta.ts +3 -0
- package/src/resources/completions.ts +230 -0
- package/src/resources/index.ts +206 -0
- package/src/resources/messages/batches.ts +396 -0
- package/src/resources/messages/index.ts +189 -0
- package/src/resources/messages/messages.ts +3361 -0
- package/src/resources/messages.ts +3 -0
- package/src/resources/models.ts +269 -0
- package/src/resources/shared.ts +85 -0
- package/src/resources/top-level.ts +3 -0
- package/src/resources.ts +1 -0
- package/src/streaming.ts +2 -0
- package/src/tools/memory/node.ts +392 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +2 -0
- package/src/version.ts +1 -0
- package/streaming.d.mts +2 -0
- package/streaming.d.mts.map +1 -0
- package/streaming.d.ts +2 -0
- package/streaming.d.ts.map +1 -0
- package/streaming.js +6 -0
- package/streaming.js.map +1 -0
- package/streaming.mjs +2 -0
- package/streaming.mjs.map +1 -0
- package/tools/memory/node.d.mts +18 -0
- package/tools/memory/node.d.mts.map +1 -0
- package/tools/memory/node.d.ts +18 -0
- package/tools/memory/node.d.ts.map +1 -0
- package/tools/memory/node.js +324 -0
- package/tools/memory/node.js.map +1 -0
- package/tools/memory/node.mjs +318 -0
- package/tools/memory/node.mjs.map +1 -0
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +2 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +6 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +2 -0
- package/uploads.mjs.map +1 -0
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
|
@@ -0,0 +1,4372 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { AnthropicError } from '../../../error';
|
|
4
|
+
import { Anthropic } from '../../../client';
|
|
5
|
+
import { APIPromise } from '../../../core/api-promise';
|
|
6
|
+
import { APIResource } from '../../../core/resource';
|
|
7
|
+
import { Stream } from '../../../core/streaming';
|
|
8
|
+
import { MODEL_NONSTREAMING_TOKENS } from '../../../internal/constants';
|
|
9
|
+
import { buildHeaders } from '../../../internal/headers';
|
|
10
|
+
import { RequestOptions } from '../../../internal/request-options';
|
|
11
|
+
import { stainlessHelperHeader } from '../../../lib/stainless-helper-header';
|
|
12
|
+
import {
|
|
13
|
+
parseBetaMessage,
|
|
14
|
+
type ExtractParsedContentFromBetaParams,
|
|
15
|
+
type ParsedBetaMessage,
|
|
16
|
+
} from '../../../lib/beta-parser';
|
|
17
|
+
import { BetaMessageStream } from '../../../lib/BetaMessageStream';
|
|
18
|
+
import {
|
|
19
|
+
BetaToolRunner,
|
|
20
|
+
BetaToolRunnerParams,
|
|
21
|
+
BetaToolRunnerRequestOptions,
|
|
22
|
+
} from '../../../lib/tools/BetaToolRunner';
|
|
23
|
+
import { ToolError } from '../../../lib/tools/ToolError';
|
|
24
|
+
import type { Model } from '../../messages/messages';
|
|
25
|
+
import * as BetaMessagesAPI from './messages';
|
|
26
|
+
import * as MessagesAPI from '../../messages/messages';
|
|
27
|
+
import * as BetaAPI from '../beta';
|
|
28
|
+
import * as BatchesAPI from './batches';
|
|
29
|
+
import {
|
|
30
|
+
BatchCancelParams,
|
|
31
|
+
BatchCreateParams,
|
|
32
|
+
BatchDeleteParams,
|
|
33
|
+
BatchListParams,
|
|
34
|
+
BatchResultsParams,
|
|
35
|
+
BatchRetrieveParams,
|
|
36
|
+
Batches,
|
|
37
|
+
BetaDeletedMessageBatch,
|
|
38
|
+
BetaMessageBatch,
|
|
39
|
+
BetaMessageBatchCanceledResult,
|
|
40
|
+
BetaMessageBatchErroredResult,
|
|
41
|
+
BetaMessageBatchExpiredResult,
|
|
42
|
+
BetaMessageBatchIndividualResponse,
|
|
43
|
+
BetaMessageBatchRequestCounts,
|
|
44
|
+
BetaMessageBatchResult,
|
|
45
|
+
BetaMessageBatchSucceededResult,
|
|
46
|
+
BetaMessageBatchesPage,
|
|
47
|
+
} from './batches';
|
|
48
|
+
|
|
49
|
+
const DEPRECATED_MODELS: {
|
|
50
|
+
[K in Model]?: string;
|
|
51
|
+
} = {
|
|
52
|
+
'claude-1.3': 'November 6th, 2024',
|
|
53
|
+
'claude-1.3-100k': 'November 6th, 2024',
|
|
54
|
+
'claude-instant-1.1': 'November 6th, 2024',
|
|
55
|
+
'claude-instant-1.1-100k': 'November 6th, 2024',
|
|
56
|
+
'claude-instant-1.2': 'November 6th, 2024',
|
|
57
|
+
'claude-3-sonnet-20240229': 'July 21st, 2025',
|
|
58
|
+
'claude-3-opus-20240229': 'January 5th, 2026',
|
|
59
|
+
'claude-2.1': 'July 21st, 2025',
|
|
60
|
+
'claude-2.0': 'July 21st, 2025',
|
|
61
|
+
'claude-3-7-sonnet-latest': 'February 19th, 2026',
|
|
62
|
+
'claude-3-7-sonnet-20250219': 'February 19th, 2026',
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const MODELS_TO_WARN_WITH_THINKING_ENABLED: Model[] = ['claude-opus-4-6'];
|
|
66
|
+
|
|
67
|
+
export class Messages extends APIResource {
|
|
68
|
+
batches: BatchesAPI.Batches = new BatchesAPI.Batches(this._client);
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Send a structured list of input messages with text and/or image content, and the
|
|
72
|
+
* model will generate the next message in the conversation.
|
|
73
|
+
*
|
|
74
|
+
* The Messages API can be used for either single queries or stateless multi-turn
|
|
75
|
+
* conversations.
|
|
76
|
+
*
|
|
77
|
+
* Learn more about the Messages API in our
|
|
78
|
+
* [user guide](https://docs.claude.com/en/docs/initial-setup)
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* const betaMessage = await client.beta.messages.create({
|
|
83
|
+
* max_tokens: 1024,
|
|
84
|
+
* messages: [{ content: 'Hello, world', role: 'user' }],
|
|
85
|
+
* model: 'claude-opus-4-6',
|
|
86
|
+
* });
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
create(params: MessageCreateParamsNonStreaming, options?: RequestOptions): APIPromise<BetaMessage>;
|
|
90
|
+
create(
|
|
91
|
+
params: MessageCreateParamsStreaming,
|
|
92
|
+
options?: RequestOptions,
|
|
93
|
+
): APIPromise<Stream<BetaRawMessageStreamEvent>>;
|
|
94
|
+
create(
|
|
95
|
+
params: MessageCreateParamsBase,
|
|
96
|
+
options?: RequestOptions,
|
|
97
|
+
): APIPromise<Stream<BetaRawMessageStreamEvent> | BetaMessage>;
|
|
98
|
+
create(
|
|
99
|
+
params: MessageCreateParams,
|
|
100
|
+
options?: RequestOptions,
|
|
101
|
+
): APIPromise<BetaMessage> | APIPromise<Stream<BetaRawMessageStreamEvent>> {
|
|
102
|
+
// Transform deprecated output_format to output_config.format
|
|
103
|
+
const modifiedParams = transformOutputFormat(params);
|
|
104
|
+
|
|
105
|
+
const { betas, ...body } = modifiedParams;
|
|
106
|
+
|
|
107
|
+
if (body.model in DEPRECATED_MODELS) {
|
|
108
|
+
console.warn(
|
|
109
|
+
`The model '${body.model}' is deprecated and will reach end-of-life on ${
|
|
110
|
+
DEPRECATED_MODELS[body.model]
|
|
111
|
+
}\nPlease migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (
|
|
116
|
+
body.model in MODELS_TO_WARN_WITH_THINKING_ENABLED &&
|
|
117
|
+
body.thinking &&
|
|
118
|
+
body.thinking.type === 'enabled'
|
|
119
|
+
) {
|
|
120
|
+
console.warn(
|
|
121
|
+
`Using Claude with ${body.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`,
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
let timeout = (this._client as any)._options.timeout as number | null;
|
|
126
|
+
if (!body.stream && timeout == null) {
|
|
127
|
+
const maxNonstreamingTokens = MODEL_NONSTREAMING_TOKENS[body.model] ?? undefined;
|
|
128
|
+
timeout = this._client.calculateNonstreamingTimeout(body.max_tokens, maxNonstreamingTokens);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Collect helper info from tools and messages
|
|
132
|
+
const helperHeader = stainlessHelperHeader(body.tools, body.messages);
|
|
133
|
+
|
|
134
|
+
return this._client.post('/v1/messages?beta=true', {
|
|
135
|
+
body,
|
|
136
|
+
timeout: timeout ?? 600000,
|
|
137
|
+
...options,
|
|
138
|
+
headers: buildHeaders([
|
|
139
|
+
{ ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
|
|
140
|
+
helperHeader,
|
|
141
|
+
options?.headers,
|
|
142
|
+
]),
|
|
143
|
+
stream: modifiedParams.stream ?? false,
|
|
144
|
+
}) as APIPromise<BetaMessage> | APIPromise<Stream<BetaRawMessageStreamEvent>>;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Send a structured list of input messages with text and/or image content, along with an expected `output_format` and
|
|
149
|
+
* the response will be automatically parsed and available in the `parsed_output` property of the message.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* const message = await client.beta.messages.parse({
|
|
154
|
+
* model: 'claude-3-5-sonnet-20241022',
|
|
155
|
+
* max_tokens: 1024,
|
|
156
|
+
* messages: [{ role: 'user', content: 'What is 2+2?' }],
|
|
157
|
+
* output_format: zodOutputFormat(z.object({ answer: z.number() }), 'math'),
|
|
158
|
+
* });
|
|
159
|
+
*
|
|
160
|
+
* console.log(message.parsed_output?.answer); // 4
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
parse<Params extends MessageCreateParamsNonStreaming>(
|
|
164
|
+
params: Params,
|
|
165
|
+
options?: RequestOptions,
|
|
166
|
+
): APIPromise<ParsedBetaMessage<ExtractParsedContentFromBetaParams<Params>>> {
|
|
167
|
+
options = {
|
|
168
|
+
...options,
|
|
169
|
+
headers: buildHeaders([
|
|
170
|
+
{ 'anthropic-beta': [...(params.betas ?? []), 'structured-outputs-2025-12-15'].toString() },
|
|
171
|
+
options?.headers,
|
|
172
|
+
]),
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
return this.create(params, options).then((message) =>
|
|
176
|
+
parseBetaMessage(message, params, { logger: this._client.logger ?? console }),
|
|
177
|
+
) as APIPromise<ParsedBetaMessage<ExtractParsedContentFromBetaParams<Params>>>;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Create a Message stream
|
|
182
|
+
*/
|
|
183
|
+
stream<Params extends BetaMessageStreamParams>(
|
|
184
|
+
body: Params,
|
|
185
|
+
options?: RequestOptions,
|
|
186
|
+
): BetaMessageStream<ExtractParsedContentFromBetaParams<Params>> {
|
|
187
|
+
return BetaMessageStream.createMessage(this, body, options);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Count the number of tokens in a Message.
|
|
192
|
+
*
|
|
193
|
+
* The Token Count API can be used to count the number of tokens in a Message,
|
|
194
|
+
* including tools, images, and documents, without creating it.
|
|
195
|
+
*
|
|
196
|
+
* Learn more about token counting in our
|
|
197
|
+
* [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting)
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* const betaMessageTokensCount =
|
|
202
|
+
* await client.beta.messages.countTokens({
|
|
203
|
+
* messages: [{ content: 'string', role: 'user' }],
|
|
204
|
+
* model: 'claude-opus-4-6',
|
|
205
|
+
* });
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
countTokens(
|
|
209
|
+
params: MessageCountTokensParams,
|
|
210
|
+
options?: RequestOptions,
|
|
211
|
+
): APIPromise<BetaMessageTokensCount> {
|
|
212
|
+
// Transform deprecated output_format to output_config.format
|
|
213
|
+
const modifiedParams = transformOutputFormat(params);
|
|
214
|
+
|
|
215
|
+
const { betas, ...body } = modifiedParams;
|
|
216
|
+
return this._client.post('/v1/messages/count_tokens?beta=true', {
|
|
217
|
+
body,
|
|
218
|
+
...options,
|
|
219
|
+
headers: buildHeaders([
|
|
220
|
+
{ 'anthropic-beta': [...(betas ?? []), 'token-counting-2024-11-01'].toString() },
|
|
221
|
+
options?.headers,
|
|
222
|
+
]),
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
toolRunner(
|
|
227
|
+
body: BetaToolRunnerParams & { stream?: false },
|
|
228
|
+
options?: BetaToolRunnerRequestOptions,
|
|
229
|
+
): BetaToolRunner<false>;
|
|
230
|
+
toolRunner(
|
|
231
|
+
body: BetaToolRunnerParams & { stream: true },
|
|
232
|
+
options?: BetaToolRunnerRequestOptions,
|
|
233
|
+
): BetaToolRunner<true>;
|
|
234
|
+
toolRunner(body: BetaToolRunnerParams, options?: BetaToolRunnerRequestOptions): BetaToolRunner<boolean>;
|
|
235
|
+
toolRunner(body: BetaToolRunnerParams, options?: BetaToolRunnerRequestOptions): BetaToolRunner<boolean> {
|
|
236
|
+
return new BetaToolRunner(this._client as Anthropic, body, options);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Transform deprecated output_format to output_config.format
|
|
242
|
+
* Returns a modified copy of the params without mutating the original
|
|
243
|
+
*/
|
|
244
|
+
function transformOutputFormat<T extends MessageCreateParams | MessageCountTokensParams>(params: T): T {
|
|
245
|
+
if (!params.output_format) {
|
|
246
|
+
return params;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (params.output_config?.format) {
|
|
250
|
+
throw new AnthropicError(
|
|
251
|
+
'Both output_format and output_config.format were provided. ' +
|
|
252
|
+
'Please use only output_config.format (output_format is deprecated).',
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const { output_format, ...rest } = params;
|
|
257
|
+
|
|
258
|
+
return {
|
|
259
|
+
...rest,
|
|
260
|
+
output_config: {
|
|
261
|
+
...params.output_config,
|
|
262
|
+
format: output_format,
|
|
263
|
+
},
|
|
264
|
+
} as T;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export interface BetaAllThinkingTurns {
|
|
268
|
+
type: 'all';
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export type BetaMessageStreamParams = MessageCreateParamsBase;
|
|
272
|
+
|
|
273
|
+
export interface BetaBase64ImageSource {
|
|
274
|
+
data: string;
|
|
275
|
+
|
|
276
|
+
media_type: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
|
|
277
|
+
|
|
278
|
+
type: 'base64';
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export interface BetaBase64PDFSource {
|
|
282
|
+
data: string;
|
|
283
|
+
|
|
284
|
+
media_type: 'application/pdf';
|
|
285
|
+
|
|
286
|
+
type: 'base64';
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export interface BetaBashCodeExecutionOutputBlock {
|
|
290
|
+
file_id: string;
|
|
291
|
+
|
|
292
|
+
type: 'bash_code_execution_output';
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export interface BetaBashCodeExecutionOutputBlockParam {
|
|
296
|
+
file_id: string;
|
|
297
|
+
|
|
298
|
+
type: 'bash_code_execution_output';
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export interface BetaBashCodeExecutionResultBlock {
|
|
302
|
+
content: Array<BetaBashCodeExecutionOutputBlock>;
|
|
303
|
+
|
|
304
|
+
return_code: number;
|
|
305
|
+
|
|
306
|
+
stderr: string;
|
|
307
|
+
|
|
308
|
+
stdout: string;
|
|
309
|
+
|
|
310
|
+
type: 'bash_code_execution_result';
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export interface BetaBashCodeExecutionResultBlockParam {
|
|
314
|
+
content: Array<BetaBashCodeExecutionOutputBlockParam>;
|
|
315
|
+
|
|
316
|
+
return_code: number;
|
|
317
|
+
|
|
318
|
+
stderr: string;
|
|
319
|
+
|
|
320
|
+
stdout: string;
|
|
321
|
+
|
|
322
|
+
type: 'bash_code_execution_result';
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export interface BetaBashCodeExecutionToolResultBlock {
|
|
326
|
+
content: BetaBashCodeExecutionToolResultError | BetaBashCodeExecutionResultBlock;
|
|
327
|
+
|
|
328
|
+
tool_use_id: string;
|
|
329
|
+
|
|
330
|
+
type: 'bash_code_execution_tool_result';
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export interface BetaBashCodeExecutionToolResultBlockParam {
|
|
334
|
+
content: BetaBashCodeExecutionToolResultErrorParam | BetaBashCodeExecutionResultBlockParam;
|
|
335
|
+
|
|
336
|
+
tool_use_id: string;
|
|
337
|
+
|
|
338
|
+
type: 'bash_code_execution_tool_result';
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Create a cache control breakpoint at this content block.
|
|
342
|
+
*/
|
|
343
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export interface BetaBashCodeExecutionToolResultError {
|
|
347
|
+
error_code:
|
|
348
|
+
| 'invalid_tool_input'
|
|
349
|
+
| 'unavailable'
|
|
350
|
+
| 'too_many_requests'
|
|
351
|
+
| 'execution_time_exceeded'
|
|
352
|
+
| 'output_file_too_large';
|
|
353
|
+
|
|
354
|
+
type: 'bash_code_execution_tool_result_error';
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export interface BetaBashCodeExecutionToolResultErrorParam {
|
|
358
|
+
error_code:
|
|
359
|
+
| 'invalid_tool_input'
|
|
360
|
+
| 'unavailable'
|
|
361
|
+
| 'too_many_requests'
|
|
362
|
+
| 'execution_time_exceeded'
|
|
363
|
+
| 'output_file_too_large';
|
|
364
|
+
|
|
365
|
+
type: 'bash_code_execution_tool_result_error';
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export interface BetaCacheControlEphemeral {
|
|
369
|
+
type: 'ephemeral';
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* The time-to-live for the cache control breakpoint.
|
|
373
|
+
*
|
|
374
|
+
* This may be one the following values:
|
|
375
|
+
*
|
|
376
|
+
* - `5m`: 5 minutes
|
|
377
|
+
* - `1h`: 1 hour
|
|
378
|
+
*
|
|
379
|
+
* Defaults to `5m`.
|
|
380
|
+
*/
|
|
381
|
+
ttl?: '5m' | '1h';
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export interface BetaCacheCreation {
|
|
385
|
+
/**
|
|
386
|
+
* The number of input tokens used to create the 1 hour cache entry.
|
|
387
|
+
*/
|
|
388
|
+
ephemeral_1h_input_tokens: number;
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* The number of input tokens used to create the 5 minute cache entry.
|
|
392
|
+
*/
|
|
393
|
+
ephemeral_5m_input_tokens: number;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export interface BetaCitationCharLocation {
|
|
397
|
+
cited_text: string;
|
|
398
|
+
|
|
399
|
+
document_index: number;
|
|
400
|
+
|
|
401
|
+
document_title: string | null;
|
|
402
|
+
|
|
403
|
+
end_char_index: number;
|
|
404
|
+
|
|
405
|
+
file_id: string | null;
|
|
406
|
+
|
|
407
|
+
start_char_index: number;
|
|
408
|
+
|
|
409
|
+
type: 'char_location';
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export interface BetaCitationCharLocationParam {
|
|
413
|
+
cited_text: string;
|
|
414
|
+
|
|
415
|
+
document_index: number;
|
|
416
|
+
|
|
417
|
+
document_title: string | null;
|
|
418
|
+
|
|
419
|
+
end_char_index: number;
|
|
420
|
+
|
|
421
|
+
start_char_index: number;
|
|
422
|
+
|
|
423
|
+
type: 'char_location';
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export interface BetaCitationConfig {
|
|
427
|
+
enabled: boolean;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export interface BetaCitationContentBlockLocation {
|
|
431
|
+
cited_text: string;
|
|
432
|
+
|
|
433
|
+
document_index: number;
|
|
434
|
+
|
|
435
|
+
document_title: string | null;
|
|
436
|
+
|
|
437
|
+
end_block_index: number;
|
|
438
|
+
|
|
439
|
+
file_id: string | null;
|
|
440
|
+
|
|
441
|
+
start_block_index: number;
|
|
442
|
+
|
|
443
|
+
type: 'content_block_location';
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export interface BetaCitationContentBlockLocationParam {
|
|
447
|
+
cited_text: string;
|
|
448
|
+
|
|
449
|
+
document_index: number;
|
|
450
|
+
|
|
451
|
+
document_title: string | null;
|
|
452
|
+
|
|
453
|
+
end_block_index: number;
|
|
454
|
+
|
|
455
|
+
start_block_index: number;
|
|
456
|
+
|
|
457
|
+
type: 'content_block_location';
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export interface BetaCitationPageLocation {
|
|
461
|
+
cited_text: string;
|
|
462
|
+
|
|
463
|
+
document_index: number;
|
|
464
|
+
|
|
465
|
+
document_title: string | null;
|
|
466
|
+
|
|
467
|
+
end_page_number: number;
|
|
468
|
+
|
|
469
|
+
file_id: string | null;
|
|
470
|
+
|
|
471
|
+
start_page_number: number;
|
|
472
|
+
|
|
473
|
+
type: 'page_location';
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
export interface BetaCitationPageLocationParam {
|
|
477
|
+
cited_text: string;
|
|
478
|
+
|
|
479
|
+
document_index: number;
|
|
480
|
+
|
|
481
|
+
document_title: string | null;
|
|
482
|
+
|
|
483
|
+
end_page_number: number;
|
|
484
|
+
|
|
485
|
+
start_page_number: number;
|
|
486
|
+
|
|
487
|
+
type: 'page_location';
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export interface BetaCitationSearchResultLocation {
|
|
491
|
+
cited_text: string;
|
|
492
|
+
|
|
493
|
+
end_block_index: number;
|
|
494
|
+
|
|
495
|
+
search_result_index: number;
|
|
496
|
+
|
|
497
|
+
source: string;
|
|
498
|
+
|
|
499
|
+
start_block_index: number;
|
|
500
|
+
|
|
501
|
+
title: string | null;
|
|
502
|
+
|
|
503
|
+
type: 'search_result_location';
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
export interface BetaCitationSearchResultLocationParam {
|
|
507
|
+
cited_text: string;
|
|
508
|
+
|
|
509
|
+
end_block_index: number;
|
|
510
|
+
|
|
511
|
+
search_result_index: number;
|
|
512
|
+
|
|
513
|
+
source: string;
|
|
514
|
+
|
|
515
|
+
start_block_index: number;
|
|
516
|
+
|
|
517
|
+
title: string | null;
|
|
518
|
+
|
|
519
|
+
type: 'search_result_location';
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
export interface BetaCitationWebSearchResultLocationParam {
|
|
523
|
+
cited_text: string;
|
|
524
|
+
|
|
525
|
+
encrypted_index: string;
|
|
526
|
+
|
|
527
|
+
title: string | null;
|
|
528
|
+
|
|
529
|
+
type: 'web_search_result_location';
|
|
530
|
+
|
|
531
|
+
url: string;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
export interface BetaCitationsConfigParam {
|
|
535
|
+
enabled?: boolean;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export interface BetaCitationsDelta {
|
|
539
|
+
citation:
|
|
540
|
+
| BetaCitationCharLocation
|
|
541
|
+
| BetaCitationPageLocation
|
|
542
|
+
| BetaCitationContentBlockLocation
|
|
543
|
+
| BetaCitationsWebSearchResultLocation
|
|
544
|
+
| BetaCitationSearchResultLocation;
|
|
545
|
+
|
|
546
|
+
type: 'citations_delta';
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export interface BetaCitationsWebSearchResultLocation {
|
|
550
|
+
cited_text: string;
|
|
551
|
+
|
|
552
|
+
encrypted_index: string;
|
|
553
|
+
|
|
554
|
+
title: string | null;
|
|
555
|
+
|
|
556
|
+
type: 'web_search_result_location';
|
|
557
|
+
|
|
558
|
+
url: string;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
export interface BetaClearThinking20251015Edit {
|
|
562
|
+
type: 'clear_thinking_20251015';
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Number of most recent assistant turns to keep thinking blocks for. Older turns
|
|
566
|
+
* will have their thinking blocks removed.
|
|
567
|
+
*/
|
|
568
|
+
keep?: BetaThinkingTurns | BetaAllThinkingTurns | 'all';
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
export interface BetaClearThinking20251015EditResponse {
|
|
572
|
+
/**
|
|
573
|
+
* Number of input tokens cleared by this edit.
|
|
574
|
+
*/
|
|
575
|
+
cleared_input_tokens: number;
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* Number of thinking turns that were cleared.
|
|
579
|
+
*/
|
|
580
|
+
cleared_thinking_turns: number;
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* The type of context management edit applied.
|
|
584
|
+
*/
|
|
585
|
+
type: 'clear_thinking_20251015';
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
export interface BetaClearToolUses20250919Edit {
|
|
589
|
+
type: 'clear_tool_uses_20250919';
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Minimum number of tokens that must be cleared when triggered. Context will only
|
|
593
|
+
* be modified if at least this many tokens can be removed.
|
|
594
|
+
*/
|
|
595
|
+
clear_at_least?: BetaInputTokensClearAtLeast | null;
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)
|
|
599
|
+
*/
|
|
600
|
+
clear_tool_inputs?: boolean | Array<string> | null;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Tool names whose uses are preserved from clearing
|
|
604
|
+
*/
|
|
605
|
+
exclude_tools?: Array<string> | null;
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Number of tool uses to retain in the conversation
|
|
609
|
+
*/
|
|
610
|
+
keep?: BetaToolUsesKeep;
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Condition that triggers the context management strategy
|
|
614
|
+
*/
|
|
615
|
+
trigger?: BetaInputTokensTrigger | BetaToolUsesTrigger;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
export interface BetaClearToolUses20250919EditResponse {
|
|
619
|
+
/**
|
|
620
|
+
* Number of input tokens cleared by this edit.
|
|
621
|
+
*/
|
|
622
|
+
cleared_input_tokens: number;
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Number of tool uses that were cleared.
|
|
626
|
+
*/
|
|
627
|
+
cleared_tool_uses: number;
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* The type of context management edit applied.
|
|
631
|
+
*/
|
|
632
|
+
type: 'clear_tool_uses_20250919';
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
export interface BetaCodeExecutionOutputBlock {
|
|
636
|
+
file_id: string;
|
|
637
|
+
|
|
638
|
+
type: 'code_execution_output';
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
export interface BetaCodeExecutionOutputBlockParam {
|
|
642
|
+
file_id: string;
|
|
643
|
+
|
|
644
|
+
type: 'code_execution_output';
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
export interface BetaCodeExecutionResultBlock {
|
|
648
|
+
content: Array<BetaCodeExecutionOutputBlock>;
|
|
649
|
+
|
|
650
|
+
return_code: number;
|
|
651
|
+
|
|
652
|
+
stderr: string;
|
|
653
|
+
|
|
654
|
+
stdout: string;
|
|
655
|
+
|
|
656
|
+
type: 'code_execution_result';
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
export interface BetaCodeExecutionResultBlockParam {
|
|
660
|
+
content: Array<BetaCodeExecutionOutputBlockParam>;
|
|
661
|
+
|
|
662
|
+
return_code: number;
|
|
663
|
+
|
|
664
|
+
stderr: string;
|
|
665
|
+
|
|
666
|
+
stdout: string;
|
|
667
|
+
|
|
668
|
+
type: 'code_execution_result';
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
export interface BetaCodeExecutionTool20250522 {
|
|
672
|
+
/**
|
|
673
|
+
* Name of the tool.
|
|
674
|
+
*
|
|
675
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
676
|
+
*/
|
|
677
|
+
name: 'code_execution';
|
|
678
|
+
|
|
679
|
+
type: 'code_execution_20250522';
|
|
680
|
+
|
|
681
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Create a cache control breakpoint at this content block.
|
|
685
|
+
*/
|
|
686
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
690
|
+
* returned via tool_reference from tool search.
|
|
691
|
+
*/
|
|
692
|
+
defer_loading?: boolean;
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
696
|
+
*/
|
|
697
|
+
strict?: boolean;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
export interface BetaCodeExecutionTool20250825 {
|
|
701
|
+
/**
|
|
702
|
+
* Name of the tool.
|
|
703
|
+
*
|
|
704
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
705
|
+
*/
|
|
706
|
+
name: 'code_execution';
|
|
707
|
+
|
|
708
|
+
type: 'code_execution_20250825';
|
|
709
|
+
|
|
710
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Create a cache control breakpoint at this content block.
|
|
714
|
+
*/
|
|
715
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
719
|
+
* returned via tool_reference from tool search.
|
|
720
|
+
*/
|
|
721
|
+
defer_loading?: boolean;
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
725
|
+
*/
|
|
726
|
+
strict?: boolean;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Code execution tool with REPL state persistence (daemon mode + gVisor
|
|
731
|
+
* checkpoint).
|
|
732
|
+
*/
|
|
733
|
+
export interface BetaCodeExecutionTool20260120 {
|
|
734
|
+
/**
|
|
735
|
+
* Name of the tool.
|
|
736
|
+
*
|
|
737
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
738
|
+
*/
|
|
739
|
+
name: 'code_execution';
|
|
740
|
+
|
|
741
|
+
type: 'code_execution_20260120';
|
|
742
|
+
|
|
743
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Create a cache control breakpoint at this content block.
|
|
747
|
+
*/
|
|
748
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
752
|
+
* returned via tool_reference from tool search.
|
|
753
|
+
*/
|
|
754
|
+
defer_loading?: boolean;
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
758
|
+
*/
|
|
759
|
+
strict?: boolean;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
export interface BetaCodeExecutionToolResultBlock {
|
|
763
|
+
/**
|
|
764
|
+
* Code execution result with encrypted stdout for PFC + web_search results.
|
|
765
|
+
*/
|
|
766
|
+
content: BetaCodeExecutionToolResultBlockContent;
|
|
767
|
+
|
|
768
|
+
tool_use_id: string;
|
|
769
|
+
|
|
770
|
+
type: 'code_execution_tool_result';
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Code execution result with encrypted stdout for PFC + web_search results.
|
|
775
|
+
*/
|
|
776
|
+
export type BetaCodeExecutionToolResultBlockContent =
|
|
777
|
+
| BetaCodeExecutionToolResultError
|
|
778
|
+
| BetaCodeExecutionResultBlock
|
|
779
|
+
| BetaEncryptedCodeExecutionResultBlock;
|
|
780
|
+
|
|
781
|
+
export interface BetaCodeExecutionToolResultBlockParam {
|
|
782
|
+
/**
|
|
783
|
+
* Code execution result with encrypted stdout for PFC + web_search results.
|
|
784
|
+
*/
|
|
785
|
+
content: BetaCodeExecutionToolResultBlockParamContent;
|
|
786
|
+
|
|
787
|
+
tool_use_id: string;
|
|
788
|
+
|
|
789
|
+
type: 'code_execution_tool_result';
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* Create a cache control breakpoint at this content block.
|
|
793
|
+
*/
|
|
794
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Code execution result with encrypted stdout for PFC + web_search results.
|
|
799
|
+
*/
|
|
800
|
+
export type BetaCodeExecutionToolResultBlockParamContent =
|
|
801
|
+
| BetaCodeExecutionToolResultErrorParam
|
|
802
|
+
| BetaCodeExecutionResultBlockParam
|
|
803
|
+
| BetaEncryptedCodeExecutionResultBlockParam;
|
|
804
|
+
|
|
805
|
+
export interface BetaCodeExecutionToolResultError {
|
|
806
|
+
error_code: BetaCodeExecutionToolResultErrorCode;
|
|
807
|
+
|
|
808
|
+
type: 'code_execution_tool_result_error';
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
export type BetaCodeExecutionToolResultErrorCode =
|
|
812
|
+
| 'invalid_tool_input'
|
|
813
|
+
| 'unavailable'
|
|
814
|
+
| 'too_many_requests'
|
|
815
|
+
| 'execution_time_exceeded';
|
|
816
|
+
|
|
817
|
+
export interface BetaCodeExecutionToolResultErrorParam {
|
|
818
|
+
error_code: BetaCodeExecutionToolResultErrorCode;
|
|
819
|
+
|
|
820
|
+
type: 'code_execution_tool_result_error';
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Automatically compact older context when reaching the configured trigger
|
|
825
|
+
* threshold.
|
|
826
|
+
*/
|
|
827
|
+
export interface BetaCompact20260112Edit {
|
|
828
|
+
type: 'compact_20260112';
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* Additional instructions for summarization.
|
|
832
|
+
*/
|
|
833
|
+
instructions?: string | null;
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Whether to pause after compaction and return the compaction block to the user.
|
|
837
|
+
*/
|
|
838
|
+
pause_after_compaction?: boolean;
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* When to trigger compaction. Defaults to 150000 input tokens.
|
|
842
|
+
*/
|
|
843
|
+
trigger?: BetaInputTokensTrigger | null;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* A compaction block returned when autocompact is triggered.
|
|
848
|
+
*
|
|
849
|
+
* When content is None, it indicates the compaction failed to produce a valid
|
|
850
|
+
* summary (e.g., malformed output from the model). Clients may round-trip
|
|
851
|
+
* compaction blocks with null content; the server treats them as no-ops.
|
|
852
|
+
*/
|
|
853
|
+
export interface BetaCompactionBlock {
|
|
854
|
+
/**
|
|
855
|
+
* Summary of compacted content, or null if compaction failed
|
|
856
|
+
*/
|
|
857
|
+
content: string | null;
|
|
858
|
+
|
|
859
|
+
type: 'compaction';
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* A compaction block containing summary of previous context.
|
|
864
|
+
*
|
|
865
|
+
* Users should round-trip these blocks from responses to subsequent requests to
|
|
866
|
+
* maintain context across compaction boundaries.
|
|
867
|
+
*
|
|
868
|
+
* When content is None, the block represents a failed compaction. The server
|
|
869
|
+
* treats these as no-ops. Empty string content is not allowed.
|
|
870
|
+
*/
|
|
871
|
+
export interface BetaCompactionBlockParam {
|
|
872
|
+
/**
|
|
873
|
+
* Summary of previously compacted content, or null if compaction failed
|
|
874
|
+
*/
|
|
875
|
+
content: string | null;
|
|
876
|
+
|
|
877
|
+
type: 'compaction';
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* Create a cache control breakpoint at this content block.
|
|
881
|
+
*/
|
|
882
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
export interface BetaCompactionContentBlockDelta {
|
|
886
|
+
content: string | null;
|
|
887
|
+
|
|
888
|
+
type: 'compaction_delta';
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* Token usage for a compaction iteration.
|
|
893
|
+
*/
|
|
894
|
+
export interface BetaCompactionIterationUsage {
|
|
895
|
+
/**
|
|
896
|
+
* Breakdown of cached tokens by TTL
|
|
897
|
+
*/
|
|
898
|
+
cache_creation: BetaCacheCreation | null;
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* The number of input tokens used to create the cache entry.
|
|
902
|
+
*/
|
|
903
|
+
cache_creation_input_tokens: number;
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* The number of input tokens read from the cache.
|
|
907
|
+
*/
|
|
908
|
+
cache_read_input_tokens: number;
|
|
909
|
+
|
|
910
|
+
/**
|
|
911
|
+
* The number of input tokens which were used.
|
|
912
|
+
*/
|
|
913
|
+
input_tokens: number;
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* The number of output tokens which were used.
|
|
917
|
+
*/
|
|
918
|
+
output_tokens: number;
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Usage for a compaction iteration
|
|
922
|
+
*/
|
|
923
|
+
type: 'compaction';
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* Information about the container used in the request (for the code execution
|
|
928
|
+
* tool)
|
|
929
|
+
*/
|
|
930
|
+
export interface BetaContainer {
|
|
931
|
+
/**
|
|
932
|
+
* Identifier for the container used in this request
|
|
933
|
+
*/
|
|
934
|
+
id: string;
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* The time at which the container will expire.
|
|
938
|
+
*/
|
|
939
|
+
expires_at: string;
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Skills loaded in the container
|
|
943
|
+
*/
|
|
944
|
+
skills: Array<BetaSkill> | null;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* Container parameters with skills to be loaded.
|
|
949
|
+
*/
|
|
950
|
+
export interface BetaContainerParams {
|
|
951
|
+
/**
|
|
952
|
+
* Container id
|
|
953
|
+
*/
|
|
954
|
+
id?: string | null;
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* List of skills to load in the container
|
|
958
|
+
*/
|
|
959
|
+
skills?: Array<BetaSkillParams> | null;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* Response model for a file uploaded to the container.
|
|
964
|
+
*/
|
|
965
|
+
export interface BetaContainerUploadBlock {
|
|
966
|
+
file_id: string;
|
|
967
|
+
|
|
968
|
+
type: 'container_upload';
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* A content block that represents a file to be uploaded to the container Files
|
|
973
|
+
* uploaded via this block will be available in the container's input directory.
|
|
974
|
+
*/
|
|
975
|
+
export interface BetaContainerUploadBlockParam {
|
|
976
|
+
file_id: string;
|
|
977
|
+
|
|
978
|
+
type: 'container_upload';
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* Create a cache control breakpoint at this content block.
|
|
982
|
+
*/
|
|
983
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* Response model for a file uploaded to the container.
|
|
988
|
+
*/
|
|
989
|
+
export type BetaContentBlock =
|
|
990
|
+
| BetaTextBlock
|
|
991
|
+
| BetaThinkingBlock
|
|
992
|
+
| BetaRedactedThinkingBlock
|
|
993
|
+
| BetaToolUseBlock
|
|
994
|
+
| BetaServerToolUseBlock
|
|
995
|
+
| BetaWebSearchToolResultBlock
|
|
996
|
+
| BetaWebFetchToolResultBlock
|
|
997
|
+
| BetaCodeExecutionToolResultBlock
|
|
998
|
+
| BetaBashCodeExecutionToolResultBlock
|
|
999
|
+
| BetaTextEditorCodeExecutionToolResultBlock
|
|
1000
|
+
| BetaToolSearchToolResultBlock
|
|
1001
|
+
| BetaMCPToolUseBlock
|
|
1002
|
+
| BetaMCPToolResultBlock
|
|
1003
|
+
| BetaContainerUploadBlock
|
|
1004
|
+
| BetaCompactionBlock;
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* Regular text content.
|
|
1008
|
+
*/
|
|
1009
|
+
export type BetaContentBlockParam =
|
|
1010
|
+
| BetaTextBlockParam
|
|
1011
|
+
| BetaImageBlockParam
|
|
1012
|
+
| BetaRequestDocumentBlock
|
|
1013
|
+
| BetaSearchResultBlockParam
|
|
1014
|
+
| BetaThinkingBlockParam
|
|
1015
|
+
| BetaRedactedThinkingBlockParam
|
|
1016
|
+
| BetaToolUseBlockParam
|
|
1017
|
+
| BetaToolResultBlockParam
|
|
1018
|
+
| BetaServerToolUseBlockParam
|
|
1019
|
+
| BetaWebSearchToolResultBlockParam
|
|
1020
|
+
| BetaWebFetchToolResultBlockParam
|
|
1021
|
+
| BetaCodeExecutionToolResultBlockParam
|
|
1022
|
+
| BetaBashCodeExecutionToolResultBlockParam
|
|
1023
|
+
| BetaTextEditorCodeExecutionToolResultBlockParam
|
|
1024
|
+
| BetaToolSearchToolResultBlockParam
|
|
1025
|
+
| BetaMCPToolUseBlockParam
|
|
1026
|
+
| BetaRequestMCPToolResultBlockParam
|
|
1027
|
+
| BetaContainerUploadBlockParam
|
|
1028
|
+
| BetaCompactionBlockParam;
|
|
1029
|
+
|
|
1030
|
+
export interface BetaContentBlockSource {
|
|
1031
|
+
content: string | Array<BetaContentBlockSourceContent>;
|
|
1032
|
+
|
|
1033
|
+
type: 'content';
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
export type BetaContentBlockSourceContent = BetaTextBlockParam | BetaImageBlockParam;
|
|
1037
|
+
|
|
1038
|
+
export interface BetaContextManagementConfig {
|
|
1039
|
+
/**
|
|
1040
|
+
* List of context management edits to apply
|
|
1041
|
+
*/
|
|
1042
|
+
edits?: Array<BetaClearToolUses20250919Edit | BetaClearThinking20251015Edit | BetaCompact20260112Edit>;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
export interface BetaContextManagementResponse {
|
|
1046
|
+
/**
|
|
1047
|
+
* List of context management edits that were applied.
|
|
1048
|
+
*/
|
|
1049
|
+
applied_edits: Array<BetaClearToolUses20250919EditResponse | BetaClearThinking20251015EditResponse>;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
export interface BetaCountTokensContextManagementResponse {
|
|
1053
|
+
/**
|
|
1054
|
+
* The original token count before context management was applied
|
|
1055
|
+
*/
|
|
1056
|
+
original_input_tokens: number;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
/**
|
|
1060
|
+
* Tool invocation directly from the model.
|
|
1061
|
+
*/
|
|
1062
|
+
export interface BetaDirectCaller {
|
|
1063
|
+
type: 'direct';
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
export interface BetaDocumentBlock {
|
|
1067
|
+
/**
|
|
1068
|
+
* Citation configuration for the document
|
|
1069
|
+
*/
|
|
1070
|
+
citations: BetaCitationConfig | null;
|
|
1071
|
+
|
|
1072
|
+
source: BetaBase64PDFSource | BetaPlainTextSource;
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* The title of the document
|
|
1076
|
+
*/
|
|
1077
|
+
title: string | null;
|
|
1078
|
+
|
|
1079
|
+
type: 'document';
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
/**
|
|
1083
|
+
* Code execution result with encrypted stdout for PFC + web_search results.
|
|
1084
|
+
*/
|
|
1085
|
+
export interface BetaEncryptedCodeExecutionResultBlock {
|
|
1086
|
+
content: Array<BetaCodeExecutionOutputBlock>;
|
|
1087
|
+
|
|
1088
|
+
encrypted_stdout: string;
|
|
1089
|
+
|
|
1090
|
+
return_code: number;
|
|
1091
|
+
|
|
1092
|
+
stderr: string;
|
|
1093
|
+
|
|
1094
|
+
type: 'encrypted_code_execution_result';
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
/**
|
|
1098
|
+
* Code execution result with encrypted stdout for PFC + web_search results.
|
|
1099
|
+
*/
|
|
1100
|
+
export interface BetaEncryptedCodeExecutionResultBlockParam {
|
|
1101
|
+
content: Array<BetaCodeExecutionOutputBlockParam>;
|
|
1102
|
+
|
|
1103
|
+
encrypted_stdout: string;
|
|
1104
|
+
|
|
1105
|
+
return_code: number;
|
|
1106
|
+
|
|
1107
|
+
stderr: string;
|
|
1108
|
+
|
|
1109
|
+
type: 'encrypted_code_execution_result';
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
export interface BetaFileDocumentSource {
|
|
1113
|
+
file_id: string;
|
|
1114
|
+
|
|
1115
|
+
type: 'file';
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
export interface BetaFileImageSource {
|
|
1119
|
+
file_id: string;
|
|
1120
|
+
|
|
1121
|
+
type: 'file';
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
export interface BetaImageBlockParam {
|
|
1125
|
+
source: BetaBase64ImageSource | BetaURLImageSource | BetaFileImageSource;
|
|
1126
|
+
|
|
1127
|
+
type: 'image';
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* Create a cache control breakpoint at this content block.
|
|
1131
|
+
*/
|
|
1132
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
export interface BetaInputJSONDelta {
|
|
1136
|
+
partial_json: string;
|
|
1137
|
+
|
|
1138
|
+
type: 'input_json_delta';
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
export interface BetaInputTokensClearAtLeast {
|
|
1142
|
+
type: 'input_tokens';
|
|
1143
|
+
|
|
1144
|
+
value: number;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
export interface BetaInputTokensTrigger {
|
|
1148
|
+
type: 'input_tokens';
|
|
1149
|
+
|
|
1150
|
+
value: number;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* Per-iteration token usage breakdown.
|
|
1155
|
+
*
|
|
1156
|
+
* Each entry represents one sampling iteration, with its own input/output token
|
|
1157
|
+
* counts and cache statistics. This allows you to:
|
|
1158
|
+
*
|
|
1159
|
+
* - Determine which iterations exceeded long context thresholds (>=200k tokens)
|
|
1160
|
+
* - Calculate the true context window size from the last iteration
|
|
1161
|
+
* - Understand token accumulation across server-side tool use loops
|
|
1162
|
+
*/
|
|
1163
|
+
export type BetaIterationsUsage = Array<BetaMessageIterationUsage | BetaCompactionIterationUsage>;
|
|
1164
|
+
|
|
1165
|
+
export interface BetaJSONOutputFormat {
|
|
1166
|
+
/**
|
|
1167
|
+
* The JSON schema of the format
|
|
1168
|
+
*/
|
|
1169
|
+
schema: { [key: string]: unknown };
|
|
1170
|
+
|
|
1171
|
+
type: 'json_schema';
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* Configuration for a specific tool in an MCP toolset.
|
|
1176
|
+
*/
|
|
1177
|
+
export interface BetaMCPToolConfig {
|
|
1178
|
+
defer_loading?: boolean;
|
|
1179
|
+
|
|
1180
|
+
enabled?: boolean;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
/**
|
|
1184
|
+
* Default configuration for tools in an MCP toolset.
|
|
1185
|
+
*/
|
|
1186
|
+
export interface BetaMCPToolDefaultConfig {
|
|
1187
|
+
defer_loading?: boolean;
|
|
1188
|
+
|
|
1189
|
+
enabled?: boolean;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
export interface BetaMCPToolResultBlock {
|
|
1193
|
+
content: string | Array<BetaTextBlock>;
|
|
1194
|
+
|
|
1195
|
+
is_error: boolean;
|
|
1196
|
+
|
|
1197
|
+
tool_use_id: string;
|
|
1198
|
+
|
|
1199
|
+
type: 'mcp_tool_result';
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
export interface BetaMCPToolUseBlock {
|
|
1203
|
+
id: string;
|
|
1204
|
+
|
|
1205
|
+
input: unknown;
|
|
1206
|
+
|
|
1207
|
+
/**
|
|
1208
|
+
* The name of the MCP tool
|
|
1209
|
+
*/
|
|
1210
|
+
name: string;
|
|
1211
|
+
|
|
1212
|
+
/**
|
|
1213
|
+
* The name of the MCP server
|
|
1214
|
+
*/
|
|
1215
|
+
server_name: string;
|
|
1216
|
+
|
|
1217
|
+
type: 'mcp_tool_use';
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
export interface BetaMCPToolUseBlockParam {
|
|
1221
|
+
id: string;
|
|
1222
|
+
|
|
1223
|
+
input: unknown;
|
|
1224
|
+
|
|
1225
|
+
name: string;
|
|
1226
|
+
|
|
1227
|
+
/**
|
|
1228
|
+
* The name of the MCP server
|
|
1229
|
+
*/
|
|
1230
|
+
server_name: string;
|
|
1231
|
+
|
|
1232
|
+
type: 'mcp_tool_use';
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Create a cache control breakpoint at this content block.
|
|
1236
|
+
*/
|
|
1237
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
/**
|
|
1241
|
+
* Configuration for a group of tools from an MCP server.
|
|
1242
|
+
*
|
|
1243
|
+
* Allows configuring enabled status and defer_loading for all tools from an MCP
|
|
1244
|
+
* server, with optional per-tool overrides.
|
|
1245
|
+
*/
|
|
1246
|
+
export interface BetaMCPToolset {
|
|
1247
|
+
/**
|
|
1248
|
+
* Name of the MCP server to configure tools for
|
|
1249
|
+
*/
|
|
1250
|
+
mcp_server_name: string;
|
|
1251
|
+
|
|
1252
|
+
type: 'mcp_toolset';
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* Create a cache control breakpoint at this content block.
|
|
1256
|
+
*/
|
|
1257
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
1258
|
+
|
|
1259
|
+
/**
|
|
1260
|
+
* Configuration overrides for specific tools, keyed by tool name
|
|
1261
|
+
*/
|
|
1262
|
+
configs?: { [key: string]: BetaMCPToolConfig } | null;
|
|
1263
|
+
|
|
1264
|
+
/**
|
|
1265
|
+
* Default configuration applied to all tools from this server
|
|
1266
|
+
*/
|
|
1267
|
+
default_config?: BetaMCPToolDefaultConfig;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
export interface BetaMemoryTool20250818 {
|
|
1271
|
+
/**
|
|
1272
|
+
* Name of the tool.
|
|
1273
|
+
*
|
|
1274
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
1275
|
+
*/
|
|
1276
|
+
name: 'memory';
|
|
1277
|
+
|
|
1278
|
+
type: 'memory_20250818';
|
|
1279
|
+
|
|
1280
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
1281
|
+
|
|
1282
|
+
/**
|
|
1283
|
+
* Create a cache control breakpoint at this content block.
|
|
1284
|
+
*/
|
|
1285
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
1286
|
+
|
|
1287
|
+
/**
|
|
1288
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
1289
|
+
* returned via tool_reference from tool search.
|
|
1290
|
+
*/
|
|
1291
|
+
defer_loading?: boolean;
|
|
1292
|
+
|
|
1293
|
+
input_examples?: Array<{ [key: string]: unknown }>;
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
1297
|
+
*/
|
|
1298
|
+
strict?: boolean;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
export type BetaMemoryTool20250818Command =
|
|
1302
|
+
| BetaMemoryTool20250818ViewCommand
|
|
1303
|
+
| BetaMemoryTool20250818CreateCommand
|
|
1304
|
+
| BetaMemoryTool20250818StrReplaceCommand
|
|
1305
|
+
| BetaMemoryTool20250818InsertCommand
|
|
1306
|
+
| BetaMemoryTool20250818DeleteCommand
|
|
1307
|
+
| BetaMemoryTool20250818RenameCommand;
|
|
1308
|
+
|
|
1309
|
+
export interface BetaMemoryTool20250818CreateCommand {
|
|
1310
|
+
/**
|
|
1311
|
+
* Command type identifier
|
|
1312
|
+
*/
|
|
1313
|
+
command: 'create';
|
|
1314
|
+
|
|
1315
|
+
/**
|
|
1316
|
+
* Content to write to the file
|
|
1317
|
+
*/
|
|
1318
|
+
file_text: string;
|
|
1319
|
+
|
|
1320
|
+
/**
|
|
1321
|
+
* Path where the file should be created
|
|
1322
|
+
*/
|
|
1323
|
+
path: string;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
export interface BetaMemoryTool20250818DeleteCommand {
|
|
1327
|
+
/**
|
|
1328
|
+
* Command type identifier
|
|
1329
|
+
*/
|
|
1330
|
+
command: 'delete';
|
|
1331
|
+
|
|
1332
|
+
/**
|
|
1333
|
+
* Path to the file or directory to delete
|
|
1334
|
+
*/
|
|
1335
|
+
path: string;
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
export interface BetaMemoryTool20250818InsertCommand {
|
|
1339
|
+
/**
|
|
1340
|
+
* Command type identifier
|
|
1341
|
+
*/
|
|
1342
|
+
command: 'insert';
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* Line number where text should be inserted
|
|
1346
|
+
*/
|
|
1347
|
+
insert_line: number;
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* Text to insert at the specified line
|
|
1351
|
+
*/
|
|
1352
|
+
insert_text: string;
|
|
1353
|
+
|
|
1354
|
+
/**
|
|
1355
|
+
* Path to the file where text should be inserted
|
|
1356
|
+
*/
|
|
1357
|
+
path: string;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
export interface BetaMemoryTool20250818RenameCommand {
|
|
1361
|
+
/**
|
|
1362
|
+
* Command type identifier
|
|
1363
|
+
*/
|
|
1364
|
+
command: 'rename';
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
* New path for the file or directory
|
|
1368
|
+
*/
|
|
1369
|
+
new_path: string;
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* Current path of the file or directory
|
|
1373
|
+
*/
|
|
1374
|
+
old_path: string;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
export interface BetaMemoryTool20250818StrReplaceCommand {
|
|
1378
|
+
/**
|
|
1379
|
+
* Command type identifier
|
|
1380
|
+
*/
|
|
1381
|
+
command: 'str_replace';
|
|
1382
|
+
|
|
1383
|
+
/**
|
|
1384
|
+
* Text to replace with
|
|
1385
|
+
*/
|
|
1386
|
+
new_str: string;
|
|
1387
|
+
|
|
1388
|
+
/**
|
|
1389
|
+
* Text to search for and replace
|
|
1390
|
+
*/
|
|
1391
|
+
old_str: string;
|
|
1392
|
+
|
|
1393
|
+
/**
|
|
1394
|
+
* Path to the file where text should be replaced
|
|
1395
|
+
*/
|
|
1396
|
+
path: string;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
export interface BetaMemoryTool20250818ViewCommand {
|
|
1400
|
+
/**
|
|
1401
|
+
* Command type identifier
|
|
1402
|
+
*/
|
|
1403
|
+
command: 'view';
|
|
1404
|
+
|
|
1405
|
+
/**
|
|
1406
|
+
* Path to directory or file to view
|
|
1407
|
+
*/
|
|
1408
|
+
path: string;
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* Optional line range for viewing specific lines
|
|
1412
|
+
*/
|
|
1413
|
+
view_range?: Array<number>;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
export interface BetaMessage {
|
|
1417
|
+
/**
|
|
1418
|
+
* Unique object identifier.
|
|
1419
|
+
*
|
|
1420
|
+
* The format and length of IDs may change over time.
|
|
1421
|
+
*/
|
|
1422
|
+
id: string;
|
|
1423
|
+
|
|
1424
|
+
/**
|
|
1425
|
+
* Information about the container used in the request (for the code execution
|
|
1426
|
+
* tool)
|
|
1427
|
+
*/
|
|
1428
|
+
container: BetaContainer | null;
|
|
1429
|
+
|
|
1430
|
+
/**
|
|
1431
|
+
* Content generated by the model.
|
|
1432
|
+
*
|
|
1433
|
+
* This is an array of content blocks, each of which has a `type` that determines
|
|
1434
|
+
* its shape.
|
|
1435
|
+
*
|
|
1436
|
+
* Example:
|
|
1437
|
+
*
|
|
1438
|
+
* ```json
|
|
1439
|
+
* [{ "type": "text", "text": "Hi, I'm Claude." }]
|
|
1440
|
+
* ```
|
|
1441
|
+
*
|
|
1442
|
+
* If the request input `messages` ended with an `assistant` turn, then the
|
|
1443
|
+
* response `content` will continue directly from that last turn. You can use this
|
|
1444
|
+
* to constrain the model's output.
|
|
1445
|
+
*
|
|
1446
|
+
* For example, if the input `messages` were:
|
|
1447
|
+
*
|
|
1448
|
+
* ```json
|
|
1449
|
+
* [
|
|
1450
|
+
* {
|
|
1451
|
+
* "role": "user",
|
|
1452
|
+
* "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
|
1453
|
+
* },
|
|
1454
|
+
* { "role": "assistant", "content": "The best answer is (" }
|
|
1455
|
+
* ]
|
|
1456
|
+
* ```
|
|
1457
|
+
*
|
|
1458
|
+
* Then the response `content` might be:
|
|
1459
|
+
*
|
|
1460
|
+
* ```json
|
|
1461
|
+
* [{ "type": "text", "text": "B)" }]
|
|
1462
|
+
* ```
|
|
1463
|
+
*/
|
|
1464
|
+
content: Array<BetaContentBlock>;
|
|
1465
|
+
|
|
1466
|
+
/**
|
|
1467
|
+
* Context management response.
|
|
1468
|
+
*
|
|
1469
|
+
* Information about context management strategies applied during the request.
|
|
1470
|
+
*/
|
|
1471
|
+
context_management: BetaContextManagementResponse | null;
|
|
1472
|
+
|
|
1473
|
+
/**
|
|
1474
|
+
* The model that will complete your prompt.\n\nSee
|
|
1475
|
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
|
1476
|
+
* details and options.
|
|
1477
|
+
*/
|
|
1478
|
+
model: MessagesAPI.Model;
|
|
1479
|
+
|
|
1480
|
+
/**
|
|
1481
|
+
* Conversational role of the generated message.
|
|
1482
|
+
*
|
|
1483
|
+
* This will always be `"assistant"`.
|
|
1484
|
+
*/
|
|
1485
|
+
role: 'assistant';
|
|
1486
|
+
|
|
1487
|
+
/**
|
|
1488
|
+
* Structured information about a refusal.
|
|
1489
|
+
*/
|
|
1490
|
+
stop_details: BetaRefusalStopDetails | null;
|
|
1491
|
+
|
|
1492
|
+
/**
|
|
1493
|
+
* The reason that we stopped.
|
|
1494
|
+
*
|
|
1495
|
+
* This may be one the following values:
|
|
1496
|
+
*
|
|
1497
|
+
* - `"end_turn"`: the model reached a natural stopping point
|
|
1498
|
+
* - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
|
|
1499
|
+
* - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
|
|
1500
|
+
* - `"tool_use"`: the model invoked one or more tools
|
|
1501
|
+
* - `"pause_turn"`: we paused a long-running turn. You may provide the response
|
|
1502
|
+
* back as-is in a subsequent request to let the model continue.
|
|
1503
|
+
* - `"refusal"`: when streaming classifiers intervene to handle potential policy
|
|
1504
|
+
* violations
|
|
1505
|
+
*
|
|
1506
|
+
* In non-streaming mode this value is always non-null. In streaming mode, it is
|
|
1507
|
+
* null in the `message_start` event and non-null otherwise.
|
|
1508
|
+
*/
|
|
1509
|
+
stop_reason: BetaStopReason | null;
|
|
1510
|
+
|
|
1511
|
+
/**
|
|
1512
|
+
* Which custom stop sequence was generated, if any.
|
|
1513
|
+
*
|
|
1514
|
+
* This value will be a non-null string if one of your custom stop sequences was
|
|
1515
|
+
* generated.
|
|
1516
|
+
*/
|
|
1517
|
+
stop_sequence: string | null;
|
|
1518
|
+
|
|
1519
|
+
/**
|
|
1520
|
+
* Object type.
|
|
1521
|
+
*
|
|
1522
|
+
* For Messages, this is always `"message"`.
|
|
1523
|
+
*/
|
|
1524
|
+
type: 'message';
|
|
1525
|
+
|
|
1526
|
+
/**
|
|
1527
|
+
* Billing and rate-limit usage.
|
|
1528
|
+
*
|
|
1529
|
+
* Anthropic's API bills and rate-limits by token counts, as tokens represent the
|
|
1530
|
+
* underlying cost to our systems.
|
|
1531
|
+
*
|
|
1532
|
+
* Under the hood, the API transforms requests into a format suitable for the
|
|
1533
|
+
* model. The model's output then goes through a parsing stage before becoming an
|
|
1534
|
+
* API response. As a result, the token counts in `usage` will not match one-to-one
|
|
1535
|
+
* with the exact visible content of an API request or response.
|
|
1536
|
+
*
|
|
1537
|
+
* For example, `output_tokens` will be non-zero, even for an empty string response
|
|
1538
|
+
* from Claude.
|
|
1539
|
+
*
|
|
1540
|
+
* Total input tokens in a request is the summation of `input_tokens`,
|
|
1541
|
+
* `cache_creation_input_tokens`, and `cache_read_input_tokens`.
|
|
1542
|
+
*/
|
|
1543
|
+
usage: BetaUsage;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
export interface BetaMessageDeltaUsage {
|
|
1547
|
+
/**
|
|
1548
|
+
* The cumulative number of input tokens used to create the cache entry.
|
|
1549
|
+
*/
|
|
1550
|
+
cache_creation_input_tokens: number | null;
|
|
1551
|
+
|
|
1552
|
+
/**
|
|
1553
|
+
* The cumulative number of input tokens read from the cache.
|
|
1554
|
+
*/
|
|
1555
|
+
cache_read_input_tokens: number | null;
|
|
1556
|
+
|
|
1557
|
+
/**
|
|
1558
|
+
* The cumulative number of input tokens which were used.
|
|
1559
|
+
*/
|
|
1560
|
+
input_tokens: number | null;
|
|
1561
|
+
|
|
1562
|
+
/**
|
|
1563
|
+
* Per-iteration token usage breakdown.
|
|
1564
|
+
*
|
|
1565
|
+
* Each entry represents one sampling iteration, with its own input/output token
|
|
1566
|
+
* counts and cache statistics. This allows you to:
|
|
1567
|
+
*
|
|
1568
|
+
* - Determine which iterations exceeded long context thresholds (>=200k tokens)
|
|
1569
|
+
* - Calculate the true context window size from the last iteration
|
|
1570
|
+
* - Understand token accumulation across server-side tool use loops
|
|
1571
|
+
*/
|
|
1572
|
+
iterations: BetaIterationsUsage | null;
|
|
1573
|
+
|
|
1574
|
+
/**
|
|
1575
|
+
* The cumulative number of output tokens which were used.
|
|
1576
|
+
*/
|
|
1577
|
+
output_tokens: number;
|
|
1578
|
+
|
|
1579
|
+
/**
|
|
1580
|
+
* The number of server tool requests.
|
|
1581
|
+
*/
|
|
1582
|
+
server_tool_use: BetaServerToolUsage | null;
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
/**
|
|
1586
|
+
* Token usage for a sampling iteration.
|
|
1587
|
+
*/
|
|
1588
|
+
export interface BetaMessageIterationUsage {
|
|
1589
|
+
/**
|
|
1590
|
+
* Breakdown of cached tokens by TTL
|
|
1591
|
+
*/
|
|
1592
|
+
cache_creation: BetaCacheCreation | null;
|
|
1593
|
+
|
|
1594
|
+
/**
|
|
1595
|
+
* The number of input tokens used to create the cache entry.
|
|
1596
|
+
*/
|
|
1597
|
+
cache_creation_input_tokens: number;
|
|
1598
|
+
|
|
1599
|
+
/**
|
|
1600
|
+
* The number of input tokens read from the cache.
|
|
1601
|
+
*/
|
|
1602
|
+
cache_read_input_tokens: number;
|
|
1603
|
+
|
|
1604
|
+
/**
|
|
1605
|
+
* The number of input tokens which were used.
|
|
1606
|
+
*/
|
|
1607
|
+
input_tokens: number;
|
|
1608
|
+
|
|
1609
|
+
/**
|
|
1610
|
+
* The number of output tokens which were used.
|
|
1611
|
+
*/
|
|
1612
|
+
output_tokens: number;
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* Usage for a sampling iteration
|
|
1616
|
+
*/
|
|
1617
|
+
type: 'message';
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
export interface BetaMessageParam {
|
|
1621
|
+
content: string | Array<BetaContentBlockParam>;
|
|
1622
|
+
|
|
1623
|
+
role: 'user' | 'assistant';
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
export interface BetaMessageTokensCount {
|
|
1627
|
+
/**
|
|
1628
|
+
* Information about context management applied to the message.
|
|
1629
|
+
*/
|
|
1630
|
+
context_management: BetaCountTokensContextManagementResponse | null;
|
|
1631
|
+
|
|
1632
|
+
/**
|
|
1633
|
+
* The total number of tokens across the provided list of messages, system prompt,
|
|
1634
|
+
* and tools.
|
|
1635
|
+
*/
|
|
1636
|
+
input_tokens: number;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
export interface BetaMetadata {
|
|
1640
|
+
/**
|
|
1641
|
+
* An external identifier for the user who is associated with the request.
|
|
1642
|
+
*
|
|
1643
|
+
* This should be a uuid, hash value, or other opaque identifier. Anthropic may use
|
|
1644
|
+
* this id to help detect abuse. Do not include any identifying information such as
|
|
1645
|
+
* name, email address, or phone number.
|
|
1646
|
+
*/
|
|
1647
|
+
user_id?: string | null;
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
export interface BetaOutputConfig {
|
|
1651
|
+
/**
|
|
1652
|
+
* All possible effort levels.
|
|
1653
|
+
*/
|
|
1654
|
+
effort?: 'low' | 'medium' | 'high' | 'max' | null;
|
|
1655
|
+
|
|
1656
|
+
/**
|
|
1657
|
+
* A schema to specify Claude's output format in responses. See
|
|
1658
|
+
* [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
|
|
1659
|
+
*/
|
|
1660
|
+
format?: BetaJSONOutputFormat | null;
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
export interface BetaPlainTextSource {
|
|
1664
|
+
data: string;
|
|
1665
|
+
|
|
1666
|
+
media_type: 'text/plain';
|
|
1667
|
+
|
|
1668
|
+
type: 'text';
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
export type BetaRawContentBlockDelta =
|
|
1672
|
+
| BetaTextDelta
|
|
1673
|
+
| BetaInputJSONDelta
|
|
1674
|
+
| BetaCitationsDelta
|
|
1675
|
+
| BetaThinkingDelta
|
|
1676
|
+
| BetaSignatureDelta
|
|
1677
|
+
| BetaCompactionContentBlockDelta;
|
|
1678
|
+
|
|
1679
|
+
export interface BetaRawContentBlockDeltaEvent {
|
|
1680
|
+
delta: BetaRawContentBlockDelta;
|
|
1681
|
+
|
|
1682
|
+
index: number;
|
|
1683
|
+
|
|
1684
|
+
type: 'content_block_delta';
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
export interface BetaRawContentBlockStartEvent {
|
|
1688
|
+
/**
|
|
1689
|
+
* Response model for a file uploaded to the container.
|
|
1690
|
+
*/
|
|
1691
|
+
content_block:
|
|
1692
|
+
| BetaTextBlock
|
|
1693
|
+
| BetaThinkingBlock
|
|
1694
|
+
| BetaRedactedThinkingBlock
|
|
1695
|
+
| BetaToolUseBlock
|
|
1696
|
+
| BetaServerToolUseBlock
|
|
1697
|
+
| BetaWebSearchToolResultBlock
|
|
1698
|
+
| BetaWebFetchToolResultBlock
|
|
1699
|
+
| BetaCodeExecutionToolResultBlock
|
|
1700
|
+
| BetaBashCodeExecutionToolResultBlock
|
|
1701
|
+
| BetaTextEditorCodeExecutionToolResultBlock
|
|
1702
|
+
| BetaToolSearchToolResultBlock
|
|
1703
|
+
| BetaMCPToolUseBlock
|
|
1704
|
+
| BetaMCPToolResultBlock
|
|
1705
|
+
| BetaContainerUploadBlock
|
|
1706
|
+
| BetaCompactionBlock;
|
|
1707
|
+
|
|
1708
|
+
index: number;
|
|
1709
|
+
|
|
1710
|
+
type: 'content_block_start';
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
export interface BetaRawContentBlockStopEvent {
|
|
1714
|
+
index: number;
|
|
1715
|
+
|
|
1716
|
+
type: 'content_block_stop';
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
export interface BetaRawMessageDeltaEvent {
|
|
1720
|
+
/**
|
|
1721
|
+
* Information about context management strategies applied during the request
|
|
1722
|
+
*/
|
|
1723
|
+
context_management: BetaContextManagementResponse | null;
|
|
1724
|
+
|
|
1725
|
+
delta: BetaRawMessageDeltaEvent.Delta;
|
|
1726
|
+
|
|
1727
|
+
type: 'message_delta';
|
|
1728
|
+
|
|
1729
|
+
/**
|
|
1730
|
+
* Billing and rate-limit usage.
|
|
1731
|
+
*
|
|
1732
|
+
* Anthropic's API bills and rate-limits by token counts, as tokens represent the
|
|
1733
|
+
* underlying cost to our systems.
|
|
1734
|
+
*
|
|
1735
|
+
* Under the hood, the API transforms requests into a format suitable for the
|
|
1736
|
+
* model. The model's output then goes through a parsing stage before becoming an
|
|
1737
|
+
* API response. As a result, the token counts in `usage` will not match one-to-one
|
|
1738
|
+
* with the exact visible content of an API request or response.
|
|
1739
|
+
*
|
|
1740
|
+
* For example, `output_tokens` will be non-zero, even for an empty string response
|
|
1741
|
+
* from Claude.
|
|
1742
|
+
*
|
|
1743
|
+
* Total input tokens in a request is the summation of `input_tokens`,
|
|
1744
|
+
* `cache_creation_input_tokens`, and `cache_read_input_tokens`.
|
|
1745
|
+
*/
|
|
1746
|
+
usage: BetaMessageDeltaUsage;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
export namespace BetaRawMessageDeltaEvent {
|
|
1750
|
+
export interface Delta {
|
|
1751
|
+
/**
|
|
1752
|
+
* Information about the container used in the request (for the code execution
|
|
1753
|
+
* tool)
|
|
1754
|
+
*/
|
|
1755
|
+
container: BetaMessagesAPI.BetaContainer | null;
|
|
1756
|
+
|
|
1757
|
+
/**
|
|
1758
|
+
* Structured information about a refusal.
|
|
1759
|
+
*/
|
|
1760
|
+
stop_details: BetaMessagesAPI.BetaRefusalStopDetails | null;
|
|
1761
|
+
|
|
1762
|
+
stop_reason: BetaMessagesAPI.BetaStopReason | null;
|
|
1763
|
+
|
|
1764
|
+
stop_sequence: string | null;
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
export interface BetaRawMessageStartEvent {
|
|
1769
|
+
message: BetaMessage;
|
|
1770
|
+
|
|
1771
|
+
type: 'message_start';
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
export interface BetaRawMessageStopEvent {
|
|
1775
|
+
type: 'message_stop';
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
export type BetaRawMessageStreamEvent =
|
|
1779
|
+
| BetaRawMessageStartEvent
|
|
1780
|
+
| BetaRawMessageDeltaEvent
|
|
1781
|
+
| BetaRawMessageStopEvent
|
|
1782
|
+
| BetaRawContentBlockStartEvent
|
|
1783
|
+
| BetaRawContentBlockDeltaEvent
|
|
1784
|
+
| BetaRawContentBlockStopEvent;
|
|
1785
|
+
|
|
1786
|
+
export interface BetaRedactedThinkingBlock {
|
|
1787
|
+
data: string;
|
|
1788
|
+
|
|
1789
|
+
type: 'redacted_thinking';
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
export interface BetaRedactedThinkingBlockParam {
|
|
1793
|
+
data: string;
|
|
1794
|
+
|
|
1795
|
+
type: 'redacted_thinking';
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
/**
|
|
1799
|
+
* Structured information about a refusal.
|
|
1800
|
+
*/
|
|
1801
|
+
export interface BetaRefusalStopDetails {
|
|
1802
|
+
/**
|
|
1803
|
+
* The policy category that triggered the refusal.
|
|
1804
|
+
*
|
|
1805
|
+
* `null` when the refusal doesn't map to a named category.
|
|
1806
|
+
*/
|
|
1807
|
+
category: 'cyber' | 'bio' | null;
|
|
1808
|
+
|
|
1809
|
+
/**
|
|
1810
|
+
* Human-readable explanation of the refusal.
|
|
1811
|
+
*
|
|
1812
|
+
* This text is not guaranteed to be stable. `null` when no explanation is
|
|
1813
|
+
* available for the category.
|
|
1814
|
+
*/
|
|
1815
|
+
explanation: string | null;
|
|
1816
|
+
|
|
1817
|
+
type: 'refusal';
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
export interface BetaRequestDocumentBlock {
|
|
1821
|
+
source:
|
|
1822
|
+
| BetaBase64PDFSource
|
|
1823
|
+
| BetaPlainTextSource
|
|
1824
|
+
| BetaContentBlockSource
|
|
1825
|
+
| BetaURLPDFSource
|
|
1826
|
+
| BetaFileDocumentSource;
|
|
1827
|
+
|
|
1828
|
+
type: 'document';
|
|
1829
|
+
|
|
1830
|
+
/**
|
|
1831
|
+
* Create a cache control breakpoint at this content block.
|
|
1832
|
+
*/
|
|
1833
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
1834
|
+
|
|
1835
|
+
citations?: BetaCitationsConfigParam | null;
|
|
1836
|
+
|
|
1837
|
+
context?: string | null;
|
|
1838
|
+
|
|
1839
|
+
title?: string | null;
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
export interface BetaRequestMCPServerToolConfiguration {
|
|
1843
|
+
allowed_tools?: Array<string> | null;
|
|
1844
|
+
|
|
1845
|
+
enabled?: boolean | null;
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
export interface BetaRequestMCPServerURLDefinition {
|
|
1849
|
+
name: string;
|
|
1850
|
+
|
|
1851
|
+
type: 'url';
|
|
1852
|
+
|
|
1853
|
+
url: string;
|
|
1854
|
+
|
|
1855
|
+
authorization_token?: string | null;
|
|
1856
|
+
|
|
1857
|
+
tool_configuration?: BetaRequestMCPServerToolConfiguration | null;
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
export interface BetaRequestMCPToolResultBlockParam {
|
|
1861
|
+
tool_use_id: string;
|
|
1862
|
+
|
|
1863
|
+
type: 'mcp_tool_result';
|
|
1864
|
+
|
|
1865
|
+
/**
|
|
1866
|
+
* Create a cache control breakpoint at this content block.
|
|
1867
|
+
*/
|
|
1868
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
1869
|
+
|
|
1870
|
+
content?: string | Array<BetaTextBlockParam>;
|
|
1871
|
+
|
|
1872
|
+
is_error?: boolean;
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
export interface BetaSearchResultBlockParam {
|
|
1876
|
+
content: Array<BetaTextBlockParam>;
|
|
1877
|
+
|
|
1878
|
+
source: string;
|
|
1879
|
+
|
|
1880
|
+
title: string;
|
|
1881
|
+
|
|
1882
|
+
type: 'search_result';
|
|
1883
|
+
|
|
1884
|
+
/**
|
|
1885
|
+
* Create a cache control breakpoint at this content block.
|
|
1886
|
+
*/
|
|
1887
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
1888
|
+
|
|
1889
|
+
citations?: BetaCitationsConfigParam;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
/**
|
|
1893
|
+
* Tool invocation generated by a server-side tool.
|
|
1894
|
+
*/
|
|
1895
|
+
export interface BetaServerToolCaller {
|
|
1896
|
+
tool_id: string;
|
|
1897
|
+
|
|
1898
|
+
type: 'code_execution_20250825';
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
export interface BetaServerToolCaller20260120 {
|
|
1902
|
+
tool_id: string;
|
|
1903
|
+
|
|
1904
|
+
type: 'code_execution_20260120';
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
export interface BetaServerToolUsage {
|
|
1908
|
+
/**
|
|
1909
|
+
* The number of web fetch tool requests.
|
|
1910
|
+
*/
|
|
1911
|
+
web_fetch_requests: number;
|
|
1912
|
+
|
|
1913
|
+
/**
|
|
1914
|
+
* The number of web search tool requests.
|
|
1915
|
+
*/
|
|
1916
|
+
web_search_requests: number;
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
export interface BetaServerToolUseBlock {
|
|
1920
|
+
id: string;
|
|
1921
|
+
|
|
1922
|
+
input: { [key: string]: unknown };
|
|
1923
|
+
|
|
1924
|
+
name:
|
|
1925
|
+
| 'web_search'
|
|
1926
|
+
| 'web_fetch'
|
|
1927
|
+
| 'code_execution'
|
|
1928
|
+
| 'bash_code_execution'
|
|
1929
|
+
| 'text_editor_code_execution'
|
|
1930
|
+
| 'tool_search_tool_regex'
|
|
1931
|
+
| 'tool_search_tool_bm25';
|
|
1932
|
+
|
|
1933
|
+
type: 'server_tool_use';
|
|
1934
|
+
|
|
1935
|
+
/**
|
|
1936
|
+
* Tool invocation directly from the model.
|
|
1937
|
+
*/
|
|
1938
|
+
caller?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller20260120;
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
export interface BetaServerToolUseBlockParam {
|
|
1942
|
+
id: string;
|
|
1943
|
+
|
|
1944
|
+
input: unknown;
|
|
1945
|
+
|
|
1946
|
+
name:
|
|
1947
|
+
| 'web_search'
|
|
1948
|
+
| 'web_fetch'
|
|
1949
|
+
| 'code_execution'
|
|
1950
|
+
| 'bash_code_execution'
|
|
1951
|
+
| 'text_editor_code_execution'
|
|
1952
|
+
| 'tool_search_tool_regex'
|
|
1953
|
+
| 'tool_search_tool_bm25';
|
|
1954
|
+
|
|
1955
|
+
type: 'server_tool_use';
|
|
1956
|
+
|
|
1957
|
+
/**
|
|
1958
|
+
* Create a cache control breakpoint at this content block.
|
|
1959
|
+
*/
|
|
1960
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
1961
|
+
|
|
1962
|
+
/**
|
|
1963
|
+
* Tool invocation directly from the model.
|
|
1964
|
+
*/
|
|
1965
|
+
caller?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller20260120;
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
export interface BetaSignatureDelta {
|
|
1969
|
+
signature: string;
|
|
1970
|
+
|
|
1971
|
+
type: 'signature_delta';
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
/**
|
|
1975
|
+
* A skill that was loaded in a container (response model).
|
|
1976
|
+
*/
|
|
1977
|
+
export interface BetaSkill {
|
|
1978
|
+
/**
|
|
1979
|
+
* Skill ID
|
|
1980
|
+
*/
|
|
1981
|
+
skill_id: string;
|
|
1982
|
+
|
|
1983
|
+
/**
|
|
1984
|
+
* Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
|
|
1985
|
+
*/
|
|
1986
|
+
type: 'anthropic' | 'custom';
|
|
1987
|
+
|
|
1988
|
+
/**
|
|
1989
|
+
* Skill version or 'latest' for most recent version
|
|
1990
|
+
*/
|
|
1991
|
+
version: string;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
/**
|
|
1995
|
+
* Specification for a skill to be loaded in a container (request model).
|
|
1996
|
+
*/
|
|
1997
|
+
export interface BetaSkillParams {
|
|
1998
|
+
/**
|
|
1999
|
+
* Skill ID
|
|
2000
|
+
*/
|
|
2001
|
+
skill_id: string;
|
|
2002
|
+
|
|
2003
|
+
/**
|
|
2004
|
+
* Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
|
|
2005
|
+
*/
|
|
2006
|
+
type: 'anthropic' | 'custom';
|
|
2007
|
+
|
|
2008
|
+
/**
|
|
2009
|
+
* Skill version or 'latest' for most recent version
|
|
2010
|
+
*/
|
|
2011
|
+
version?: string;
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
export type BetaStopReason =
|
|
2015
|
+
| 'end_turn'
|
|
2016
|
+
| 'max_tokens'
|
|
2017
|
+
| 'stop_sequence'
|
|
2018
|
+
| 'tool_use'
|
|
2019
|
+
| 'pause_turn'
|
|
2020
|
+
| 'compaction'
|
|
2021
|
+
| 'refusal'
|
|
2022
|
+
| 'model_context_window_exceeded';
|
|
2023
|
+
|
|
2024
|
+
export interface BetaTextBlock {
|
|
2025
|
+
/**
|
|
2026
|
+
* Citations supporting the text block.
|
|
2027
|
+
*
|
|
2028
|
+
* The type of citation returned will depend on the type of document being cited.
|
|
2029
|
+
* Citing a PDF results in `page_location`, plain text results in `char_location`,
|
|
2030
|
+
* and content document results in `content_block_location`.
|
|
2031
|
+
*/
|
|
2032
|
+
citations: Array<BetaTextCitation> | null;
|
|
2033
|
+
|
|
2034
|
+
text: string;
|
|
2035
|
+
|
|
2036
|
+
type: 'text';
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
export interface BetaTextBlockParam {
|
|
2040
|
+
text: string;
|
|
2041
|
+
|
|
2042
|
+
type: 'text';
|
|
2043
|
+
|
|
2044
|
+
/**
|
|
2045
|
+
* Create a cache control breakpoint at this content block.
|
|
2046
|
+
*/
|
|
2047
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2048
|
+
|
|
2049
|
+
citations?: Array<BetaTextCitationParam> | null;
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
export type BetaTextCitation =
|
|
2053
|
+
| BetaCitationCharLocation
|
|
2054
|
+
| BetaCitationPageLocation
|
|
2055
|
+
| BetaCitationContentBlockLocation
|
|
2056
|
+
| BetaCitationsWebSearchResultLocation
|
|
2057
|
+
| BetaCitationSearchResultLocation;
|
|
2058
|
+
|
|
2059
|
+
export type BetaTextCitationParam =
|
|
2060
|
+
| BetaCitationCharLocationParam
|
|
2061
|
+
| BetaCitationPageLocationParam
|
|
2062
|
+
| BetaCitationContentBlockLocationParam
|
|
2063
|
+
| BetaCitationWebSearchResultLocationParam
|
|
2064
|
+
| BetaCitationSearchResultLocationParam;
|
|
2065
|
+
|
|
2066
|
+
export interface BetaTextDelta {
|
|
2067
|
+
text: string;
|
|
2068
|
+
|
|
2069
|
+
type: 'text_delta';
|
|
2070
|
+
}
|
|
2071
|
+
|
|
2072
|
+
export interface BetaTextEditorCodeExecutionCreateResultBlock {
|
|
2073
|
+
is_file_update: boolean;
|
|
2074
|
+
|
|
2075
|
+
type: 'text_editor_code_execution_create_result';
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
export interface BetaTextEditorCodeExecutionCreateResultBlockParam {
|
|
2079
|
+
is_file_update: boolean;
|
|
2080
|
+
|
|
2081
|
+
type: 'text_editor_code_execution_create_result';
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
export interface BetaTextEditorCodeExecutionStrReplaceResultBlock {
|
|
2085
|
+
lines: Array<string> | null;
|
|
2086
|
+
|
|
2087
|
+
new_lines: number | null;
|
|
2088
|
+
|
|
2089
|
+
new_start: number | null;
|
|
2090
|
+
|
|
2091
|
+
old_lines: number | null;
|
|
2092
|
+
|
|
2093
|
+
old_start: number | null;
|
|
2094
|
+
|
|
2095
|
+
type: 'text_editor_code_execution_str_replace_result';
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
export interface BetaTextEditorCodeExecutionStrReplaceResultBlockParam {
|
|
2099
|
+
type: 'text_editor_code_execution_str_replace_result';
|
|
2100
|
+
|
|
2101
|
+
lines?: Array<string> | null;
|
|
2102
|
+
|
|
2103
|
+
new_lines?: number | null;
|
|
2104
|
+
|
|
2105
|
+
new_start?: number | null;
|
|
2106
|
+
|
|
2107
|
+
old_lines?: number | null;
|
|
2108
|
+
|
|
2109
|
+
old_start?: number | null;
|
|
2110
|
+
}
|
|
2111
|
+
|
|
2112
|
+
export interface BetaTextEditorCodeExecutionToolResultBlock {
|
|
2113
|
+
content:
|
|
2114
|
+
| BetaTextEditorCodeExecutionToolResultError
|
|
2115
|
+
| BetaTextEditorCodeExecutionViewResultBlock
|
|
2116
|
+
| BetaTextEditorCodeExecutionCreateResultBlock
|
|
2117
|
+
| BetaTextEditorCodeExecutionStrReplaceResultBlock;
|
|
2118
|
+
|
|
2119
|
+
tool_use_id: string;
|
|
2120
|
+
|
|
2121
|
+
type: 'text_editor_code_execution_tool_result';
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
export interface BetaTextEditorCodeExecutionToolResultBlockParam {
|
|
2125
|
+
content:
|
|
2126
|
+
| BetaTextEditorCodeExecutionToolResultErrorParam
|
|
2127
|
+
| BetaTextEditorCodeExecutionViewResultBlockParam
|
|
2128
|
+
| BetaTextEditorCodeExecutionCreateResultBlockParam
|
|
2129
|
+
| BetaTextEditorCodeExecutionStrReplaceResultBlockParam;
|
|
2130
|
+
|
|
2131
|
+
tool_use_id: string;
|
|
2132
|
+
|
|
2133
|
+
type: 'text_editor_code_execution_tool_result';
|
|
2134
|
+
|
|
2135
|
+
/**
|
|
2136
|
+
* Create a cache control breakpoint at this content block.
|
|
2137
|
+
*/
|
|
2138
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2139
|
+
}
|
|
2140
|
+
|
|
2141
|
+
export interface BetaTextEditorCodeExecutionToolResultError {
|
|
2142
|
+
error_code:
|
|
2143
|
+
| 'invalid_tool_input'
|
|
2144
|
+
| 'unavailable'
|
|
2145
|
+
| 'too_many_requests'
|
|
2146
|
+
| 'execution_time_exceeded'
|
|
2147
|
+
| 'file_not_found';
|
|
2148
|
+
|
|
2149
|
+
error_message: string | null;
|
|
2150
|
+
|
|
2151
|
+
type: 'text_editor_code_execution_tool_result_error';
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
export interface BetaTextEditorCodeExecutionToolResultErrorParam {
|
|
2155
|
+
error_code:
|
|
2156
|
+
| 'invalid_tool_input'
|
|
2157
|
+
| 'unavailable'
|
|
2158
|
+
| 'too_many_requests'
|
|
2159
|
+
| 'execution_time_exceeded'
|
|
2160
|
+
| 'file_not_found';
|
|
2161
|
+
|
|
2162
|
+
type: 'text_editor_code_execution_tool_result_error';
|
|
2163
|
+
|
|
2164
|
+
error_message?: string | null;
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
export interface BetaTextEditorCodeExecutionViewResultBlock {
|
|
2168
|
+
content: string;
|
|
2169
|
+
|
|
2170
|
+
file_type: 'text' | 'image' | 'pdf';
|
|
2171
|
+
|
|
2172
|
+
num_lines: number | null;
|
|
2173
|
+
|
|
2174
|
+
start_line: number | null;
|
|
2175
|
+
|
|
2176
|
+
total_lines: number | null;
|
|
2177
|
+
|
|
2178
|
+
type: 'text_editor_code_execution_view_result';
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
export interface BetaTextEditorCodeExecutionViewResultBlockParam {
|
|
2182
|
+
content: string;
|
|
2183
|
+
|
|
2184
|
+
file_type: 'text' | 'image' | 'pdf';
|
|
2185
|
+
|
|
2186
|
+
type: 'text_editor_code_execution_view_result';
|
|
2187
|
+
|
|
2188
|
+
num_lines?: number | null;
|
|
2189
|
+
|
|
2190
|
+
start_line?: number | null;
|
|
2191
|
+
|
|
2192
|
+
total_lines?: number | null;
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
export interface BetaThinkingBlock {
|
|
2196
|
+
signature: string;
|
|
2197
|
+
|
|
2198
|
+
thinking: string;
|
|
2199
|
+
|
|
2200
|
+
type: 'thinking';
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
export interface BetaThinkingBlockParam {
|
|
2204
|
+
signature: string;
|
|
2205
|
+
|
|
2206
|
+
thinking: string;
|
|
2207
|
+
|
|
2208
|
+
type: 'thinking';
|
|
2209
|
+
}
|
|
2210
|
+
|
|
2211
|
+
export interface BetaThinkingConfigAdaptive {
|
|
2212
|
+
type: 'adaptive';
|
|
2213
|
+
|
|
2214
|
+
/**
|
|
2215
|
+
* Controls how thinking content appears in the response. When set to `summarized`,
|
|
2216
|
+
* thinking is returned normally. When set to `omitted`, thinking content is
|
|
2217
|
+
* redacted but a signature is returned for multi-turn continuity. Defaults to
|
|
2218
|
+
* `summarized`.
|
|
2219
|
+
*/
|
|
2220
|
+
display?: 'summarized' | 'omitted' | null;
|
|
2221
|
+
}
|
|
2222
|
+
|
|
2223
|
+
export interface BetaThinkingConfigDisabled {
|
|
2224
|
+
type: 'disabled';
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
export interface BetaThinkingConfigEnabled {
|
|
2228
|
+
/**
|
|
2229
|
+
* Determines how many tokens Claude can use for its internal reasoning process.
|
|
2230
|
+
* Larger budgets can enable more thorough analysis for complex problems, improving
|
|
2231
|
+
* response quality.
|
|
2232
|
+
*
|
|
2233
|
+
* Must be ≥1024 and less than `max_tokens`.
|
|
2234
|
+
*
|
|
2235
|
+
* See
|
|
2236
|
+
* [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
|
|
2237
|
+
* for details.
|
|
2238
|
+
*/
|
|
2239
|
+
budget_tokens: number;
|
|
2240
|
+
|
|
2241
|
+
type: 'enabled';
|
|
2242
|
+
|
|
2243
|
+
/**
|
|
2244
|
+
* Controls how thinking content appears in the response. When set to `summarized`,
|
|
2245
|
+
* thinking is returned normally. When set to `omitted`, thinking content is
|
|
2246
|
+
* redacted but a signature is returned for multi-turn continuity. Defaults to
|
|
2247
|
+
* `summarized`.
|
|
2248
|
+
*/
|
|
2249
|
+
display?: 'summarized' | 'omitted' | null;
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
/**
|
|
2253
|
+
* Configuration for enabling Claude's extended thinking.
|
|
2254
|
+
*
|
|
2255
|
+
* When enabled, responses include `thinking` content blocks showing Claude's
|
|
2256
|
+
* thinking process before the final answer. Requires a minimum budget of 1,024
|
|
2257
|
+
* tokens and counts towards your `max_tokens` limit.
|
|
2258
|
+
*
|
|
2259
|
+
* See
|
|
2260
|
+
* [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
|
|
2261
|
+
* for details.
|
|
2262
|
+
*/
|
|
2263
|
+
export type BetaThinkingConfigParam =
|
|
2264
|
+
| BetaThinkingConfigEnabled
|
|
2265
|
+
| BetaThinkingConfigDisabled
|
|
2266
|
+
| BetaThinkingConfigAdaptive;
|
|
2267
|
+
|
|
2268
|
+
export interface BetaThinkingDelta {
|
|
2269
|
+
thinking: string;
|
|
2270
|
+
|
|
2271
|
+
type: 'thinking_delta';
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2274
|
+
export interface BetaThinkingTurns {
|
|
2275
|
+
type: 'thinking_turns';
|
|
2276
|
+
|
|
2277
|
+
value: number;
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
export interface BetaTool {
|
|
2281
|
+
/**
|
|
2282
|
+
* [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
|
|
2283
|
+
*
|
|
2284
|
+
* This defines the shape of the `input` that your tool accepts and that the model
|
|
2285
|
+
* will produce.
|
|
2286
|
+
*/
|
|
2287
|
+
input_schema: BetaTool.InputSchema;
|
|
2288
|
+
|
|
2289
|
+
/**
|
|
2290
|
+
* Name of the tool.
|
|
2291
|
+
*
|
|
2292
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
2293
|
+
*/
|
|
2294
|
+
name: string;
|
|
2295
|
+
|
|
2296
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
2297
|
+
|
|
2298
|
+
/**
|
|
2299
|
+
* Create a cache control breakpoint at this content block.
|
|
2300
|
+
*/
|
|
2301
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2302
|
+
|
|
2303
|
+
/**
|
|
2304
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
2305
|
+
* returned via tool_reference from tool search.
|
|
2306
|
+
*/
|
|
2307
|
+
defer_loading?: boolean;
|
|
2308
|
+
|
|
2309
|
+
/**
|
|
2310
|
+
* Description of what this tool does.
|
|
2311
|
+
*
|
|
2312
|
+
* Tool descriptions should be as detailed as possible. The more information that
|
|
2313
|
+
* the model has about what the tool is and how to use it, the better it will
|
|
2314
|
+
* perform. You can use natural language descriptions to reinforce important
|
|
2315
|
+
* aspects of the tool input JSON schema.
|
|
2316
|
+
*/
|
|
2317
|
+
description?: string;
|
|
2318
|
+
|
|
2319
|
+
/**
|
|
2320
|
+
* Enable eager input streaming for this tool. When true, tool input parameters
|
|
2321
|
+
* will be streamed incrementally as they are generated, and types will be inferred
|
|
2322
|
+
* on-the-fly rather than buffering the full JSON output. When false, streaming is
|
|
2323
|
+
* disabled for this tool even if the fine-grained-tool-streaming beta is active.
|
|
2324
|
+
* When null (default), uses the default behavior based on beta headers.
|
|
2325
|
+
*/
|
|
2326
|
+
eager_input_streaming?: boolean | null;
|
|
2327
|
+
|
|
2328
|
+
input_examples?: Array<{ [key: string]: unknown }>;
|
|
2329
|
+
|
|
2330
|
+
/**
|
|
2331
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
2332
|
+
*/
|
|
2333
|
+
strict?: boolean;
|
|
2334
|
+
|
|
2335
|
+
type?: 'custom' | null;
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
export namespace BetaTool {
|
|
2339
|
+
/**
|
|
2340
|
+
* [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
|
|
2341
|
+
*
|
|
2342
|
+
* This defines the shape of the `input` that your tool accepts and that the model
|
|
2343
|
+
* will produce.
|
|
2344
|
+
*/
|
|
2345
|
+
export interface InputSchema {
|
|
2346
|
+
type: 'object';
|
|
2347
|
+
|
|
2348
|
+
properties?: unknown | null;
|
|
2349
|
+
|
|
2350
|
+
required?: string[] | readonly string[] | null;
|
|
2351
|
+
|
|
2352
|
+
[k: string]: unknown;
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
export interface BetaToolBash20241022 {
|
|
2357
|
+
/**
|
|
2358
|
+
* Name of the tool.
|
|
2359
|
+
*
|
|
2360
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
2361
|
+
*/
|
|
2362
|
+
name: 'bash';
|
|
2363
|
+
|
|
2364
|
+
type: 'bash_20241022';
|
|
2365
|
+
|
|
2366
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
2367
|
+
|
|
2368
|
+
/**
|
|
2369
|
+
* Create a cache control breakpoint at this content block.
|
|
2370
|
+
*/
|
|
2371
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2372
|
+
|
|
2373
|
+
/**
|
|
2374
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
2375
|
+
* returned via tool_reference from tool search.
|
|
2376
|
+
*/
|
|
2377
|
+
defer_loading?: boolean;
|
|
2378
|
+
|
|
2379
|
+
input_examples?: Array<{ [key: string]: unknown }>;
|
|
2380
|
+
|
|
2381
|
+
/**
|
|
2382
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
2383
|
+
*/
|
|
2384
|
+
strict?: boolean;
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
export interface BetaToolBash20250124 {
|
|
2388
|
+
/**
|
|
2389
|
+
* Name of the tool.
|
|
2390
|
+
*
|
|
2391
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
2392
|
+
*/
|
|
2393
|
+
name: 'bash';
|
|
2394
|
+
|
|
2395
|
+
type: 'bash_20250124';
|
|
2396
|
+
|
|
2397
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
2398
|
+
|
|
2399
|
+
/**
|
|
2400
|
+
* Create a cache control breakpoint at this content block.
|
|
2401
|
+
*/
|
|
2402
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2403
|
+
|
|
2404
|
+
/**
|
|
2405
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
2406
|
+
* returned via tool_reference from tool search.
|
|
2407
|
+
*/
|
|
2408
|
+
defer_loading?: boolean;
|
|
2409
|
+
|
|
2410
|
+
input_examples?: Array<{ [key: string]: unknown }>;
|
|
2411
|
+
|
|
2412
|
+
/**
|
|
2413
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
2414
|
+
*/
|
|
2415
|
+
strict?: boolean;
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
/**
|
|
2419
|
+
* How the model should use the provided tools. The model can use a specific tool,
|
|
2420
|
+
* any available tool, decide by itself, or not use tools at all.
|
|
2421
|
+
*/
|
|
2422
|
+
export type BetaToolChoice = BetaToolChoiceAuto | BetaToolChoiceAny | BetaToolChoiceTool | BetaToolChoiceNone;
|
|
2423
|
+
|
|
2424
|
+
/**
|
|
2425
|
+
* The model will use any available tools.
|
|
2426
|
+
*/
|
|
2427
|
+
export interface BetaToolChoiceAny {
|
|
2428
|
+
type: 'any';
|
|
2429
|
+
|
|
2430
|
+
/**
|
|
2431
|
+
* Whether to disable parallel tool use.
|
|
2432
|
+
*
|
|
2433
|
+
* Defaults to `false`. If set to `true`, the model will output exactly one tool
|
|
2434
|
+
* use.
|
|
2435
|
+
*/
|
|
2436
|
+
disable_parallel_tool_use?: boolean;
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
/**
|
|
2440
|
+
* The model will automatically decide whether to use tools.
|
|
2441
|
+
*/
|
|
2442
|
+
export interface BetaToolChoiceAuto {
|
|
2443
|
+
type: 'auto';
|
|
2444
|
+
|
|
2445
|
+
/**
|
|
2446
|
+
* Whether to disable parallel tool use.
|
|
2447
|
+
*
|
|
2448
|
+
* Defaults to `false`. If set to `true`, the model will output at most one tool
|
|
2449
|
+
* use.
|
|
2450
|
+
*/
|
|
2451
|
+
disable_parallel_tool_use?: boolean;
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
/**
|
|
2455
|
+
* The model will not be allowed to use tools.
|
|
2456
|
+
*/
|
|
2457
|
+
export interface BetaToolChoiceNone {
|
|
2458
|
+
type: 'none';
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
/**
|
|
2462
|
+
* The model will use the specified tool with `tool_choice.name`.
|
|
2463
|
+
*/
|
|
2464
|
+
export interface BetaToolChoiceTool {
|
|
2465
|
+
/**
|
|
2466
|
+
* The name of the tool to use.
|
|
2467
|
+
*/
|
|
2468
|
+
name: string;
|
|
2469
|
+
|
|
2470
|
+
type: 'tool';
|
|
2471
|
+
|
|
2472
|
+
/**
|
|
2473
|
+
* Whether to disable parallel tool use.
|
|
2474
|
+
*
|
|
2475
|
+
* Defaults to `false`. If set to `true`, the model will output exactly one tool
|
|
2476
|
+
* use.
|
|
2477
|
+
*/
|
|
2478
|
+
disable_parallel_tool_use?: boolean;
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
export interface BetaToolComputerUse20241022 {
|
|
2482
|
+
/**
|
|
2483
|
+
* The height of the display in pixels.
|
|
2484
|
+
*/
|
|
2485
|
+
display_height_px: number;
|
|
2486
|
+
|
|
2487
|
+
/**
|
|
2488
|
+
* The width of the display in pixels.
|
|
2489
|
+
*/
|
|
2490
|
+
display_width_px: number;
|
|
2491
|
+
|
|
2492
|
+
/**
|
|
2493
|
+
* Name of the tool.
|
|
2494
|
+
*
|
|
2495
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
2496
|
+
*/
|
|
2497
|
+
name: 'computer';
|
|
2498
|
+
|
|
2499
|
+
type: 'computer_20241022';
|
|
2500
|
+
|
|
2501
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
2502
|
+
|
|
2503
|
+
/**
|
|
2504
|
+
* Create a cache control breakpoint at this content block.
|
|
2505
|
+
*/
|
|
2506
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2507
|
+
|
|
2508
|
+
/**
|
|
2509
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
2510
|
+
* returned via tool_reference from tool search.
|
|
2511
|
+
*/
|
|
2512
|
+
defer_loading?: boolean;
|
|
2513
|
+
|
|
2514
|
+
/**
|
|
2515
|
+
* The X11 display number (e.g. 0, 1) for the display.
|
|
2516
|
+
*/
|
|
2517
|
+
display_number?: number | null;
|
|
2518
|
+
|
|
2519
|
+
input_examples?: Array<{ [key: string]: unknown }>;
|
|
2520
|
+
|
|
2521
|
+
/**
|
|
2522
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
2523
|
+
*/
|
|
2524
|
+
strict?: boolean;
|
|
2525
|
+
}
|
|
2526
|
+
|
|
2527
|
+
export interface BetaToolComputerUse20250124 {
|
|
2528
|
+
/**
|
|
2529
|
+
* The height of the display in pixels.
|
|
2530
|
+
*/
|
|
2531
|
+
display_height_px: number;
|
|
2532
|
+
|
|
2533
|
+
/**
|
|
2534
|
+
* The width of the display in pixels.
|
|
2535
|
+
*/
|
|
2536
|
+
display_width_px: number;
|
|
2537
|
+
|
|
2538
|
+
/**
|
|
2539
|
+
* Name of the tool.
|
|
2540
|
+
*
|
|
2541
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
2542
|
+
*/
|
|
2543
|
+
name: 'computer';
|
|
2544
|
+
|
|
2545
|
+
type: 'computer_20250124';
|
|
2546
|
+
|
|
2547
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
2548
|
+
|
|
2549
|
+
/**
|
|
2550
|
+
* Create a cache control breakpoint at this content block.
|
|
2551
|
+
*/
|
|
2552
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2553
|
+
|
|
2554
|
+
/**
|
|
2555
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
2556
|
+
* returned via tool_reference from tool search.
|
|
2557
|
+
*/
|
|
2558
|
+
defer_loading?: boolean;
|
|
2559
|
+
|
|
2560
|
+
/**
|
|
2561
|
+
* The X11 display number (e.g. 0, 1) for the display.
|
|
2562
|
+
*/
|
|
2563
|
+
display_number?: number | null;
|
|
2564
|
+
|
|
2565
|
+
input_examples?: Array<{ [key: string]: unknown }>;
|
|
2566
|
+
|
|
2567
|
+
/**
|
|
2568
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
2569
|
+
*/
|
|
2570
|
+
strict?: boolean;
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
export interface BetaToolComputerUse20251124 {
|
|
2574
|
+
/**
|
|
2575
|
+
* The height of the display in pixels.
|
|
2576
|
+
*/
|
|
2577
|
+
display_height_px: number;
|
|
2578
|
+
|
|
2579
|
+
/**
|
|
2580
|
+
* The width of the display in pixels.
|
|
2581
|
+
*/
|
|
2582
|
+
display_width_px: number;
|
|
2583
|
+
|
|
2584
|
+
/**
|
|
2585
|
+
* Name of the tool.
|
|
2586
|
+
*
|
|
2587
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
2588
|
+
*/
|
|
2589
|
+
name: 'computer';
|
|
2590
|
+
|
|
2591
|
+
type: 'computer_20251124';
|
|
2592
|
+
|
|
2593
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
2594
|
+
|
|
2595
|
+
/**
|
|
2596
|
+
* Create a cache control breakpoint at this content block.
|
|
2597
|
+
*/
|
|
2598
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2599
|
+
|
|
2600
|
+
/**
|
|
2601
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
2602
|
+
* returned via tool_reference from tool search.
|
|
2603
|
+
*/
|
|
2604
|
+
defer_loading?: boolean;
|
|
2605
|
+
|
|
2606
|
+
/**
|
|
2607
|
+
* The X11 display number (e.g. 0, 1) for the display.
|
|
2608
|
+
*/
|
|
2609
|
+
display_number?: number | null;
|
|
2610
|
+
|
|
2611
|
+
/**
|
|
2612
|
+
* Whether to enable an action to take a zoomed-in screenshot of the screen.
|
|
2613
|
+
*/
|
|
2614
|
+
enable_zoom?: boolean;
|
|
2615
|
+
|
|
2616
|
+
input_examples?: Array<{ [key: string]: unknown }>;
|
|
2617
|
+
|
|
2618
|
+
/**
|
|
2619
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
2620
|
+
*/
|
|
2621
|
+
strict?: boolean;
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
export interface BetaToolReferenceBlock {
|
|
2625
|
+
tool_name: string;
|
|
2626
|
+
|
|
2627
|
+
type: 'tool_reference';
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2630
|
+
/**
|
|
2631
|
+
* Tool reference block that can be included in tool_result content.
|
|
2632
|
+
*/
|
|
2633
|
+
export interface BetaToolReferenceBlockParam {
|
|
2634
|
+
tool_name: string;
|
|
2635
|
+
|
|
2636
|
+
type: 'tool_reference';
|
|
2637
|
+
|
|
2638
|
+
/**
|
|
2639
|
+
* Create a cache control breakpoint at this content block.
|
|
2640
|
+
*/
|
|
2641
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2644
|
+
export interface BetaToolResultBlockParam {
|
|
2645
|
+
tool_use_id: string;
|
|
2646
|
+
|
|
2647
|
+
type: 'tool_result';
|
|
2648
|
+
|
|
2649
|
+
/**
|
|
2650
|
+
* Create a cache control breakpoint at this content block.
|
|
2651
|
+
*/
|
|
2652
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2653
|
+
|
|
2654
|
+
content?:
|
|
2655
|
+
| string
|
|
2656
|
+
| Array<
|
|
2657
|
+
| BetaTextBlockParam
|
|
2658
|
+
| BetaImageBlockParam
|
|
2659
|
+
| BetaSearchResultBlockParam
|
|
2660
|
+
| BetaRequestDocumentBlock
|
|
2661
|
+
| BetaToolReferenceBlockParam
|
|
2662
|
+
>;
|
|
2663
|
+
|
|
2664
|
+
is_error?: boolean;
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2667
|
+
export interface BetaToolSearchToolBm25_20251119 {
|
|
2668
|
+
/**
|
|
2669
|
+
* Name of the tool.
|
|
2670
|
+
*
|
|
2671
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
2672
|
+
*/
|
|
2673
|
+
name: 'tool_search_tool_bm25';
|
|
2674
|
+
|
|
2675
|
+
type: 'tool_search_tool_bm25_20251119' | 'tool_search_tool_bm25';
|
|
2676
|
+
|
|
2677
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
2678
|
+
|
|
2679
|
+
/**
|
|
2680
|
+
* Create a cache control breakpoint at this content block.
|
|
2681
|
+
*/
|
|
2682
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2683
|
+
|
|
2684
|
+
/**
|
|
2685
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
2686
|
+
* returned via tool_reference from tool search.
|
|
2687
|
+
*/
|
|
2688
|
+
defer_loading?: boolean;
|
|
2689
|
+
|
|
2690
|
+
/**
|
|
2691
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
2692
|
+
*/
|
|
2693
|
+
strict?: boolean;
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2696
|
+
export interface BetaToolSearchToolRegex20251119 {
|
|
2697
|
+
/**
|
|
2698
|
+
* Name of the tool.
|
|
2699
|
+
*
|
|
2700
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
2701
|
+
*/
|
|
2702
|
+
name: 'tool_search_tool_regex';
|
|
2703
|
+
|
|
2704
|
+
type: 'tool_search_tool_regex_20251119' | 'tool_search_tool_regex';
|
|
2705
|
+
|
|
2706
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
2707
|
+
|
|
2708
|
+
/**
|
|
2709
|
+
* Create a cache control breakpoint at this content block.
|
|
2710
|
+
*/
|
|
2711
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2712
|
+
|
|
2713
|
+
/**
|
|
2714
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
2715
|
+
* returned via tool_reference from tool search.
|
|
2716
|
+
*/
|
|
2717
|
+
defer_loading?: boolean;
|
|
2718
|
+
|
|
2719
|
+
/**
|
|
2720
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
2721
|
+
*/
|
|
2722
|
+
strict?: boolean;
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
export interface BetaToolSearchToolResultBlock {
|
|
2726
|
+
content: BetaToolSearchToolResultError | BetaToolSearchToolSearchResultBlock;
|
|
2727
|
+
|
|
2728
|
+
tool_use_id: string;
|
|
2729
|
+
|
|
2730
|
+
type: 'tool_search_tool_result';
|
|
2731
|
+
}
|
|
2732
|
+
|
|
2733
|
+
export interface BetaToolSearchToolResultBlockParam {
|
|
2734
|
+
content: BetaToolSearchToolResultErrorParam | BetaToolSearchToolSearchResultBlockParam;
|
|
2735
|
+
|
|
2736
|
+
tool_use_id: string;
|
|
2737
|
+
|
|
2738
|
+
type: 'tool_search_tool_result';
|
|
2739
|
+
|
|
2740
|
+
/**
|
|
2741
|
+
* Create a cache control breakpoint at this content block.
|
|
2742
|
+
*/
|
|
2743
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
export interface BetaToolSearchToolResultError {
|
|
2747
|
+
error_code: 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded';
|
|
2748
|
+
|
|
2749
|
+
error_message: string | null;
|
|
2750
|
+
|
|
2751
|
+
type: 'tool_search_tool_result_error';
|
|
2752
|
+
}
|
|
2753
|
+
|
|
2754
|
+
export interface BetaToolSearchToolResultErrorParam {
|
|
2755
|
+
error_code: 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded';
|
|
2756
|
+
|
|
2757
|
+
type: 'tool_search_tool_result_error';
|
|
2758
|
+
}
|
|
2759
|
+
|
|
2760
|
+
export interface BetaToolSearchToolSearchResultBlock {
|
|
2761
|
+
tool_references: Array<BetaToolReferenceBlock>;
|
|
2762
|
+
|
|
2763
|
+
type: 'tool_search_tool_search_result';
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2766
|
+
export interface BetaToolSearchToolSearchResultBlockParam {
|
|
2767
|
+
tool_references: Array<BetaToolReferenceBlockParam>;
|
|
2768
|
+
|
|
2769
|
+
type: 'tool_search_tool_search_result';
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2772
|
+
export type BetaToolResultContentBlockParam = Extract<BetaToolResultBlockParam['content'], any[]>[number];
|
|
2773
|
+
|
|
2774
|
+
export interface BetaToolTextEditor20241022 {
|
|
2775
|
+
/**
|
|
2776
|
+
* Name of the tool.
|
|
2777
|
+
*
|
|
2778
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
2779
|
+
*/
|
|
2780
|
+
name: 'str_replace_editor';
|
|
2781
|
+
|
|
2782
|
+
type: 'text_editor_20241022';
|
|
2783
|
+
|
|
2784
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
2785
|
+
|
|
2786
|
+
/**
|
|
2787
|
+
* Create a cache control breakpoint at this content block.
|
|
2788
|
+
*/
|
|
2789
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2790
|
+
|
|
2791
|
+
/**
|
|
2792
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
2793
|
+
* returned via tool_reference from tool search.
|
|
2794
|
+
*/
|
|
2795
|
+
defer_loading?: boolean;
|
|
2796
|
+
|
|
2797
|
+
input_examples?: Array<{ [key: string]: unknown }>;
|
|
2798
|
+
|
|
2799
|
+
/**
|
|
2800
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
2801
|
+
*/
|
|
2802
|
+
strict?: boolean;
|
|
2803
|
+
}
|
|
2804
|
+
|
|
2805
|
+
export interface BetaToolTextEditor20250124 {
|
|
2806
|
+
/**
|
|
2807
|
+
* Name of the tool.
|
|
2808
|
+
*
|
|
2809
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
2810
|
+
*/
|
|
2811
|
+
name: 'str_replace_editor';
|
|
2812
|
+
|
|
2813
|
+
type: 'text_editor_20250124';
|
|
2814
|
+
|
|
2815
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
2816
|
+
|
|
2817
|
+
/**
|
|
2818
|
+
* Create a cache control breakpoint at this content block.
|
|
2819
|
+
*/
|
|
2820
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2821
|
+
|
|
2822
|
+
/**
|
|
2823
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
2824
|
+
* returned via tool_reference from tool search.
|
|
2825
|
+
*/
|
|
2826
|
+
defer_loading?: boolean;
|
|
2827
|
+
|
|
2828
|
+
input_examples?: Array<{ [key: string]: unknown }>;
|
|
2829
|
+
|
|
2830
|
+
/**
|
|
2831
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
2832
|
+
*/
|
|
2833
|
+
strict?: boolean;
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
export interface BetaToolTextEditor20250429 {
|
|
2837
|
+
/**
|
|
2838
|
+
* Name of the tool.
|
|
2839
|
+
*
|
|
2840
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
2841
|
+
*/
|
|
2842
|
+
name: 'str_replace_based_edit_tool';
|
|
2843
|
+
|
|
2844
|
+
type: 'text_editor_20250429';
|
|
2845
|
+
|
|
2846
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
2847
|
+
|
|
2848
|
+
/**
|
|
2849
|
+
* Create a cache control breakpoint at this content block.
|
|
2850
|
+
*/
|
|
2851
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2852
|
+
|
|
2853
|
+
/**
|
|
2854
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
2855
|
+
* returned via tool_reference from tool search.
|
|
2856
|
+
*/
|
|
2857
|
+
defer_loading?: boolean;
|
|
2858
|
+
|
|
2859
|
+
input_examples?: Array<{ [key: string]: unknown }>;
|
|
2860
|
+
|
|
2861
|
+
/**
|
|
2862
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
2863
|
+
*/
|
|
2864
|
+
strict?: boolean;
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
|
+
export interface BetaToolTextEditor20250728 {
|
|
2868
|
+
/**
|
|
2869
|
+
* Name of the tool.
|
|
2870
|
+
*
|
|
2871
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
2872
|
+
*/
|
|
2873
|
+
name: 'str_replace_based_edit_tool';
|
|
2874
|
+
|
|
2875
|
+
type: 'text_editor_20250728';
|
|
2876
|
+
|
|
2877
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
2878
|
+
|
|
2879
|
+
/**
|
|
2880
|
+
* Create a cache control breakpoint at this content block.
|
|
2881
|
+
*/
|
|
2882
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2883
|
+
|
|
2884
|
+
/**
|
|
2885
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
2886
|
+
* returned via tool_reference from tool search.
|
|
2887
|
+
*/
|
|
2888
|
+
defer_loading?: boolean;
|
|
2889
|
+
|
|
2890
|
+
input_examples?: Array<{ [key: string]: unknown }>;
|
|
2891
|
+
|
|
2892
|
+
/**
|
|
2893
|
+
* Maximum number of characters to display when viewing a file. If not specified,
|
|
2894
|
+
* defaults to displaying the full file.
|
|
2895
|
+
*/
|
|
2896
|
+
max_characters?: number | null;
|
|
2897
|
+
|
|
2898
|
+
/**
|
|
2899
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
2900
|
+
*/
|
|
2901
|
+
strict?: boolean;
|
|
2902
|
+
}
|
|
2903
|
+
|
|
2904
|
+
/**
|
|
2905
|
+
* Code execution tool with REPL state persistence (daemon mode + gVisor
|
|
2906
|
+
* checkpoint).
|
|
2907
|
+
*/
|
|
2908
|
+
export type BetaToolUnion =
|
|
2909
|
+
| BetaTool
|
|
2910
|
+
| BetaToolBash20241022
|
|
2911
|
+
| BetaToolBash20250124
|
|
2912
|
+
| BetaCodeExecutionTool20250522
|
|
2913
|
+
| BetaCodeExecutionTool20250825
|
|
2914
|
+
| BetaCodeExecutionTool20260120
|
|
2915
|
+
| BetaToolComputerUse20241022
|
|
2916
|
+
| BetaMemoryTool20250818
|
|
2917
|
+
| BetaToolComputerUse20250124
|
|
2918
|
+
| BetaToolTextEditor20241022
|
|
2919
|
+
| BetaToolComputerUse20251124
|
|
2920
|
+
| BetaToolTextEditor20250124
|
|
2921
|
+
| BetaToolTextEditor20250429
|
|
2922
|
+
| BetaToolTextEditor20250728
|
|
2923
|
+
| BetaWebSearchTool20250305
|
|
2924
|
+
| BetaWebFetchTool20250910
|
|
2925
|
+
| BetaWebSearchTool20260209
|
|
2926
|
+
| BetaWebFetchTool20260209
|
|
2927
|
+
| BetaWebFetchTool20260309
|
|
2928
|
+
| BetaToolSearchToolBm25_20251119
|
|
2929
|
+
| BetaToolSearchToolRegex20251119
|
|
2930
|
+
| BetaMCPToolset;
|
|
2931
|
+
|
|
2932
|
+
export interface BetaToolUseBlock {
|
|
2933
|
+
id: string;
|
|
2934
|
+
|
|
2935
|
+
input: unknown;
|
|
2936
|
+
|
|
2937
|
+
name: string;
|
|
2938
|
+
|
|
2939
|
+
type: 'tool_use';
|
|
2940
|
+
|
|
2941
|
+
/**
|
|
2942
|
+
* Tool invocation directly from the model.
|
|
2943
|
+
*/
|
|
2944
|
+
caller?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller20260120;
|
|
2945
|
+
}
|
|
2946
|
+
|
|
2947
|
+
export interface BetaToolUseBlockParam {
|
|
2948
|
+
id: string;
|
|
2949
|
+
|
|
2950
|
+
input: unknown;
|
|
2951
|
+
|
|
2952
|
+
name: string;
|
|
2953
|
+
|
|
2954
|
+
type: 'tool_use';
|
|
2955
|
+
|
|
2956
|
+
/**
|
|
2957
|
+
* Create a cache control breakpoint at this content block.
|
|
2958
|
+
*/
|
|
2959
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
2960
|
+
|
|
2961
|
+
/**
|
|
2962
|
+
* Tool invocation directly from the model.
|
|
2963
|
+
*/
|
|
2964
|
+
caller?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller20260120;
|
|
2965
|
+
}
|
|
2966
|
+
|
|
2967
|
+
export interface BetaToolUsesKeep {
|
|
2968
|
+
type: 'tool_uses';
|
|
2969
|
+
|
|
2970
|
+
value: number;
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2973
|
+
export interface BetaToolUsesTrigger {
|
|
2974
|
+
type: 'tool_uses';
|
|
2975
|
+
|
|
2976
|
+
value: number;
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2979
|
+
export interface BetaURLImageSource {
|
|
2980
|
+
type: 'url';
|
|
2981
|
+
|
|
2982
|
+
url: string;
|
|
2983
|
+
}
|
|
2984
|
+
|
|
2985
|
+
export interface BetaURLPDFSource {
|
|
2986
|
+
type: 'url';
|
|
2987
|
+
|
|
2988
|
+
url: string;
|
|
2989
|
+
}
|
|
2990
|
+
|
|
2991
|
+
export interface BetaUsage {
|
|
2992
|
+
/**
|
|
2993
|
+
* Breakdown of cached tokens by TTL
|
|
2994
|
+
*/
|
|
2995
|
+
cache_creation: BetaCacheCreation | null;
|
|
2996
|
+
|
|
2997
|
+
/**
|
|
2998
|
+
* The number of input tokens used to create the cache entry.
|
|
2999
|
+
*/
|
|
3000
|
+
cache_creation_input_tokens: number | null;
|
|
3001
|
+
|
|
3002
|
+
/**
|
|
3003
|
+
* The number of input tokens read from the cache.
|
|
3004
|
+
*/
|
|
3005
|
+
cache_read_input_tokens: number | null;
|
|
3006
|
+
|
|
3007
|
+
/**
|
|
3008
|
+
* The geographic region where inference was performed for this request.
|
|
3009
|
+
*/
|
|
3010
|
+
inference_geo: string | null;
|
|
3011
|
+
|
|
3012
|
+
/**
|
|
3013
|
+
* The number of input tokens which were used.
|
|
3014
|
+
*/
|
|
3015
|
+
input_tokens: number;
|
|
3016
|
+
|
|
3017
|
+
/**
|
|
3018
|
+
* Per-iteration token usage breakdown.
|
|
3019
|
+
*
|
|
3020
|
+
* Each entry represents one sampling iteration, with its own input/output token
|
|
3021
|
+
* counts and cache statistics. This allows you to:
|
|
3022
|
+
*
|
|
3023
|
+
* - Determine which iterations exceeded long context thresholds (>=200k tokens)
|
|
3024
|
+
* - Calculate the true context window size from the last iteration
|
|
3025
|
+
* - Understand token accumulation across server-side tool use loops
|
|
3026
|
+
*/
|
|
3027
|
+
iterations: BetaIterationsUsage | null;
|
|
3028
|
+
|
|
3029
|
+
/**
|
|
3030
|
+
* The number of output tokens which were used.
|
|
3031
|
+
*/
|
|
3032
|
+
output_tokens: number;
|
|
3033
|
+
|
|
3034
|
+
/**
|
|
3035
|
+
* The number of server tool requests.
|
|
3036
|
+
*/
|
|
3037
|
+
server_tool_use: BetaServerToolUsage | null;
|
|
3038
|
+
|
|
3039
|
+
/**
|
|
3040
|
+
* If the request used the priority, standard, or batch tier.
|
|
3041
|
+
*/
|
|
3042
|
+
service_tier: 'standard' | 'priority' | 'batch' | null;
|
|
3043
|
+
|
|
3044
|
+
/**
|
|
3045
|
+
* The inference speed mode used for this request.
|
|
3046
|
+
*/
|
|
3047
|
+
speed: 'standard' | 'fast' | null;
|
|
3048
|
+
}
|
|
3049
|
+
|
|
3050
|
+
export interface BetaUserLocation {
|
|
3051
|
+
type: 'approximate';
|
|
3052
|
+
|
|
3053
|
+
/**
|
|
3054
|
+
* The city of the user.
|
|
3055
|
+
*/
|
|
3056
|
+
city?: string | null;
|
|
3057
|
+
|
|
3058
|
+
/**
|
|
3059
|
+
* The two letter
|
|
3060
|
+
* [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the
|
|
3061
|
+
* user.
|
|
3062
|
+
*/
|
|
3063
|
+
country?: string | null;
|
|
3064
|
+
|
|
3065
|
+
/**
|
|
3066
|
+
* The region of the user.
|
|
3067
|
+
*/
|
|
3068
|
+
region?: string | null;
|
|
3069
|
+
|
|
3070
|
+
/**
|
|
3071
|
+
* The [IANA timezone](https://nodatime.org/TimeZones) of the user.
|
|
3072
|
+
*/
|
|
3073
|
+
timezone?: string | null;
|
|
3074
|
+
}
|
|
3075
|
+
|
|
3076
|
+
export interface BetaWebFetchBlock {
|
|
3077
|
+
content: BetaDocumentBlock;
|
|
3078
|
+
|
|
3079
|
+
/**
|
|
3080
|
+
* ISO 8601 timestamp when the content was retrieved
|
|
3081
|
+
*/
|
|
3082
|
+
retrieved_at: string | null;
|
|
3083
|
+
|
|
3084
|
+
type: 'web_fetch_result';
|
|
3085
|
+
|
|
3086
|
+
/**
|
|
3087
|
+
* Fetched content URL
|
|
3088
|
+
*/
|
|
3089
|
+
url: string;
|
|
3090
|
+
}
|
|
3091
|
+
|
|
3092
|
+
export interface BetaWebFetchBlockParam {
|
|
3093
|
+
content: BetaRequestDocumentBlock;
|
|
3094
|
+
|
|
3095
|
+
type: 'web_fetch_result';
|
|
3096
|
+
|
|
3097
|
+
/**
|
|
3098
|
+
* Fetched content URL
|
|
3099
|
+
*/
|
|
3100
|
+
url: string;
|
|
3101
|
+
|
|
3102
|
+
/**
|
|
3103
|
+
* ISO 8601 timestamp when the content was retrieved
|
|
3104
|
+
*/
|
|
3105
|
+
retrieved_at?: string | null;
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3108
|
+
export interface BetaWebFetchTool20250910 {
|
|
3109
|
+
/**
|
|
3110
|
+
* Name of the tool.
|
|
3111
|
+
*
|
|
3112
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
3113
|
+
*/
|
|
3114
|
+
name: 'web_fetch';
|
|
3115
|
+
|
|
3116
|
+
type: 'web_fetch_20250910';
|
|
3117
|
+
|
|
3118
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
3119
|
+
|
|
3120
|
+
/**
|
|
3121
|
+
* List of domains to allow fetching from
|
|
3122
|
+
*/
|
|
3123
|
+
allowed_domains?: Array<string> | null;
|
|
3124
|
+
|
|
3125
|
+
/**
|
|
3126
|
+
* List of domains to block fetching from
|
|
3127
|
+
*/
|
|
3128
|
+
blocked_domains?: Array<string> | null;
|
|
3129
|
+
|
|
3130
|
+
/**
|
|
3131
|
+
* Create a cache control breakpoint at this content block.
|
|
3132
|
+
*/
|
|
3133
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
3134
|
+
|
|
3135
|
+
/**
|
|
3136
|
+
* Citations configuration for fetched documents. Citations are disabled by
|
|
3137
|
+
* default.
|
|
3138
|
+
*/
|
|
3139
|
+
citations?: BetaCitationsConfigParam | null;
|
|
3140
|
+
|
|
3141
|
+
/**
|
|
3142
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
3143
|
+
* returned via tool_reference from tool search.
|
|
3144
|
+
*/
|
|
3145
|
+
defer_loading?: boolean;
|
|
3146
|
+
|
|
3147
|
+
/**
|
|
3148
|
+
* Maximum number of tokens used by including web page text content in the context.
|
|
3149
|
+
* The limit is approximate and does not apply to binary content such as PDFs.
|
|
3150
|
+
*/
|
|
3151
|
+
max_content_tokens?: number | null;
|
|
3152
|
+
|
|
3153
|
+
/**
|
|
3154
|
+
* Maximum number of times the tool can be used in the API request.
|
|
3155
|
+
*/
|
|
3156
|
+
max_uses?: number | null;
|
|
3157
|
+
|
|
3158
|
+
/**
|
|
3159
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
3160
|
+
*/
|
|
3161
|
+
strict?: boolean;
|
|
3162
|
+
}
|
|
3163
|
+
|
|
3164
|
+
export interface BetaWebFetchTool20260209 {
|
|
3165
|
+
/**
|
|
3166
|
+
* Name of the tool.
|
|
3167
|
+
*
|
|
3168
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
3169
|
+
*/
|
|
3170
|
+
name: 'web_fetch';
|
|
3171
|
+
|
|
3172
|
+
type: 'web_fetch_20260209';
|
|
3173
|
+
|
|
3174
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
3175
|
+
|
|
3176
|
+
/**
|
|
3177
|
+
* List of domains to allow fetching from
|
|
3178
|
+
*/
|
|
3179
|
+
allowed_domains?: Array<string> | null;
|
|
3180
|
+
|
|
3181
|
+
/**
|
|
3182
|
+
* List of domains to block fetching from
|
|
3183
|
+
*/
|
|
3184
|
+
blocked_domains?: Array<string> | null;
|
|
3185
|
+
|
|
3186
|
+
/**
|
|
3187
|
+
* Create a cache control breakpoint at this content block.
|
|
3188
|
+
*/
|
|
3189
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
3190
|
+
|
|
3191
|
+
/**
|
|
3192
|
+
* Citations configuration for fetched documents. Citations are disabled by
|
|
3193
|
+
* default.
|
|
3194
|
+
*/
|
|
3195
|
+
citations?: BetaCitationsConfigParam | null;
|
|
3196
|
+
|
|
3197
|
+
/**
|
|
3198
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
3199
|
+
* returned via tool_reference from tool search.
|
|
3200
|
+
*/
|
|
3201
|
+
defer_loading?: boolean;
|
|
3202
|
+
|
|
3203
|
+
/**
|
|
3204
|
+
* Maximum number of tokens used by including web page text content in the context.
|
|
3205
|
+
* The limit is approximate and does not apply to binary content such as PDFs.
|
|
3206
|
+
*/
|
|
3207
|
+
max_content_tokens?: number | null;
|
|
3208
|
+
|
|
3209
|
+
/**
|
|
3210
|
+
* Maximum number of times the tool can be used in the API request.
|
|
3211
|
+
*/
|
|
3212
|
+
max_uses?: number | null;
|
|
3213
|
+
|
|
3214
|
+
/**
|
|
3215
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
3216
|
+
*/
|
|
3217
|
+
strict?: boolean;
|
|
3218
|
+
}
|
|
3219
|
+
|
|
3220
|
+
/**
|
|
3221
|
+
* Web fetch tool with use_cache parameter for bypassing cached content.
|
|
3222
|
+
*/
|
|
3223
|
+
export interface BetaWebFetchTool20260309 {
|
|
3224
|
+
/**
|
|
3225
|
+
* Name of the tool.
|
|
3226
|
+
*
|
|
3227
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
3228
|
+
*/
|
|
3229
|
+
name: 'web_fetch';
|
|
3230
|
+
|
|
3231
|
+
type: 'web_fetch_20260309';
|
|
3232
|
+
|
|
3233
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
3234
|
+
|
|
3235
|
+
/**
|
|
3236
|
+
* List of domains to allow fetching from
|
|
3237
|
+
*/
|
|
3238
|
+
allowed_domains?: Array<string> | null;
|
|
3239
|
+
|
|
3240
|
+
/**
|
|
3241
|
+
* List of domains to block fetching from
|
|
3242
|
+
*/
|
|
3243
|
+
blocked_domains?: Array<string> | null;
|
|
3244
|
+
|
|
3245
|
+
/**
|
|
3246
|
+
* Create a cache control breakpoint at this content block.
|
|
3247
|
+
*/
|
|
3248
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
3249
|
+
|
|
3250
|
+
/**
|
|
3251
|
+
* Citations configuration for fetched documents. Citations are disabled by
|
|
3252
|
+
* default.
|
|
3253
|
+
*/
|
|
3254
|
+
citations?: BetaCitationsConfigParam | null;
|
|
3255
|
+
|
|
3256
|
+
/**
|
|
3257
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
3258
|
+
* returned via tool_reference from tool search.
|
|
3259
|
+
*/
|
|
3260
|
+
defer_loading?: boolean;
|
|
3261
|
+
|
|
3262
|
+
/**
|
|
3263
|
+
* Maximum number of tokens used by including web page text content in the context.
|
|
3264
|
+
* The limit is approximate and does not apply to binary content such as PDFs.
|
|
3265
|
+
*/
|
|
3266
|
+
max_content_tokens?: number | null;
|
|
3267
|
+
|
|
3268
|
+
/**
|
|
3269
|
+
* Maximum number of times the tool can be used in the API request.
|
|
3270
|
+
*/
|
|
3271
|
+
max_uses?: number | null;
|
|
3272
|
+
|
|
3273
|
+
/**
|
|
3274
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
3275
|
+
*/
|
|
3276
|
+
strict?: boolean;
|
|
3277
|
+
|
|
3278
|
+
/**
|
|
3279
|
+
* Whether to use cached content. Set to false to bypass the cache and fetch fresh
|
|
3280
|
+
* content. Only set to false when the user explicitly requests fresh content or
|
|
3281
|
+
* when fetching rapidly-changing sources.
|
|
3282
|
+
*/
|
|
3283
|
+
use_cache?: boolean;
|
|
3284
|
+
}
|
|
3285
|
+
|
|
3286
|
+
export interface BetaWebFetchToolResultBlock {
|
|
3287
|
+
content: BetaWebFetchToolResultErrorBlock | BetaWebFetchBlock;
|
|
3288
|
+
|
|
3289
|
+
tool_use_id: string;
|
|
3290
|
+
|
|
3291
|
+
type: 'web_fetch_tool_result';
|
|
3292
|
+
|
|
3293
|
+
/**
|
|
3294
|
+
* Tool invocation directly from the model.
|
|
3295
|
+
*/
|
|
3296
|
+
caller?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller20260120;
|
|
3297
|
+
}
|
|
3298
|
+
|
|
3299
|
+
export interface BetaWebFetchToolResultBlockParam {
|
|
3300
|
+
content: BetaWebFetchToolResultErrorBlockParam | BetaWebFetchBlockParam;
|
|
3301
|
+
|
|
3302
|
+
tool_use_id: string;
|
|
3303
|
+
|
|
3304
|
+
type: 'web_fetch_tool_result';
|
|
3305
|
+
|
|
3306
|
+
/**
|
|
3307
|
+
* Create a cache control breakpoint at this content block.
|
|
3308
|
+
*/
|
|
3309
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
3310
|
+
|
|
3311
|
+
/**
|
|
3312
|
+
* Tool invocation directly from the model.
|
|
3313
|
+
*/
|
|
3314
|
+
caller?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller20260120;
|
|
3315
|
+
}
|
|
3316
|
+
|
|
3317
|
+
export interface BetaWebFetchToolResultErrorBlock {
|
|
3318
|
+
error_code: BetaWebFetchToolResultErrorCode;
|
|
3319
|
+
|
|
3320
|
+
type: 'web_fetch_tool_result_error';
|
|
3321
|
+
}
|
|
3322
|
+
|
|
3323
|
+
export interface BetaWebFetchToolResultErrorBlockParam {
|
|
3324
|
+
error_code: BetaWebFetchToolResultErrorCode;
|
|
3325
|
+
|
|
3326
|
+
type: 'web_fetch_tool_result_error';
|
|
3327
|
+
}
|
|
3328
|
+
|
|
3329
|
+
export type BetaWebFetchToolResultErrorCode =
|
|
3330
|
+
| 'invalid_tool_input'
|
|
3331
|
+
| 'url_too_long'
|
|
3332
|
+
| 'url_not_allowed'
|
|
3333
|
+
| 'url_not_accessible'
|
|
3334
|
+
| 'unsupported_content_type'
|
|
3335
|
+
| 'too_many_requests'
|
|
3336
|
+
| 'max_uses_exceeded'
|
|
3337
|
+
| 'unavailable';
|
|
3338
|
+
|
|
3339
|
+
export interface BetaWebSearchResultBlock {
|
|
3340
|
+
encrypted_content: string;
|
|
3341
|
+
|
|
3342
|
+
page_age: string | null;
|
|
3343
|
+
|
|
3344
|
+
title: string;
|
|
3345
|
+
|
|
3346
|
+
type: 'web_search_result';
|
|
3347
|
+
|
|
3348
|
+
url: string;
|
|
3349
|
+
}
|
|
3350
|
+
|
|
3351
|
+
export interface BetaWebSearchResultBlockParam {
|
|
3352
|
+
encrypted_content: string;
|
|
3353
|
+
|
|
3354
|
+
title: string;
|
|
3355
|
+
|
|
3356
|
+
type: 'web_search_result';
|
|
3357
|
+
|
|
3358
|
+
url: string;
|
|
3359
|
+
|
|
3360
|
+
page_age?: string | null;
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3363
|
+
export interface BetaWebSearchTool20250305 {
|
|
3364
|
+
/**
|
|
3365
|
+
* Name of the tool.
|
|
3366
|
+
*
|
|
3367
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
3368
|
+
*/
|
|
3369
|
+
name: 'web_search';
|
|
3370
|
+
|
|
3371
|
+
type: 'web_search_20250305';
|
|
3372
|
+
|
|
3373
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
3374
|
+
|
|
3375
|
+
/**
|
|
3376
|
+
* If provided, only these domains will be included in results. Cannot be used
|
|
3377
|
+
* alongside `blocked_domains`.
|
|
3378
|
+
*/
|
|
3379
|
+
allowed_domains?: Array<string> | null;
|
|
3380
|
+
|
|
3381
|
+
/**
|
|
3382
|
+
* If provided, these domains will never appear in results. Cannot be used
|
|
3383
|
+
* alongside `allowed_domains`.
|
|
3384
|
+
*/
|
|
3385
|
+
blocked_domains?: Array<string> | null;
|
|
3386
|
+
|
|
3387
|
+
/**
|
|
3388
|
+
* Create a cache control breakpoint at this content block.
|
|
3389
|
+
*/
|
|
3390
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
3391
|
+
|
|
3392
|
+
/**
|
|
3393
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
3394
|
+
* returned via tool_reference from tool search.
|
|
3395
|
+
*/
|
|
3396
|
+
defer_loading?: boolean;
|
|
3397
|
+
|
|
3398
|
+
/**
|
|
3399
|
+
* Maximum number of times the tool can be used in the API request.
|
|
3400
|
+
*/
|
|
3401
|
+
max_uses?: number | null;
|
|
3402
|
+
|
|
3403
|
+
/**
|
|
3404
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
3405
|
+
*/
|
|
3406
|
+
strict?: boolean;
|
|
3407
|
+
|
|
3408
|
+
/**
|
|
3409
|
+
* Parameters for the user's location. Used to provide more relevant search
|
|
3410
|
+
* results.
|
|
3411
|
+
*/
|
|
3412
|
+
user_location?: BetaUserLocation | null;
|
|
3413
|
+
}
|
|
3414
|
+
|
|
3415
|
+
export interface BetaWebSearchTool20260209 {
|
|
3416
|
+
/**
|
|
3417
|
+
* Name of the tool.
|
|
3418
|
+
*
|
|
3419
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
3420
|
+
*/
|
|
3421
|
+
name: 'web_search';
|
|
3422
|
+
|
|
3423
|
+
type: 'web_search_20260209';
|
|
3424
|
+
|
|
3425
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
3426
|
+
|
|
3427
|
+
/**
|
|
3428
|
+
* If provided, only these domains will be included in results. Cannot be used
|
|
3429
|
+
* alongside `blocked_domains`.
|
|
3430
|
+
*/
|
|
3431
|
+
allowed_domains?: Array<string> | null;
|
|
3432
|
+
|
|
3433
|
+
/**
|
|
3434
|
+
* If provided, these domains will never appear in results. Cannot be used
|
|
3435
|
+
* alongside `allowed_domains`.
|
|
3436
|
+
*/
|
|
3437
|
+
blocked_domains?: Array<string> | null;
|
|
3438
|
+
|
|
3439
|
+
/**
|
|
3440
|
+
* Create a cache control breakpoint at this content block.
|
|
3441
|
+
*/
|
|
3442
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
3443
|
+
|
|
3444
|
+
/**
|
|
3445
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
3446
|
+
* returned via tool_reference from tool search.
|
|
3447
|
+
*/
|
|
3448
|
+
defer_loading?: boolean;
|
|
3449
|
+
|
|
3450
|
+
/**
|
|
3451
|
+
* Maximum number of times the tool can be used in the API request.
|
|
3452
|
+
*/
|
|
3453
|
+
max_uses?: number | null;
|
|
3454
|
+
|
|
3455
|
+
/**
|
|
3456
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
3457
|
+
*/
|
|
3458
|
+
strict?: boolean;
|
|
3459
|
+
|
|
3460
|
+
/**
|
|
3461
|
+
* Parameters for the user's location. Used to provide more relevant search
|
|
3462
|
+
* results.
|
|
3463
|
+
*/
|
|
3464
|
+
user_location?: BetaUserLocation | null;
|
|
3465
|
+
}
|
|
3466
|
+
|
|
3467
|
+
export interface BetaWebSearchToolRequestError {
|
|
3468
|
+
error_code: BetaWebSearchToolResultErrorCode;
|
|
3469
|
+
|
|
3470
|
+
type: 'web_search_tool_result_error';
|
|
3471
|
+
}
|
|
3472
|
+
|
|
3473
|
+
export interface BetaWebSearchToolResultBlock {
|
|
3474
|
+
content: BetaWebSearchToolResultBlockContent;
|
|
3475
|
+
|
|
3476
|
+
tool_use_id: string;
|
|
3477
|
+
|
|
3478
|
+
type: 'web_search_tool_result';
|
|
3479
|
+
|
|
3480
|
+
/**
|
|
3481
|
+
* Tool invocation directly from the model.
|
|
3482
|
+
*/
|
|
3483
|
+
caller?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller20260120;
|
|
3484
|
+
}
|
|
3485
|
+
|
|
3486
|
+
export type BetaWebSearchToolResultBlockContent =
|
|
3487
|
+
| BetaWebSearchToolResultError
|
|
3488
|
+
| Array<BetaWebSearchResultBlock>;
|
|
3489
|
+
|
|
3490
|
+
export interface BetaWebSearchToolResultBlockParam {
|
|
3491
|
+
content: BetaWebSearchToolResultBlockParamContent;
|
|
3492
|
+
|
|
3493
|
+
tool_use_id: string;
|
|
3494
|
+
|
|
3495
|
+
type: 'web_search_tool_result';
|
|
3496
|
+
|
|
3497
|
+
/**
|
|
3498
|
+
* Create a cache control breakpoint at this content block.
|
|
3499
|
+
*/
|
|
3500
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
3501
|
+
|
|
3502
|
+
/**
|
|
3503
|
+
* Tool invocation directly from the model.
|
|
3504
|
+
*/
|
|
3505
|
+
caller?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller20260120;
|
|
3506
|
+
}
|
|
3507
|
+
|
|
3508
|
+
export type BetaWebSearchToolResultBlockParamContent =
|
|
3509
|
+
| Array<BetaWebSearchResultBlockParam>
|
|
3510
|
+
| BetaWebSearchToolRequestError;
|
|
3511
|
+
|
|
3512
|
+
export interface BetaWebSearchToolResultError {
|
|
3513
|
+
error_code: BetaWebSearchToolResultErrorCode;
|
|
3514
|
+
|
|
3515
|
+
type: 'web_search_tool_result_error';
|
|
3516
|
+
}
|
|
3517
|
+
|
|
3518
|
+
export type BetaWebSearchToolResultErrorCode =
|
|
3519
|
+
| 'invalid_tool_input'
|
|
3520
|
+
| 'unavailable'
|
|
3521
|
+
| 'max_uses_exceeded'
|
|
3522
|
+
| 'too_many_requests'
|
|
3523
|
+
| 'query_too_long'
|
|
3524
|
+
| 'request_too_large';
|
|
3525
|
+
|
|
3526
|
+
/**
|
|
3527
|
+
* @deprecated BetaRequestDocumentBlock should be used insated
|
|
3528
|
+
*/
|
|
3529
|
+
export type BetaBase64PDFBlock = BetaRequestDocumentBlock;
|
|
3530
|
+
|
|
3531
|
+
export type MessageCreateParams = MessageCreateParamsNonStreaming | MessageCreateParamsStreaming;
|
|
3532
|
+
|
|
3533
|
+
export interface MessageCreateParamsBase {
|
|
3534
|
+
/**
|
|
3535
|
+
* Body param: The maximum number of tokens to generate before stopping.
|
|
3536
|
+
*
|
|
3537
|
+
* Note that our models may stop _before_ reaching this maximum. This parameter
|
|
3538
|
+
* only specifies the absolute maximum number of tokens to generate.
|
|
3539
|
+
*
|
|
3540
|
+
* Different models have different maximum values for this parameter. See
|
|
3541
|
+
* [models](https://docs.claude.com/en/docs/models-overview) for details.
|
|
3542
|
+
*/
|
|
3543
|
+
max_tokens: number;
|
|
3544
|
+
|
|
3545
|
+
/**
|
|
3546
|
+
* Body param: Input messages.
|
|
3547
|
+
*
|
|
3548
|
+
* Our models are trained to operate on alternating `user` and `assistant`
|
|
3549
|
+
* conversational turns. When creating a new `Message`, you specify the prior
|
|
3550
|
+
* conversational turns with the `messages` parameter, and the model then generates
|
|
3551
|
+
* the next `Message` in the conversation. Consecutive `user` or `assistant` turns
|
|
3552
|
+
* in your request will be combined into a single turn.
|
|
3553
|
+
*
|
|
3554
|
+
* Each input message must be an object with a `role` and `content`. You can
|
|
3555
|
+
* specify a single `user`-role message, or you can include multiple `user` and
|
|
3556
|
+
* `assistant` messages.
|
|
3557
|
+
*
|
|
3558
|
+
* If the final message uses the `assistant` role, the response content will
|
|
3559
|
+
* continue immediately from the content in that message. This can be used to
|
|
3560
|
+
* constrain part of the model's response.
|
|
3561
|
+
*
|
|
3562
|
+
* Example with a single `user` message:
|
|
3563
|
+
*
|
|
3564
|
+
* ```json
|
|
3565
|
+
* [{ "role": "user", "content": "Hello, Claude" }]
|
|
3566
|
+
* ```
|
|
3567
|
+
*
|
|
3568
|
+
* Example with multiple conversational turns:
|
|
3569
|
+
*
|
|
3570
|
+
* ```json
|
|
3571
|
+
* [
|
|
3572
|
+
* { "role": "user", "content": "Hello there." },
|
|
3573
|
+
* { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
|
|
3574
|
+
* { "role": "user", "content": "Can you explain LLMs in plain English?" }
|
|
3575
|
+
* ]
|
|
3576
|
+
* ```
|
|
3577
|
+
*
|
|
3578
|
+
* Example with a partially-filled response from Claude:
|
|
3579
|
+
*
|
|
3580
|
+
* ```json
|
|
3581
|
+
* [
|
|
3582
|
+
* {
|
|
3583
|
+
* "role": "user",
|
|
3584
|
+
* "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
|
3585
|
+
* },
|
|
3586
|
+
* { "role": "assistant", "content": "The best answer is (" }
|
|
3587
|
+
* ]
|
|
3588
|
+
* ```
|
|
3589
|
+
*
|
|
3590
|
+
* Each input message `content` may be either a single `string` or an array of
|
|
3591
|
+
* content blocks, where each block has a specific `type`. Using a `string` for
|
|
3592
|
+
* `content` is shorthand for an array of one content block of type `"text"`. The
|
|
3593
|
+
* following input messages are equivalent:
|
|
3594
|
+
*
|
|
3595
|
+
* ```json
|
|
3596
|
+
* { "role": "user", "content": "Hello, Claude" }
|
|
3597
|
+
* ```
|
|
3598
|
+
*
|
|
3599
|
+
* ```json
|
|
3600
|
+
* { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
|
3601
|
+
* ```
|
|
3602
|
+
*
|
|
3603
|
+
* See [input examples](https://docs.claude.com/en/api/messages-examples).
|
|
3604
|
+
*
|
|
3605
|
+
* Note that if you want to include a
|
|
3606
|
+
* [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the
|
|
3607
|
+
* top-level `system` parameter — there is no `"system"` role for input messages in
|
|
3608
|
+
* the Messages API.
|
|
3609
|
+
*
|
|
3610
|
+
* There is a limit of 100,000 messages in a single request.
|
|
3611
|
+
*/
|
|
3612
|
+
messages: Array<BetaMessageParam>;
|
|
3613
|
+
|
|
3614
|
+
/**
|
|
3615
|
+
* Body param: The model that will complete your prompt.\n\nSee
|
|
3616
|
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
|
3617
|
+
* details and options.
|
|
3618
|
+
*/
|
|
3619
|
+
model: MessagesAPI.Model;
|
|
3620
|
+
|
|
3621
|
+
/**
|
|
3622
|
+
* Body param: Top-level cache control automatically applies a cache_control marker
|
|
3623
|
+
* to the last cacheable block in the request.
|
|
3624
|
+
*/
|
|
3625
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
3626
|
+
|
|
3627
|
+
/**
|
|
3628
|
+
* Body param: Container identifier for reuse across requests.
|
|
3629
|
+
*/
|
|
3630
|
+
container?: BetaContainerParams | string | null;
|
|
3631
|
+
|
|
3632
|
+
/**
|
|
3633
|
+
* Body param: Context management configuration.
|
|
3634
|
+
*
|
|
3635
|
+
* This allows you to control how Claude manages context across multiple requests,
|
|
3636
|
+
* such as whether to clear function results or not.
|
|
3637
|
+
*/
|
|
3638
|
+
context_management?: BetaContextManagementConfig | null;
|
|
3639
|
+
|
|
3640
|
+
/**
|
|
3641
|
+
* Body param: Specifies the geographic region for inference processing. If not
|
|
3642
|
+
* specified, the workspace's `default_inference_geo` is used.
|
|
3643
|
+
*/
|
|
3644
|
+
inference_geo?: string | null;
|
|
3645
|
+
|
|
3646
|
+
/**
|
|
3647
|
+
* Body param: MCP servers to be utilized in this request
|
|
3648
|
+
*/
|
|
3649
|
+
mcp_servers?: Array<BetaRequestMCPServerURLDefinition>;
|
|
3650
|
+
|
|
3651
|
+
/**
|
|
3652
|
+
* Body param: An object describing metadata about the request.
|
|
3653
|
+
*/
|
|
3654
|
+
metadata?: BetaMetadata;
|
|
3655
|
+
|
|
3656
|
+
/**
|
|
3657
|
+
* Body param: Configuration options for the model's output, such as the output
|
|
3658
|
+
* format.
|
|
3659
|
+
*/
|
|
3660
|
+
output_config?: BetaOutputConfig;
|
|
3661
|
+
|
|
3662
|
+
/**
|
|
3663
|
+
* Body param: Deprecated: Use `output_config.format` instead. See
|
|
3664
|
+
* [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
|
|
3665
|
+
*
|
|
3666
|
+
* A schema to specify Claude's output format in responses. This parameter will be
|
|
3667
|
+
* removed in a future release.
|
|
3668
|
+
*/
|
|
3669
|
+
output_format?: BetaJSONOutputFormat | null;
|
|
3670
|
+
|
|
3671
|
+
/**
|
|
3672
|
+
* Body param: Determines whether to use priority capacity (if available) or
|
|
3673
|
+
* standard capacity for this request.
|
|
3674
|
+
*
|
|
3675
|
+
* Anthropic offers different levels of service for your API requests. See
|
|
3676
|
+
* [service-tiers](https://docs.claude.com/en/api/service-tiers) for details.
|
|
3677
|
+
*/
|
|
3678
|
+
service_tier?: 'auto' | 'standard_only';
|
|
3679
|
+
|
|
3680
|
+
/**
|
|
3681
|
+
* Body param: The inference speed mode for this request. `"fast"` enables high
|
|
3682
|
+
* output-tokens-per-second inference.
|
|
3683
|
+
*/
|
|
3684
|
+
speed?: 'standard' | 'fast' | null;
|
|
3685
|
+
|
|
3686
|
+
/**
|
|
3687
|
+
* Body param: Custom text sequences that will cause the model to stop generating.
|
|
3688
|
+
*
|
|
3689
|
+
* Our models will normally stop when they have naturally completed their turn,
|
|
3690
|
+
* which will result in a response `stop_reason` of `"end_turn"`.
|
|
3691
|
+
*
|
|
3692
|
+
* If you want the model to stop generating when it encounters custom strings of
|
|
3693
|
+
* text, you can use the `stop_sequences` parameter. If the model encounters one of
|
|
3694
|
+
* the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
|
|
3695
|
+
* and the response `stop_sequence` value will contain the matched stop sequence.
|
|
3696
|
+
*/
|
|
3697
|
+
stop_sequences?: Array<string>;
|
|
3698
|
+
|
|
3699
|
+
/**
|
|
3700
|
+
* Body param: Whether to incrementally stream the response using server-sent
|
|
3701
|
+
* events.
|
|
3702
|
+
*
|
|
3703
|
+
* See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
|
|
3704
|
+
*/
|
|
3705
|
+
stream?: boolean;
|
|
3706
|
+
|
|
3707
|
+
/**
|
|
3708
|
+
* Body param: System prompt.
|
|
3709
|
+
*
|
|
3710
|
+
* A system prompt is a way of providing context and instructions to Claude, such
|
|
3711
|
+
* as specifying a particular goal or role. See our
|
|
3712
|
+
* [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
|
|
3713
|
+
*/
|
|
3714
|
+
system?: string | Array<BetaTextBlockParam>;
|
|
3715
|
+
|
|
3716
|
+
/**
|
|
3717
|
+
* Body param: Amount of randomness injected into the response.
|
|
3718
|
+
*
|
|
3719
|
+
* Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
|
|
3720
|
+
* for analytical / multiple choice, and closer to `1.0` for creative and
|
|
3721
|
+
* generative tasks.
|
|
3722
|
+
*
|
|
3723
|
+
* Note that even with `temperature` of `0.0`, the results will not be fully
|
|
3724
|
+
* deterministic.
|
|
3725
|
+
*/
|
|
3726
|
+
temperature?: number;
|
|
3727
|
+
|
|
3728
|
+
/**
|
|
3729
|
+
* Body param: Configuration for enabling Claude's extended thinking.
|
|
3730
|
+
*
|
|
3731
|
+
* When enabled, responses include `thinking` content blocks showing Claude's
|
|
3732
|
+
* thinking process before the final answer. Requires a minimum budget of 1,024
|
|
3733
|
+
* tokens and counts towards your `max_tokens` limit.
|
|
3734
|
+
*
|
|
3735
|
+
* See
|
|
3736
|
+
* [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
|
|
3737
|
+
* for details.
|
|
3738
|
+
*/
|
|
3739
|
+
thinking?: BetaThinkingConfigParam;
|
|
3740
|
+
|
|
3741
|
+
/**
|
|
3742
|
+
* Body param: How the model should use the provided tools. The model can use a
|
|
3743
|
+
* specific tool, any available tool, decide by itself, or not use tools at all.
|
|
3744
|
+
*/
|
|
3745
|
+
tool_choice?: BetaToolChoice;
|
|
3746
|
+
|
|
3747
|
+
/**
|
|
3748
|
+
* Body param: Definitions of tools that the model may use.
|
|
3749
|
+
*
|
|
3750
|
+
* If you include `tools` in your API request, the model may return `tool_use`
|
|
3751
|
+
* content blocks that represent the model's use of those tools. You can then run
|
|
3752
|
+
* those tools using the tool input generated by the model and then optionally
|
|
3753
|
+
* return results back to the model using `tool_result` content blocks.
|
|
3754
|
+
*
|
|
3755
|
+
* There are two types of tools: **client tools** and **server tools**. The
|
|
3756
|
+
* behavior described below applies to client tools. For
|
|
3757
|
+
* [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
|
3758
|
+
* see their individual documentation as each has its own behavior (e.g., the
|
|
3759
|
+
* [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
|
3760
|
+
*
|
|
3761
|
+
* Each tool definition includes:
|
|
3762
|
+
*
|
|
3763
|
+
* - `name`: Name of the tool.
|
|
3764
|
+
* - `description`: Optional, but strongly-recommended description of the tool.
|
|
3765
|
+
* - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
|
|
3766
|
+
* tool `input` shape that the model will produce in `tool_use` output content
|
|
3767
|
+
* blocks.
|
|
3768
|
+
*
|
|
3769
|
+
* For example, if you defined `tools` as:
|
|
3770
|
+
*
|
|
3771
|
+
* ```json
|
|
3772
|
+
* [
|
|
3773
|
+
* {
|
|
3774
|
+
* "name": "get_stock_price",
|
|
3775
|
+
* "description": "Get the current stock price for a given ticker symbol.",
|
|
3776
|
+
* "input_schema": {
|
|
3777
|
+
* "type": "object",
|
|
3778
|
+
* "properties": {
|
|
3779
|
+
* "ticker": {
|
|
3780
|
+
* "type": "string",
|
|
3781
|
+
* "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
|
|
3782
|
+
* }
|
|
3783
|
+
* },
|
|
3784
|
+
* "required": ["ticker"]
|
|
3785
|
+
* }
|
|
3786
|
+
* }
|
|
3787
|
+
* ]
|
|
3788
|
+
* ```
|
|
3789
|
+
*
|
|
3790
|
+
* And then asked the model "What's the S&P 500 at today?", the model might produce
|
|
3791
|
+
* `tool_use` content blocks in the response like this:
|
|
3792
|
+
*
|
|
3793
|
+
* ```json
|
|
3794
|
+
* [
|
|
3795
|
+
* {
|
|
3796
|
+
* "type": "tool_use",
|
|
3797
|
+
* "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
|
3798
|
+
* "name": "get_stock_price",
|
|
3799
|
+
* "input": { "ticker": "^GSPC" }
|
|
3800
|
+
* }
|
|
3801
|
+
* ]
|
|
3802
|
+
* ```
|
|
3803
|
+
*
|
|
3804
|
+
* You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
|
|
3805
|
+
* input, and return the following back to the model in a subsequent `user`
|
|
3806
|
+
* message:
|
|
3807
|
+
*
|
|
3808
|
+
* ```json
|
|
3809
|
+
* [
|
|
3810
|
+
* {
|
|
3811
|
+
* "type": "tool_result",
|
|
3812
|
+
* "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
|
3813
|
+
* "content": "259.75 USD"
|
|
3814
|
+
* }
|
|
3815
|
+
* ]
|
|
3816
|
+
* ```
|
|
3817
|
+
*
|
|
3818
|
+
* Tools can be used for workflows that include running client-side tools and
|
|
3819
|
+
* functions, or more generally whenever you want the model to produce a particular
|
|
3820
|
+
* JSON structure of output.
|
|
3821
|
+
*
|
|
3822
|
+
* See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
|
|
3823
|
+
*/
|
|
3824
|
+
tools?: Array<BetaToolUnion>;
|
|
3825
|
+
|
|
3826
|
+
/**
|
|
3827
|
+
* Body param: Only sample from the top K options for each subsequent token.
|
|
3828
|
+
*
|
|
3829
|
+
* Used to remove "long tail" low probability responses.
|
|
3830
|
+
* [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
|
|
3831
|
+
*
|
|
3832
|
+
* Recommended for advanced use cases only. You usually only need to use
|
|
3833
|
+
* `temperature`.
|
|
3834
|
+
*/
|
|
3835
|
+
top_k?: number;
|
|
3836
|
+
|
|
3837
|
+
/**
|
|
3838
|
+
* Body param: Use nucleus sampling.
|
|
3839
|
+
*
|
|
3840
|
+
* In nucleus sampling, we compute the cumulative distribution over all the options
|
|
3841
|
+
* for each subsequent token in decreasing probability order and cut it off once it
|
|
3842
|
+
* reaches a particular probability specified by `top_p`. You should either alter
|
|
3843
|
+
* `temperature` or `top_p`, but not both.
|
|
3844
|
+
*
|
|
3845
|
+
* Recommended for advanced use cases only. You usually only need to use
|
|
3846
|
+
* `temperature`.
|
|
3847
|
+
*/
|
|
3848
|
+
top_p?: number;
|
|
3849
|
+
|
|
3850
|
+
/**
|
|
3851
|
+
* Header param: Optional header to specify the beta version(s) you want to use.
|
|
3852
|
+
*/
|
|
3853
|
+
betas?: Array<BetaAPI.AnthropicBeta>;
|
|
3854
|
+
}
|
|
3855
|
+
|
|
3856
|
+
export namespace MessageCreateParams {
|
|
3857
|
+
export type MessageCreateParamsNonStreaming = BetaMessagesAPI.MessageCreateParamsNonStreaming;
|
|
3858
|
+
export type MessageCreateParamsStreaming = BetaMessagesAPI.MessageCreateParamsStreaming;
|
|
3859
|
+
}
|
|
3860
|
+
|
|
3861
|
+
export interface MessageCreateParamsNonStreaming extends MessageCreateParamsBase {
|
|
3862
|
+
/**
|
|
3863
|
+
* Body param: Whether to incrementally stream the response using server-sent
|
|
3864
|
+
* events.
|
|
3865
|
+
*
|
|
3866
|
+
* See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
|
|
3867
|
+
*/
|
|
3868
|
+
stream?: false;
|
|
3869
|
+
}
|
|
3870
|
+
|
|
3871
|
+
export interface MessageCreateParamsStreaming extends MessageCreateParamsBase {
|
|
3872
|
+
/**
|
|
3873
|
+
* Body param: Whether to incrementally stream the response using server-sent
|
|
3874
|
+
* events.
|
|
3875
|
+
*
|
|
3876
|
+
* See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
|
|
3877
|
+
*/
|
|
3878
|
+
stream: true;
|
|
3879
|
+
}
|
|
3880
|
+
|
|
3881
|
+
export interface MessageCountTokensParams {
|
|
3882
|
+
/**
|
|
3883
|
+
* Body param: Input messages.
|
|
3884
|
+
*
|
|
3885
|
+
* Our models are trained to operate on alternating `user` and `assistant`
|
|
3886
|
+
* conversational turns. When creating a new `Message`, you specify the prior
|
|
3887
|
+
* conversational turns with the `messages` parameter, and the model then generates
|
|
3888
|
+
* the next `Message` in the conversation. Consecutive `user` or `assistant` turns
|
|
3889
|
+
* in your request will be combined into a single turn.
|
|
3890
|
+
*
|
|
3891
|
+
* Each input message must be an object with a `role` and `content`. You can
|
|
3892
|
+
* specify a single `user`-role message, or you can include multiple `user` and
|
|
3893
|
+
* `assistant` messages.
|
|
3894
|
+
*
|
|
3895
|
+
* If the final message uses the `assistant` role, the response content will
|
|
3896
|
+
* continue immediately from the content in that message. This can be used to
|
|
3897
|
+
* constrain part of the model's response.
|
|
3898
|
+
*
|
|
3899
|
+
* Example with a single `user` message:
|
|
3900
|
+
*
|
|
3901
|
+
* ```json
|
|
3902
|
+
* [{ "role": "user", "content": "Hello, Claude" }]
|
|
3903
|
+
* ```
|
|
3904
|
+
*
|
|
3905
|
+
* Example with multiple conversational turns:
|
|
3906
|
+
*
|
|
3907
|
+
* ```json
|
|
3908
|
+
* [
|
|
3909
|
+
* { "role": "user", "content": "Hello there." },
|
|
3910
|
+
* { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
|
|
3911
|
+
* { "role": "user", "content": "Can you explain LLMs in plain English?" }
|
|
3912
|
+
* ]
|
|
3913
|
+
* ```
|
|
3914
|
+
*
|
|
3915
|
+
* Example with a partially-filled response from Claude:
|
|
3916
|
+
*
|
|
3917
|
+
* ```json
|
|
3918
|
+
* [
|
|
3919
|
+
* {
|
|
3920
|
+
* "role": "user",
|
|
3921
|
+
* "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
|
3922
|
+
* },
|
|
3923
|
+
* { "role": "assistant", "content": "The best answer is (" }
|
|
3924
|
+
* ]
|
|
3925
|
+
* ```
|
|
3926
|
+
*
|
|
3927
|
+
* Each input message `content` may be either a single `string` or an array of
|
|
3928
|
+
* content blocks, where each block has a specific `type`. Using a `string` for
|
|
3929
|
+
* `content` is shorthand for an array of one content block of type `"text"`. The
|
|
3930
|
+
* following input messages are equivalent:
|
|
3931
|
+
*
|
|
3932
|
+
* ```json
|
|
3933
|
+
* { "role": "user", "content": "Hello, Claude" }
|
|
3934
|
+
* ```
|
|
3935
|
+
*
|
|
3936
|
+
* ```json
|
|
3937
|
+
* { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
|
3938
|
+
* ```
|
|
3939
|
+
*
|
|
3940
|
+
* See [input examples](https://docs.claude.com/en/api/messages-examples).
|
|
3941
|
+
*
|
|
3942
|
+
* Note that if you want to include a
|
|
3943
|
+
* [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the
|
|
3944
|
+
* top-level `system` parameter — there is no `"system"` role for input messages in
|
|
3945
|
+
* the Messages API.
|
|
3946
|
+
*
|
|
3947
|
+
* There is a limit of 100,000 messages in a single request.
|
|
3948
|
+
*/
|
|
3949
|
+
messages: Array<BetaMessageParam>;
|
|
3950
|
+
|
|
3951
|
+
/**
|
|
3952
|
+
* Body param: The model that will complete your prompt.\n\nSee
|
|
3953
|
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
|
3954
|
+
* details and options.
|
|
3955
|
+
*/
|
|
3956
|
+
model: MessagesAPI.Model;
|
|
3957
|
+
|
|
3958
|
+
/**
|
|
3959
|
+
* Body param: Top-level cache control automatically applies a cache_control marker
|
|
3960
|
+
* to the last cacheable block in the request.
|
|
3961
|
+
*/
|
|
3962
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
3963
|
+
|
|
3964
|
+
/**
|
|
3965
|
+
* Body param: Context management configuration.
|
|
3966
|
+
*
|
|
3967
|
+
* This allows you to control how Claude manages context across multiple requests,
|
|
3968
|
+
* such as whether to clear function results or not.
|
|
3969
|
+
*/
|
|
3970
|
+
context_management?: BetaContextManagementConfig | null;
|
|
3971
|
+
|
|
3972
|
+
/**
|
|
3973
|
+
* Body param: MCP servers to be utilized in this request
|
|
3974
|
+
*/
|
|
3975
|
+
mcp_servers?: Array<BetaRequestMCPServerURLDefinition>;
|
|
3976
|
+
|
|
3977
|
+
/**
|
|
3978
|
+
* Body param: Configuration options for the model's output, such as the output
|
|
3979
|
+
* format.
|
|
3980
|
+
*/
|
|
3981
|
+
output_config?: BetaOutputConfig;
|
|
3982
|
+
|
|
3983
|
+
/**
|
|
3984
|
+
* Body param: Deprecated: Use `output_config.format` instead. See
|
|
3985
|
+
* [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
|
|
3986
|
+
*
|
|
3987
|
+
* A schema to specify Claude's output format in responses. This parameter will be
|
|
3988
|
+
* removed in a future release.
|
|
3989
|
+
*/
|
|
3990
|
+
output_format?: BetaJSONOutputFormat | null;
|
|
3991
|
+
|
|
3992
|
+
/**
|
|
3993
|
+
* Body param: The inference speed mode for this request. `"fast"` enables high
|
|
3994
|
+
* output-tokens-per-second inference.
|
|
3995
|
+
*/
|
|
3996
|
+
speed?: 'standard' | 'fast' | null;
|
|
3997
|
+
|
|
3998
|
+
/**
|
|
3999
|
+
* Body param: System prompt.
|
|
4000
|
+
*
|
|
4001
|
+
* A system prompt is a way of providing context and instructions to Claude, such
|
|
4002
|
+
* as specifying a particular goal or role. See our
|
|
4003
|
+
* [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
|
|
4004
|
+
*/
|
|
4005
|
+
system?: string | Array<BetaTextBlockParam>;
|
|
4006
|
+
|
|
4007
|
+
/**
|
|
4008
|
+
* Body param: Configuration for enabling Claude's extended thinking.
|
|
4009
|
+
*
|
|
4010
|
+
* When enabled, responses include `thinking` content blocks showing Claude's
|
|
4011
|
+
* thinking process before the final answer. Requires a minimum budget of 1,024
|
|
4012
|
+
* tokens and counts towards your `max_tokens` limit.
|
|
4013
|
+
*
|
|
4014
|
+
* See
|
|
4015
|
+
* [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
|
|
4016
|
+
* for details.
|
|
4017
|
+
*/
|
|
4018
|
+
thinking?: BetaThinkingConfigParam;
|
|
4019
|
+
|
|
4020
|
+
/**
|
|
4021
|
+
* Body param: How the model should use the provided tools. The model can use a
|
|
4022
|
+
* specific tool, any available tool, decide by itself, or not use tools at all.
|
|
4023
|
+
*/
|
|
4024
|
+
tool_choice?: BetaToolChoice;
|
|
4025
|
+
|
|
4026
|
+
/**
|
|
4027
|
+
* Body param: Definitions of tools that the model may use.
|
|
4028
|
+
*
|
|
4029
|
+
* If you include `tools` in your API request, the model may return `tool_use`
|
|
4030
|
+
* content blocks that represent the model's use of those tools. You can then run
|
|
4031
|
+
* those tools using the tool input generated by the model and then optionally
|
|
4032
|
+
* return results back to the model using `tool_result` content blocks.
|
|
4033
|
+
*
|
|
4034
|
+
* There are two types of tools: **client tools** and **server tools**. The
|
|
4035
|
+
* behavior described below applies to client tools. For
|
|
4036
|
+
* [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
|
4037
|
+
* see their individual documentation as each has its own behavior (e.g., the
|
|
4038
|
+
* [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
|
4039
|
+
*
|
|
4040
|
+
* Each tool definition includes:
|
|
4041
|
+
*
|
|
4042
|
+
* - `name`: Name of the tool.
|
|
4043
|
+
* - `description`: Optional, but strongly-recommended description of the tool.
|
|
4044
|
+
* - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
|
|
4045
|
+
* tool `input` shape that the model will produce in `tool_use` output content
|
|
4046
|
+
* blocks.
|
|
4047
|
+
*
|
|
4048
|
+
* For example, if you defined `tools` as:
|
|
4049
|
+
*
|
|
4050
|
+
* ```json
|
|
4051
|
+
* [
|
|
4052
|
+
* {
|
|
4053
|
+
* "name": "get_stock_price",
|
|
4054
|
+
* "description": "Get the current stock price for a given ticker symbol.",
|
|
4055
|
+
* "input_schema": {
|
|
4056
|
+
* "type": "object",
|
|
4057
|
+
* "properties": {
|
|
4058
|
+
* "ticker": {
|
|
4059
|
+
* "type": "string",
|
|
4060
|
+
* "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
|
|
4061
|
+
* }
|
|
4062
|
+
* },
|
|
4063
|
+
* "required": ["ticker"]
|
|
4064
|
+
* }
|
|
4065
|
+
* }
|
|
4066
|
+
* ]
|
|
4067
|
+
* ```
|
|
4068
|
+
*
|
|
4069
|
+
* And then asked the model "What's the S&P 500 at today?", the model might produce
|
|
4070
|
+
* `tool_use` content blocks in the response like this:
|
|
4071
|
+
*
|
|
4072
|
+
* ```json
|
|
4073
|
+
* [
|
|
4074
|
+
* {
|
|
4075
|
+
* "type": "tool_use",
|
|
4076
|
+
* "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
|
4077
|
+
* "name": "get_stock_price",
|
|
4078
|
+
* "input": { "ticker": "^GSPC" }
|
|
4079
|
+
* }
|
|
4080
|
+
* ]
|
|
4081
|
+
* ```
|
|
4082
|
+
*
|
|
4083
|
+
* You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
|
|
4084
|
+
* input, and return the following back to the model in a subsequent `user`
|
|
4085
|
+
* message:
|
|
4086
|
+
*
|
|
4087
|
+
* ```json
|
|
4088
|
+
* [
|
|
4089
|
+
* {
|
|
4090
|
+
* "type": "tool_result",
|
|
4091
|
+
* "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
|
4092
|
+
* "content": "259.75 USD"
|
|
4093
|
+
* }
|
|
4094
|
+
* ]
|
|
4095
|
+
* ```
|
|
4096
|
+
*
|
|
4097
|
+
* Tools can be used for workflows that include running client-side tools and
|
|
4098
|
+
* functions, or more generally whenever you want the model to produce a particular
|
|
4099
|
+
* JSON structure of output.
|
|
4100
|
+
*
|
|
4101
|
+
* See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
|
|
4102
|
+
*/
|
|
4103
|
+
tools?: Array<
|
|
4104
|
+
| BetaTool
|
|
4105
|
+
| BetaToolBash20241022
|
|
4106
|
+
| BetaToolBash20250124
|
|
4107
|
+
| BetaCodeExecutionTool20250522
|
|
4108
|
+
| BetaCodeExecutionTool20250825
|
|
4109
|
+
| BetaCodeExecutionTool20260120
|
|
4110
|
+
| BetaToolComputerUse20241022
|
|
4111
|
+
| BetaMemoryTool20250818
|
|
4112
|
+
| BetaToolComputerUse20250124
|
|
4113
|
+
| BetaToolTextEditor20241022
|
|
4114
|
+
| BetaToolComputerUse20251124
|
|
4115
|
+
| BetaToolTextEditor20250124
|
|
4116
|
+
| BetaToolTextEditor20250429
|
|
4117
|
+
| BetaToolTextEditor20250728
|
|
4118
|
+
| BetaWebSearchTool20250305
|
|
4119
|
+
| BetaWebFetchTool20250910
|
|
4120
|
+
| BetaWebSearchTool20260209
|
|
4121
|
+
| BetaWebFetchTool20260209
|
|
4122
|
+
| BetaWebFetchTool20260309
|
|
4123
|
+
| BetaToolSearchToolBm25_20251119
|
|
4124
|
+
| BetaToolSearchToolRegex20251119
|
|
4125
|
+
| BetaMCPToolset
|
|
4126
|
+
>;
|
|
4127
|
+
|
|
4128
|
+
/**
|
|
4129
|
+
* Header param: Optional header to specify the beta version(s) you want to use.
|
|
4130
|
+
*/
|
|
4131
|
+
betas?: Array<BetaAPI.AnthropicBeta>;
|
|
4132
|
+
}
|
|
4133
|
+
|
|
4134
|
+
export { BetaToolRunner, type BetaToolRunnerParams } from '../../../lib/tools/BetaToolRunner';
|
|
4135
|
+
export { ToolError } from '../../../lib/tools/ToolError';
|
|
4136
|
+
|
|
4137
|
+
Messages.Batches = Batches;
|
|
4138
|
+
|
|
4139
|
+
Messages.BetaToolRunner = BetaToolRunner;
|
|
4140
|
+
Messages.ToolError = ToolError;
|
|
4141
|
+
|
|
4142
|
+
export declare namespace Messages {
|
|
4143
|
+
export {
|
|
4144
|
+
type BetaAllThinkingTurns as BetaAllThinkingTurns,
|
|
4145
|
+
type BetaBase64ImageSource as BetaBase64ImageSource,
|
|
4146
|
+
type BetaBase64PDFSource as BetaBase64PDFSource,
|
|
4147
|
+
type BetaBashCodeExecutionOutputBlock as BetaBashCodeExecutionOutputBlock,
|
|
4148
|
+
type BetaBashCodeExecutionOutputBlockParam as BetaBashCodeExecutionOutputBlockParam,
|
|
4149
|
+
type BetaBashCodeExecutionResultBlock as BetaBashCodeExecutionResultBlock,
|
|
4150
|
+
type BetaBashCodeExecutionResultBlockParam as BetaBashCodeExecutionResultBlockParam,
|
|
4151
|
+
type BetaBashCodeExecutionToolResultBlock as BetaBashCodeExecutionToolResultBlock,
|
|
4152
|
+
type BetaBashCodeExecutionToolResultBlockParam as BetaBashCodeExecutionToolResultBlockParam,
|
|
4153
|
+
type BetaBashCodeExecutionToolResultError as BetaBashCodeExecutionToolResultError,
|
|
4154
|
+
type BetaBashCodeExecutionToolResultErrorParam as BetaBashCodeExecutionToolResultErrorParam,
|
|
4155
|
+
type BetaCacheControlEphemeral as BetaCacheControlEphemeral,
|
|
4156
|
+
type BetaCacheCreation as BetaCacheCreation,
|
|
4157
|
+
type BetaCitationCharLocation as BetaCitationCharLocation,
|
|
4158
|
+
type BetaCitationCharLocationParam as BetaCitationCharLocationParam,
|
|
4159
|
+
type BetaCitationConfig as BetaCitationConfig,
|
|
4160
|
+
type BetaCitationContentBlockLocation as BetaCitationContentBlockLocation,
|
|
4161
|
+
type BetaCitationContentBlockLocationParam as BetaCitationContentBlockLocationParam,
|
|
4162
|
+
type BetaCitationPageLocation as BetaCitationPageLocation,
|
|
4163
|
+
type BetaCitationPageLocationParam as BetaCitationPageLocationParam,
|
|
4164
|
+
type BetaCitationSearchResultLocation as BetaCitationSearchResultLocation,
|
|
4165
|
+
type BetaCitationSearchResultLocationParam as BetaCitationSearchResultLocationParam,
|
|
4166
|
+
type BetaCitationWebSearchResultLocationParam as BetaCitationWebSearchResultLocationParam,
|
|
4167
|
+
type BetaCitationsConfigParam as BetaCitationsConfigParam,
|
|
4168
|
+
type BetaCitationsDelta as BetaCitationsDelta,
|
|
4169
|
+
type BetaCitationsWebSearchResultLocation as BetaCitationsWebSearchResultLocation,
|
|
4170
|
+
type BetaClearThinking20251015Edit as BetaClearThinking20251015Edit,
|
|
4171
|
+
type BetaClearThinking20251015EditResponse as BetaClearThinking20251015EditResponse,
|
|
4172
|
+
type BetaClearToolUses20250919Edit as BetaClearToolUses20250919Edit,
|
|
4173
|
+
type BetaClearToolUses20250919EditResponse as BetaClearToolUses20250919EditResponse,
|
|
4174
|
+
type BetaCodeExecutionOutputBlock as BetaCodeExecutionOutputBlock,
|
|
4175
|
+
type BetaCodeExecutionOutputBlockParam as BetaCodeExecutionOutputBlockParam,
|
|
4176
|
+
type BetaCodeExecutionResultBlock as BetaCodeExecutionResultBlock,
|
|
4177
|
+
type BetaCodeExecutionResultBlockParam as BetaCodeExecutionResultBlockParam,
|
|
4178
|
+
type BetaCodeExecutionTool20250522 as BetaCodeExecutionTool20250522,
|
|
4179
|
+
type BetaCodeExecutionTool20250825 as BetaCodeExecutionTool20250825,
|
|
4180
|
+
type BetaCodeExecutionTool20260120 as BetaCodeExecutionTool20260120,
|
|
4181
|
+
type BetaCodeExecutionToolResultBlock as BetaCodeExecutionToolResultBlock,
|
|
4182
|
+
type BetaCodeExecutionToolResultBlockContent as BetaCodeExecutionToolResultBlockContent,
|
|
4183
|
+
type BetaCodeExecutionToolResultBlockParam as BetaCodeExecutionToolResultBlockParam,
|
|
4184
|
+
type BetaCodeExecutionToolResultBlockParamContent as BetaCodeExecutionToolResultBlockParamContent,
|
|
4185
|
+
type BetaCodeExecutionToolResultError as BetaCodeExecutionToolResultError,
|
|
4186
|
+
type BetaCodeExecutionToolResultErrorCode as BetaCodeExecutionToolResultErrorCode,
|
|
4187
|
+
type BetaCodeExecutionToolResultErrorParam as BetaCodeExecutionToolResultErrorParam,
|
|
4188
|
+
type BetaCompact20260112Edit as BetaCompact20260112Edit,
|
|
4189
|
+
type BetaCompactionBlock as BetaCompactionBlock,
|
|
4190
|
+
type BetaCompactionBlockParam as BetaCompactionBlockParam,
|
|
4191
|
+
type BetaCompactionContentBlockDelta as BetaCompactionContentBlockDelta,
|
|
4192
|
+
type BetaCompactionIterationUsage as BetaCompactionIterationUsage,
|
|
4193
|
+
type BetaContainer as BetaContainer,
|
|
4194
|
+
type BetaContainerParams as BetaContainerParams,
|
|
4195
|
+
type BetaContainerUploadBlock as BetaContainerUploadBlock,
|
|
4196
|
+
type BetaContainerUploadBlockParam as BetaContainerUploadBlockParam,
|
|
4197
|
+
type BetaContentBlock as BetaContentBlock,
|
|
4198
|
+
type BetaContentBlockParam as BetaContentBlockParam,
|
|
4199
|
+
type BetaContentBlockSource as BetaContentBlockSource,
|
|
4200
|
+
type BetaContentBlockSourceContent as BetaContentBlockSourceContent,
|
|
4201
|
+
type BetaContextManagementConfig as BetaContextManagementConfig,
|
|
4202
|
+
type BetaContextManagementResponse as BetaContextManagementResponse,
|
|
4203
|
+
type BetaCountTokensContextManagementResponse as BetaCountTokensContextManagementResponse,
|
|
4204
|
+
type BetaDirectCaller as BetaDirectCaller,
|
|
4205
|
+
type BetaDocumentBlock as BetaDocumentBlock,
|
|
4206
|
+
type BetaEncryptedCodeExecutionResultBlock as BetaEncryptedCodeExecutionResultBlock,
|
|
4207
|
+
type BetaEncryptedCodeExecutionResultBlockParam as BetaEncryptedCodeExecutionResultBlockParam,
|
|
4208
|
+
type BetaFileDocumentSource as BetaFileDocumentSource,
|
|
4209
|
+
type BetaFileImageSource as BetaFileImageSource,
|
|
4210
|
+
type BetaImageBlockParam as BetaImageBlockParam,
|
|
4211
|
+
type BetaInputJSONDelta as BetaInputJSONDelta,
|
|
4212
|
+
type BetaInputTokensClearAtLeast as BetaInputTokensClearAtLeast,
|
|
4213
|
+
type BetaInputTokensTrigger as BetaInputTokensTrigger,
|
|
4214
|
+
type BetaIterationsUsage as BetaIterationsUsage,
|
|
4215
|
+
type BetaJSONOutputFormat as BetaJSONOutputFormat,
|
|
4216
|
+
type BetaMCPToolConfig as BetaMCPToolConfig,
|
|
4217
|
+
type BetaMCPToolDefaultConfig as BetaMCPToolDefaultConfig,
|
|
4218
|
+
type BetaMCPToolResultBlock as BetaMCPToolResultBlock,
|
|
4219
|
+
type BetaMCPToolUseBlock as BetaMCPToolUseBlock,
|
|
4220
|
+
type BetaMCPToolUseBlockParam as BetaMCPToolUseBlockParam,
|
|
4221
|
+
type BetaMCPToolset as BetaMCPToolset,
|
|
4222
|
+
type BetaMemoryTool20250818 as BetaMemoryTool20250818,
|
|
4223
|
+
type BetaMemoryTool20250818Command as BetaMemoryTool20250818Command,
|
|
4224
|
+
type BetaMemoryTool20250818CreateCommand as BetaMemoryTool20250818CreateCommand,
|
|
4225
|
+
type BetaMemoryTool20250818DeleteCommand as BetaMemoryTool20250818DeleteCommand,
|
|
4226
|
+
type BetaMemoryTool20250818InsertCommand as BetaMemoryTool20250818InsertCommand,
|
|
4227
|
+
type BetaMemoryTool20250818RenameCommand as BetaMemoryTool20250818RenameCommand,
|
|
4228
|
+
type BetaMemoryTool20250818StrReplaceCommand as BetaMemoryTool20250818StrReplaceCommand,
|
|
4229
|
+
type BetaMemoryTool20250818ViewCommand as BetaMemoryTool20250818ViewCommand,
|
|
4230
|
+
type BetaMessage as BetaMessage,
|
|
4231
|
+
type BetaMessageDeltaUsage as BetaMessageDeltaUsage,
|
|
4232
|
+
type BetaMessageIterationUsage as BetaMessageIterationUsage,
|
|
4233
|
+
type BetaMessageParam as BetaMessageParam,
|
|
4234
|
+
type BetaMessageTokensCount as BetaMessageTokensCount,
|
|
4235
|
+
type BetaMetadata as BetaMetadata,
|
|
4236
|
+
type BetaOutputConfig as BetaOutputConfig,
|
|
4237
|
+
type BetaPlainTextSource as BetaPlainTextSource,
|
|
4238
|
+
type BetaRawContentBlockDelta as BetaRawContentBlockDelta,
|
|
4239
|
+
type BetaRawContentBlockDeltaEvent as BetaRawContentBlockDeltaEvent,
|
|
4240
|
+
type BetaRawContentBlockStartEvent as BetaRawContentBlockStartEvent,
|
|
4241
|
+
type BetaRawContentBlockStopEvent as BetaRawContentBlockStopEvent,
|
|
4242
|
+
type BetaRawMessageDeltaEvent as BetaRawMessageDeltaEvent,
|
|
4243
|
+
type BetaRawMessageStartEvent as BetaRawMessageStartEvent,
|
|
4244
|
+
type BetaRawMessageStopEvent as BetaRawMessageStopEvent,
|
|
4245
|
+
type BetaRawMessageStreamEvent as BetaRawMessageStreamEvent,
|
|
4246
|
+
type BetaRedactedThinkingBlock as BetaRedactedThinkingBlock,
|
|
4247
|
+
type BetaRedactedThinkingBlockParam as BetaRedactedThinkingBlockParam,
|
|
4248
|
+
type BetaRefusalStopDetails as BetaRefusalStopDetails,
|
|
4249
|
+
type BetaRequestDocumentBlock as BetaRequestDocumentBlock,
|
|
4250
|
+
type BetaRequestMCPServerToolConfiguration as BetaRequestMCPServerToolConfiguration,
|
|
4251
|
+
type BetaRequestMCPServerURLDefinition as BetaRequestMCPServerURLDefinition,
|
|
4252
|
+
type BetaRequestMCPToolResultBlockParam as BetaRequestMCPToolResultBlockParam,
|
|
4253
|
+
type BetaSearchResultBlockParam as BetaSearchResultBlockParam,
|
|
4254
|
+
type BetaServerToolCaller as BetaServerToolCaller,
|
|
4255
|
+
type BetaServerToolCaller20260120 as BetaServerToolCaller20260120,
|
|
4256
|
+
type BetaServerToolUsage as BetaServerToolUsage,
|
|
4257
|
+
type BetaServerToolUseBlock as BetaServerToolUseBlock,
|
|
4258
|
+
type BetaServerToolUseBlockParam as BetaServerToolUseBlockParam,
|
|
4259
|
+
type BetaSignatureDelta as BetaSignatureDelta,
|
|
4260
|
+
type BetaSkill as BetaSkill,
|
|
4261
|
+
type BetaSkillParams as BetaSkillParams,
|
|
4262
|
+
type BetaStopReason as BetaStopReason,
|
|
4263
|
+
type BetaTextBlock as BetaTextBlock,
|
|
4264
|
+
type BetaTextBlockParam as BetaTextBlockParam,
|
|
4265
|
+
type BetaTextCitation as BetaTextCitation,
|
|
4266
|
+
type BetaTextCitationParam as BetaTextCitationParam,
|
|
4267
|
+
type BetaTextDelta as BetaTextDelta,
|
|
4268
|
+
type BetaTextEditorCodeExecutionCreateResultBlock as BetaTextEditorCodeExecutionCreateResultBlock,
|
|
4269
|
+
type BetaTextEditorCodeExecutionCreateResultBlockParam as BetaTextEditorCodeExecutionCreateResultBlockParam,
|
|
4270
|
+
type BetaTextEditorCodeExecutionStrReplaceResultBlock as BetaTextEditorCodeExecutionStrReplaceResultBlock,
|
|
4271
|
+
type BetaTextEditorCodeExecutionStrReplaceResultBlockParam as BetaTextEditorCodeExecutionStrReplaceResultBlockParam,
|
|
4272
|
+
type BetaTextEditorCodeExecutionToolResultBlock as BetaTextEditorCodeExecutionToolResultBlock,
|
|
4273
|
+
type BetaTextEditorCodeExecutionToolResultBlockParam as BetaTextEditorCodeExecutionToolResultBlockParam,
|
|
4274
|
+
type BetaTextEditorCodeExecutionToolResultError as BetaTextEditorCodeExecutionToolResultError,
|
|
4275
|
+
type BetaTextEditorCodeExecutionToolResultErrorParam as BetaTextEditorCodeExecutionToolResultErrorParam,
|
|
4276
|
+
type BetaTextEditorCodeExecutionViewResultBlock as BetaTextEditorCodeExecutionViewResultBlock,
|
|
4277
|
+
type BetaTextEditorCodeExecutionViewResultBlockParam as BetaTextEditorCodeExecutionViewResultBlockParam,
|
|
4278
|
+
type BetaThinkingBlock as BetaThinkingBlock,
|
|
4279
|
+
type BetaThinkingBlockParam as BetaThinkingBlockParam,
|
|
4280
|
+
type BetaThinkingConfigAdaptive as BetaThinkingConfigAdaptive,
|
|
4281
|
+
type BetaThinkingConfigDisabled as BetaThinkingConfigDisabled,
|
|
4282
|
+
type BetaThinkingConfigEnabled as BetaThinkingConfigEnabled,
|
|
4283
|
+
type BetaThinkingConfigParam as BetaThinkingConfigParam,
|
|
4284
|
+
type BetaThinkingDelta as BetaThinkingDelta,
|
|
4285
|
+
type BetaThinkingTurns as BetaThinkingTurns,
|
|
4286
|
+
type BetaTool as BetaTool,
|
|
4287
|
+
type BetaToolBash20241022 as BetaToolBash20241022,
|
|
4288
|
+
type BetaToolBash20250124 as BetaToolBash20250124,
|
|
4289
|
+
type BetaToolChoice as BetaToolChoice,
|
|
4290
|
+
type BetaToolChoiceAny as BetaToolChoiceAny,
|
|
4291
|
+
type BetaToolChoiceAuto as BetaToolChoiceAuto,
|
|
4292
|
+
type BetaToolChoiceNone as BetaToolChoiceNone,
|
|
4293
|
+
type BetaToolChoiceTool as BetaToolChoiceTool,
|
|
4294
|
+
type BetaToolComputerUse20241022 as BetaToolComputerUse20241022,
|
|
4295
|
+
type BetaToolComputerUse20250124 as BetaToolComputerUse20250124,
|
|
4296
|
+
type BetaToolComputerUse20251124 as BetaToolComputerUse20251124,
|
|
4297
|
+
type BetaToolReferenceBlock as BetaToolReferenceBlock,
|
|
4298
|
+
type BetaToolReferenceBlockParam as BetaToolReferenceBlockParam,
|
|
4299
|
+
type BetaToolResultBlockParam as BetaToolResultBlockParam,
|
|
4300
|
+
type BetaToolResultContentBlockParam as BetaToolResultContentBlockParam,
|
|
4301
|
+
type BetaToolSearchToolBm25_20251119 as BetaToolSearchToolBm25_20251119,
|
|
4302
|
+
type BetaToolSearchToolRegex20251119 as BetaToolSearchToolRegex20251119,
|
|
4303
|
+
type BetaToolSearchToolResultBlock as BetaToolSearchToolResultBlock,
|
|
4304
|
+
type BetaToolSearchToolResultBlockParam as BetaToolSearchToolResultBlockParam,
|
|
4305
|
+
type BetaToolSearchToolResultError as BetaToolSearchToolResultError,
|
|
4306
|
+
type BetaToolSearchToolResultErrorParam as BetaToolSearchToolResultErrorParam,
|
|
4307
|
+
type BetaToolSearchToolSearchResultBlock as BetaToolSearchToolSearchResultBlock,
|
|
4308
|
+
type BetaToolSearchToolSearchResultBlockParam as BetaToolSearchToolSearchResultBlockParam,
|
|
4309
|
+
type BetaToolTextEditor20241022 as BetaToolTextEditor20241022,
|
|
4310
|
+
type BetaToolTextEditor20250124 as BetaToolTextEditor20250124,
|
|
4311
|
+
type BetaToolTextEditor20250429 as BetaToolTextEditor20250429,
|
|
4312
|
+
type BetaToolTextEditor20250728 as BetaToolTextEditor20250728,
|
|
4313
|
+
type BetaToolUnion as BetaToolUnion,
|
|
4314
|
+
type BetaToolUseBlock as BetaToolUseBlock,
|
|
4315
|
+
type BetaToolUseBlockParam as BetaToolUseBlockParam,
|
|
4316
|
+
type BetaToolUsesKeep as BetaToolUsesKeep,
|
|
4317
|
+
type BetaToolUsesTrigger as BetaToolUsesTrigger,
|
|
4318
|
+
type BetaURLImageSource as BetaURLImageSource,
|
|
4319
|
+
type BetaURLPDFSource as BetaURLPDFSource,
|
|
4320
|
+
type BetaUsage as BetaUsage,
|
|
4321
|
+
type BetaUserLocation as BetaUserLocation,
|
|
4322
|
+
type BetaWebFetchBlock as BetaWebFetchBlock,
|
|
4323
|
+
type BetaWebFetchBlockParam as BetaWebFetchBlockParam,
|
|
4324
|
+
type BetaWebFetchTool20250910 as BetaWebFetchTool20250910,
|
|
4325
|
+
type BetaWebFetchTool20260209 as BetaWebFetchTool20260209,
|
|
4326
|
+
type BetaWebFetchTool20260309 as BetaWebFetchTool20260309,
|
|
4327
|
+
type BetaWebFetchToolResultBlock as BetaWebFetchToolResultBlock,
|
|
4328
|
+
type BetaWebFetchToolResultBlockParam as BetaWebFetchToolResultBlockParam,
|
|
4329
|
+
type BetaWebFetchToolResultErrorBlock as BetaWebFetchToolResultErrorBlock,
|
|
4330
|
+
type BetaWebFetchToolResultErrorBlockParam as BetaWebFetchToolResultErrorBlockParam,
|
|
4331
|
+
type BetaWebFetchToolResultErrorCode as BetaWebFetchToolResultErrorCode,
|
|
4332
|
+
type BetaWebSearchResultBlock as BetaWebSearchResultBlock,
|
|
4333
|
+
type BetaWebSearchResultBlockParam as BetaWebSearchResultBlockParam,
|
|
4334
|
+
type BetaWebSearchTool20250305 as BetaWebSearchTool20250305,
|
|
4335
|
+
type BetaWebSearchTool20260209 as BetaWebSearchTool20260209,
|
|
4336
|
+
type BetaWebSearchToolRequestError as BetaWebSearchToolRequestError,
|
|
4337
|
+
type BetaWebSearchToolResultBlock as BetaWebSearchToolResultBlock,
|
|
4338
|
+
type BetaWebSearchToolResultBlockContent as BetaWebSearchToolResultBlockContent,
|
|
4339
|
+
type BetaWebSearchToolResultBlockParam as BetaWebSearchToolResultBlockParam,
|
|
4340
|
+
type BetaWebSearchToolResultBlockParamContent as BetaWebSearchToolResultBlockParamContent,
|
|
4341
|
+
type BetaWebSearchToolResultError as BetaWebSearchToolResultError,
|
|
4342
|
+
type BetaWebSearchToolResultErrorCode as BetaWebSearchToolResultErrorCode,
|
|
4343
|
+
type BetaBase64PDFBlock as BetaBase64PDFBlock,
|
|
4344
|
+
type MessageCreateParams as MessageCreateParams,
|
|
4345
|
+
type MessageCreateParamsNonStreaming as MessageCreateParamsNonStreaming,
|
|
4346
|
+
type MessageCreateParamsStreaming as MessageCreateParamsStreaming,
|
|
4347
|
+
type MessageCountTokensParams as MessageCountTokensParams,
|
|
4348
|
+
};
|
|
4349
|
+
|
|
4350
|
+
export { type BetaToolRunnerParams, BetaToolRunner };
|
|
4351
|
+
export { ToolError };
|
|
4352
|
+
|
|
4353
|
+
export {
|
|
4354
|
+
Batches as Batches,
|
|
4355
|
+
type BetaDeletedMessageBatch as BetaDeletedMessageBatch,
|
|
4356
|
+
type BetaMessageBatch as BetaMessageBatch,
|
|
4357
|
+
type BetaMessageBatchCanceledResult as BetaMessageBatchCanceledResult,
|
|
4358
|
+
type BetaMessageBatchErroredResult as BetaMessageBatchErroredResult,
|
|
4359
|
+
type BetaMessageBatchExpiredResult as BetaMessageBatchExpiredResult,
|
|
4360
|
+
type BetaMessageBatchIndividualResponse as BetaMessageBatchIndividualResponse,
|
|
4361
|
+
type BetaMessageBatchRequestCounts as BetaMessageBatchRequestCounts,
|
|
4362
|
+
type BetaMessageBatchResult as BetaMessageBatchResult,
|
|
4363
|
+
type BetaMessageBatchSucceededResult as BetaMessageBatchSucceededResult,
|
|
4364
|
+
type BetaMessageBatchesPage as BetaMessageBatchesPage,
|
|
4365
|
+
type BatchCreateParams as BatchCreateParams,
|
|
4366
|
+
type BatchRetrieveParams as BatchRetrieveParams,
|
|
4367
|
+
type BatchListParams as BatchListParams,
|
|
4368
|
+
type BatchDeleteParams as BatchDeleteParams,
|
|
4369
|
+
type BatchCancelParams as BatchCancelParams,
|
|
4370
|
+
type BatchResultsParams as BatchResultsParams,
|
|
4371
|
+
};
|
|
4372
|
+
}
|