@fairyhunter13/ai-anthropic 3.0.58-fork.9 → 3.0.74-fork.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +277 -0
  2. package/README.md +2 -0
  3. package/dist/index.d.ts +156 -67
  4. package/dist/index.js +2191 -1464
  5. package/dist/index.js.map +1 -1
  6. package/dist/internal/index.d.ts +167 -58
  7. package/dist/internal/index.js +1951 -1451
  8. package/dist/internal/index.js.map +1 -1
  9. package/docs/05-anthropic.mdx +116 -13
  10. package/package.json +15 -12
  11. package/src/{anthropic-messages-api.ts → anthropic-api.ts} +46 -13
  12. package/src/anthropic-error.ts +1 -1
  13. package/src/anthropic-files.ts +95 -0
  14. package/src/{anthropic-messages-options.ts → anthropic-language-model-options.ts} +80 -41
  15. package/src/{anthropic-messages-language-model.ts → anthropic-language-model.ts} +225 -131
  16. package/src/anthropic-message-metadata.ts +2 -1
  17. package/src/anthropic-prepare-tools.ts +68 -26
  18. package/src/anthropic-provider.ts +42 -13
  19. package/src/anthropic-tools.ts +18 -0
  20. package/src/{convert-anthropic-messages-usage.ts → convert-anthropic-usage.ts} +4 -4
  21. package/src/{convert-to-anthropic-messages-prompt.ts → convert-to-anthropic-prompt.ts} +233 -180
  22. package/src/forward-anthropic-container-id-from-last-step.ts +2 -2
  23. package/src/get-cache-control.ts +5 -2
  24. package/src/index.ts +1 -1
  25. package/src/internal/index.ts +9 -3
  26. package/src/map-anthropic-stop-reason.ts +1 -1
  27. package/src/sanitize-json-schema.ts +203 -0
  28. package/src/skills/anthropic-skills-api.ts +44 -0
  29. package/src/skills/anthropic-skills.ts +132 -0
  30. package/src/tool/bash_20241022.ts +2 -2
  31. package/src/tool/bash_20250124.ts +2 -2
  32. package/src/tool/code-execution_20250522.ts +2 -2
  33. package/src/tool/code-execution_20250825.ts +2 -2
  34. package/src/tool/code-execution_20260120.ts +2 -2
  35. package/src/tool/computer_20241022.ts +2 -2
  36. package/src/tool/computer_20250124.ts +2 -2
  37. package/src/tool/computer_20251124.ts +2 -2
  38. package/src/tool/memory_20250818.ts +2 -2
  39. package/src/tool/text-editor_20241022.ts +2 -2
  40. package/src/tool/text-editor_20250124.ts +2 -2
  41. package/src/tool/text-editor_20250429.ts +2 -2
  42. package/src/tool/text-editor_20250728.ts +6 -3
  43. package/src/tool/tool-search-bm25_20251119.ts +2 -2
  44. package/src/tool/tool-search-regex_20251119.ts +2 -2
  45. package/src/tool/web-fetch-20250910.ts +2 -2
  46. package/src/tool/web-fetch-20260209.ts +2 -2
  47. package/src/tool/web-fetch-20260309.ts +181 -0
  48. package/src/tool/web-search_20250305.ts +2 -2
  49. package/src/tool/web-search_20260209.ts +19 -2
  50. package/dist/index.d.mts +0 -1105
  51. package/dist/index.mjs +0 -5394
  52. package/dist/index.mjs.map +0 -1
  53. package/dist/internal/index.d.mts +0 -981
  54. package/dist/internal/index.mjs +0 -5287
  55. package/dist/internal/index.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,282 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 4.0.0-canary.43
