@ai-sdk/anthropic 4.0.17 → 4.0.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/anthropic",
3
- "version": "4.0.17",
3
+ "version": "4.0.19",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -301,6 +301,17 @@ export class AnthropicLanguageModel implements LanguageModelV4 {
301
301
  isKnownModel,
302
302
  } = getModelCapabilities(this.modelId);
303
303
 
304
+ if (!isKnownModel && maxOutputTokens == null) {
305
+ warnings.push({
306
+ type: 'compatibility',
307
+ feature: 'maxOutputTokens',
308
+ details:
309
+ `The model "${this.modelId}" is unknown. ` +
310
+ `The max output tokens have been limited to ${maxOutputTokensForModel}. ` +
311
+ `Set maxOutputTokens explicitly to override this limit.`,
312
+ });
313
+ }
314
+
304
315
  if (rejectsSamplingParameters) {
305
316
  if (temperature != null) {
306
317
  warnings.push({
@@ -328,7 +339,7 @@ export class AnthropicLanguageModel implements LanguageModelV4 {
328
339
  }
329
340
  }
330
341
 
331
- const isAnthropicModel = isKnownModel || this.modelId.startsWith('claude-');
342
+ const isAnthropicModel = isKnownModel || this.modelId.includes('claude-');
332
343
 
333
344
  const supportsStructuredOutput =
334
345
  (this.config.supportsNativeStructuredOutput ?? true) &&
@@ -2716,6 +2727,29 @@ export function getModelCapabilities(modelId: string): {
2716
2727
  supportsXhighEffort: false,
2717
2728
  isKnownModel: true,
2718
2729
  };
2730
+ } else if (
2731
+ /claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)
2732
+ ) {
2733
+ return {
2734
+ maxOutputTokens: 4096,
2735
+ supportsStructuredOutput: false,
2736
+ supportsAdaptiveThinking: false,
2737
+ rejectsSamplingParameters: false,
2738
+ supportsXhighEffort: false,
2739
+ isKnownModel: false,
2740
+ };
2741
+ } else if (modelId.includes('claude-')) {
2742
+ // Known and legacy Claude families are handled above, so any remaining
2743
+ // Claude ID is assumed to be newer than the known list. Keep it unknown so
2744
+ // callers still receive the maxOutputTokens compatibility warning.
2745
+ return {
2746
+ maxOutputTokens: 128000,
2747
+ supportsStructuredOutput: true,
2748
+ supportsAdaptiveThinking: true,
2749
+ rejectsSamplingParameters: true,
2750
+ supportsXhighEffort: true,
2751
+ isKnownModel: false,
2752
+ };
2719
2753
  } else {
2720
2754
  return {
2721
2755
  maxOutputTokens: 4096,