@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.
package/dist/index.js CHANGED
@@ -28,14 +28,14 @@ module.exports = __toCommonJS(index_exports);
28
28
 
29
29
  // src/anthropic-provider.ts
30
30
  var import_provider4 = require("@ai-sdk/provider");
31
- var import_provider_utils21 = require("@ai-sdk/provider-utils");
31
+ var import_provider_utils22 = require("@ai-sdk/provider-utils");
32
32
 
33
33
  // src/version.ts
34
- var VERSION = true ? "2.0.109" : "0.0.0-test";
34
+ var VERSION = true ? "2.0.110" : "0.0.0-test";
35
35
 
36
36
  // src/anthropic-messages-language-model.ts
37
37
  var import_provider3 = require("@ai-sdk/provider");
38
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
38
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
39
39
 
40
40
  // src/anthropic-error.ts
41
41
  var import_provider_utils = require("@ai-sdk/provider-utils");
@@ -59,7 +59,7 @@ var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorRe
59
59
  // src/anthropic-messages-api.ts
60
60
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
61
61
  var import_v42 = require("zod/v4");
62
- var anthropicStopDetailsSchema = import_v42.z.object({
62
+ var anthropicStopDetailsSchema = () => import_v42.z.object({
63
63
  type: import_v42.z.string(),
64
64
  category: import_v42.z.string().nullish(),
65
65
  explanation: import_v42.z.string().nullish(),
@@ -265,7 +265,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
265
265
  ),
266
266
  stop_reason: import_v42.z.string().nullish(),
267
267
  stop_sequence: import_v42.z.string().nullish(),
268
- stop_details: anthropicStopDetailsSchema.nullish(),
268
+ stop_details: anthropicStopDetailsSchema().nullish(),
269
269
  usage: import_v42.z.looseObject({
270
270
  input_tokens: import_v42.z.number(),
271
271
  output_tokens: import_v42.z.number(),
@@ -569,7 +569,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
569
569
  delta: import_v42.z.object({
570
570
  stop_reason: import_v42.z.string().nullish(),
571
571
  stop_sequence: import_v42.z.string().nullish(),
572
- stop_details: anthropicStopDetailsSchema.nullish(),
572
+ stop_details: anthropicStopDetailsSchema().nullish(),
573
573
  container: import_v42.z.object({
574
574
  expires_at: import_v42.z.string(),
575
575
  id: import_v42.z.string(),
@@ -645,314 +645,327 @@ var anthropicReasoningMetadataSchema = (0, import_provider_utils2.lazySchema)(
645
645
  );
646
646
 
647
647
  // src/anthropic-messages-options.ts
648
+ var import_provider_utils3 = require("@ai-sdk/provider-utils");
648
649
  var import_v43 = require("zod/v4");
649
- var anthropicFilePartProviderOptions = import_v43.z.object({
650
- /**
651
- * Citation configuration for this document.
652
- * When enabled, this document will generate citations in the response.
653
- */
654
- citations: import_v43.z.object({
655
- /**
656
- * Enable citations for this document
657
- */
658
- enabled: import_v43.z.boolean()
659
- }).optional(),
660
- /**
661
- * Custom title for the document.
662
- * If not provided, the filename will be used.
663
- */
664
- title: import_v43.z.string().optional(),
665
- /**
666
- * Context about the document that will be passed to the model
667
- * but not used towards cited content.
668
- * Useful for storing document metadata as text or stringified JSON.
669
- */
670
- context: import_v43.z.string().optional()
671
- });
672
- var anthropicSystemMessageProviderOptions = import_v43.z.object({
673
- /**
674
- * Controls when a mid-conversation system message is cleared.
675
- *
676
- * The value is forwarded to Anthropic as `clear_at`. The required
677
- * `mid-conversation-system-clear-at-2026-08-21` beta is added automatically.
678
- */
679
- clearAt: import_v43.z.literal("next_user_message").optional(),
680
- /**
681
- * Sets the model effort from the next user turn until a later message
682
- * changes it. An effort-only system message with empty content can appear
683
- * first. The required `mid-conversation-output-config-2026-07-01` beta is
684
- * added automatically.
685
- */
686
- effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
687
- /**
688
- * Mid-conversation tool changes. Adds or removes tools from the
689
- * conversation's tool set between turns without invalidating the prompt
690
- * cache.
691
- *
692
- * Only supported on system messages that appear mid-conversation (not the
693
- * initial system prompt). A system message carrying tool changes must come
694
- * right before an assistant message or at the end of the messages.
695
- *
696
- * Tools referenced by a `tool_addition` must be declared in the `tools`
697
- * option (typically with `deferLoading: true` so they are not loaded until
698
- * the addition surfaces them). The required
699
- * `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
700
- */
701
- toolChanges: import_v43.z.array(
702
- import_v43.z.discriminatedUnion("type", [
703
- import_v43.z.object({
704
- type: import_v43.z.literal("tool_addition"),
705
- toolName: import_v43.z.string()
706
- }),
707
- import_v43.z.object({
708
- type: import_v43.z.literal("tool_removal"),
709
- toolName: import_v43.z.string()
710
- })
711
- ])
712
- ).optional()
713
- });
714
- var anthropicThinkingBlockBinding = import_v43.z.object({
715
- /**
716
- * Controls behavior when a replayed thinking block does not match its
717
- * conversation prefix. The `drop_block` behavior drops the mismatched block
718
- * instead of returning an invalid signature error.
719
- */
720
- prefixMismatchBehavior: import_v43.z.literal("drop_block")
721
- });
722
- var anthropicProviderOptions = import_v43.z.object({
723
- /**
724
- * Whether to send reasoning to the model.
725
- *
726
- * This allows you to deactivate reasoning inputs for models that do not support them.
727
- */
728
- sendReasoning: import_v43.z.boolean().optional(),
729
- /**
730
- * Determines how structured outputs are generated.
731
- *
732
- * - `outputFormat`: Use the `output_format` parameter to specify the structured output format.
733
- * - `jsonTool`: Use a special JSON response tool to specify the structured output format (default for most models).
734
- * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Sonnet 5.5, Opus 5.5, and Fable 5.1).
735
- */
736
- structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
737
- /**
738
- * Configuration for enabling Claude's extended thinking.
739
- *
740
- * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
741
- * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
742
- *
743
- * Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
744
- * `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
745
- * provider drops the unsupported setting, emits a warning, and sends an
746
- * adaptive thinking request. Use `effort` to control how much they think.
747
- *
748
- * `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
749
- * and the provider uses it in place of `disabled` for that model.
750
- */
751
- thinking: import_v43.z.union([
650
+ var anthropicFilePartProviderOptions = (0, import_provider_utils3.lazySchema)(
651
+ () => (0, import_provider_utils3.zodSchema)(
752
652
  import_v43.z.object({
753
- /** for Sonnet 4.6, Opus 4.6, and newer models */
754
- type: import_v43.z.literal("adaptive"),
755
653
  /**
756
- * Controls whether thinking content is included in the response.
757
- * - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
758
- * - `"summarized"`: Thinking content is returned. Required to see reasoning output.
759
- * - `"updates"`: Thinking summaries are emitted between tool calls.
654
+ * Citation configuration for this document.
655
+ * When enabled, this document will generate citations in the response.
760
656
  */
761
- display: import_v43.z.enum(["omitted", "summarized", "updates"]).optional(),
657
+ citations: import_v43.z.object({
658
+ /**
659
+ * Enable citations for this document
660
+ */
661
+ enabled: import_v43.z.boolean()
662
+ }).optional(),
762
663
  /**
763
- * Controls handling for thinking blocks whose conversation prefix no
764
- * longer matches. Forwarded as `block_binding`.
664
+ * Custom title for the document.
665
+ * If not provided, the filename will be used.
765
666
  */
766
- blockBinding: anthropicThinkingBlockBinding.optional()
767
- }),
768
- import_v43.z.object({
769
- /** for models before Opus 4.6, except Sonnet 4.6 still supports it */
770
- type: import_v43.z.literal("enabled"),
771
- budgetTokens: import_v43.z.number().optional(),
667
+ title: import_v43.z.string().optional(),
772
668
  /**
773
- * Controls handling for thinking blocks whose conversation prefix no
774
- * longer matches. Forwarded as `block_binding`.
669
+ * Context about the document that will be passed to the model
670
+ * but not used towards cited content.
671
+ * Useful for storing document metadata as text or stringified JSON.
775
672
  */
776
- blockBinding: anthropicThinkingBlockBinding.optional()
777
- }),
778
- import_v43.z.object({
779
- type: import_v43.z.literal("disabled")
780
- }),
673
+ context: import_v43.z.string().optional()
674
+ })
675
+ )
676
+ );
677
+ var anthropicSystemMessageProviderOptions = (0, import_provider_utils3.lazySchema)(
678
+ () => (0, import_provider_utils3.zodSchema)(
781
679
  import_v43.z.object({
782
680
  /**
783
- * for `claude-sonnet-5-5`: no upfront thinking, but progress notes
784
- * between tool calls are returned as summarized thinking blocks.
785
- * Only supported at `low`, `medium`, and `high` effort.
681
+ * Controls when a mid-conversation system message is cleared.
682
+ *
683
+ * The value is forwarded to Anthropic as `clear_at`. The required
684
+ * `mid-conversation-system-clear-at-2026-08-21` beta is added automatically.
786
685
  */
787
- type: import_v43.z.literal("between_tools")
788
- }),
789
- import_v43.z.object({
686
+ clearAt: import_v43.z.literal("next_user_message").optional(),
687
+ /**
688
+ * Sets the model effort from the next user turn until a later message
689
+ * changes it. An effort-only system message with empty content can appear
690
+ * first. The required `mid-conversation-output-config-2026-07-01` beta is
691
+ * added automatically.
692
+ */
693
+ effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
790
694
  /**
791
- * Configure prefix mismatch handling without changing the model's
792
- * default thinking mode.
695
+ * Mid-conversation tool changes. Adds or removes tools from the
696
+ * conversation's tool set between turns without invalidating the prompt
697
+ * cache.
698
+ *
699
+ * Only supported on system messages that appear mid-conversation (not the
700
+ * initial system prompt). A system message carrying tool changes must come
701
+ * right before an assistant message or at the end of the messages.
702
+ *
703
+ * Tools referenced by a `tool_addition` must be declared in the `tools`
704
+ * option (typically with `deferLoading: true` so they are not loaded until
705
+ * the addition surfaces them). The required
706
+ * `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
793
707
  */
794
- blockBinding: anthropicThinkingBlockBinding
708
+ toolChanges: import_v43.z.array(
709
+ import_v43.z.discriminatedUnion("type", [
710
+ import_v43.z.object({
711
+ type: import_v43.z.literal("tool_addition"),
712
+ toolName: import_v43.z.string()
713
+ }),
714
+ import_v43.z.object({
715
+ type: import_v43.z.literal("tool_removal"),
716
+ toolName: import_v43.z.string()
717
+ })
718
+ ])
719
+ ).optional()
795
720
  })
796
- ]).optional(),
797
- /**
798
- * Whether to disable parallel function calling during tool use. Default is false.
799
- * When set to true, Claude will use at most one tool per response.
800
- */
801
- disableParallelToolUse: import_v43.z.boolean().optional(),
802
- /**
803
- * Cache control settings for this message.
804
- * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
805
- */
806
- cacheControl: import_v43.z.object({
807
- type: import_v43.z.literal("ephemeral"),
808
- ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
809
- }).optional(),
810
- /**
811
- * Metadata to include with the request.
812
- *
813
- * See https://platform.claude.com/docs/en/api/messages/create for details.
814
- */
815
- metadata: import_v43.z.object({
721
+ )
722
+ );
723
+ var anthropicProviderOptions = (0, import_provider_utils3.lazySchema)(() => {
724
+ const anthropicThinkingBlockBinding = import_v43.z.object({
816
725
  /**
817
- * An external identifier for the user associated with the request.
818
- *
819
- * Should be a UUID, hash value, or other opaque identifier.
820
- * Must not contain PII (name, email, phone number, etc.).
726
+ * Controls behavior when a replayed thinking block does not match its
727
+ * conversation prefix. The `drop_block` behavior drops the mismatched block
728
+ * instead of returning an invalid signature error.
821
729
  */
822
- userId: import_v43.z.string().optional()
823
- }).optional(),
824
- /**
825
- * Agent Skills configuration. Skills enable Claude to perform specialized tasks
826
- * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
827
- * Requires code execution tool to be enabled.
828
- */
829
- container: import_v43.z.object({
830
- id: import_v43.z.string().optional(),
831
- skills: import_v43.z.array(
832
- import_v43.z.object({
833
- type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
834
- skillId: import_v43.z.string(),
835
- version: import_v43.z.string().optional()
836
- })
837
- ).optional()
838
- }).optional(),
839
- /**
840
- * @default 'high'
841
- */
842
- effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
843
- /**
844
- * Task budget for agentic turns. Informs the model of the total token budget
845
- * available for the current task, allowing it to prioritize work and wind down
846
- * gracefully as the budget is consumed.
847
- *
848
- * Advisory only — does not enforce a hard token limit.
849
- */
850
- taskBudget: import_v43.z.object({
851
- type: import_v43.z.literal("tokens"),
852
- total: import_v43.z.number().int().min(2e4),
853
- remaining: import_v43.z.number().int().min(0).optional()
854
- }).optional(),
855
- /**
856
- * Enable fast mode for faster inference (2.5x faster output token speeds).
857
- * Only supported with claude-opus-4-6.
858
- */
859
- speed: import_v43.z.enum(["fast", "standard"]).optional(),
860
- /**
861
- * Controls where model inference runs for this request.
862
- *
863
- * - `"global"`: Inference may run in any available geography (default).
864
- * - `"us"`: Inference runs only in US-based infrastructure.
865
- *
866
- * See https://platform.claude.com/docs/en/build-with-claude/data-residency
867
- */
868
- inferenceGeo: import_v43.z.enum(["us", "global"]).optional(),
869
- /**
870
- * Server-side fallback configuration.
871
- *
872
- * When the primary model's safety classifiers block a turn, the API
873
- * automatically retries it server-side on a fallback model. A
874
- * `content-filter` finish reason means the fallback(s) refused as well.
875
- *
876
- * - `'default'` (recommended): the API routes the retry to Anthropic's
877
- * recommended fallback model based on the refusal category. Requires the
878
- * `server-side-fallback-2026-07-01` beta, which is added automatically.
879
- * - Array form: an explicit fallback chain. Each entry is merged into the
880
- * request as a direct request to that entry's model, so it must be
881
- * formatted accordingly: `model` is required, and an entry may
882
- * additionally override `max_tokens`, `thinking`, `output_config`, and
883
- * `speed` for that attempt only (`speed` additionally requires the speed
884
- * beta). The value is passed through to the API as-is, and the
885
- * `server-side-fallback-2026-06-01` beta is added automatically.
886
- */
887
- fallbacks: import_v43.z.union([
888
- import_v43.z.literal("default"),
889
- import_v43.z.array(
890
- import_v43.z.object({
891
- model: import_v43.z.string(),
892
- max_tokens: import_v43.z.number().int().optional(),
893
- thinking: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
894
- output_config: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
895
- speed: import_v43.z.enum(["fast", "standard"]).optional()
896
- })
897
- )
898
- ]).optional(),
899
- /**
900
- * Context management configuration for automatic context window management.
901
- * Enables features like automatic compaction and clearing of tool uses/thinking blocks.
902
- */
903
- contextManagement: import_v43.z.object({
904
- edits: import_v43.z.array(
905
- import_v43.z.discriminatedUnion("type", [
730
+ prefixMismatchBehavior: import_v43.z.literal("drop_block")
731
+ });
732
+ return (0, import_provider_utils3.zodSchema)(
733
+ import_v43.z.object({
734
+ /**
735
+ * Whether to send reasoning to the model.
736
+ *
737
+ * This allows you to deactivate reasoning inputs for models that do not support them.
738
+ */
739
+ sendReasoning: import_v43.z.boolean().optional(),
740
+ /**
741
+ * Determines how structured outputs are generated.
742
+ *
743
+ * - `outputFormat`: Use the `output_format` parameter to specify the structured output format.
744
+ * - `jsonTool`: Use a special JSON response tool to specify the structured output format (default for most models).
745
+ * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Sonnet 5.5, Opus 5.5, and Fable 5.1).
746
+ */
747
+ structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
748
+ /**
749
+ * Configuration for enabling Claude's extended thinking.
750
+ *
751
+ * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
752
+ * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
753
+ *
754
+ * Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
755
+ * `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
756
+ * provider drops the unsupported setting, emits a warning, and sends an
757
+ * adaptive thinking request. Use `effort` to control how much they think.
758
+ *
759
+ * `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
760
+ * and the provider uses it in place of `disabled` for that model.
761
+ */
762
+ thinking: import_v43.z.union([
906
763
  import_v43.z.object({
907
- type: import_v43.z.literal("clear_tool_uses_20250919"),
908
- trigger: import_v43.z.discriminatedUnion("type", [
909
- import_v43.z.object({
910
- type: import_v43.z.literal("input_tokens"),
911
- value: import_v43.z.number()
912
- }),
913
- import_v43.z.object({
914
- type: import_v43.z.literal("tool_uses"),
915
- value: import_v43.z.number()
916
- })
917
- ]).optional(),
918
- keep: import_v43.z.object({
919
- type: import_v43.z.literal("tool_uses"),
920
- value: import_v43.z.number()
921
- }).optional(),
922
- clearAtLeast: import_v43.z.object({
923
- type: import_v43.z.literal("input_tokens"),
924
- value: import_v43.z.number()
925
- }).optional(),
926
- clearToolInputs: import_v43.z.boolean().optional(),
927
- excludeTools: import_v43.z.array(import_v43.z.string()).optional()
764
+ /** for Sonnet 4.6, Opus 4.6, and newer models */
765
+ type: import_v43.z.literal("adaptive"),
766
+ /**
767
+ * Controls whether thinking content is included in the response.
768
+ * - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
769
+ * - `"summarized"`: Thinking content is returned. Required to see reasoning output.
770
+ * - `"updates"`: Thinking summaries are emitted between tool calls.
771
+ */
772
+ display: import_v43.z.enum(["omitted", "summarized", "updates"]).optional(),
773
+ /**
774
+ * Controls handling for thinking blocks whose conversation prefix no
775
+ * longer matches. Forwarded as `block_binding`.
776
+ */
777
+ blockBinding: anthropicThinkingBlockBinding.optional()
928
778
  }),
929
779
  import_v43.z.object({
930
- type: import_v43.z.literal("clear_thinking_20251015"),
931
- keep: import_v43.z.union([
932
- import_v43.z.literal("all"),
933
- import_v43.z.object({
934
- type: import_v43.z.literal("thinking_turns"),
935
- value: import_v43.z.number()
936
- })
937
- ]).optional()
780
+ /** for models before Opus 4.6, except Sonnet 4.6 still supports it */
781
+ type: import_v43.z.literal("enabled"),
782
+ budgetTokens: import_v43.z.number().optional(),
783
+ /**
784
+ * Controls handling for thinking blocks whose conversation prefix no
785
+ * longer matches. Forwarded as `block_binding`.
786
+ */
787
+ blockBinding: anthropicThinkingBlockBinding.optional()
788
+ }),
789
+ import_v43.z.object({
790
+ type: import_v43.z.literal("disabled")
938
791
  }),
939
792
  import_v43.z.object({
940
- type: import_v43.z.literal("compact_20260112"),
941
- trigger: import_v43.z.object({
942
- type: import_v43.z.literal("input_tokens"),
943
- value: import_v43.z.number()
944
- }).optional(),
945
- pauseAfterCompaction: import_v43.z.boolean().optional(),
946
- instructions: import_v43.z.string().optional()
793
+ /**
794
+ * for `claude-sonnet-5-5`: no upfront thinking, but progress notes
795
+ * between tool calls are returned as summarized thinking blocks.
796
+ * Only supported at `low`, `medium`, and `high` effort.
797
+ */
798
+ type: import_v43.z.literal("between_tools")
799
+ }),
800
+ import_v43.z.object({
801
+ /**
802
+ * Configure prefix mismatch handling without changing the model's
803
+ * default thinking mode.
804
+ */
805
+ blockBinding: anthropicThinkingBlockBinding
947
806
  })
948
- ])
949
- )
950
- }).optional(),
951
- /**
952
- * A set of beta features to enable.
953
- * Allow a provider to receive the full `betas` set if it needs it.
954
- */
955
- anthropicBeta: import_v43.z.array(import_v43.z.string()).optional()
807
+ ]).optional(),
808
+ /**
809
+ * Whether to disable parallel function calling during tool use. Default is false.
810
+ * When set to true, Claude will use at most one tool per response.
811
+ */
812
+ disableParallelToolUse: import_v43.z.boolean().optional(),
813
+ /**
814
+ * Cache control settings for this message.
815
+ * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
816
+ */
817
+ cacheControl: import_v43.z.object({
818
+ type: import_v43.z.literal("ephemeral"),
819
+ ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
820
+ }).optional(),
821
+ /**
822
+ * Metadata to include with the request.
823
+ *
824
+ * See https://platform.claude.com/docs/en/api/messages/create for details.
825
+ */
826
+ metadata: import_v43.z.object({
827
+ /**
828
+ * An external identifier for the user associated with the request.
829
+ *
830
+ * Should be a UUID, hash value, or other opaque identifier.
831
+ * Must not contain PII (name, email, phone number, etc.).
832
+ */
833
+ userId: import_v43.z.string().optional()
834
+ }).optional(),
835
+ /**
836
+ * Agent Skills configuration. Skills enable Claude to perform specialized tasks
837
+ * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
838
+ * Requires code execution tool to be enabled.
839
+ */
840
+ container: import_v43.z.object({
841
+ id: import_v43.z.string().optional(),
842
+ skills: import_v43.z.array(
843
+ import_v43.z.object({
844
+ type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
845
+ skillId: import_v43.z.string(),
846
+ version: import_v43.z.string().optional()
847
+ })
848
+ ).optional()
849
+ }).optional(),
850
+ /**
851
+ * @default 'high'
852
+ */
853
+ effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
854
+ /**
855
+ * Task budget for agentic turns. Informs the model of the total token budget
856
+ * available for the current task, allowing it to prioritize work and wind down
857
+ * gracefully as the budget is consumed.
858
+ *
859
+ * Advisory only — does not enforce a hard token limit.
860
+ */
861
+ taskBudget: import_v43.z.object({
862
+ type: import_v43.z.literal("tokens"),
863
+ total: import_v43.z.number().int().min(2e4),
864
+ remaining: import_v43.z.number().int().min(0).optional()
865
+ }).optional(),
866
+ /**
867
+ * Enable fast mode for faster inference (2.5x faster output token speeds).
868
+ * Only supported with claude-opus-4-6.
869
+ */
870
+ speed: import_v43.z.enum(["fast", "standard"]).optional(),
871
+ /**
872
+ * Controls where model inference runs for this request.
873
+ *
874
+ * - `"global"`: Inference may run in any available geography (default).
875
+ * - `"us"`: Inference runs only in US-based infrastructure.
876
+ *
877
+ * See https://platform.claude.com/docs/en/build-with-claude/data-residency
878
+ */
879
+ inferenceGeo: import_v43.z.enum(["us", "global"]).optional(),
880
+ /**
881
+ * Server-side fallback configuration.
882
+ *
883
+ * When the primary model's safety classifiers block a turn, the API
884
+ * automatically retries it server-side on a fallback model. A
885
+ * `content-filter` finish reason means the fallback(s) refused as well.
886
+ *
887
+ * - `'default'` (recommended): the API routes the retry to Anthropic's
888
+ * recommended fallback model based on the refusal category. Requires the
889
+ * `server-side-fallback-2026-07-01` beta, which is added automatically.
890
+ * - Array form: an explicit fallback chain. Each entry is merged into the
891
+ * request as a direct request to that entry's model, so it must be
892
+ * formatted accordingly: `model` is required, and an entry may
893
+ * additionally override `max_tokens`, `thinking`, `output_config`, and
894
+ * `speed` for that attempt only (`speed` additionally requires the speed
895
+ * beta). The value is passed through to the API as-is, and the
896
+ * `server-side-fallback-2026-06-01` beta is added automatically.
897
+ */
898
+ fallbacks: import_v43.z.union([
899
+ import_v43.z.literal("default"),
900
+ import_v43.z.array(
901
+ import_v43.z.object({
902
+ model: import_v43.z.string(),
903
+ max_tokens: import_v43.z.number().int().optional(),
904
+ thinking: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
905
+ output_config: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
906
+ speed: import_v43.z.enum(["fast", "standard"]).optional()
907
+ })
908
+ )
909
+ ]).optional(),
910
+ /**
911
+ * Context management configuration for automatic context window management.
912
+ * Enables features like automatic compaction and clearing of tool uses/thinking blocks.
913
+ */
914
+ contextManagement: import_v43.z.object({
915
+ edits: import_v43.z.array(
916
+ import_v43.z.discriminatedUnion("type", [
917
+ import_v43.z.object({
918
+ type: import_v43.z.literal("clear_tool_uses_20250919"),
919
+ trigger: import_v43.z.discriminatedUnion("type", [
920
+ import_v43.z.object({
921
+ type: import_v43.z.literal("input_tokens"),
922
+ value: import_v43.z.number()
923
+ }),
924
+ import_v43.z.object({
925
+ type: import_v43.z.literal("tool_uses"),
926
+ value: import_v43.z.number()
927
+ })
928
+ ]).optional(),
929
+ keep: import_v43.z.object({
930
+ type: import_v43.z.literal("tool_uses"),
931
+ value: import_v43.z.number()
932
+ }).optional(),
933
+ clearAtLeast: import_v43.z.object({
934
+ type: import_v43.z.literal("input_tokens"),
935
+ value: import_v43.z.number()
936
+ }).optional(),
937
+ clearToolInputs: import_v43.z.boolean().optional(),
938
+ excludeTools: import_v43.z.array(import_v43.z.string()).optional()
939
+ }),
940
+ import_v43.z.object({
941
+ type: import_v43.z.literal("clear_thinking_20251015"),
942
+ keep: import_v43.z.union([
943
+ import_v43.z.literal("all"),
944
+ import_v43.z.object({
945
+ type: import_v43.z.literal("thinking_turns"),
946
+ value: import_v43.z.number()
947
+ })
948
+ ]).optional()
949
+ }),
950
+ import_v43.z.object({
951
+ type: import_v43.z.literal("compact_20260112"),
952
+ trigger: import_v43.z.object({
953
+ type: import_v43.z.literal("input_tokens"),
954
+ value: import_v43.z.number()
955
+ }).optional(),
956
+ pauseAfterCompaction: import_v43.z.boolean().optional(),
957
+ instructions: import_v43.z.string().optional()
958
+ })
959
+ ])
960
+ )
961
+ }).optional(),
962
+ /**
963
+ * A set of beta features to enable.
964
+ * Allow a provider to receive the full `betas` set if it needs it.
965
+ */
966
+ anthropicBeta: import_v43.z.array(import_v43.z.string()).optional()
967
+ })
968
+ );
956
969
  });
957
970
 
958
971
  // src/anthropic-prepare-tools.ts
@@ -1001,7 +1014,7 @@ var CacheControlValidator = class {
1001
1014
  };
1002
1015
 
1003
1016
  // src/tool/computer-toolset_20260801.ts
1004
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
1017
+ var import_provider_utils4 = require("@ai-sdk/provider-utils");
1005
1018
  var import_v44 = require("zod/v4");
1006
1019
  var computerToolset_20260801Members = [
1007
1020
  "screenshot",
@@ -1022,8 +1035,8 @@ var computerToolset_20260801Members = [
1022
1035
  "hold_key",
1023
1036
  "wait"
1024
1037
  ];
1025
- var computerToolset_20260801InputSchema = (0, import_provider_utils3.lazySchema)(
1026
- () => (0, import_provider_utils3.zodSchema)(
1038
+ var computerToolset_20260801InputSchema = (0, import_provider_utils4.lazySchema)(
1039
+ () => (0, import_provider_utils4.zodSchema)(
1027
1040
  import_v44.z.object({
1028
1041
  action: import_v44.z.enum(computerToolset_20260801Members),
1029
1042
  coordinate: import_v44.z.tuple([import_v44.z.number().int(), import_v44.z.number().int()]).optional(),
@@ -1042,8 +1055,8 @@ var computerToolset_20260801InputSchema = (0, import_provider_utils3.lazySchema)
1042
1055
  })
1043
1056
  )
1044
1057
  );
1045
- var computerToolset_20260801ArgsSchema = (0, import_provider_utils3.lazySchema)(
1046
- () => (0, import_provider_utils3.zodSchema)(
1058
+ var computerToolset_20260801ArgsSchema = (0, import_provider_utils4.lazySchema)(
1059
+ () => (0, import_provider_utils4.zodSchema)(
1047
1060
  import_v44.z.object({
1048
1061
  configs: import_v44.z.partialRecord(
1049
1062
  import_v44.z.enum(computerToolset_20260801Members),
@@ -1055,24 +1068,24 @@ var computerToolset_20260801ArgsSchema = (0, import_provider_utils3.lazySchema)(
1055
1068
  })
1056
1069
  )
1057
1070
  );
1058
- var computerToolset_20260801 = (0, import_provider_utils3.createProviderDefinedToolFactory)({
1071
+ var computerToolset_20260801 = (0, import_provider_utils4.createProviderDefinedToolFactory)({
1059
1072
  id: "anthropic.computer_toolset_20260801",
1060
1073
  name: "computer",
1061
1074
  inputSchema: computerToolset_20260801InputSchema
1062
1075
  });
1063
1076
 
1064
1077
  // src/tool/text-editor_20250728.ts
1065
- var import_provider_utils4 = require("@ai-sdk/provider-utils");
1078
+ var import_provider_utils5 = require("@ai-sdk/provider-utils");
1066
1079
  var import_v45 = require("zod/v4");
1067
- var textEditor_20250728ArgsSchema = (0, import_provider_utils4.lazySchema)(
1068
- () => (0, import_provider_utils4.zodSchema)(
1080
+ var textEditor_20250728ArgsSchema = (0, import_provider_utils5.lazySchema)(
1081
+ () => (0, import_provider_utils5.zodSchema)(
1069
1082
  import_v45.z.object({
1070
1083
  maxCharacters: import_v45.z.number().optional()
1071
1084
  })
1072
1085
  )
1073
1086
  );
1074
- var textEditor_20250728InputSchema = (0, import_provider_utils4.lazySchema)(
1075
- () => (0, import_provider_utils4.zodSchema)(
1087
+ var textEditor_20250728InputSchema = (0, import_provider_utils5.lazySchema)(
1088
+ () => (0, import_provider_utils5.zodSchema)(
1076
1089
  import_v45.z.object({
1077
1090
  command: import_v45.z.enum(["view", "create", "str_replace", "insert"]),
1078
1091
  path: import_v45.z.string(),
@@ -1084,7 +1097,7 @@ var textEditor_20250728InputSchema = (0, import_provider_utils4.lazySchema)(
1084
1097
  })
1085
1098
  )
1086
1099
  );
1087
- var factory = (0, import_provider_utils4.createProviderDefinedToolFactory)({
1100
+ var factory = (0, import_provider_utils5.createProviderDefinedToolFactory)({
1088
1101
  id: "anthropic.text_editor_20250728",
1089
1102
  name: "str_replace_based_edit_tool",
1090
1103
  inputSchema: textEditor_20250728InputSchema
@@ -1094,10 +1107,10 @@ var textEditor_20250728 = (args = {}) => {
1094
1107
  };
1095
1108
 
1096
1109
  // src/tool/web-search_20250305.ts
1097
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
1110
+ var import_provider_utils6 = require("@ai-sdk/provider-utils");
1098
1111
  var import_v46 = require("zod/v4");
1099
- var webSearch_20250305ArgsSchema = (0, import_provider_utils5.lazySchema)(
1100
- () => (0, import_provider_utils5.zodSchema)(
1112
+ var webSearch_20250305ArgsSchema = (0, import_provider_utils6.lazySchema)(
1113
+ () => (0, import_provider_utils6.zodSchema)(
1101
1114
  import_v46.z.object({
1102
1115
  maxUses: import_v46.z.number().optional(),
1103
1116
  allowedDomains: import_v46.z.array(import_v46.z.string()).optional(),
@@ -1112,8 +1125,8 @@ var webSearch_20250305ArgsSchema = (0, import_provider_utils5.lazySchema)(
1112
1125
  })
1113
1126
  )
1114
1127
  );
1115
- var webSearch_20250305OutputSchema = (0, import_provider_utils5.lazySchema)(
1116
- () => (0, import_provider_utils5.zodSchema)(
1128
+ var webSearch_20250305OutputSchema = (0, import_provider_utils6.lazySchema)(
1129
+ () => (0, import_provider_utils6.zodSchema)(
1117
1130
  import_v46.z.array(
1118
1131
  import_v46.z.object({
1119
1132
  url: import_v46.z.string(),
@@ -1125,14 +1138,14 @@ var webSearch_20250305OutputSchema = (0, import_provider_utils5.lazySchema)(
1125
1138
  )
1126
1139
  )
1127
1140
  );
1128
- var webSearch_20250305InputSchema = (0, import_provider_utils5.lazySchema)(
1129
- () => (0, import_provider_utils5.zodSchema)(
1141
+ var webSearch_20250305InputSchema = (0, import_provider_utils6.lazySchema)(
1142
+ () => (0, import_provider_utils6.zodSchema)(
1130
1143
  import_v46.z.object({
1131
1144
  query: import_v46.z.string()
1132
1145
  })
1133
1146
  )
1134
1147
  );
1135
- var factory2 = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
1148
+ var factory2 = (0, import_provider_utils6.createProviderDefinedToolFactoryWithOutputSchema)({
1136
1149
  id: "anthropic.web_search_20250305",
1137
1150
  name: "web_search",
1138
1151
  inputSchema: webSearch_20250305InputSchema,
@@ -1143,10 +1156,10 @@ var webSearch_20250305 = (args = {}) => {
1143
1156
  };
1144
1157
 
1145
1158
  // src/tool/web-fetch-20250910.ts
1146
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
1159
+ var import_provider_utils7 = require("@ai-sdk/provider-utils");
1147
1160
  var import_v47 = require("zod/v4");
1148
- var webFetch_20250910ArgsSchema = (0, import_provider_utils6.lazySchema)(
1149
- () => (0, import_provider_utils6.zodSchema)(
1161
+ var webFetch_20250910ArgsSchema = (0, import_provider_utils7.lazySchema)(
1162
+ () => (0, import_provider_utils7.zodSchema)(
1150
1163
  import_v47.z.object({
1151
1164
  maxUses: import_v47.z.number().optional(),
1152
1165
  allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
@@ -1156,8 +1169,8 @@ var webFetch_20250910ArgsSchema = (0, import_provider_utils6.lazySchema)(
1156
1169
  })
1157
1170
  )
1158
1171
  );
1159
- var webFetch_20250910OutputSchema = (0, import_provider_utils6.lazySchema)(
1160
- () => (0, import_provider_utils6.zodSchema)(
1172
+ var webFetch_20250910OutputSchema = (0, import_provider_utils7.lazySchema)(
1173
+ () => (0, import_provider_utils7.zodSchema)(
1161
1174
  import_v47.z.object({
1162
1175
  type: import_v47.z.literal("web_fetch_result"),
1163
1176
  url: import_v47.z.string(),
@@ -1182,14 +1195,14 @@ var webFetch_20250910OutputSchema = (0, import_provider_utils6.lazySchema)(
1182
1195
  })
1183
1196
  )
1184
1197
  );
1185
- var webFetch_20250910InputSchema = (0, import_provider_utils6.lazySchema)(
1186
- () => (0, import_provider_utils6.zodSchema)(
1198
+ var webFetch_20250910InputSchema = (0, import_provider_utils7.lazySchema)(
1199
+ () => (0, import_provider_utils7.zodSchema)(
1187
1200
  import_v47.z.object({
1188
1201
  url: import_v47.z.string()
1189
1202
  })
1190
1203
  )
1191
1204
  );
1192
- var factory3 = (0, import_provider_utils6.createProviderDefinedToolFactoryWithOutputSchema)({
1205
+ var factory3 = (0, import_provider_utils7.createProviderDefinedToolFactoryWithOutputSchema)({
1193
1206
  id: "anthropic.web_fetch_20250910",
1194
1207
  name: "web_fetch",
1195
1208
  inputSchema: webFetch_20250910InputSchema,
@@ -1200,7 +1213,7 @@ var webFetch_20250910 = (args = {}) => {
1200
1213
  };
1201
1214
 
1202
1215
  // src/anthropic-prepare-tools.ts
1203
- var import_provider_utils7 = require("@ai-sdk/provider-utils");
1216
+ var import_provider_utils8 = require("@ai-sdk/provider-utils");
1204
1217
  async function prepareTools({
1205
1218
  tools,
1206
1219
  toolChoice,
@@ -1262,7 +1275,7 @@ async function prepareTools({
1262
1275
  break;
1263
1276
  }
1264
1277
  case "anthropic.computer_toolset_20260801": {
1265
- const args = await (0, import_provider_utils7.validateTypes)({
1278
+ const args = await (0, import_provider_utils8.validateTypes)({
1266
1279
  value: tool.args,
1267
1280
  schema: computerToolset_20260801ArgsSchema
1268
1281
  });
@@ -1338,7 +1351,7 @@ async function prepareTools({
1338
1351
  break;
1339
1352
  }
1340
1353
  case "anthropic.text_editor_20250728": {
1341
- const args = await (0, import_provider_utils7.validateTypes)({
1354
+ const args = await (0, import_provider_utils8.validateTypes)({
1342
1355
  value: tool.args,
1343
1356
  schema: textEditor_20250728ArgsSchema
1344
1357
  });
@@ -1378,7 +1391,7 @@ async function prepareTools({
1378
1391
  }
1379
1392
  case "anthropic.web_fetch_20250910": {
1380
1393
  betas.add("web-fetch-2025-09-10");
1381
- const args = await (0, import_provider_utils7.validateTypes)({
1394
+ const args = await (0, import_provider_utils8.validateTypes)({
1382
1395
  value: tool.args,
1383
1396
  schema: webFetch_20250910ArgsSchema
1384
1397
  });
@@ -1395,7 +1408,7 @@ async function prepareTools({
1395
1408
  break;
1396
1409
  }
1397
1410
  case "anthropic.web_search_20250305": {
1398
- const args = await (0, import_provider_utils7.validateTypes)({
1411
+ const args = await (0, import_provider_utils8.validateTypes)({
1399
1412
  value: tool.args,
1400
1413
  schema: webSearch_20250305ArgsSchema
1401
1414
  });
@@ -1511,13 +1524,13 @@ async function prepareTools({
1511
1524
 
1512
1525
  // src/convert-to-anthropic-messages-prompt.ts
1513
1526
  var import_provider2 = require("@ai-sdk/provider");
1514
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
1527
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
1515
1528
 
1516
1529
  // src/tool/code-execution_20250522.ts
1517
- var import_provider_utils8 = require("@ai-sdk/provider-utils");
1530
+ var import_provider_utils9 = require("@ai-sdk/provider-utils");
1518
1531
  var import_v48 = require("zod/v4");
1519
- var codeExecution_20250522OutputSchema = (0, import_provider_utils8.lazySchema)(
1520
- () => (0, import_provider_utils8.zodSchema)(
1532
+ var codeExecution_20250522OutputSchema = (0, import_provider_utils9.lazySchema)(
1533
+ () => (0, import_provider_utils9.zodSchema)(
1521
1534
  import_v48.z.object({
1522
1535
  type: import_v48.z.literal("code_execution_result"),
1523
1536
  stdout: import_v48.z.string(),
@@ -1526,14 +1539,14 @@ var codeExecution_20250522OutputSchema = (0, import_provider_utils8.lazySchema)(
1526
1539
  })
1527
1540
  )
1528
1541
  );
1529
- var codeExecution_20250522InputSchema = (0, import_provider_utils8.lazySchema)(
1530
- () => (0, import_provider_utils8.zodSchema)(
1542
+ var codeExecution_20250522InputSchema = (0, import_provider_utils9.lazySchema)(
1543
+ () => (0, import_provider_utils9.zodSchema)(
1531
1544
  import_v48.z.object({
1532
1545
  code: import_v48.z.string()
1533
1546
  })
1534
1547
  )
1535
1548
  );
1536
- var factory4 = (0, import_provider_utils8.createProviderDefinedToolFactoryWithOutputSchema)({
1549
+ var factory4 = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
1537
1550
  id: "anthropic.code_execution_20250522",
1538
1551
  name: "code_execution",
1539
1552
  inputSchema: codeExecution_20250522InputSchema,
@@ -1544,10 +1557,10 @@ var codeExecution_20250522 = (args = {}) => {
1544
1557
  };
1545
1558
 
1546
1559
  // src/tool/code-execution_20250825.ts
1547
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
1560
+ var import_provider_utils10 = require("@ai-sdk/provider-utils");
1548
1561
  var import_v49 = require("zod/v4");
1549
- var codeExecution_20250825OutputSchema = (0, import_provider_utils9.lazySchema)(
1550
- () => (0, import_provider_utils9.zodSchema)(
1562
+ var codeExecution_20250825OutputSchema = (0, import_provider_utils10.lazySchema)(
1563
+ () => (0, import_provider_utils10.zodSchema)(
1551
1564
  import_v49.z.discriminatedUnion("type", [
1552
1565
  import_v49.z.object({
1553
1566
  type: import_v49.z.literal("bash_code_execution_result"),
@@ -1592,8 +1605,8 @@ var codeExecution_20250825OutputSchema = (0, import_provider_utils9.lazySchema)(
1592
1605
  ])
1593
1606
  )
1594
1607
  );
1595
- var codeExecution_20250825InputSchema = (0, import_provider_utils9.lazySchema)(
1596
- () => (0, import_provider_utils9.zodSchema)(
1608
+ var codeExecution_20250825InputSchema = (0, import_provider_utils10.lazySchema)(
1609
+ () => (0, import_provider_utils10.zodSchema)(
1597
1610
  import_v49.z.discriminatedUnion("type", [
1598
1611
  import_v49.z.object({
1599
1612
  type: import_v49.z.literal("bash_code_execution"),
@@ -1622,7 +1635,7 @@ var codeExecution_20250825InputSchema = (0, import_provider_utils9.lazySchema)(
1622
1635
  ])
1623
1636
  )
1624
1637
  );
1625
- var factory5 = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
1638
+ var factory5 = (0, import_provider_utils10.createProviderDefinedToolFactoryWithOutputSchema)({
1626
1639
  id: "anthropic.code_execution_20250825",
1627
1640
  name: "code_execution",
1628
1641
  inputSchema: codeExecution_20250825InputSchema,
@@ -1664,7 +1677,7 @@ async function convertToAnthropicMessagesPrompt({
1664
1677
  const messages = [];
1665
1678
  async function shouldEnableCitations(providerMetadata) {
1666
1679
  var _a2, _b2;
1667
- const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
1680
+ const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
1668
1681
  provider: "anthropic",
1669
1682
  providerOptions: providerMetadata,
1670
1683
  schema: anthropicFilePartProviderOptions
@@ -1672,7 +1685,7 @@ async function convertToAnthropicMessagesPrompt({
1672
1685
  return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
1673
1686
  }
1674
1687
  async function getDocumentMetadata(providerMetadata) {
1675
- const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
1688
+ const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
1676
1689
  provider: "anthropic",
1677
1690
  providerOptions: providerMetadata,
1678
1691
  schema: anthropicFilePartProviderOptions
@@ -1692,7 +1705,7 @@ async function convertToAnthropicMessagesPrompt({
1692
1705
  let toolChangeCount = 0;
1693
1706
  let hasMidConversationOptions = false;
1694
1707
  for (const { content: text, providerOptions } of block.messages) {
1695
- const systemMessageOptions = await (0, import_provider_utils10.parseProviderOptions)({
1708
+ const systemMessageOptions = await (0, import_provider_utils11.parseProviderOptions)({
1696
1709
  provider: "anthropic",
1697
1710
  providerOptions,
1698
1711
  schema: anthropicSystemMessageProviderOptions
@@ -1802,7 +1815,7 @@ async function convertToAnthropicMessagesPrompt({
1802
1815
  } : {
1803
1816
  type: "base64",
1804
1817
  media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
1805
- data: (0, import_provider_utils10.convertToBase64)(part.data)
1818
+ data: (0, import_provider_utils11.convertToBase64)(part.data)
1806
1819
  },
1807
1820
  cache_control: cacheControl
1808
1821
  });
@@ -1822,7 +1835,7 @@ async function convertToAnthropicMessagesPrompt({
1822
1835
  } : {
1823
1836
  type: "base64",
1824
1837
  media_type: "application/pdf",
1825
- data: (0, import_provider_utils10.convertToBase64)(part.data)
1838
+ data: (0, import_provider_utils11.convertToBase64)(part.data)
1826
1839
  },
1827
1840
  title: (_c = metadata.title) != null ? _c : part.filename,
1828
1841
  ...metadata.context && { context: metadata.context },
@@ -1996,7 +2009,7 @@ async function convertToAnthropicMessagesPrompt({
1996
2009
  }
1997
2010
  case "reasoning": {
1998
2011
  if (sendReasoning) {
1999
- const reasoningMetadata = await (0, import_provider_utils10.parseProviderOptions)({
2012
+ const reasoningMetadata = await (0, import_provider_utils11.parseProviderOptions)({
2000
2013
  provider: "anthropic",
2001
2014
  providerOptions: part.providerOptions,
2002
2015
  schema: anthropicReasoningMetadataSchema
@@ -2121,7 +2134,7 @@ async function convertToAnthropicMessagesPrompt({
2121
2134
  break;
2122
2135
  }
2123
2136
  if (output.value.type === "code_execution_result") {
2124
- const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
2137
+ const codeExecutionOutput = await (0, import_provider_utils11.validateTypes)({
2125
2138
  value: output.value,
2126
2139
  schema: codeExecution_20250522OutputSchema
2127
2140
  });
@@ -2137,7 +2150,7 @@ async function convertToAnthropicMessagesPrompt({
2137
2150
  cache_control: cacheControl
2138
2151
  });
2139
2152
  } else {
2140
- const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
2153
+ const codeExecutionOutput = await (0, import_provider_utils11.validateTypes)({
2141
2154
  value: output.value,
2142
2155
  schema: codeExecution_20250825OutputSchema
2143
2156
  });
@@ -2174,7 +2187,7 @@ async function convertToAnthropicMessagesPrompt({
2174
2187
  });
2175
2188
  break;
2176
2189
  }
2177
- const webFetchOutput = await (0, import_provider_utils10.validateTypes)({
2190
+ const webFetchOutput = await (0, import_provider_utils11.validateTypes)({
2178
2191
  value: output.value,
2179
2192
  schema: webFetch_20250910OutputSchema
2180
2193
  });
@@ -2209,7 +2222,7 @@ async function convertToAnthropicMessagesPrompt({
2209
2222
  });
2210
2223
  break;
2211
2224
  }
2212
- const webSearchOutput = await (0, import_provider_utils10.validateTypes)({
2225
+ const webSearchOutput = await (0, import_provider_utils11.validateTypes)({
2213
2226
  value: output.value,
2214
2227
  schema: webSearch_20250305OutputSchema
2215
2228
  });
@@ -2566,7 +2579,7 @@ var AnthropicMessagesLanguageModel = class {
2566
2579
  var _a;
2567
2580
  this.modelId = modelId;
2568
2581
  this.config = config;
2569
- this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils11.generateId;
2582
+ this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils12.generateId;
2570
2583
  }
2571
2584
  supportsUrl(url) {
2572
2585
  return url.protocol === "https:";
@@ -2638,7 +2651,7 @@ var AnthropicMessagesLanguageModel = class {
2638
2651
  });
2639
2652
  }
2640
2653
  }
2641
- const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
2654
+ const anthropicOptions = await (0, import_provider_utils12.parseProviderOptions)({
2642
2655
  provider: "anthropic",
2643
2656
  providerOptions,
2644
2657
  schema: anthropicProviderOptions
@@ -3032,15 +3045,15 @@ var AnthropicMessagesLanguageModel = class {
3032
3045
  betas,
3033
3046
  headers
3034
3047
  }) {
3035
- return (0, import_provider_utils11.combineHeaders)(
3036
- await (0, import_provider_utils11.resolve)(this.config.headers),
3048
+ return (0, import_provider_utils12.combineHeaders)(
3049
+ await (0, import_provider_utils12.resolve)(this.config.headers),
3037
3050
  headers,
3038
3051
  betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
3039
3052
  );
3040
3053
  }
3041
3054
  async getBetasFromHeaders(requestHeaders) {
3042
3055
  var _a, _b;
3043
- const configHeaders = await (0, import_provider_utils11.resolve)(this.config.headers);
3056
+ const configHeaders = await (0, import_provider_utils12.resolve)(this.config.headers);
3044
3057
  const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
3045
3058
  const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
3046
3059
  return new Set(
@@ -3092,12 +3105,12 @@ var AnthropicMessagesLanguageModel = class {
3092
3105
  responseHeaders,
3093
3106
  value: response,
3094
3107
  rawValue: rawResponse
3095
- } = await (0, import_provider_utils11.postJsonToApi)({
3108
+ } = await (0, import_provider_utils12.postJsonToApi)({
3096
3109
  url: this.buildRequestUrl(false),
3097
3110
  headers: await this.getHeaders({ betas, headers: options.headers }),
3098
3111
  body: this.transformRequestBody(args, betas),
3099
3112
  failedResponseHandler: anthropicFailedResponseHandler,
3100
- successfulResponseHandler: (0, import_provider_utils11.createJsonResponseHandler)(
3113
+ successfulResponseHandler: (0, import_provider_utils12.createJsonResponseHandler)(
3101
3114
  anthropicMessagesResponseSchema
3102
3115
  ),
3103
3116
  abortSignal: options.abortSignal,
@@ -3461,12 +3474,12 @@ var AnthropicMessagesLanguageModel = class {
3461
3474
  const citationDocuments = this.extractCitationDocuments(options.prompt);
3462
3475
  const body = { ...args, stream: true };
3463
3476
  const url = this.buildRequestUrl(true);
3464
- const { responseHeaders, value: response } = await (0, import_provider_utils11.postJsonToApi)({
3477
+ const { responseHeaders, value: response } = await (0, import_provider_utils12.postJsonToApi)({
3465
3478
  url,
3466
3479
  headers: await this.getHeaders({ betas, headers: options.headers }),
3467
3480
  body: this.transformRequestBody(body, betas),
3468
3481
  failedResponseHandler: anthropicFailedResponseHandler,
3469
- successfulResponseHandler: (0, import_provider_utils11.createEventSourceResponseHandler)(
3482
+ successfulResponseHandler: (0, import_provider_utils12.createEventSourceResponseHandler)(
3470
3483
  anthropicMessagesChunkSchema
3471
3484
  ),
3472
3485
  abortSignal: options.abortSignal,
@@ -4342,44 +4355,44 @@ function mapAnthropicStopDetails(stopDetails) {
4342
4355
  }
4343
4356
 
4344
4357
  // src/tool/bash_20241022.ts
4345
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
4358
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
4346
4359
  var import_v410 = require("zod/v4");
4347
- var bash_20241022InputSchema = (0, import_provider_utils12.lazySchema)(
4348
- () => (0, import_provider_utils12.zodSchema)(
4360
+ var bash_20241022InputSchema = (0, import_provider_utils13.lazySchema)(
4361
+ () => (0, import_provider_utils13.zodSchema)(
4349
4362
  import_v410.z.object({
4350
4363
  command: import_v410.z.string(),
4351
4364
  restart: import_v410.z.boolean().optional()
4352
4365
  })
4353
4366
  )
4354
4367
  );
4355
- var bash_20241022 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
4368
+ var bash_20241022 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
4356
4369
  id: "anthropic.bash_20241022",
4357
4370
  name: "bash",
4358
4371
  inputSchema: bash_20241022InputSchema
4359
4372
  });
4360
4373
 
4361
4374
  // src/tool/bash_20250124.ts
4362
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
4375
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
4363
4376
  var import_v411 = require("zod/v4");
4364
- var bash_20250124InputSchema = (0, import_provider_utils13.lazySchema)(
4365
- () => (0, import_provider_utils13.zodSchema)(
4377
+ var bash_20250124InputSchema = (0, import_provider_utils14.lazySchema)(
4378
+ () => (0, import_provider_utils14.zodSchema)(
4366
4379
  import_v411.z.object({
4367
4380
  command: import_v411.z.string(),
4368
4381
  restart: import_v411.z.boolean().optional()
4369
4382
  })
4370
4383
  )
4371
4384
  );
4372
- var bash_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
4385
+ var bash_20250124 = (0, import_provider_utils14.createProviderDefinedToolFactory)({
4373
4386
  id: "anthropic.bash_20250124",
4374
4387
  name: "bash",
4375
4388
  inputSchema: bash_20250124InputSchema
4376
4389
  });
4377
4390
 
4378
4391
  // src/tool/code-execution_20260120.ts
4379
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
4392
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
4380
4393
  var import_v412 = require("zod/v4");
4381
- var codeExecution_20260120OutputSchema = (0, import_provider_utils14.lazySchema)(
4382
- () => (0, import_provider_utils14.zodSchema)(
4394
+ var codeExecution_20260120OutputSchema = (0, import_provider_utils15.lazySchema)(
4395
+ () => (0, import_provider_utils15.zodSchema)(
4383
4396
  import_v412.z.discriminatedUnion("type", [
4384
4397
  import_v412.z.object({
4385
4398
  type: import_v412.z.literal("code_execution_result"),
@@ -4436,8 +4449,8 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils14.lazySchema)
4436
4449
  ])
4437
4450
  )
4438
4451
  );
4439
- var codeExecution_20260120InputSchema = (0, import_provider_utils14.lazySchema)(
4440
- () => (0, import_provider_utils14.zodSchema)(
4452
+ var codeExecution_20260120InputSchema = (0, import_provider_utils15.lazySchema)(
4453
+ () => (0, import_provider_utils15.zodSchema)(
4441
4454
  import_v412.z.discriminatedUnion("type", [
4442
4455
  import_v412.z.object({
4443
4456
  type: import_v412.z.literal("programmatic-tool-call"),
@@ -4470,7 +4483,7 @@ var codeExecution_20260120InputSchema = (0, import_provider_utils14.lazySchema)(
4470
4483
  ])
4471
4484
  )
4472
4485
  );
4473
- var factory6 = (0, import_provider_utils14.createProviderDefinedToolFactoryWithOutputSchema)({
4486
+ var factory6 = (0, import_provider_utils15.createProviderDefinedToolFactoryWithOutputSchema)({
4474
4487
  id: "anthropic.code_execution_20260120",
4475
4488
  name: "code_execution",
4476
4489
  inputSchema: codeExecution_20260120InputSchema,
@@ -4481,10 +4494,10 @@ var codeExecution_20260120 = (args = {}) => {
4481
4494
  };
4482
4495
 
4483
4496
  // src/tool/computer_20241022.ts
4484
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
4497
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
4485
4498
  var import_v413 = require("zod/v4");
4486
- var computer_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
4487
- () => (0, import_provider_utils15.zodSchema)(
4499
+ var computer_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
4500
+ () => (0, import_provider_utils16.zodSchema)(
4488
4501
  import_v413.z.object({
4489
4502
  action: import_v413.z.enum([
4490
4503
  "key",
@@ -4503,17 +4516,17 @@ var computer_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
4503
4516
  })
4504
4517
  )
4505
4518
  );
4506
- var computer_20241022 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
4519
+ var computer_20241022 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
4507
4520
  id: "anthropic.computer_20241022",
4508
4521
  name: "computer",
4509
4522
  inputSchema: computer_20241022InputSchema
4510
4523
  });
4511
4524
 
4512
4525
  // src/tool/computer_20250124.ts
4513
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
4526
+ var import_provider_utils17 = require("@ai-sdk/provider-utils");
4514
4527
  var import_v414 = require("zod/v4");
4515
- var computer_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
4516
- () => (0, import_provider_utils16.zodSchema)(
4528
+ var computer_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
4529
+ () => (0, import_provider_utils17.zodSchema)(
4517
4530
  import_v414.z.object({
4518
4531
  action: import_v414.z.enum([
4519
4532
  "key",
@@ -4542,17 +4555,17 @@ var computer_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
4542
4555
  })
4543
4556
  )
4544
4557
  );
4545
- var computer_20250124 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
4558
+ var computer_20250124 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
4546
4559
  id: "anthropic.computer_20250124",
4547
4560
  name: "computer",
4548
4561
  inputSchema: computer_20250124InputSchema
4549
4562
  });
4550
4563
 
4551
4564
  // src/tool/memory_20250818.ts
4552
- var import_provider_utils17 = require("@ai-sdk/provider-utils");
4565
+ var import_provider_utils18 = require("@ai-sdk/provider-utils");
4553
4566
  var import_v415 = require("zod/v4");
4554
- var memory_20250818InputSchema = (0, import_provider_utils17.lazySchema)(
4555
- () => (0, import_provider_utils17.zodSchema)(
4567
+ var memory_20250818InputSchema = (0, import_provider_utils18.lazySchema)(
4568
+ () => (0, import_provider_utils18.zodSchema)(
4556
4569
  import_v415.z.discriminatedUnion("command", [
4557
4570
  import_v415.z.object({
4558
4571
  command: import_v415.z.literal("view"),
@@ -4588,17 +4601,17 @@ var memory_20250818InputSchema = (0, import_provider_utils17.lazySchema)(
4588
4601
  ])
4589
4602
  )
4590
4603
  );
4591
- var memory_20250818 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
4604
+ var memory_20250818 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
4592
4605
  id: "anthropic.memory_20250818",
4593
4606
  name: "memory",
4594
4607
  inputSchema: memory_20250818InputSchema
4595
4608
  });
4596
4609
 
4597
4610
  // src/tool/text-editor_20241022.ts
4598
- var import_provider_utils18 = require("@ai-sdk/provider-utils");
4611
+ var import_provider_utils19 = require("@ai-sdk/provider-utils");
4599
4612
  var import_v416 = require("zod/v4");
4600
- var textEditor_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
4601
- () => (0, import_provider_utils18.zodSchema)(
4613
+ var textEditor_20241022InputSchema = (0, import_provider_utils19.lazySchema)(
4614
+ () => (0, import_provider_utils19.zodSchema)(
4602
4615
  import_v416.z.object({
4603
4616
  command: import_v416.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4604
4617
  path: import_v416.z.string(),
@@ -4610,17 +4623,17 @@ var textEditor_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
4610
4623
  })
4611
4624
  )
4612
4625
  );
4613
- var textEditor_20241022 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
4626
+ var textEditor_20241022 = (0, import_provider_utils19.createProviderDefinedToolFactory)({
4614
4627
  id: "anthropic.text_editor_20241022",
4615
4628
  name: "str_replace_editor",
4616
4629
  inputSchema: textEditor_20241022InputSchema
4617
4630
  });
4618
4631
 
4619
4632
  // src/tool/text-editor_20250124.ts
4620
- var import_provider_utils19 = require("@ai-sdk/provider-utils");
4633
+ var import_provider_utils20 = require("@ai-sdk/provider-utils");
4621
4634
  var import_v417 = require("zod/v4");
4622
- var textEditor_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
4623
- () => (0, import_provider_utils19.zodSchema)(
4635
+ var textEditor_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
4636
+ () => (0, import_provider_utils20.zodSchema)(
4624
4637
  import_v417.z.object({
4625
4638
  command: import_v417.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4626
4639
  path: import_v417.z.string(),
@@ -4632,17 +4645,17 @@ var textEditor_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
4632
4645
  })
4633
4646
  )
4634
4647
  );
4635
- var textEditor_20250124 = (0, import_provider_utils19.createProviderDefinedToolFactory)({
4648
+ var textEditor_20250124 = (0, import_provider_utils20.createProviderDefinedToolFactory)({
4636
4649
  id: "anthropic.text_editor_20250124",
4637
4650
  name: "str_replace_editor",
4638
4651
  inputSchema: textEditor_20250124InputSchema
4639
4652
  });
4640
4653
 
4641
4654
  // src/tool/text-editor_20250429.ts
4642
- var import_provider_utils20 = require("@ai-sdk/provider-utils");
4655
+ var import_provider_utils21 = require("@ai-sdk/provider-utils");
4643
4656
  var import_v418 = require("zod/v4");
4644
- var textEditor_20250429InputSchema = (0, import_provider_utils20.lazySchema)(
4645
- () => (0, import_provider_utils20.zodSchema)(
4657
+ var textEditor_20250429InputSchema = (0, import_provider_utils21.lazySchema)(
4658
+ () => (0, import_provider_utils21.zodSchema)(
4646
4659
  import_v418.z.object({
4647
4660
  command: import_v418.z.enum(["view", "create", "str_replace", "insert"]),
4648
4661
  path: import_v418.z.string(),
@@ -4654,7 +4667,7 @@ var textEditor_20250429InputSchema = (0, import_provider_utils20.lazySchema)(
4654
4667
  })
4655
4668
  )
4656
4669
  );
4657
- var textEditor_20250429 = (0, import_provider_utils20.createProviderDefinedToolFactory)({
4670
+ var textEditor_20250429 = (0, import_provider_utils21.createProviderDefinedToolFactory)({
4658
4671
  id: "anthropic.text_editor_20250429",
4659
4672
  name: "str_replace_based_edit_tool",
4660
4673
  inputSchema: textEditor_20250429InputSchema
@@ -4853,17 +4866,17 @@ var anthropicTools = {
4853
4866
  // src/anthropic-provider.ts
4854
4867
  function createAnthropic(options = {}) {
4855
4868
  var _a, _b;
4856
- const baseURL = (_a = (0, import_provider_utils21.withoutTrailingSlash)(
4857
- (0, import_provider_utils21.loadOptionalSetting)({
4869
+ const baseURL = (_a = (0, import_provider_utils22.withoutTrailingSlash)(
4870
+ (0, import_provider_utils22.loadOptionalSetting)({
4858
4871
  settingValue: options.baseURL,
4859
4872
  environmentVariableName: "ANTHROPIC_BASE_URL"
4860
4873
  })
4861
4874
  )) != null ? _a : "https://api.anthropic.com/v1";
4862
4875
  const providerName = (_b = options.name) != null ? _b : "anthropic.messages";
4863
- const getHeaders = () => (0, import_provider_utils21.withUserAgentSuffix)(
4876
+ const getHeaders = () => (0, import_provider_utils22.withUserAgentSuffix)(
4864
4877
  {
4865
4878
  "anthropic-version": "2023-06-01",
4866
- "x-api-key": (0, import_provider_utils21.loadApiKey)({
4879
+ "x-api-key": (0, import_provider_utils22.loadApiKey)({
4867
4880
  apiKey: options.apiKey,
4868
4881
  environmentVariableName: "ANTHROPIC_API_KEY",
4869
4882
  description: "Anthropic"
@@ -4879,7 +4892,7 @@ function createAnthropic(options = {}) {
4879
4892
  baseURL,
4880
4893
  headers: getHeaders,
4881
4894
  fetch: options.fetch,
4882
- generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils21.generateId,
4895
+ generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils22.generateId,
4883
4896
  supportedUrls: () => ({
4884
4897
  "image/*": [/^https?:\/\/.*$/]
4885
4898
  })