@tanstack/ai-anthropic 0.18.13 → 0.19.1

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/src/index.ts CHANGED
@@ -22,6 +22,14 @@ export {
22
22
  type AnthropicSummarizeConfig,
23
23
  type AnthropicSummarizeModel,
24
24
  } from './adapters/summarize'
25
+
26
+ // Files adapter - upload media to the Anthropic Files API (beta) by file_id
27
+ export {
28
+ AnthropicFilesAdapter,
29
+ createAnthropicFiles,
30
+ anthropicFiles,
31
+ type AnthropicFilesConfig,
32
+ } from './adapters/files'
25
33
  // ============================================================================
26
34
  // Type Exports
27
35
  // ============================================================================
package/src/model-meta.ts CHANGED
@@ -608,7 +608,48 @@ const CLAUDE_FABLE_5_1 = {
608
608
  AnthropicOutputConfigOptions
609
609
  >
610
610
 
611
+ const CLAUDE_OPUS_5_5 = {
612
+ name: 'claude-opus-5-5',
613
+ id: 'claude-opus-5-5',
614
+ context_window: 1_000_000,
615
+ max_output_tokens: 128_000,
616
+ supports: {
617
+ input: ['text', 'image', 'document'],
618
+ // No 'computer_use': this model accepts only `computer_toolset_20260801`,
619
+ // and `computerUseTool()` sends the older versions, which return a 400.
620
+ tools: [
621
+ 'web_search',
622
+ 'web_fetch',
623
+ 'code_execution',
624
+ 'bash',
625
+ 'text_editor',
626
+ 'memory',
627
+ ],
628
+ },
629
+ pricing: {
630
+ input: {
631
+ normal: 4,
632
+ cached: 0.2,
633
+ },
634
+ output: {
635
+ normal: 20,
636
+ },
637
+ },
638
+ } as const satisfies ModelMeta<
639
+ AnthropicCacheControlOptions &
640
+ AnthropicContainerOptions &
641
+ AnthropicContextManagementOptions &
642
+ AnthropicMCPOptions &
643
+ AnthropicServiceTierOptions &
644
+ AnthropicStopSequencesOptions &
645
+ AnthropicAdaptiveOnlyThinkingOptions &
646
+ AnthropicToolChoiceOptions &
647
+ AnthropicSamplingOptions &
648
+ AnthropicOutputConfigOptions
649
+ >
650
+
611
651
  export const ANTHROPIC_MODELS = [
652
+ CLAUDE_OPUS_5_5.id,
612
653
  CLAUDE_FABLE_5_1.id,
613
654
  CLAUDE_OPUS_5.id,
614
655
  CLAUDE_OPUS_5_FAST.id,
@@ -686,6 +727,7 @@ const ANTHROPIC_MODEL_MAX_OUTPUT_TOKENS: Record<string, number> = {
686
727
  [CLAUDE_OPUS_5.id]: CLAUDE_OPUS_5.max_output_tokens,
687
728
  [CLAUDE_OPUS_5_FAST.id]: CLAUDE_OPUS_5_FAST.max_output_tokens,
688
729
  [CLAUDE_FABLE_5_1.id]: CLAUDE_FABLE_5_1.max_output_tokens,
730
+ [CLAUDE_OPUS_5_5.id]: CLAUDE_OPUS_5_5.max_output_tokens,
689
731
  }
690
732
 
691
733
  /**
@@ -741,6 +783,7 @@ export const ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS = new Set<string>([
741
783
  CLAUDE_OPUS_5.id,
742
784
  CLAUDE_FABLE_5.id,
743
785
  CLAUDE_FABLE_5_1.id,
786
+ CLAUDE_OPUS_5_5.id,
744
787
  CLAUDE_SONNET_5.id,
745
788
  CLAUDE_SONNET_4_5.id,
746
789
  CLAUDE_SONNET_4_6.id,
@@ -891,6 +934,16 @@ export type AnthropicChatModelProviderOptionsByName = {
891
934
  AnthropicToolChoiceOptions &
892
935
  AnthropicMaxTokensOptions &
893
936
  AnthropicOutputConfigOptions
937
+ [CLAUDE_OPUS_5_5.id]: AnthropicCacheControlOptions &
938
+ AnthropicContainerOptions &
939
+ AnthropicContextManagementOptions &
940
+ AnthropicMCPOptions &
941
+ AnthropicServiceTierOptions &
942
+ AnthropicStopSequencesOptions &
943
+ AnthropicAdaptiveOnlyThinkingOptions &
944
+ AnthropicToolChoiceOptions &
945
+ AnthropicSamplingOptions &
946
+ AnthropicOutputConfigOptions
894
947
  }
895
948
 
896
949
  export type AnthropicChatModelToolCapabilitiesByName = {
@@ -907,6 +960,7 @@ export type AnthropicChatModelToolCapabilitiesByName = {
907
960
  [CLAUDE_OPUS_5.id]: typeof CLAUDE_OPUS_5.supports.tools
908
961
  [CLAUDE_OPUS_5_FAST.id]: typeof CLAUDE_OPUS_5_FAST.supports.tools
909
962
  [CLAUDE_FABLE_5_1.id]: typeof CLAUDE_FABLE_5_1.supports.tools
963
+ [CLAUDE_OPUS_5_5.id]: typeof CLAUDE_OPUS_5_5.supports.tools
910
964
  }
911
965
 
912
966
  /**
@@ -934,4 +988,5 @@ export type AnthropicModelInputModalitiesByName = {
934
988
  [CLAUDE_OPUS_5.id]: typeof CLAUDE_OPUS_5.supports.input
935
989
  [CLAUDE_OPUS_5_FAST.id]: typeof CLAUDE_OPUS_5_FAST.supports.input
936
990
  [CLAUDE_FABLE_5_1.id]: typeof CLAUDE_FABLE_5_1.supports.input
991
+ [CLAUDE_OPUS_5_5.id]: typeof CLAUDE_OPUS_5_5.supports.input
937
992
  }
@@ -1,15 +1,13 @@
1
1
  import type {
2
2
  BetaContextManagementConfig,
3
+ BetaMessageParam,
3
4
  BetaToolChoiceAny,
4
5
  BetaToolChoiceAuto,
5
6
  BetaToolChoiceTool,
6
7
  } from '@anthropic-ai/sdk/resources/beta/messages/messages'
7
8
  import type { CacheControlEphemeral } from '@anthropic-ai/sdk/resources'
8
9
  import type { AnthropicContainerSkill, AnthropicTool } from '../tools/index'
9
- import type {
10
- MessageParam,
11
- TextBlockParam,
12
- } from '@anthropic-ai/sdk/resources/messages'
10
+ import type { TextBlockParam } from '@anthropic-ai/sdk/resources/messages'
13
11
 
14
12
  /**
15
13
  * Per-prompt metadata Anthropic understands on `systemPrompts` entries.
@@ -320,7 +318,7 @@ export type ExternalTextProviderOptions = AnthropicCacheControlOptions &
320
318
  export interface InternalTextProviderOptions extends ExternalTextProviderOptions {
321
319
  model: string
322
320
 
323
- messages: Array<MessageParam>
321
+ messages: Array<BetaMessageParam>
324
322
 
325
323
  /**
326
324
  * The maximum number of tokens to generate before stopping. This parameter only specifies the absolute maximum number of tokens to generate.