@ai-sdk/anthropic 2.0.109 → 2.0.110

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.
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(index_exports);
30
30
 
31
31
  // src/anthropic-messages-language-model.ts
32
32
  var import_provider3 = require("@ai-sdk/provider");
33
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
33
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
34
34
 
35
35
  // src/anthropic-error.ts
36
36
  var import_provider_utils = require("@ai-sdk/provider-utils");
@@ -54,7 +54,7 @@ var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorRe
54
54
  // src/anthropic-messages-api.ts
55
55
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
56
56
  var import_v42 = require("zod/v4");
57
- var anthropicStopDetailsSchema = import_v42.z.object({
57
+ var anthropicStopDetailsSchema = () => import_v42.z.object({
58
58
  type: import_v42.z.string(),
59
59
  category: import_v42.z.string().nullish(),
60
60
  explanation: import_v42.z.string().nullish(),
@@ -260,7 +260,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
260
260
  ),
261
261
  stop_reason: import_v42.z.string().nullish(),
262
262
  stop_sequence: import_v42.z.string().nullish(),
263
- stop_details: anthropicStopDetailsSchema.nullish(),
263
+ stop_details: anthropicStopDetailsSchema().nullish(),
264
264
  usage: import_v42.z.looseObject({
265
265
  input_tokens: import_v42.z.number(),
266
266
  output_tokens: import_v42.z.number(),
@@ -564,7 +564,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
564
564
  delta: import_v42.z.object({
565
565
  stop_reason: import_v42.z.string().nullish(),
566
566
  stop_sequence: import_v42.z.string().nullish(),
567
- stop_details: anthropicStopDetailsSchema.nullish(),
567
+ stop_details: anthropicStopDetailsSchema().nullish(),
568
568
  container: import_v42.z.object({
569
569
  expires_at: import_v42.z.string(),
570
570
  id: import_v42.z.string(),
@@ -640,314 +640,327 @@ var anthropicReasoningMetadataSchema = (0, import_provider_utils2.lazySchema)(
640
640
  );
641
641
 
642
642
  // src/anthropic-messages-options.ts
643
+ var import_provider_utils3 = require("@ai-sdk/provider-utils");
643
644
  var import_v43 = require("zod/v4");
644
- var anthropicFilePartProviderOptions = import_v43.z.object({
645
- /**
646
- * Citation configuration for this document.
647
- * When enabled, this document will generate citations in the response.
648
- */
649
- citations: import_v43.z.object({
650
- /**
651
- * Enable citations for this document
652
- */
653
- enabled: import_v43.z.boolean()
654
- }).optional(),
655
- /**
656
- * Custom title for the document.
657
- * If not provided, the filename will be used.
658
- */
659
- title: import_v43.z.string().optional(),
660
- /**
661
- * Context about the document that will be passed to the model
662
- * but not used towards cited content.
663
- * Useful for storing document metadata as text or stringified JSON.
664
- */
665
- context: import_v43.z.string().optional()
666
- });
667
- var anthropicSystemMessageProviderOptions = import_v43.z.object({
668
- /**
669
- * Controls when a mid-conversation system message is cleared.
670
- *
671
- * The value is forwarded to Anthropic as `clear_at`. The required
672
- * `mid-conversation-system-clear-at-2026-08-21` beta is added automatically.
673
- */
674
- clearAt: import_v43.z.literal("next_user_message").optional(),
675
- /**
676
- * Sets the model effort from the next user turn until a later message
677
- * changes it. An effort-only system message with empty content can appear
678
- * first. The required `mid-conversation-output-config-2026-07-01` beta is
679
- * added automatically.
680
- */
681
- effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
682
- /**
683
- * Mid-conversation tool changes. Adds or removes tools from the
684
- * conversation's tool set between turns without invalidating the prompt
685
- * cache.
686
- *
687
- * Only supported on system messages that appear mid-conversation (not the
688
- * initial system prompt). A system message carrying tool changes must come
689
- * right before an assistant message or at the end of the messages.
690
- *
691
- * Tools referenced by a `tool_addition` must be declared in the `tools`
692
- * option (typically with `deferLoading: true` so they are not loaded until
693
- * the addition surfaces them). The required
694
- * `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
695
- */
696
- toolChanges: import_v43.z.array(
697
- import_v43.z.discriminatedUnion("type", [
698
- import_v43.z.object({
699
- type: import_v43.z.literal("tool_addition"),
700
- toolName: import_v43.z.string()
701
- }),
702
- import_v43.z.object({
703
- type: import_v43.z.literal("tool_removal"),
704
- toolName: import_v43.z.string()
705
- })
706
- ])
707
- ).optional()
708
- });
709
- var anthropicThinkingBlockBinding = import_v43.z.object({
710
- /**
711
- * Controls behavior when a replayed thinking block does not match its
712
- * conversation prefix. The `drop_block` behavior drops the mismatched block
713
- * instead of returning an invalid signature error.
714
- */
715
- prefixMismatchBehavior: import_v43.z.literal("drop_block")
716
- });
717
- var anthropicProviderOptions = import_v43.z.object({
718
- /**
719
- * Whether to send reasoning to the model.
720
- *
721
- * This allows you to deactivate reasoning inputs for models that do not support them.
722
- */
723
- sendReasoning: import_v43.z.boolean().optional(),
724
- /**
725
- * Determines how structured outputs are generated.
726
- *
727
- * - `outputFormat`: Use the `output_format` parameter to specify the structured output format.
728
- * - `jsonTool`: Use a special JSON response tool to specify the structured output format (default for most models).
729
- * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Sonnet 5.5, Opus 5.5, and Fable 5.1).
730
- */
731
- structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
732
- /**
733
- * Configuration for enabling Claude's extended thinking.
734
- *
735
- * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
736
- * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
737
- *
738
- * Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
739
- * `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
740
- * provider drops the unsupported setting, emits a warning, and sends an
741
- * adaptive thinking request. Use `effort` to control how much they think.
742
- *
743
- * `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
744
- * and the provider uses it in place of `disabled` for that model.
745
- */
746
- thinking: import_v43.z.union([
645
+ var anthropicFilePartProviderOptions = (0, import_provider_utils3.lazySchema)(
646
+ () => (0, import_provider_utils3.zodSchema)(
747
647
  import_v43.z.object({
748
- /** for Sonnet 4.6, Opus 4.6, and newer models */
749
- type: import_v43.z.literal("adaptive"),
750
648
  /**
751
- * Controls whether thinking content is included in the response.
752
- * - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
753
- * - `"summarized"`: Thinking content is returned. Required to see reasoning output.
754
- * - `"updates"`: Thinking summaries are emitted between tool calls.
649
+ * Citation configuration for this document.
650
+ * When enabled, this document will generate citations in the response.
755
651
  */
756
- display: import_v43.z.enum(["omitted", "summarized", "updates"]).optional(),
652
+ citations: import_v43.z.object({
653
+ /**
654
+ * Enable citations for this document
655
+ */
656
+ enabled: import_v43.z.boolean()
657
+ }).optional(),
757
658
  /**
758
- * Controls handling for thinking blocks whose conversation prefix no
759
- * longer matches. Forwarded as `block_binding`.
659
+ * Custom title for the document.
660
+ * If not provided, the filename will be used.
760
661
  */
761
- blockBinding: anthropicThinkingBlockBinding.optional()
762
- }),
763
- import_v43.z.object({
764
- /** for models before Opus 4.6, except Sonnet 4.6 still supports it */
765
- type: import_v43.z.literal("enabled"),
766
- budgetTokens: import_v43.z.number().optional(),
662
+ title: import_v43.z.string().optional(),
767
663
  /**
768
- * Controls handling for thinking blocks whose conversation prefix no
769
- * longer matches. Forwarded as `block_binding`.
664
+ * Context about the document that will be passed to the model
665
+ * but not used towards cited content.
666
+ * Useful for storing document metadata as text or stringified JSON.
770
667
  */
771
- blockBinding: anthropicThinkingBlockBinding.optional()
772
- }),
773
- import_v43.z.object({
774
- type: import_v43.z.literal("disabled")
775
- }),
668
+ context: import_v43.z.string().optional()
669
+ })
670
+ )
671
+ );
672
+ var anthropicSystemMessageProviderOptions = (0, import_provider_utils3.lazySchema)(
673
+ () => (0, import_provider_utils3.zodSchema)(
776
674
  import_v43.z.object({
777
675
  /**
778
- * for `claude-sonnet-5-5`: no upfront thinking, but progress notes
779
- * between tool calls are returned as summarized thinking blocks.
780
- * Only supported at `low`, `medium`, and `high` effort.
676
+ * Controls when a mid-conversation system message is cleared.
677
+ *
678
+ * The value is forwarded to Anthropic as `clear_at`. The required
679
+ * `mid-conversation-system-clear-at-2026-08-21` beta is added automatically.
781
680
  */
782
- type: import_v43.z.literal("between_tools")
783
- }),
784
- import_v43.z.object({
681
+ clearAt: import_v43.z.literal("next_user_message").optional(),
682
+ /**
683
+ * Sets the model effort from the next user turn until a later message
684
+ * changes it. An effort-only system message with empty content can appear
685
+ * first. The required `mid-conversation-output-config-2026-07-01` beta is
686
+ * added automatically.
687
+ */
688
+ effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
785
689
  /**
786
- * Configure prefix mismatch handling without changing the model's
787
- * default thinking mode.
690
+ * Mid-conversation tool changes. Adds or removes tools from the
691
+ * conversation's tool set between turns without invalidating the prompt
692
+ * cache.
693
+ *
694
+ * Only supported on system messages that appear mid-conversation (not the
695
+ * initial system prompt). A system message carrying tool changes must come
696
+ * right before an assistant message or at the end of the messages.
697
+ *
698
+ * Tools referenced by a `tool_addition` must be declared in the `tools`
699
+ * option (typically with `deferLoading: true` so they are not loaded until
700
+ * the addition surfaces them). The required
701
+ * `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
788
702
  */
789
- blockBinding: anthropicThinkingBlockBinding
703
+ toolChanges: import_v43.z.array(
704
+ import_v43.z.discriminatedUnion("type", [
705
+ import_v43.z.object({
706
+ type: import_v43.z.literal("tool_addition"),
707
+ toolName: import_v43.z.string()
708
+ }),
709
+ import_v43.z.object({
710
+ type: import_v43.z.literal("tool_removal"),
711
+ toolName: import_v43.z.string()
712
+ })
713
+ ])
714
+ ).optional()
790
715
  })
791
- ]).optional(),
792
- /**
793
- * Whether to disable parallel function calling during tool use. Default is false.
794
- * When set to true, Claude will use at most one tool per response.
795
- */
796
- disableParallelToolUse: import_v43.z.boolean().optional(),
797
- /**
798
- * Cache control settings for this message.
799
- * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
800
- */
801
- cacheControl: import_v43.z.object({
802
- type: import_v43.z.literal("ephemeral"),
803
- ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
804
- }).optional(),
805
- /**
806
- * Metadata to include with the request.
807
- *
808
- * See https://platform.claude.com/docs/en/api/messages/create for details.
809
- */
810
- metadata: import_v43.z.object({
716
+ )
717
+ );
718
+ var anthropicProviderOptions = (0, import_provider_utils3.lazySchema)(() => {
719
+ const anthropicThinkingBlockBinding = import_v43.z.object({
811
720
  /**
812
- * An external identifier for the user associated with the request.
813
- *
814
- * Should be a UUID, hash value, or other opaque identifier.
815
- * Must not contain PII (name, email, phone number, etc.).
721
+ * Controls behavior when a replayed thinking block does not match its
722
+ * conversation prefix. The `drop_block` behavior drops the mismatched block
723
+ * instead of returning an invalid signature error.
816
724
  */
817
- userId: import_v43.z.string().optional()
818
- }).optional(),
819
- /**
820
- * Agent Skills configuration. Skills enable Claude to perform specialized tasks
821
- * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
822
- * Requires code execution tool to be enabled.
823
- */
824
- container: import_v43.z.object({
825
- id: import_v43.z.string().optional(),
826
- skills: import_v43.z.array(
827
- import_v43.z.object({
828
- type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
829
- skillId: import_v43.z.string(),
830
- version: import_v43.z.string().optional()
831
- })
832
- ).optional()
833
- }).optional(),
834
- /**
835
- * @default 'high'
836
- */
837
- effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
838
- /**
839
- * Task budget for agentic turns. Informs the model of the total token budget
840
- * available for the current task, allowing it to prioritize work and wind down
841
- * gracefully as the budget is consumed.
842
- *
843
- * Advisory only — does not enforce a hard token limit.
844
- */
845
- taskBudget: import_v43.z.object({
846
- type: import_v43.z.literal("tokens"),
847
- total: import_v43.z.number().int().min(2e4),
848
- remaining: import_v43.z.number().int().min(0).optional()
849
- }).optional(),
850
- /**
851
- * Enable fast mode for faster inference (2.5x faster output token speeds).
852
- * Only supported with claude-opus-4-6.
853
- */
854
- speed: import_v43.z.enum(["fast", "standard"]).optional(),
855
- /**
856
- * Controls where model inference runs for this request.
857
- *
858
- * - `"global"`: Inference may run in any available geography (default).
859
- * - `"us"`: Inference runs only in US-based infrastructure.
860
- *
861
- * See https://platform.claude.com/docs/en/build-with-claude/data-residency
862
- */
863
- inferenceGeo: import_v43.z.enum(["us", "global"]).optional(),
864
- /**
865
- * Server-side fallback configuration.
866
- *
867
- * When the primary model's safety classifiers block a turn, the API
868
- * automatically retries it server-side on a fallback model. A
869
- * `content-filter` finish reason means the fallback(s) refused as well.
870
- *
871
- * - `'default'` (recommended): the API routes the retry to Anthropic's
872
- * recommended fallback model based on the refusal category. Requires the
873
- * `server-side-fallback-2026-07-01` beta, which is added automatically.
874
- * - Array form: an explicit fallback chain. Each entry is merged into the
875
- * request as a direct request to that entry's model, so it must be
876
- * formatted accordingly: `model` is required, and an entry may
877
- * additionally override `max_tokens`, `thinking`, `output_config`, and
878
- * `speed` for that attempt only (`speed` additionally requires the speed
879
- * beta). The value is passed through to the API as-is, and the
880
- * `server-side-fallback-2026-06-01` beta is added automatically.
881
- */
882
- fallbacks: import_v43.z.union([
883
- import_v43.z.literal("default"),
884
- import_v43.z.array(
885
- import_v43.z.object({
886
- model: import_v43.z.string(),
887
- max_tokens: import_v43.z.number().int().optional(),
888
- thinking: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
889
- output_config: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
890
- speed: import_v43.z.enum(["fast", "standard"]).optional()
891
- })
892
- )
893
- ]).optional(),
894
- /**
895
- * Context management configuration for automatic context window management.
896
- * Enables features like automatic compaction and clearing of tool uses/thinking blocks.
897
- */
898
- contextManagement: import_v43.z.object({
899
- edits: import_v43.z.array(
900
- import_v43.z.discriminatedUnion("type", [
725
+ prefixMismatchBehavior: import_v43.z.literal("drop_block")
726
+ });
727
+ return (0, import_provider_utils3.zodSchema)(
728
+ import_v43.z.object({
729
+ /**
730
+ * Whether to send reasoning to the model.
731
+ *
732
+ * This allows you to deactivate reasoning inputs for models that do not support them.
733
+ */
734
+ sendReasoning: import_v43.z.boolean().optional(),
735
+ /**
736
+ * Determines how structured outputs are generated.
737
+ *
738
+ * - `outputFormat`: Use the `output_format` parameter to specify the structured output format.
739
+ * - `jsonTool`: Use a special JSON response tool to specify the structured output format (default for most models).
740
+ * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Sonnet 5.5, Opus 5.5, and Fable 5.1).
741
+ */
742
+ structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
743
+ /**
744
+ * Configuration for enabling Claude's extended thinking.
745
+ *
746
+ * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
747
+ * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
748
+ *
749
+ * Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
750
+ * `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
751
+ * provider drops the unsupported setting, emits a warning, and sends an
752
+ * adaptive thinking request. Use `effort` to control how much they think.
753
+ *
754
+ * `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
755
+ * and the provider uses it in place of `disabled` for that model.
756
+ */
757
+ thinking: import_v43.z.union([
901
758
  import_v43.z.object({
902
- type: import_v43.z.literal("clear_tool_uses_20250919"),
903
- trigger: import_v43.z.discriminatedUnion("type", [
904
- import_v43.z.object({
905
- type: import_v43.z.literal("input_tokens"),
906
- value: import_v43.z.number()
907
- }),
908
- import_v43.z.object({
909
- type: import_v43.z.literal("tool_uses"),
910
- value: import_v43.z.number()
911
- })
912
- ]).optional(),
913
- keep: import_v43.z.object({
914
- type: import_v43.z.literal("tool_uses"),
915
- value: import_v43.z.number()
916
- }).optional(),
917
- clearAtLeast: import_v43.z.object({
918
- type: import_v43.z.literal("input_tokens"),
919
- value: import_v43.z.number()
920
- }).optional(),
921
- clearToolInputs: import_v43.z.boolean().optional(),
922
- excludeTools: import_v43.z.array(import_v43.z.string()).optional()
759
+ /** for Sonnet 4.6, Opus 4.6, and newer models */
760
+ type: import_v43.z.literal("adaptive"),
761
+ /**
762
+ * Controls whether thinking content is included in the response.
763
+ * - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
764
+ * - `"summarized"`: Thinking content is returned. Required to see reasoning output.
765
+ * - `"updates"`: Thinking summaries are emitted between tool calls.
766
+ */
767
+ display: import_v43.z.enum(["omitted", "summarized", "updates"]).optional(),
768
+ /**
769
+ * Controls handling for thinking blocks whose conversation prefix no
770
+ * longer matches. Forwarded as `block_binding`.
771
+ */
772
+ blockBinding: anthropicThinkingBlockBinding.optional()
923
773
  }),
924
774
  import_v43.z.object({
925
- type: import_v43.z.literal("clear_thinking_20251015"),
926
- keep: import_v43.z.union([
927
- import_v43.z.literal("all"),
928
- import_v43.z.object({
929
- type: import_v43.z.literal("thinking_turns"),
930
- value: import_v43.z.number()
931
- })
932
- ]).optional()
775
+ /** for models before Opus 4.6, except Sonnet 4.6 still supports it */
776
+ type: import_v43.z.literal("enabled"),
777
+ budgetTokens: import_v43.z.number().optional(),
778
+ /**
779
+ * Controls handling for thinking blocks whose conversation prefix no
780
+ * longer matches. Forwarded as `block_binding`.
781
+ */
782
+ blockBinding: anthropicThinkingBlockBinding.optional()
783
+ }),
784
+ import_v43.z.object({
785
+ type: import_v43.z.literal("disabled")
933
786
  }),
934
787
  import_v43.z.object({
935
- type: import_v43.z.literal("compact_20260112"),
936
- trigger: import_v43.z.object({
937
- type: import_v43.z.literal("input_tokens"),
938
- value: import_v43.z.number()
939
- }).optional(),
940
- pauseAfterCompaction: import_v43.z.boolean().optional(),
941
- instructions: import_v43.z.string().optional()
788
+ /**
789
+ * for `claude-sonnet-5-5`: no upfront thinking, but progress notes
790
+ * between tool calls are returned as summarized thinking blocks.
791
+ * Only supported at `low`, `medium`, and `high` effort.
792
+ */
793
+ type: import_v43.z.literal("between_tools")
794
+ }),
795
+ import_v43.z.object({
796
+ /**
797
+ * Configure prefix mismatch handling without changing the model's
798
+ * default thinking mode.
799
+ */
800
+ blockBinding: anthropicThinkingBlockBinding
942
801
  })
943
- ])
944
- )
945
- }).optional(),
946
- /**
947
- * A set of beta features to enable.
948
- * Allow a provider to receive the full `betas` set if it needs it.
949
- */
950
- anthropicBeta: import_v43.z.array(import_v43.z.string()).optional()
802
+ ]).optional(),
803
+ /**
804
+ * Whether to disable parallel function calling during tool use. Default is false.
805
+ * When set to true, Claude will use at most one tool per response.
806
+ */
807
+ disableParallelToolUse: import_v43.z.boolean().optional(),
808
+ /**
809
+ * Cache control settings for this message.
810
+ * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
811
+ */
812
+ cacheControl: import_v43.z.object({
813
+ type: import_v43.z.literal("ephemeral"),
814
+ ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
815
+ }).optional(),
816
+ /**
817
+ * Metadata to include with the request.
818
+ *
819
+ * See https://platform.claude.com/docs/en/api/messages/create for details.
820
+ */
821
+ metadata: import_v43.z.object({
822
+ /**
823
+ * An external identifier for the user associated with the request.
824
+ *
825
+ * Should be a UUID, hash value, or other opaque identifier.
826
+ * Must not contain PII (name, email, phone number, etc.).
827
+ */
828
+ userId: import_v43.z.string().optional()
829
+ }).optional(),
830
+ /**
831
+ * Agent Skills configuration. Skills enable Claude to perform specialized tasks
832
+ * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
833
+ * Requires code execution tool to be enabled.
834
+ */
835
+ container: import_v43.z.object({
836
+ id: import_v43.z.string().optional(),
837
+ skills: import_v43.z.array(
838
+ import_v43.z.object({
839
+ type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
840
+ skillId: import_v43.z.string(),
841
+ version: import_v43.z.string().optional()
842
+ })
843
+ ).optional()
844
+ }).optional(),
845
+ /**
846
+ * @default 'high'
847
+ */
848
+ effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
849
+ /**
850
+ * Task budget for agentic turns. Informs the model of the total token budget
851
+ * available for the current task, allowing it to prioritize work and wind down
852
+ * gracefully as the budget is consumed.
853
+ *
854
+ * Advisory only — does not enforce a hard token limit.
855
+ */
856
+ taskBudget: import_v43.z.object({
857
+ type: import_v43.z.literal("tokens"),
858
+ total: import_v43.z.number().int().min(2e4),
859
+ remaining: import_v43.z.number().int().min(0).optional()
860
+ }).optional(),
861
+ /**
862
+ * Enable fast mode for faster inference (2.5x faster output token speeds).
863
+ * Only supported with claude-opus-4-6.
864
+ */
865
+ speed: import_v43.z.enum(["fast", "standard"]).optional(),
866
+ /**
867
+ * Controls where model inference runs for this request.
868
+ *
869
+ * - `"global"`: Inference may run in any available geography (default).
870
+ * - `"us"`: Inference runs only in US-based infrastructure.
871
+ *
872
+ * See https://platform.claude.com/docs/en/build-with-claude/data-residency
873
+ */
874
+ inferenceGeo: import_v43.z.enum(["us", "global"]).optional(),
875
+ /**
876
+ * Server-side fallback configuration.
877
+ *
878
+ * When the primary model's safety classifiers block a turn, the API
879
+ * automatically retries it server-side on a fallback model. A
880
+ * `content-filter` finish reason means the fallback(s) refused as well.
881
+ *
882
+ * - `'default'` (recommended): the API routes the retry to Anthropic's
883
+ * recommended fallback model based on the refusal category. Requires the
884
+ * `server-side-fallback-2026-07-01` beta, which is added automatically.
885
+ * - Array form: an explicit fallback chain. Each entry is merged into the
886
+ * request as a direct request to that entry's model, so it must be
887
+ * formatted accordingly: `model` is required, and an entry may
888
+ * additionally override `max_tokens`, `thinking`, `output_config`, and
889
+ * `speed` for that attempt only (`speed` additionally requires the speed
890
+ * beta). The value is passed through to the API as-is, and the
891
+ * `server-side-fallback-2026-06-01` beta is added automatically.
892
+ */
893
+ fallbacks: import_v43.z.union([
894
+ import_v43.z.literal("default"),
895
+ import_v43.z.array(
896
+ import_v43.z.object({
897
+ model: import_v43.z.string(),
898
+ max_tokens: import_v43.z.number().int().optional(),
899
+ thinking: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
900
+ output_config: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
901
+ speed: import_v43.z.enum(["fast", "standard"]).optional()
902
+ })
903
+ )
904
+ ]).optional(),
905
+ /**
906
+ * Context management configuration for automatic context window management.
907
+ * Enables features like automatic compaction and clearing of tool uses/thinking blocks.
908
+ */
909
+ contextManagement: import_v43.z.object({
910
+ edits: import_v43.z.array(
911
+ import_v43.z.discriminatedUnion("type", [
912
+ import_v43.z.object({
913
+ type: import_v43.z.literal("clear_tool_uses_20250919"),
914
+ trigger: import_v43.z.discriminatedUnion("type", [
915
+ import_v43.z.object({
916
+ type: import_v43.z.literal("input_tokens"),
917
+ value: import_v43.z.number()
918
+ }),
919
+ import_v43.z.object({
920
+ type: import_v43.z.literal("tool_uses"),
921
+ value: import_v43.z.number()
922
+ })
923
+ ]).optional(),
924
+ keep: import_v43.z.object({
925
+ type: import_v43.z.literal("tool_uses"),
926
+ value: import_v43.z.number()
927
+ }).optional(),
928
+ clearAtLeast: import_v43.z.object({
929
+ type: import_v43.z.literal("input_tokens"),
930
+ value: import_v43.z.number()
931
+ }).optional(),
932
+ clearToolInputs: import_v43.z.boolean().optional(),
933
+ excludeTools: import_v43.z.array(import_v43.z.string()).optional()
934
+ }),
935
+ import_v43.z.object({
936
+ type: import_v43.z.literal("clear_thinking_20251015"),
937
+ keep: import_v43.z.union([
938
+ import_v43.z.literal("all"),
939
+ import_v43.z.object({
940
+ type: import_v43.z.literal("thinking_turns"),
941
+ value: import_v43.z.number()
942
+ })
943
+ ]).optional()
944
+ }),
945
+ import_v43.z.object({
946
+ type: import_v43.z.literal("compact_20260112"),
947
+ trigger: import_v43.z.object({
948
+ type: import_v43.z.literal("input_tokens"),
949
+ value: import_v43.z.number()
950
+ }).optional(),
951
+ pauseAfterCompaction: import_v43.z.boolean().optional(),
952
+ instructions: import_v43.z.string().optional()
953
+ })
954
+ ])
955
+ )
956
+ }).optional(),
957
+ /**
958
+ * A set of beta features to enable.
959
+ * Allow a provider to receive the full `betas` set if it needs it.
960
+ */
961
+ anthropicBeta: import_v43.z.array(import_v43.z.string()).optional()
962
+ })
963
+ );
951
964
  });
952
965
 
953
966
  // src/anthropic-prepare-tools.ts
@@ -996,7 +1009,7 @@ var CacheControlValidator = class {
996
1009
  };
997
1010
 
998
1011
  // src/tool/computer-toolset_20260801.ts
999
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
1012
+ var import_provider_utils4 = require("@ai-sdk/provider-utils");
1000
1013
  var import_v44 = require("zod/v4");
1001
1014
  var computerToolset_20260801Members = [
1002
1015
  "screenshot",
@@ -1017,8 +1030,8 @@ var computerToolset_20260801Members = [
1017
1030
  "hold_key",
1018
1031
  "wait"
1019
1032
  ];
1020
- var computerToolset_20260801InputSchema = (0, import_provider_utils3.lazySchema)(
1021
- () => (0, import_provider_utils3.zodSchema)(
1033
+ var computerToolset_20260801InputSchema = (0, import_provider_utils4.lazySchema)(
1034
+ () => (0, import_provider_utils4.zodSchema)(
1022
1035
  import_v44.z.object({
1023
1036
  action: import_v44.z.enum(computerToolset_20260801Members),
1024
1037
  coordinate: import_v44.z.tuple([import_v44.z.number().int(), import_v44.z.number().int()]).optional(),
@@ -1037,8 +1050,8 @@ var computerToolset_20260801InputSchema = (0, import_provider_utils3.lazySchema)
1037
1050
  })
1038
1051
  )
1039
1052
  );
1040
- var computerToolset_20260801ArgsSchema = (0, import_provider_utils3.lazySchema)(
1041
- () => (0, import_provider_utils3.zodSchema)(
1053
+ var computerToolset_20260801ArgsSchema = (0, import_provider_utils4.lazySchema)(
1054
+ () => (0, import_provider_utils4.zodSchema)(
1042
1055
  import_v44.z.object({
1043
1056
  configs: import_v44.z.partialRecord(
1044
1057
  import_v44.z.enum(computerToolset_20260801Members),
@@ -1050,24 +1063,24 @@ var computerToolset_20260801ArgsSchema = (0, import_provider_utils3.lazySchema)(
1050
1063
  })
1051
1064
  )
1052
1065
  );
1053
- var computerToolset_20260801 = (0, import_provider_utils3.createProviderDefinedToolFactory)({
1066
+ var computerToolset_20260801 = (0, import_provider_utils4.createProviderDefinedToolFactory)({
1054
1067
  id: "anthropic.computer_toolset_20260801",
1055
1068
  name: "computer",
1056
1069
  inputSchema: computerToolset_20260801InputSchema
1057
1070
  });
1058
1071
 
1059
1072
  // src/tool/text-editor_20250728.ts
1060
- var import_provider_utils4 = require("@ai-sdk/provider-utils");
1073
+ var import_provider_utils5 = require("@ai-sdk/provider-utils");
1061
1074
  var import_v45 = require("zod/v4");
1062
- var textEditor_20250728ArgsSchema = (0, import_provider_utils4.lazySchema)(
1063
- () => (0, import_provider_utils4.zodSchema)(
1075
+ var textEditor_20250728ArgsSchema = (0, import_provider_utils5.lazySchema)(
1076
+ () => (0, import_provider_utils5.zodSchema)(
1064
1077
  import_v45.z.object({
1065
1078
  maxCharacters: import_v45.z.number().optional()
1066
1079
  })
1067
1080
  )
1068
1081
  );
1069
- var textEditor_20250728InputSchema = (0, import_provider_utils4.lazySchema)(
1070
- () => (0, import_provider_utils4.zodSchema)(
1082
+ var textEditor_20250728InputSchema = (0, import_provider_utils5.lazySchema)(
1083
+ () => (0, import_provider_utils5.zodSchema)(
1071
1084
  import_v45.z.object({
1072
1085
  command: import_v45.z.enum(["view", "create", "str_replace", "insert"]),
1073
1086
  path: import_v45.z.string(),
@@ -1079,7 +1092,7 @@ var textEditor_20250728InputSchema = (0, import_provider_utils4.lazySchema)(
1079
1092
  })
1080
1093
  )
1081
1094
  );
1082
- var factory = (0, import_provider_utils4.createProviderDefinedToolFactory)({
1095
+ var factory = (0, import_provider_utils5.createProviderDefinedToolFactory)({
1083
1096
  id: "anthropic.text_editor_20250728",
1084
1097
  name: "str_replace_based_edit_tool",
1085
1098
  inputSchema: textEditor_20250728InputSchema
@@ -1089,10 +1102,10 @@ var textEditor_20250728 = (args = {}) => {
1089
1102
  };
1090
1103
 
1091
1104
  // src/tool/web-search_20250305.ts
1092
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
1105
+ var import_provider_utils6 = require("@ai-sdk/provider-utils");
1093
1106
  var import_v46 = require("zod/v4");
1094
- var webSearch_20250305ArgsSchema = (0, import_provider_utils5.lazySchema)(
1095
- () => (0, import_provider_utils5.zodSchema)(
1107
+ var webSearch_20250305ArgsSchema = (0, import_provider_utils6.lazySchema)(
1108
+ () => (0, import_provider_utils6.zodSchema)(
1096
1109
  import_v46.z.object({
1097
1110
  maxUses: import_v46.z.number().optional(),
1098
1111
  allowedDomains: import_v46.z.array(import_v46.z.string()).optional(),
@@ -1107,8 +1120,8 @@ var webSearch_20250305ArgsSchema = (0, import_provider_utils5.lazySchema)(
1107
1120
  })
1108
1121
  )
1109
1122
  );
1110
- var webSearch_20250305OutputSchema = (0, import_provider_utils5.lazySchema)(
1111
- () => (0, import_provider_utils5.zodSchema)(
1123
+ var webSearch_20250305OutputSchema = (0, import_provider_utils6.lazySchema)(
1124
+ () => (0, import_provider_utils6.zodSchema)(
1112
1125
  import_v46.z.array(
1113
1126
  import_v46.z.object({
1114
1127
  url: import_v46.z.string(),
@@ -1120,14 +1133,14 @@ var webSearch_20250305OutputSchema = (0, import_provider_utils5.lazySchema)(
1120
1133
  )
1121
1134
  )
1122
1135
  );
1123
- var webSearch_20250305InputSchema = (0, import_provider_utils5.lazySchema)(
1124
- () => (0, import_provider_utils5.zodSchema)(
1136
+ var webSearch_20250305InputSchema = (0, import_provider_utils6.lazySchema)(
1137
+ () => (0, import_provider_utils6.zodSchema)(
1125
1138
  import_v46.z.object({
1126
1139
  query: import_v46.z.string()
1127
1140
  })
1128
1141
  )
1129
1142
  );
1130
- var factory2 = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
1143
+ var factory2 = (0, import_provider_utils6.createProviderDefinedToolFactoryWithOutputSchema)({
1131
1144
  id: "anthropic.web_search_20250305",
1132
1145
  name: "web_search",
1133
1146
  inputSchema: webSearch_20250305InputSchema,
@@ -1138,10 +1151,10 @@ var webSearch_20250305 = (args = {}) => {
1138
1151
  };
1139
1152
 
1140
1153
  // src/tool/web-fetch-20250910.ts
1141
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
1154
+ var import_provider_utils7 = require("@ai-sdk/provider-utils");
1142
1155
  var import_v47 = require("zod/v4");
1143
- var webFetch_20250910ArgsSchema = (0, import_provider_utils6.lazySchema)(
1144
- () => (0, import_provider_utils6.zodSchema)(
1156
+ var webFetch_20250910ArgsSchema = (0, import_provider_utils7.lazySchema)(
1157
+ () => (0, import_provider_utils7.zodSchema)(
1145
1158
  import_v47.z.object({
1146
1159
  maxUses: import_v47.z.number().optional(),
1147
1160
  allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
@@ -1151,8 +1164,8 @@ var webFetch_20250910ArgsSchema = (0, import_provider_utils6.lazySchema)(
1151
1164
  })
1152
1165
  )
1153
1166
  );
1154
- var webFetch_20250910OutputSchema = (0, import_provider_utils6.lazySchema)(
1155
- () => (0, import_provider_utils6.zodSchema)(
1167
+ var webFetch_20250910OutputSchema = (0, import_provider_utils7.lazySchema)(
1168
+ () => (0, import_provider_utils7.zodSchema)(
1156
1169
  import_v47.z.object({
1157
1170
  type: import_v47.z.literal("web_fetch_result"),
1158
1171
  url: import_v47.z.string(),
@@ -1177,14 +1190,14 @@ var webFetch_20250910OutputSchema = (0, import_provider_utils6.lazySchema)(
1177
1190
  })
1178
1191
  )
1179
1192
  );
1180
- var webFetch_20250910InputSchema = (0, import_provider_utils6.lazySchema)(
1181
- () => (0, import_provider_utils6.zodSchema)(
1193
+ var webFetch_20250910InputSchema = (0, import_provider_utils7.lazySchema)(
1194
+ () => (0, import_provider_utils7.zodSchema)(
1182
1195
  import_v47.z.object({
1183
1196
  url: import_v47.z.string()
1184
1197
  })
1185
1198
  )
1186
1199
  );
1187
- var factory3 = (0, import_provider_utils6.createProviderDefinedToolFactoryWithOutputSchema)({
1200
+ var factory3 = (0, import_provider_utils7.createProviderDefinedToolFactoryWithOutputSchema)({
1188
1201
  id: "anthropic.web_fetch_20250910",
1189
1202
  name: "web_fetch",
1190
1203
  inputSchema: webFetch_20250910InputSchema,
@@ -1195,7 +1208,7 @@ var webFetch_20250910 = (args = {}) => {
1195
1208
  };
1196
1209
 
1197
1210
  // src/anthropic-prepare-tools.ts
1198
- var import_provider_utils7 = require("@ai-sdk/provider-utils");
1211
+ var import_provider_utils8 = require("@ai-sdk/provider-utils");
1199
1212
  async function prepareTools({
1200
1213
  tools,
1201
1214
  toolChoice,
@@ -1257,7 +1270,7 @@ async function prepareTools({
1257
1270
  break;
1258
1271
  }
1259
1272
  case "anthropic.computer_toolset_20260801": {
1260
- const args = await (0, import_provider_utils7.validateTypes)({
1273
+ const args = await (0, import_provider_utils8.validateTypes)({
1261
1274
  value: tool.args,
1262
1275
  schema: computerToolset_20260801ArgsSchema
1263
1276
  });
@@ -1333,7 +1346,7 @@ async function prepareTools({
1333
1346
  break;
1334
1347
  }
1335
1348
  case "anthropic.text_editor_20250728": {
1336
- const args = await (0, import_provider_utils7.validateTypes)({
1349
+ const args = await (0, import_provider_utils8.validateTypes)({
1337
1350
  value: tool.args,
1338
1351
  schema: textEditor_20250728ArgsSchema
1339
1352
  });
@@ -1373,7 +1386,7 @@ async function prepareTools({
1373
1386
  }
1374
1387
  case "anthropic.web_fetch_20250910": {
1375
1388
  betas.add("web-fetch-2025-09-10");
1376
- const args = await (0, import_provider_utils7.validateTypes)({
1389
+ const args = await (0, import_provider_utils8.validateTypes)({
1377
1390
  value: tool.args,
1378
1391
  schema: webFetch_20250910ArgsSchema
1379
1392
  });
@@ -1390,7 +1403,7 @@ async function prepareTools({
1390
1403
  break;
1391
1404
  }
1392
1405
  case "anthropic.web_search_20250305": {
1393
- const args = await (0, import_provider_utils7.validateTypes)({
1406
+ const args = await (0, import_provider_utils8.validateTypes)({
1394
1407
  value: tool.args,
1395
1408
  schema: webSearch_20250305ArgsSchema
1396
1409
  });
@@ -1506,13 +1519,13 @@ async function prepareTools({
1506
1519
 
1507
1520
  // src/convert-to-anthropic-messages-prompt.ts
1508
1521
  var import_provider2 = require("@ai-sdk/provider");
1509
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
1522
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
1510
1523
 
1511
1524
  // src/tool/code-execution_20250522.ts
1512
- var import_provider_utils8 = require("@ai-sdk/provider-utils");
1525
+ var import_provider_utils9 = require("@ai-sdk/provider-utils");
1513
1526
  var import_v48 = require("zod/v4");
1514
- var codeExecution_20250522OutputSchema = (0, import_provider_utils8.lazySchema)(
1515
- () => (0, import_provider_utils8.zodSchema)(
1527
+ var codeExecution_20250522OutputSchema = (0, import_provider_utils9.lazySchema)(
1528
+ () => (0, import_provider_utils9.zodSchema)(
1516
1529
  import_v48.z.object({
1517
1530
  type: import_v48.z.literal("code_execution_result"),
1518
1531
  stdout: import_v48.z.string(),
@@ -1521,14 +1534,14 @@ var codeExecution_20250522OutputSchema = (0, import_provider_utils8.lazySchema)(
1521
1534
  })
1522
1535
  )
1523
1536
  );
1524
- var codeExecution_20250522InputSchema = (0, import_provider_utils8.lazySchema)(
1525
- () => (0, import_provider_utils8.zodSchema)(
1537
+ var codeExecution_20250522InputSchema = (0, import_provider_utils9.lazySchema)(
1538
+ () => (0, import_provider_utils9.zodSchema)(
1526
1539
  import_v48.z.object({
1527
1540
  code: import_v48.z.string()
1528
1541
  })
1529
1542
  )
1530
1543
  );
1531
- var factory4 = (0, import_provider_utils8.createProviderDefinedToolFactoryWithOutputSchema)({
1544
+ var factory4 = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
1532
1545
  id: "anthropic.code_execution_20250522",
1533
1546
  name: "code_execution",
1534
1547
  inputSchema: codeExecution_20250522InputSchema,
@@ -1539,10 +1552,10 @@ var codeExecution_20250522 = (args = {}) => {
1539
1552
  };
1540
1553
 
1541
1554
  // src/tool/code-execution_20250825.ts
1542
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
1555
+ var import_provider_utils10 = require("@ai-sdk/provider-utils");
1543
1556
  var import_v49 = require("zod/v4");
1544
- var codeExecution_20250825OutputSchema = (0, import_provider_utils9.lazySchema)(
1545
- () => (0, import_provider_utils9.zodSchema)(
1557
+ var codeExecution_20250825OutputSchema = (0, import_provider_utils10.lazySchema)(
1558
+ () => (0, import_provider_utils10.zodSchema)(
1546
1559
  import_v49.z.discriminatedUnion("type", [
1547
1560
  import_v49.z.object({
1548
1561
  type: import_v49.z.literal("bash_code_execution_result"),
@@ -1587,8 +1600,8 @@ var codeExecution_20250825OutputSchema = (0, import_provider_utils9.lazySchema)(
1587
1600
  ])
1588
1601
  )
1589
1602
  );
1590
- var codeExecution_20250825InputSchema = (0, import_provider_utils9.lazySchema)(
1591
- () => (0, import_provider_utils9.zodSchema)(
1603
+ var codeExecution_20250825InputSchema = (0, import_provider_utils10.lazySchema)(
1604
+ () => (0, import_provider_utils10.zodSchema)(
1592
1605
  import_v49.z.discriminatedUnion("type", [
1593
1606
  import_v49.z.object({
1594
1607
  type: import_v49.z.literal("bash_code_execution"),
@@ -1617,7 +1630,7 @@ var codeExecution_20250825InputSchema = (0, import_provider_utils9.lazySchema)(
1617
1630
  ])
1618
1631
  )
1619
1632
  );
1620
- var factory5 = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
1633
+ var factory5 = (0, import_provider_utils10.createProviderDefinedToolFactoryWithOutputSchema)({
1621
1634
  id: "anthropic.code_execution_20250825",
1622
1635
  name: "code_execution",
1623
1636
  inputSchema: codeExecution_20250825InputSchema,
@@ -1659,7 +1672,7 @@ async function convertToAnthropicMessagesPrompt({
1659
1672
  const messages = [];
1660
1673
  async function shouldEnableCitations(providerMetadata) {
1661
1674
  var _a2, _b2;
1662
- const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
1675
+ const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
1663
1676
  provider: "anthropic",
1664
1677
  providerOptions: providerMetadata,
1665
1678
  schema: anthropicFilePartProviderOptions
@@ -1667,7 +1680,7 @@ async function convertToAnthropicMessagesPrompt({
1667
1680
  return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
1668
1681
  }
1669
1682
  async function getDocumentMetadata(providerMetadata) {
1670
- const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
1683
+ const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
1671
1684
  provider: "anthropic",
1672
1685
  providerOptions: providerMetadata,
1673
1686
  schema: anthropicFilePartProviderOptions
@@ -1687,7 +1700,7 @@ async function convertToAnthropicMessagesPrompt({
1687
1700
  let toolChangeCount = 0;
1688
1701
  let hasMidConversationOptions = false;
1689
1702
  for (const { content: text, providerOptions } of block.messages) {
1690
- const systemMessageOptions = await (0, import_provider_utils10.parseProviderOptions)({
1703
+ const systemMessageOptions = await (0, import_provider_utils11.parseProviderOptions)({
1691
1704
  provider: "anthropic",
1692
1705
  providerOptions,
1693
1706
  schema: anthropicSystemMessageProviderOptions
@@ -1797,7 +1810,7 @@ async function convertToAnthropicMessagesPrompt({
1797
1810
  } : {
1798
1811
  type: "base64",
1799
1812
  media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
1800
- data: (0, import_provider_utils10.convertToBase64)(part.data)
1813
+ data: (0, import_provider_utils11.convertToBase64)(part.data)
1801
1814
  },
1802
1815
  cache_control: cacheControl
1803
1816
  });
@@ -1817,7 +1830,7 @@ async function convertToAnthropicMessagesPrompt({
1817
1830
  } : {
1818
1831
  type: "base64",
1819
1832
  media_type: "application/pdf",
1820
- data: (0, import_provider_utils10.convertToBase64)(part.data)
1833
+ data: (0, import_provider_utils11.convertToBase64)(part.data)
1821
1834
  },
1822
1835
  title: (_c = metadata.title) != null ? _c : part.filename,
1823
1836
  ...metadata.context && { context: metadata.context },
@@ -1991,7 +2004,7 @@ async function convertToAnthropicMessagesPrompt({
1991
2004
  }
1992
2005
  case "reasoning": {
1993
2006
  if (sendReasoning) {
1994
- const reasoningMetadata = await (0, import_provider_utils10.parseProviderOptions)({
2007
+ const reasoningMetadata = await (0, import_provider_utils11.parseProviderOptions)({
1995
2008
  provider: "anthropic",
1996
2009
  providerOptions: part.providerOptions,
1997
2010
  schema: anthropicReasoningMetadataSchema
@@ -2116,7 +2129,7 @@ async function convertToAnthropicMessagesPrompt({
2116
2129
  break;
2117
2130
  }
2118
2131
  if (output.value.type === "code_execution_result") {
2119
- const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
2132
+ const codeExecutionOutput = await (0, import_provider_utils11.validateTypes)({
2120
2133
  value: output.value,
2121
2134
  schema: codeExecution_20250522OutputSchema
2122
2135
  });
@@ -2132,7 +2145,7 @@ async function convertToAnthropicMessagesPrompt({
2132
2145
  cache_control: cacheControl
2133
2146
  });
2134
2147
  } else {
2135
- const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
2148
+ const codeExecutionOutput = await (0, import_provider_utils11.validateTypes)({
2136
2149
  value: output.value,
2137
2150
  schema: codeExecution_20250825OutputSchema
2138
2151
  });
@@ -2169,7 +2182,7 @@ async function convertToAnthropicMessagesPrompt({
2169
2182
  });
2170
2183
  break;
2171
2184
  }
2172
- const webFetchOutput = await (0, import_provider_utils10.validateTypes)({
2185
+ const webFetchOutput = await (0, import_provider_utils11.validateTypes)({
2173
2186
  value: output.value,
2174
2187
  schema: webFetch_20250910OutputSchema
2175
2188
  });
@@ -2204,7 +2217,7 @@ async function convertToAnthropicMessagesPrompt({
2204
2217
  });
2205
2218
  break;
2206
2219
  }
2207
- const webSearchOutput = await (0, import_provider_utils10.validateTypes)({
2220
+ const webSearchOutput = await (0, import_provider_utils11.validateTypes)({
2208
2221
  value: output.value,
2209
2222
  schema: webSearch_20250305OutputSchema
2210
2223
  });
@@ -2561,7 +2574,7 @@ var AnthropicMessagesLanguageModel = class {
2561
2574
  var _a;
2562
2575
  this.modelId = modelId;
2563
2576
  this.config = config;
2564
- this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils11.generateId;
2577
+ this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils12.generateId;
2565
2578
  }
2566
2579
  supportsUrl(url) {
2567
2580
  return url.protocol === "https:";
@@ -2633,7 +2646,7 @@ var AnthropicMessagesLanguageModel = class {
2633
2646
  });
2634
2647
  }
2635
2648
  }
2636
- const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
2649
+ const anthropicOptions = await (0, import_provider_utils12.parseProviderOptions)({
2637
2650
  provider: "anthropic",
2638
2651
  providerOptions,
2639
2652
  schema: anthropicProviderOptions
@@ -3027,15 +3040,15 @@ var AnthropicMessagesLanguageModel = class {
3027
3040
  betas,
3028
3041
  headers
3029
3042
  }) {
3030
- return (0, import_provider_utils11.combineHeaders)(
3031
- await (0, import_provider_utils11.resolve)(this.config.headers),
3043
+ return (0, import_provider_utils12.combineHeaders)(
3044
+ await (0, import_provider_utils12.resolve)(this.config.headers),
3032
3045
  headers,
3033
3046
  betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
3034
3047
  );
3035
3048
  }
3036
3049
  async getBetasFromHeaders(requestHeaders) {
3037
3050
  var _a, _b;
3038
- const configHeaders = await (0, import_provider_utils11.resolve)(this.config.headers);
3051
+ const configHeaders = await (0, import_provider_utils12.resolve)(this.config.headers);
3039
3052
  const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
3040
3053
  const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
3041
3054
  return new Set(
@@ -3087,12 +3100,12 @@ var AnthropicMessagesLanguageModel = class {
3087
3100
  responseHeaders,
3088
3101
  value: response,
3089
3102
  rawValue: rawResponse
3090
- } = await (0, import_provider_utils11.postJsonToApi)({
3103
+ } = await (0, import_provider_utils12.postJsonToApi)({
3091
3104
  url: this.buildRequestUrl(false),
3092
3105
  headers: await this.getHeaders({ betas, headers: options.headers }),
3093
3106
  body: this.transformRequestBody(args, betas),
3094
3107
  failedResponseHandler: anthropicFailedResponseHandler,
3095
- successfulResponseHandler: (0, import_provider_utils11.createJsonResponseHandler)(
3108
+ successfulResponseHandler: (0, import_provider_utils12.createJsonResponseHandler)(
3096
3109
  anthropicMessagesResponseSchema
3097
3110
  ),
3098
3111
  abortSignal: options.abortSignal,
@@ -3456,12 +3469,12 @@ var AnthropicMessagesLanguageModel = class {
3456
3469
  const citationDocuments = this.extractCitationDocuments(options.prompt);
3457
3470
  const body = { ...args, stream: true };
3458
3471
  const url = this.buildRequestUrl(true);
3459
- const { responseHeaders, value: response } = await (0, import_provider_utils11.postJsonToApi)({
3472
+ const { responseHeaders, value: response } = await (0, import_provider_utils12.postJsonToApi)({
3460
3473
  url,
3461
3474
  headers: await this.getHeaders({ betas, headers: options.headers }),
3462
3475
  body: this.transformRequestBody(body, betas),
3463
3476
  failedResponseHandler: anthropicFailedResponseHandler,
3464
- successfulResponseHandler: (0, import_provider_utils11.createEventSourceResponseHandler)(
3477
+ successfulResponseHandler: (0, import_provider_utils12.createEventSourceResponseHandler)(
3465
3478
  anthropicMessagesChunkSchema
3466
3479
  ),
3467
3480
  abortSignal: options.abortSignal,
@@ -4337,44 +4350,44 @@ function mapAnthropicStopDetails(stopDetails) {
4337
4350
  }
4338
4351
 
4339
4352
  // src/tool/bash_20241022.ts
4340
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
4353
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
4341
4354
  var import_v410 = require("zod/v4");
4342
- var bash_20241022InputSchema = (0, import_provider_utils12.lazySchema)(
4343
- () => (0, import_provider_utils12.zodSchema)(
4355
+ var bash_20241022InputSchema = (0, import_provider_utils13.lazySchema)(
4356
+ () => (0, import_provider_utils13.zodSchema)(
4344
4357
  import_v410.z.object({
4345
4358
  command: import_v410.z.string(),
4346
4359
  restart: import_v410.z.boolean().optional()
4347
4360
  })
4348
4361
  )
4349
4362
  );
4350
- var bash_20241022 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
4363
+ var bash_20241022 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
4351
4364
  id: "anthropic.bash_20241022",
4352
4365
  name: "bash",
4353
4366
  inputSchema: bash_20241022InputSchema
4354
4367
  });
4355
4368
 
4356
4369
  // src/tool/bash_20250124.ts
4357
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
4370
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
4358
4371
  var import_v411 = require("zod/v4");
4359
- var bash_20250124InputSchema = (0, import_provider_utils13.lazySchema)(
4360
- () => (0, import_provider_utils13.zodSchema)(
4372
+ var bash_20250124InputSchema = (0, import_provider_utils14.lazySchema)(
4373
+ () => (0, import_provider_utils14.zodSchema)(
4361
4374
  import_v411.z.object({
4362
4375
  command: import_v411.z.string(),
4363
4376
  restart: import_v411.z.boolean().optional()
4364
4377
  })
4365
4378
  )
4366
4379
  );
4367
- var bash_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
4380
+ var bash_20250124 = (0, import_provider_utils14.createProviderDefinedToolFactory)({
4368
4381
  id: "anthropic.bash_20250124",
4369
4382
  name: "bash",
4370
4383
  inputSchema: bash_20250124InputSchema
4371
4384
  });
4372
4385
 
4373
4386
  // src/tool/code-execution_20260120.ts
4374
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
4387
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
4375
4388
  var import_v412 = require("zod/v4");
4376
- var codeExecution_20260120OutputSchema = (0, import_provider_utils14.lazySchema)(
4377
- () => (0, import_provider_utils14.zodSchema)(
4389
+ var codeExecution_20260120OutputSchema = (0, import_provider_utils15.lazySchema)(
4390
+ () => (0, import_provider_utils15.zodSchema)(
4378
4391
  import_v412.z.discriminatedUnion("type", [
4379
4392
  import_v412.z.object({
4380
4393
  type: import_v412.z.literal("code_execution_result"),
@@ -4431,8 +4444,8 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils14.lazySchema)
4431
4444
  ])
4432
4445
  )
4433
4446
  );
4434
- var codeExecution_20260120InputSchema = (0, import_provider_utils14.lazySchema)(
4435
- () => (0, import_provider_utils14.zodSchema)(
4447
+ var codeExecution_20260120InputSchema = (0, import_provider_utils15.lazySchema)(
4448
+ () => (0, import_provider_utils15.zodSchema)(
4436
4449
  import_v412.z.discriminatedUnion("type", [
4437
4450
  import_v412.z.object({
4438
4451
  type: import_v412.z.literal("programmatic-tool-call"),
@@ -4465,7 +4478,7 @@ var codeExecution_20260120InputSchema = (0, import_provider_utils14.lazySchema)(
4465
4478
  ])
4466
4479
  )
4467
4480
  );
4468
- var factory6 = (0, import_provider_utils14.createProviderDefinedToolFactoryWithOutputSchema)({
4481
+ var factory6 = (0, import_provider_utils15.createProviderDefinedToolFactoryWithOutputSchema)({
4469
4482
  id: "anthropic.code_execution_20260120",
4470
4483
  name: "code_execution",
4471
4484
  inputSchema: codeExecution_20260120InputSchema,
@@ -4476,10 +4489,10 @@ var codeExecution_20260120 = (args = {}) => {
4476
4489
  };
4477
4490
 
4478
4491
  // src/tool/computer_20241022.ts
4479
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
4492
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
4480
4493
  var import_v413 = require("zod/v4");
4481
- var computer_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
4482
- () => (0, import_provider_utils15.zodSchema)(
4494
+ var computer_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
4495
+ () => (0, import_provider_utils16.zodSchema)(
4483
4496
  import_v413.z.object({
4484
4497
  action: import_v413.z.enum([
4485
4498
  "key",
@@ -4498,17 +4511,17 @@ var computer_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
4498
4511
  })
4499
4512
  )
4500
4513
  );
4501
- var computer_20241022 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
4514
+ var computer_20241022 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
4502
4515
  id: "anthropic.computer_20241022",
4503
4516
  name: "computer",
4504
4517
  inputSchema: computer_20241022InputSchema
4505
4518
  });
4506
4519
 
4507
4520
  // src/tool/computer_20250124.ts
4508
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
4521
+ var import_provider_utils17 = require("@ai-sdk/provider-utils");
4509
4522
  var import_v414 = require("zod/v4");
4510
- var computer_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
4511
- () => (0, import_provider_utils16.zodSchema)(
4523
+ var computer_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
4524
+ () => (0, import_provider_utils17.zodSchema)(
4512
4525
  import_v414.z.object({
4513
4526
  action: import_v414.z.enum([
4514
4527
  "key",
@@ -4537,17 +4550,17 @@ var computer_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
4537
4550
  })
4538
4551
  )
4539
4552
  );
4540
- var computer_20250124 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
4553
+ var computer_20250124 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
4541
4554
  id: "anthropic.computer_20250124",
4542
4555
  name: "computer",
4543
4556
  inputSchema: computer_20250124InputSchema
4544
4557
  });
4545
4558
 
4546
4559
  // src/tool/memory_20250818.ts
4547
- var import_provider_utils17 = require("@ai-sdk/provider-utils");
4560
+ var import_provider_utils18 = require("@ai-sdk/provider-utils");
4548
4561
  var import_v415 = require("zod/v4");
4549
- var memory_20250818InputSchema = (0, import_provider_utils17.lazySchema)(
4550
- () => (0, import_provider_utils17.zodSchema)(
4562
+ var memory_20250818InputSchema = (0, import_provider_utils18.lazySchema)(
4563
+ () => (0, import_provider_utils18.zodSchema)(
4551
4564
  import_v415.z.discriminatedUnion("command", [
4552
4565
  import_v415.z.object({
4553
4566
  command: import_v415.z.literal("view"),
@@ -4583,17 +4596,17 @@ var memory_20250818InputSchema = (0, import_provider_utils17.lazySchema)(
4583
4596
  ])
4584
4597
  )
4585
4598
  );
4586
- var memory_20250818 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
4599
+ var memory_20250818 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
4587
4600
  id: "anthropic.memory_20250818",
4588
4601
  name: "memory",
4589
4602
  inputSchema: memory_20250818InputSchema
4590
4603
  });
4591
4604
 
4592
4605
  // src/tool/text-editor_20241022.ts
4593
- var import_provider_utils18 = require("@ai-sdk/provider-utils");
4606
+ var import_provider_utils19 = require("@ai-sdk/provider-utils");
4594
4607
  var import_v416 = require("zod/v4");
4595
- var textEditor_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
4596
- () => (0, import_provider_utils18.zodSchema)(
4608
+ var textEditor_20241022InputSchema = (0, import_provider_utils19.lazySchema)(
4609
+ () => (0, import_provider_utils19.zodSchema)(
4597
4610
  import_v416.z.object({
4598
4611
  command: import_v416.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4599
4612
  path: import_v416.z.string(),
@@ -4605,17 +4618,17 @@ var textEditor_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
4605
4618
  })
4606
4619
  )
4607
4620
  );
4608
- var textEditor_20241022 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
4621
+ var textEditor_20241022 = (0, import_provider_utils19.createProviderDefinedToolFactory)({
4609
4622
  id: "anthropic.text_editor_20241022",
4610
4623
  name: "str_replace_editor",
4611
4624
  inputSchema: textEditor_20241022InputSchema
4612
4625
  });
4613
4626
 
4614
4627
  // src/tool/text-editor_20250124.ts
4615
- var import_provider_utils19 = require("@ai-sdk/provider-utils");
4628
+ var import_provider_utils20 = require("@ai-sdk/provider-utils");
4616
4629
  var import_v417 = require("zod/v4");
4617
- var textEditor_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
4618
- () => (0, import_provider_utils19.zodSchema)(
4630
+ var textEditor_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
4631
+ () => (0, import_provider_utils20.zodSchema)(
4619
4632
  import_v417.z.object({
4620
4633
  command: import_v417.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4621
4634
  path: import_v417.z.string(),
@@ -4627,17 +4640,17 @@ var textEditor_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
4627
4640
  })
4628
4641
  )
4629
4642
  );
4630
- var textEditor_20250124 = (0, import_provider_utils19.createProviderDefinedToolFactory)({
4643
+ var textEditor_20250124 = (0, import_provider_utils20.createProviderDefinedToolFactory)({
4631
4644
  id: "anthropic.text_editor_20250124",
4632
4645
  name: "str_replace_editor",
4633
4646
  inputSchema: textEditor_20250124InputSchema
4634
4647
  });
4635
4648
 
4636
4649
  // src/tool/text-editor_20250429.ts
4637
- var import_provider_utils20 = require("@ai-sdk/provider-utils");
4650
+ var import_provider_utils21 = require("@ai-sdk/provider-utils");
4638
4651
  var import_v418 = require("zod/v4");
4639
- var textEditor_20250429InputSchema = (0, import_provider_utils20.lazySchema)(
4640
- () => (0, import_provider_utils20.zodSchema)(
4652
+ var textEditor_20250429InputSchema = (0, import_provider_utils21.lazySchema)(
4653
+ () => (0, import_provider_utils21.zodSchema)(
4641
4654
  import_v418.z.object({
4642
4655
  command: import_v418.z.enum(["view", "create", "str_replace", "insert"]),
4643
4656
  path: import_v418.z.string(),
@@ -4649,7 +4662,7 @@ var textEditor_20250429InputSchema = (0, import_provider_utils20.lazySchema)(
4649
4662
  })
4650
4663
  )
4651
4664
  );
4652
- var textEditor_20250429 = (0, import_provider_utils20.createProviderDefinedToolFactory)({
4665
+ var textEditor_20250429 = (0, import_provider_utils21.createProviderDefinedToolFactory)({
4653
4666
  id: "anthropic.text_editor_20250429",
4654
4667
  name: "str_replace_based_edit_tool",
4655
4668
  inputSchema: textEditor_20250429InputSchema