@ai-sdk/anthropic 3.0.100 → 3.0.101

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": "3.0.100",
3
+ "version": "3.0.101",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -317,7 +317,7 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
317
317
  }
318
318
  }
319
319
 
320
- const isAnthropicModel = isKnownModel || this.modelId.startsWith('claude-');
320
+ const isAnthropicModel = isKnownModel || this.modelId.includes('claude-');
321
321
 
322
322
  const supportsStructuredOutput =
323
323
  (this.config.supportsNativeStructuredOutput ?? true) &&
@@ -2598,7 +2598,7 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
2598
2598
  * @see https://docs.claude.com/en/docs/about-claude/models/overview#model-comparison-table
2599
2599
  * @see https://platform.claude.com/docs/en/build-with-claude/structured-outputs
2600
2600
  */
2601
- function getModelCapabilities(modelId: string): {
2601
+ export function getModelCapabilities(modelId: string): {
2602
2602
  maxOutputTokens: number;
2603
2603
  supportsStructuredOutput: boolean;
2604
2604
  rejectsSamplingParameters: boolean;
@@ -2665,6 +2665,25 @@ function getModelCapabilities(modelId: string): {
2665
2665
  rejectsSamplingParameters: false,
2666
2666
  isKnownModel: true,
2667
2667
  };
2668
+ } else if (
2669
+ /claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)
2670
+ ) {
2671
+ return {
2672
+ maxOutputTokens: 4096,
2673
+ supportsStructuredOutput: false,
2674
+ rejectsSamplingParameters: false,
2675
+ isKnownModel: false,
2676
+ };
2677
+ } else if (modelId.includes('claude-')) {
2678
+ // Known and legacy Claude families are handled above, so any remaining
2679
+ // Claude ID is assumed to be newer than the known list. Keep it unknown so
2680
+ // callers still receive the maxOutputTokens compatibility warning.
2681
+ return {
2682
+ maxOutputTokens: 128000,
2683
+ supportsStructuredOutput: true,
2684
+ rejectsSamplingParameters: true,
2685
+ isKnownModel: false,
2686
+ };
2668
2687
  } else {
2669
2688
  return {
2670
2689
  maxOutputTokens: 4096,
@@ -1,4 +1,7 @@
1
- export { AnthropicMessagesLanguageModel } from '../anthropic-messages-language-model';
1
+ export {
2
+ AnthropicMessagesLanguageModel,
3
+ getModelCapabilities,
4
+ } from '../anthropic-messages-language-model';
2
5
  export { anthropicTools } from '../anthropic-tools';
3
6
  export type { AnthropicMessagesModelId } from '../anthropic-messages-options';
4
7
  export { prepareTools } from '../anthropic-prepare-tools';