Skip to content

Commit a39b501

Browse files
authored
add anthropic meta information (TanStack#8)
1 parent a7f4a4e commit a39b501

13 files changed

Lines changed: 862 additions & 20 deletions

packages/typescript/ai-anthropic/src/anthropic-adapter.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,12 @@ import {
1313
type Message,
1414
type StreamChunk,
1515
} from "@tanstack/ai";
16+
import { ANTHROPIC_AUDIO_MODELS, ANTHROPIC_EMBEDDING_MODELS, ANTHROPIC_IMAGE_MODELS, ANTHROPIC_MODELS, ANTHROPIC_VIDEO_MODELS } from "./model-meta";
1617

1718
export interface AnthropicConfig {
1819
apiKey: string;
1920
}
2021

21-
const ANTHROPIC_MODELS = [
22-
"claude-3-5-sonnet-20241022",
23-
"claude-3-5-sonnet-20240620",
24-
"claude-3-opus-20240229",
25-
"claude-3-sonnet-20240229",
26-
"claude-3-haiku-20240307",
27-
"claude-2.1",
28-
"claude-2.0",
29-
"claude-instant-1.2",
30-
] as const;
31-
32-
const ANTHROPIC_IMAGE_MODELS = [] as const;
33-
const ANTHROPIC_EMBEDDING_MODELS = [] as const;
34-
const ANTHROPIC_AUDIO_MODELS = [] as const;
35-
const ANTHROPIC_VIDEO_MODELS = [] as const;
36-
37-
export type AnthropicModel = (typeof ANTHROPIC_MODELS)[number];
3822

3923
/**
4024
* Anthropic-specific provider options
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
interface ModelMeta {
2+
name: string;
3+
id: string;
4+
supports: {
5+
extended_thinking?: boolean;
6+
priority_tier?: boolean;
7+
8+
};
9+
context_window?: number;
10+
max_output_tokens?: number;
11+
knowledge_cutoff?: string;
12+
pricing: {
13+
input: {
14+
normal: number;
15+
cached?: number;
16+
};
17+
output: {
18+
normal: number;
19+
};
20+
};
21+
}
22+
const CLAUDE_SONNET_4_5 = {
23+
name: "claude-sonnet-4-5",
24+
id: "claude-sonnet-4-5-20250929",
25+
context_window: 200_000,
26+
max_output_tokens: 64_000,
27+
knowledge_cutoff: "2025-09-29",
28+
pricing: {
29+
input: {
30+
normal: 3,
31+
},
32+
output: {
33+
normal: 15
34+
}
35+
},
36+
supports: {
37+
extended_thinking: true,
38+
priority_tier: true
39+
}
40+
} as const satisfies ModelMeta;
41+
42+
const CLAUDE_HAIKU_4_5 = {
43+
name: "claude-haiku-4-5",
44+
id: "claude-haiku-4-5-20251001",
45+
context_window: 200_000,
46+
max_output_tokens: 64_000,
47+
knowledge_cutoff: "2025-10-01",
48+
pricing: {
49+
input: {
50+
normal: 1,
51+
},
52+
output: {
53+
normal: 5
54+
}
55+
},
56+
supports: {
57+
extended_thinking: true,
58+
priority_tier: true
59+
}
60+
} as const satisfies ModelMeta;
61+
62+
const CLAUDE_OPUS_4_1 = {
63+
name: "claude-opus-4-1",
64+
id: "claude-opus-4-1-20250805",
65+
context_window: 200_000,
66+
max_output_tokens: 64_000,
67+
knowledge_cutoff: "2025-08-05",
68+
pricing: {
69+
input: {
70+
normal: 15,
71+
},
72+
output: {
73+
normal: 75
74+
}
75+
},
76+
supports: {
77+
extended_thinking: true,
78+
priority_tier: true
79+
}
80+
} as const satisfies ModelMeta;
81+
82+
const CLAUDE_SONNET_4 = {
83+
name: "claude-sonnet-4",
84+
id: "claude-sonnet-4-20250514",
85+
context_window: 200_000,
86+
max_output_tokens: 64_000,
87+
knowledge_cutoff: "2025-05-14",
88+
pricing: {
89+
input: {
90+
normal: 3,
91+
},
92+
output: {
93+
normal: 15
94+
}
95+
},
96+
supports: {
97+
extended_thinking: true,
98+
priority_tier: true
99+
}
100+
} as const satisfies ModelMeta;
101+
102+
const CLAUDE_SONNET_3_7 = {
103+
name: "claude-sonnet-3-7",
104+
id: "claude-3-7-sonnet-20250219",
105+
max_output_tokens: 64_000,
106+
knowledge_cutoff: "2025-05-14",
107+
pricing: {
108+
input: {
109+
normal: 3,
110+
},
111+
output: {
112+
normal: 15
113+
}
114+
},
115+
supports: {
116+
extended_thinking: true,
117+
priority_tier: true
118+
}
119+
} as const satisfies ModelMeta;
120+
121+
const CLAUDE_OPUS_4 = {
122+
name: "claude-opus-4",
123+
id: "claude-opus-4-20250514",
124+
context_window: 200_000,
125+
max_output_tokens: 32_000,
126+
knowledge_cutoff: "2025-05-14",
127+
pricing: {
128+
input: {
129+
normal: 15,
130+
},
131+
output: {
132+
normal: 75
133+
}
134+
},
135+
supports: {
136+
extended_thinking: true,
137+
priority_tier: true
138+
}
139+
} as const satisfies ModelMeta;
140+
141+
const CLAUDE_HAIKU_3_5 = {
142+
name: "claude-haiku-3-5",
143+
id: "claude-3-5-haiku-20241022",
144+
context_window: 200_000,
145+
max_output_tokens: 8_000,
146+
knowledge_cutoff: "2025-10-22",
147+
pricing: {
148+
input: {
149+
normal: 0.8,
150+
},
151+
output: {
152+
normal: 4
153+
}
154+
},
155+
supports: {
156+
extended_thinking: false,
157+
priority_tier: true
158+
}
159+
} as const satisfies ModelMeta;
160+
161+
const CLAUDE_HAIKU_3 = {
162+
name: "claude-haiku-3",
163+
id: "claude-3-haiku-20240307",
164+
context_window: 200_000,
165+
max_output_tokens: 4_000,
166+
knowledge_cutoff: "2024-03-07",
167+
pricing: {
168+
input: {
169+
normal: 0.25,
170+
},
171+
output: {
172+
normal: 1.25
173+
}
174+
},
175+
supports: {
176+
extended_thinking: false,
177+
priority_tier: false
178+
}
179+
} as const satisfies ModelMeta;
180+
181+
export const ANTHROPIC_MODELS = [
182+
CLAUDE_SONNET_4_5.id,
183+
CLAUDE_HAIKU_4_5.id,
184+
CLAUDE_OPUS_4_1.id,
185+
CLAUDE_SONNET_4.id,
186+
CLAUDE_SONNET_3_7.id,
187+
CLAUDE_OPUS_4.id,
188+
CLAUDE_HAIKU_3_5.id,
189+
CLAUDE_HAIKU_3.id
190+
] as const
191+
192+
export const ANTHROPIC_IMAGE_MODELS = [] as const;
193+
export const ANTHROPIC_EMBEDDING_MODELS = [] as const;
194+
export const ANTHROPIC_AUDIO_MODELS = [] as const;
195+
export const ANTHROPIC_VIDEO_MODELS = [] as const;
196+
197+
export type AnthropicModel = (typeof ANTHROPIC_MODELS)[number];

0 commit comments

Comments
 (0)