4
+
5
+ ### Patch Changes
6
+
7
+ - 0c4c275: trigger initial canary release
8
+ - Updated dependencies [0c4c275]
9
+ - @ai-sdk/provider-utils@5.0.0-canary.31
10
+ - @ai-sdk/provider@4.0.0-canary.15
11
+
12
+ ## 4.0.0-beta.42
13
+
14
+ ### Major Changes
15
+
16
+ - 04e9009: chore: make provider implementations code patterns more consistent, including renaming certain exported symbols
17
+
18
+ For all externally exported symbols that were renamed, the old names continue to work via deprecated aliases.
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [08d2129]
23
+ - @ai-sdk/provider-utils@5.0.0-beta.30
24
+
25
+ ## 4.0.0-beta.41
26
+
27
+ ### Patch Changes
28
+
29
+ - 9bd6512: feat(provider): change file part data property to be tagged with a type and remove the image part type
30
+ - 258c093: chore: ensure consistent import handling and avoid import duplicates or cycles
31
+ - Updated dependencies [9bd6512]
32
+ - Updated dependencies [258c093]
33
+ - Updated dependencies [b6783da]
34
+ - @ai-sdk/provider-utils@5.0.0-beta.29
35
+ - @ai-sdk/provider@4.0.0-beta.14
36
+
37
+ ## 4.0.0-beta.40
38
+
39
+ ### Patch Changes
40
+
41
+ - c012d57: feat(anthropic): sanitize the unsupported JSON schema validation properties
42
+
43
+ ## 4.0.0-beta.39
44
+
45
+ ### Patch Changes
46
+
47
+ - 9f0e36c: trigger release for all packages after provenance setup
48
+ - Updated dependencies [9f0e36c]
49
+ - @ai-sdk/provider@4.0.0-beta.13
50
+ - @ai-sdk/provider-utils@5.0.0-beta.28
51
+
52
+ ## 4.0.0-beta.38
53
+
54
+ ### Patch Changes
55
+
56
+ - 87d1723: chore(anthropic): remove unnecessary messages affix from Anthropic symbols and files
57
+ - 58a2ad7: fix: more precise default message for tool execution denial
58
+ - Updated dependencies [785fe16]
59
+ - Updated dependencies [67df0a0]
60
+ - Updated dependencies [befb78c]
61
+ - Updated dependencies [0458559]
62
+ - Updated dependencies [5852c0a]
63
+ - Updated dependencies [fc92055]
64
+ - @ai-sdk/provider-utils@5.0.0-beta.27
65
+
66
+ ## 4.0.0-beta.37
67
+
68
+ ### Patch Changes
69
+
70
+ - Updated dependencies [2e98477]
71
+ - @ai-sdk/provider-utils@5.0.0-beta.26
72
+
73
+ ## 4.0.0-beta.36
74
+
75
+ ### Patch Changes
76
+
77
+ - Updated dependencies [eea8d98]
78
+ - @ai-sdk/provider-utils@5.0.0-beta.25
79
+
80
+ ## 4.0.0-beta.35
81
+
82
+ ### Patch Changes
83
+
84
+ - Updated dependencies [f807e45]
85
+ - @ai-sdk/provider-utils@5.0.0-beta.24
86
+
87
+ ## 4.0.0-beta.34
88
+
89
+ ### Patch Changes
90
+
91
+ - Updated dependencies [350ea38]
92
+ - @ai-sdk/provider-utils@5.0.0-beta.23
93
+
94
+ ## 4.0.0-beta.33
95
+
96
+ ### Major Changes
97
+
98
+ - 832f86f: fix(anthropic): remove cacheCreationInputTokens from providerMetadata
99
+
100
+ ## 4.0.0-beta.32
101
+
102
+ ### Patch Changes
103
+
104
+ - ad0b376: fix(provider/anthropic): stop adding `fine-grained-tool-streaming-2025-05-14` beta for `claude-opus-4-7`
105
+
106
+ ## 4.0.0-beta.31
107
+
108
+ ### Patch Changes
109
+
110
+ - Updated dependencies [083947b]
111
+ - @ai-sdk/provider-utils@5.0.0-beta.22
112
+
113
+ ## 4.0.0-beta.30
114
+
115
+ ### Patch Changes
116
+
117
+ - 0d8f107: feat(provider/anthropic): add support for Opus 4.7 and relevant API enhancements
118
+
119
+ ## 4.0.0-beta.29
120
+
121
+ ### Patch Changes
122
+
123
+ - Updated dependencies [add1126]
124
+ - @ai-sdk/provider-utils@5.0.0-beta.21
125
+
126
+ ## 4.0.0-beta.28
127
+
128
+ ### Patch Changes
129
+
130
+ - b3976a2: Add workflow serialization support to all provider models.
131
+
132
+ **`@ai-sdk/provider-utils`:** New `serializeModel()` helper that extracts only serializable properties from a model instance, filtering out functions and objects containing functions. Third-party provider authors can use this to add workflow support to their own models.
133
+
134
+ **All providers:** `headers` is now optional in provider config types. This is non-breaking — existing code that passes `headers` continues to work. Custom provider implementations that construct model configs manually can now omit `headers`, which is useful when models are deserialized from a workflow step boundary where auth is provided separately.
135
+
136
+ All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
137
+
138
+ - ff5eba1: feat: roll `image-*` tool output types into their equivalent `file-*` types
139
+ - Updated dependencies [b3976a2]
140
+ - Updated dependencies [ff5eba1]
141
+ - @ai-sdk/provider-utils@5.0.0-beta.20
142
+ - @ai-sdk/provider@4.0.0-beta.12
143
+
144
+ ## 4.0.0-beta.27
145
+
146
+ ### Major Changes
147
+
148
+ - ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
149
+
150
+ ### Patch Changes
151
+
152
+ - Updated dependencies [ef992f8]
153
+ - @ai-sdk/provider@4.0.0-beta.11
154
+ - @ai-sdk/provider-utils@5.0.0-beta.19
155
+
156
+ ## 4.0.0-beta.26
157
+
158
+ ### Patch Changes
159
+
160
+ - 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
161
+ - Updated dependencies [90e2d8a]
162
+ - @ai-sdk/provider-utils@5.0.0-beta.18
163
+
164
+ ## 4.0.0-beta.25
165
+
166
+ ### Patch Changes
167
+
168
+ - 09bd27b: feat (provider/anthropic): add support for inference_geo provider option
169
+
170
+ ## 4.0.0-beta.24
171
+
172
+ ### Patch Changes
173
+
174
+ - Updated dependencies [3ae1786]
175
+ - @ai-sdk/provider-utils@5.0.0-beta.17
176
+
177
+ ## 4.0.0-beta.23
178
+
179
+ ### Patch Changes
180
+
181
+ - Updated dependencies [176466a]
182
+ - @ai-sdk/provider@4.0.0-beta.10
183
+ - @ai-sdk/provider-utils@5.0.0-beta.16
184
+
185
+ ## 4.0.0-beta.22
186
+
187
+ ### Patch Changes
188
+
189
+ - e311194: feat(ai): allow passing provider instance to `uploadFile` and `uploadSkill` as shorthand
190
+ - Updated dependencies [e311194]
191
+ - @ai-sdk/provider@4.0.0-beta.9
192
+ - @ai-sdk/provider-utils@5.0.0-beta.15
193
+
194
+ ## 4.0.0-beta.21
195
+
196
+ ### Patch Changes
197
+
198
+ - 34bd95d: feat(ai): add support for uploading provider skills using the provider references abstraction
199
+ - Updated dependencies [34bd95d]
200
+ - Updated dependencies [008271d]
201
+ - @ai-sdk/provider@4.0.0-beta.8
202
+ - @ai-sdk/provider-utils@5.0.0-beta.14
203
+
204
+ ## 4.0.0-beta.20
205
+
206
+ ### Patch Changes
207
+
208
+ - Updated dependencies [b0c2869]
209
+ - Updated dependencies [7e26e81]
210
+ - @ai-sdk/provider-utils@5.0.0-beta.13
211
+
212
+ ## 4.0.0-beta.19
213
+
214
+ ### Patch Changes
215
+
216
+ - Updated dependencies [46d1149]
217
+ - @ai-sdk/provider-utils@5.0.0-beta.12
218
+
219
+ ## 4.0.0-beta.18
220
+
221
+ ### Patch Changes
222
+
223
+ - 6fd51c0: fix(provider): preserve error type prefix in getErrorMessage
224
+ - Updated dependencies [6fd51c0]
225
+ - @ai-sdk/provider-utils@5.0.0-beta.11
226
+ - @ai-sdk/provider@4.0.0-beta.7
227
+
228
+ ## 4.0.0-beta.17
229
+
230
+ ### Patch Changes
231
+
232
+ - c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
233
+ - Updated dependencies [c29a26f]
234
+ - @ai-sdk/provider-utils@5.0.0-beta.10
235
+ - @ai-sdk/provider@4.0.0-beta.6
236
+
237
+ ## 4.0.0-beta.16
238
+
239
+ ### Patch Changes
240
+
241
+ - 38fc777: Add AI Gateway hint to provider READMEs
242
+
243
+ ## 4.0.0-beta.15
244
+
245
+ ### Patch Changes
246
+
247
+ - f57c702: fix(anthropic): allow both temperature and topP for non-Anthropic models using the Anthropic-compatible API
248
+
249
+ The temperature/topP mutual exclusivity check now only applies to known Anthropic models (model IDs starting with `claude-`). Non-Anthropic models using the Anthropic-compatible API (e.g. Minimax) can now send both parameters as required by their APIs.
250
+
251
+ ## 4.0.0-beta.14
252
+
253
+ ### Patch Changes
254
+
255
+ - Updated dependencies [2e17091]
256
+ - @ai-sdk/provider-utils@5.0.0-beta.9
257
+
258
+ ## 4.0.0-beta.13
259
+
260
+ ### Patch Changes
261
+
262
+ - Updated dependencies [986c6fd]
263
+ - Updated dependencies [493295c]
264
+ - @ai-sdk/provider-utils@5.0.0-beta.8
265
+
266
+ ## 4.0.0-beta.12
267
+
268
+ ### Patch Changes
269
+
270
+ - Updated dependencies [1f509d4]
271
+ - @ai-sdk/provider-utils@5.0.0-beta.7
272
+ - @ai-sdk/provider@4.0.0-beta.5
273
+
274
+ ## 4.0.0-beta.11
275
+
276
+ ### Patch Changes
277
+
278
+ - 0ee8aec: feat (provider/anthropic): support passing metadata.user_id
279
+
3
280
  ## 4.0.0-beta.10
4
281
 
5
282
  ### Patch Changes
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  The **[Anthropic provider](https://ai-sdk.dev/providers/ai-sdk-providers/anthropic)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model support for the [Anthropic Messages API](https://docs.anthropic.com/claude/reference/messages_post).
4
4
 
5
+ > **Deploying to Vercel?** With Vercel's AI Gateway you can access Anthropic (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).
6
+
5
7
  ## Setup
6
8
 
7
9
  The Anthropic provider is available in the `@ai-sdk/anthropic` module. You can install it with