UNPKG

@ai-sdk/amazon-bedrock

Version:
1 lines • 61.1 kB
{"version":3,"file":"index.cjs","names":["getModelCapabilities","combineHeaders","normalizeHeaders","withUserAgentSuffix","getRuntimeEnvironmentUserAgent","AwsV4Signer","resolve","LoadAPIKeyError","loadOptionalSetting","loadSetting","withoutTrailingSlash","isValidHostnamePart","InvalidArgumentError","withUserAgentSuffix","OpenAIChatLanguageModel","OpenAIResponsesLanguageModel","NoSuchModelError"],"sources":["../../src/amazon-bedrock-model-catalog.ts","../../src/version.ts","../../src/amazon-bedrock-sigv4-fetch.ts","../../src/mantle/bedrock-mantle-provider.ts"],"sourcesContent":["import type {\n  ModelCapabilities,\n  ModelCapability,\n  ModelEntry,\n  ProviderOptionDefinition,\n  ProviderOptionDefinitions,\n} from '@ai-sdk/provider';\nimport { getModelCapabilities } from '@ai-sdk/anthropic/internal';\nimport type { AmazonBedrockLanguageModelChatOptions } from './amazon-bedrock-chat-language-model-options';\nimport type { AmazonBedrockEmbeddingModelOptions } from './amazon-bedrock-embedding-model-options';\nimport type { AmazonBedrockImageModelOptions } from './amazon-bedrock-image-model-options';\nimport type { AmazonBedrockRerankingModelOptions } from './reranking/amazon-bedrock-reranking-model-options';\n\n/** Options under amazonBedrock, with bedrock retained as a legacy alias. */\nexport const amazonBedrockProviderOptions = {\n  language: {\n    structuredOutputMode: {\n      description: 'Select native structured output or JSON tools.',\n    },\n    additionalModelRequestFields: {\n      description: 'Additional model-specific inference fields.',\n    },\n    reasoningConfig: {\n      description: 'Thinking mode, budget, effort, and display.',\n    },\n    anthropicBeta: { description: 'Anthropic beta features to enable.' },\n    serviceTier: { description: 'Request service tier.' },\n    requestMetadata: {\n      description: 'Invocation logging and cost attribution metadata.',\n    },\n  } satisfies Record<\n    keyof AmazonBedrockLanguageModelChatOptions,\n    ProviderOptionDefinition\n  >,\n  embedding: {\n    dimensions: { description: 'Titan v2 output dimensions.' },\n    normalize: { description: 'Normalize Titan v2 embeddings.' },\n    embeddingDimension: { description: 'Nova output dimensions.' },\n    embeddingPurpose: { description: 'Nova embedding purpose.' },\n    inputType: { description: 'Cohere embedding input type.' },\n    truncate: { description: 'Cohere or Nova truncation mode.' },\n    outputDimension: { description: 'Cohere v4 output dimensions.' },\n  } satisfies Record<\n    keyof AmazonBedrockEmbeddingModelOptions,\n    ProviderOptionDefinition\n  >,\n  image: {\n    quality: { description: 'Image quality.' },\n    negativeText: { description: 'Content to avoid.' },\n    cfgScale: { description: 'Prompt adherence scale.' },\n    style: { description: 'Image generation style.' },\n    taskType: {\n      description:\n        'Generation, variation, inpainting, outpainting, or background removal.',\n    },\n    maskPrompt: { description: 'Text describing the region to mask.' },\n    outPaintingMode: { description: 'Outpainting mode.' },\n    similarityStrength: { description: 'Similarity to reference images.' },\n  } satisfies Record<\n    keyof AmazonBedrockImageModelOptions,\n    ProviderOptionDefinition\n  >,\n  reranking: {\n    nextToken: { description: 'Pagination token.' },\n    additionalModelRequestFields: {\n      description: 'Additional model-specific reranking fields.',\n    },\n  } satisfies Record<\n    keyof AmazonBedrockRerankingModelOptions,\n    ProviderOptionDefinition\n  >,\n} as const satisfies ProviderOptionDefinitions;\n\ntype BedrockStructuredOutputCapabilities = {\n  tools: { strict: boolean };\n  structuredOutput: { native: boolean };\n};\n\nconst strictToolsAndNativeOutput = {\n  tools: { strict: true },\n  structuredOutput: { native: true },\n} satisfies BedrockStructuredOutputCapabilities;\n\nconst strictToolsOnly = {\n  tools: { strict: true },\n  structuredOutput: { native: false },\n} satisfies BedrockStructuredOutputCapabilities;\n\nconst noStrictToolsOrNativeOutput = {\n  tools: { strict: false },\n  structuredOutput: { native: false },\n} satisfies BedrockStructuredOutputCapabilities;\n\n// Bedrock's Messages schema differs from Anthropic's. Declare its support on\n// each model instead of maintaining a separate regex support allowlist.\nconst claudeStructuredOutputCapabilities: Readonly<\n  Record<string, BedrockStructuredOutputCapabilities>\n> = {\n  'claude-opus-4': strictToolsAndNativeOutput,\n  'claude-sonnet-4': strictToolsAndNativeOutput,\n  'claude-opus-4-1': strictToolsAndNativeOutput,\n  'claude-opus-4-5': strictToolsAndNativeOutput,\n  'claude-sonnet-4-5': strictToolsAndNativeOutput,\n  'claude-haiku-4-5': strictToolsOnly,\n  'claude-opus-4-6': strictToolsAndNativeOutput,\n  'claude-sonnet-4-6': strictToolsOnly,\n  'claude-opus-4-7': noStrictToolsOrNativeOutput,\n  'claude-opus-4-8': noStrictToolsOrNativeOutput,\n  'claude-opus-5': strictToolsAndNativeOutput,\n  'claude-sonnet-5': strictToolsAndNativeOutput,\n  'claude-opus-5-5': strictToolsAndNativeOutput,\n  'claude-sonnet-5-5': strictToolsAndNativeOutput,\n  'claude-haiku-5-5': strictToolsAndNativeOutput,\n  'claude-fable-5': noStrictToolsOrNativeOutput,\n  'claude-fable-5-1': noStrictToolsOrNativeOutput,\n  'claude-fable-5-2': noStrictToolsOrNativeOutput,\n};\n\nfunction resolveClaudeStructuredOutputCapabilities(\n  modelId: string,\n): BedrockStructuredOutputCapabilities {\n  // Preserve the existing request fallback for non-Claude models, opaque\n  // inference profiles, and legacy Claude IDs.\n  if (\n    !modelId.includes('claude-') ||\n    /claude-(?:instant|v?2|3)(?=[-.:]|$)/.test(modelId)\n  ) {\n    return strictToolsAndNativeOutput;\n  }\n\n  // Normalize regional/provider prefixes, release dates, and Bedrock revisions.\n  // Claude 4 minor-version IDs historically accept additional suffixes; other\n  // aliases must end at a version, release date, or Bedrock revision.\n  const canonicalModelId =\n    /claude-[a-z]+-4-\\d{1,2}(?=[-.:]|$)/.exec(modelId)?.[0] ??\n    /(claude-[a-z]+-\\d+(?:-\\d{1,2})?)(?:-\\d{8})?(?:-v\\d+)?(?=[:.]|$)/.exec(\n      modelId,\n    )?.[1];\n\n  return canonicalModelId != null &&\n    Object.prototype.hasOwnProperty.call(\n      claudeStructuredOutputCapabilities,\n      canonicalModelId,\n    )\n    ? claudeStructuredOutputCapabilities[canonicalModelId]\n    : noStrictToolsOrNativeOutput;\n}\n\ntype LanguageEntry = ModelEntry<{\n  language: {\n    anthropic: boolean;\n    applicationInferenceProfile: boolean;\n    claude: boolean;\n    mistral: boolean;\n    openai: boolean;\n    openaiGptOss: boolean;\n    openaiGptOssReasoning: boolean;\n    nova2Reasoning: boolean;\n    mantleRoute: 'openai/v1' | 'v1';\n  };\n}> & {\n  capabilities: {\n    language: NonNullable<ModelCapabilities['language']> & {\n      structuredOutput: { native: boolean };\n      tools: NonNullable<ModelCapabilities['language']>['tools'] & {\n        strict: boolean;\n      };\n    };\n  };\n  requestConfig: {\n    language: {\n      anthropic: boolean;\n      applicationInferenceProfile: boolean;\n      claude: boolean;\n      mistral: boolean;\n      openai: boolean;\n      openaiGptOss: boolean;\n      openaiGptOssReasoning: boolean;\n      nova2Reasoning: boolean;\n      mantleRoute: 'openai/v1' | 'v1';\n    };\n  };\n};\n\nconst documentedLanguageModels: Record<\n  string,\n  {\n    image: boolean;\n    objectGeneration: boolean;\n    tools: boolean;\n    streaming: boolean;\n  }\n> = {\n  'amazon.titan-tg1-large': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'amazon.titan-text-express-v1': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'amazon.titan-text-lite-v1': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'us.amazon.nova-premier-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.amazon.nova-pro-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.amazon.nova-lite-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.amazon.nova-micro-v1:0': {\n    image: false,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'anthropic.claude-haiku-4-5-20251001-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'anthropic.claude-sonnet-4-20250514-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'anthropic.claude-sonnet-4-5-20250929-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'anthropic.claude-opus-4-20250514-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'anthropic.claude-opus-4-1-20250805-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'anthropic.claude-3-5-sonnet-20241022-v2:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'anthropic.claude-3-5-sonnet-20240620-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'anthropic.claude-3-opus-20240229-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'anthropic.claude-3-sonnet-20240229-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'anthropic.claude-3-haiku-20240307-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.anthropic.claude-sonnet-4-20250514-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.anthropic.claude-sonnet-4-5-20250929-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.anthropic.claude-opus-4-20250514-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.anthropic.claude-opus-4-1-20250805-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.anthropic.claude-3-5-sonnet-20241022-v2:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.anthropic.claude-3-5-sonnet-20240620-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.anthropic.claude-3-sonnet-20240229-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.anthropic.claude-3-opus-20240229-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.anthropic.claude-3-haiku-20240307-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'anthropic.claude-v2': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'anthropic.claude-v2:1': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'anthropic.claude-instant-v1': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'cohere.command-text-v14': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'cohere.command-light-text-v14': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'cohere.command-r-v1:0': {\n    image: false,\n    objectGeneration: false,\n    tools: true,\n    streaming: false,\n  },\n  'cohere.command-r-plus-v1:0': {\n    image: false,\n    objectGeneration: false,\n    tools: true,\n    streaming: false,\n  },\n  'us.deepseek.r1-v1:0': {\n    image: false,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'meta.llama3-8b-instruct-v1:0': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'meta.llama3-70b-instruct-v1:0': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'meta.llama3-1-8b-instruct-v1:0': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'meta.llama3-1-70b-instruct-v1:0': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'meta.llama3-1-405b-instruct-v1:0': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'meta.llama3-2-1b-instruct-v1:0': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'meta.llama3-2-3b-instruct-v1:0': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'meta.llama3-2-11b-instruct-v1:0': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'meta.llama3-2-90b-instruct-v1:0': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'us.meta.llama3-2-1b-instruct-v1:0': {\n    image: false,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.meta.llama3-2-3b-instruct-v1:0': {\n    image: false,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.meta.llama3-2-11b-instruct-v1:0': {\n    image: false,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.meta.llama3-2-90b-instruct-v1:0': {\n    image: false,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.meta.llama3-1-8b-instruct-v1:0': {\n    image: false,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.meta.llama3-1-70b-instruct-v1:0': {\n    image: false,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.meta.llama3-3-70b-instruct-v1:0': {\n    image: false,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.meta.llama4-scout-17b-instruct-v1:0': {\n    image: false,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'us.meta.llama4-maverick-17b-instruct-v1:0': {\n    image: false,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'mistral.mistral-7b-instruct-v0:2': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'mistral.mixtral-8x7b-instruct-v0:1': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'mistral.mistral-large-2402-v1:0': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'mistral.mistral-small-2402-v1:0': {\n    image: false,\n    objectGeneration: false,\n    tools: false,\n    streaming: false,\n  },\n  'us.mistral.pixtral-large-2502-v1:0': {\n    image: true,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'openai.gpt-oss-120b-1:0': {\n    image: false,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n  'openai.gpt-oss-20b-1:0': {\n    image: false,\n    objectGeneration: true,\n    tools: true,\n    streaming: true,\n  },\n};\n\nfunction createLanguageEntry(modelId: string): LanguageEntry {\n  const documented = documentedLanguageModels[modelId];\n  const anthropic = getModelCapabilities(modelId);\n  const claude = modelId.includes('claude-');\n  const structuredOutputCapabilities =\n    resolveClaudeStructuredOutputCapabilities(modelId);\n  const openaiModelId = /^(?:[^.]+\\.)?(openai\\..+)$/.exec(modelId)?.[1];\n  const nova2Reasoning = modelId.includes('amazon.nova-2-lite-v1:0');\n  const sampling: ModelCapability = anthropic.rejectsSamplingParameters\n    ? false\n    : true;\n  return {\n    capabilities: {\n      language: {\n        inputs: { image: documented?.image ?? 'unknown', audio: 'unknown' },\n        objectGeneration: documented?.objectGeneration ?? 'unknown',\n        tools: {\n          usage: documented?.tools ?? 'unknown',\n          streaming: documented?.streaming ?? 'unknown',\n          strict: structuredOutputCapabilities.tools.strict,\n        },\n        reasoning: {\n          support: openaiModelId != null || nova2Reasoning ? true : 'unknown',\n        },\n        sampling: { temperature: sampling, topP: sampling, logprobs: false },\n        structuredOutput: structuredOutputCapabilities.structuredOutput,\n      },\n    },\n    providerOptions: {\n      language: {\n        structuredOutputMode: {\n          condition:\n            'Applies to Anthropic models; auto preserves each model’s native-output policy.',\n        },\n        additionalModelRequestFields: true,\n        reasoningConfig: {\n          condition:\n            'Supported reasoning configuration depends on the underlying model.',\n        },\n        anthropicBeta: {\n          condition: 'Requires an Anthropic model and a supported beta.',\n        },\n        serviceTier: {\n          condition:\n            'Requires a model and region supporting the selected tier.',\n        },\n        requestMetadata: true,\n      },\n    },\n    requestConfig: {\n      language: {\n        anthropic: modelId.includes('anthropic'),\n        applicationInferenceProfile: modelId.includes(\n          ':application-inference-profile/',\n        ),\n        claude,\n        mistral: modelId.includes('mistral.'),\n        openai: openaiModelId != null,\n        openaiGptOss: openaiModelId?.startsWith('openai.gpt-oss-') ?? false,\n        openaiGptOssReasoning: modelId.includes('openai.gpt-oss-'),\n        nova2Reasoning,\n        mantleRoute: /^(?:openai\\.gpt-(?!oss-)|google\\.gemma-4|xai\\.)/.test(\n          modelId,\n        )\n          ? 'openai/v1'\n          : 'v1',\n      },\n    },\n  };\n}\n\nexport function getAmazonBedrockLanguageModelEntry(\n  modelId: string,\n): LanguageEntry {\n  const entry = Object.prototype.hasOwnProperty.call(\n    amazonBedrockModelCatalog,\n    modelId,\n  )\n    ? amazonBedrockModelCatalog[modelId]\n    : undefined;\n  return entry?.capabilities.language != null\n    ? (entry as LanguageEntry)\n    : createLanguageEntry(modelId);\n}\n\nexport function getAmazonBedrockEmbeddingModelFamily(\n  modelId: string,\n): 'nova' | 'cohere' | 'titan' {\n  return modelId.includes('amazon.nova-') && modelId.includes('embed')\n    ? 'nova'\n    : modelId.includes('cohere.embed-')\n      ? 'cohere'\n      : 'titan';\n}\n\nfunction embeddingEntry(\n  modelId: string,\n  defaultDimensions: number,\n  customDimensions: boolean,\n): ModelEntry {\n  const family = getAmazonBedrockEmbeddingModelFamily(modelId);\n  return {\n    capabilities: { embedding: { defaultDimensions, customDimensions } },\n    providerOptions: {\n      embedding: {\n        dimensions: family === 'titan' && customDimensions,\n        normalize: family === 'titan' && customDimensions,\n        embeddingDimension: family === 'nova',\n        embeddingPurpose: family === 'nova',\n        inputType: family === 'cohere',\n        truncate: family !== 'titan',\n        outputDimension: family === 'cohere' && customDimensions,\n      },\n    },\n  };\n}\n\nexport const amazonBedrockImageModelCatalog = {\n  'amazon.nova-canvas-v1:0': {\n    capabilities: {\n      image: {\n        sizes: {\n          description:\n            '320–4096 pixels per side, divisible by 16; aspect ratio 1:4 to 4:1; fewer than 4,194,304 pixels.',\n        },\n        fileInput: true,\n        maskInput: true,\n        maxImagesPerCall: 5,\n      },\n    },\n    providerOptions: {\n      image: {\n        quality: true,\n        negativeText: true,\n        cfgScale: true,\n        style: true,\n        taskType: true,\n        maskPrompt: true,\n        outPaintingMode: true,\n        similarityStrength: true,\n      },\n    },\n  },\n} satisfies Record<string, ModelEntry>;\n\nexport function getAmazonBedrockImageModelEntry(modelId: string): ModelEntry {\n  return Object.prototype.hasOwnProperty.call(\n    amazonBedrockImageModelCatalog,\n    modelId,\n  )\n    ? amazonBedrockImageModelCatalog[\n        modelId as keyof typeof amazonBedrockImageModelCatalog\n      ]\n    : {\n        capabilities: {\n          image: {\n            sizes: { description: 'Model-dependent.' },\n            fileInput: 'unknown',\n            maskInput: 'unknown',\n            maxImagesPerCall: undefined,\n          },\n        },\n      };\n}\n\nconst rerankingEntry = {\n  capabilities: {\n    reranking: { documents: { text: true, object: true }, topN: true },\n  },\n  providerOptions: {\n    reranking: { nextToken: true, additionalModelRequestFields: true },\n  },\n} satisfies ModelEntry;\n\nconst languageModelIds = [\n  'amazon.titan-tg1-large',\n  'amazon.titan-text-express-v1',\n  'anthropic.claude-v2',\n  'anthropic.claude-v2:1',\n  'anthropic.claude-instant-v1',\n  'anthropic.claude-sonnet-5',\n  'anthropic.claude-sonnet-5-5',\n  'anthropic.claude-haiku-5-5',\n  'anthropic.claude-fable-5',\n  'anthropic.claude-fable-5-1',\n  'anthropic.claude-fable-5-2',\n  'anthropic.claude-opus-5',\n  'anthropic.claude-opus-5-5',\n  'anthropic.claude-opus-4-8',\n  'anthropic.claude-opus-4-7',\n  'anthropic.claude-opus-4-6-v1',\n  'anthropic.claude-sonnet-4-6-v1',\n  'anthropic.claude-opus-4-5-20251101-v1:0',\n  'anthropic.claude-haiku-4-5-20251001-v1:0',\n  'anthropic.claude-sonnet-4-5-20250929-v1:0',\n  'anthropic.claude-sonnet-4-20250514-v1:0',\n  'anthropic.claude-opus-4-20250514-v1:0',\n  'anthropic.claude-opus-4-1-20250805-v1:0',\n  'anthropic.claude-3-7-sonnet-20250219-v1:0',\n  'anthropic.claude-3-5-sonnet-20240620-v1:0',\n  'anthropic.claude-3-5-sonnet-20241022-v2:0',\n  'anthropic.claude-3-5-haiku-20241022-v1:0',\n  'anthropic.claude-3-sonnet-20240229-v1:0',\n  'anthropic.claude-3-haiku-20240307-v1:0',\n  'anthropic.claude-3-opus-20240229-v1:0',\n  'cohere.command-text-v14',\n  'cohere.command-light-text-v14',\n  'cohere.command-r-v1:0',\n  'cohere.command-r-plus-v1:0',\n  'meta.llama3-70b-instruct-v1:0',\n  'meta.llama3-8b-instruct-v1:0',\n  'meta.llama3-1-405b-instruct-v1:0',\n  'meta.llama3-1-70b-instruct-v1:0',\n  'meta.llama3-1-8b-instruct-v1:0',\n  'meta.llama3-2-11b-instruct-v1:0',\n  'meta.llama3-2-1b-instruct-v1:0',\n  'meta.llama3-2-3b-instruct-v1:0',\n  'meta.llama3-2-90b-instruct-v1:0',\n  'mistral.mistral-7b-instruct-v0:2',\n  'mistral.mixtral-8x7b-instruct-v0:1',\n  'mistral.mistral-large-2402-v1:0',\n  'mistral.mistral-small-2402-v1:0',\n  'openai.gpt-oss-120b-1:0',\n  'openai.gpt-oss-20b-1:0',\n  'amazon.titan-text-lite-v1',\n  'us.amazon.nova-premier-v1:0',\n  'us.amazon.nova-pro-v1:0',\n  'us.amazon.nova-micro-v1:0',\n  'us.amazon.nova-lite-v1:0',\n  'us.anthropic.claude-3-sonnet-20240229-v1:0',\n  'us.anthropic.claude-3-opus-20240229-v1:0',\n  'us.anthropic.claude-3-haiku-20240307-v1:0',\n  'us.anthropic.claude-3-5-sonnet-20240620-v1:0',\n  'us.anthropic.claude-3-5-haiku-20241022-v1:0',\n  'us.anthropic.claude-3-5-sonnet-20241022-v2:0',\n  'us.anthropic.claude-3-7-sonnet-20250219-v1:0',\n  'us.anthropic.claude-sonnet-5',\n  'us.anthropic.claude-sonnet-5-5',\n  'us.anthropic.claude-haiku-5-5',\n  'us.anthropic.claude-fable-5',\n  'us.anthropic.claude-fable-5-1',\n  'us.anthropic.claude-fable-5-2',\n  'us.anthropic.claude-opus-5',\n  'us.anthropic.claude-opus-5-5',\n  'us.anthropic.claude-opus-4-8',\n  'us.anthropic.claude-opus-4-7',\n  'us.anthropic.claude-opus-4-6-v1',\n  'us.anthropic.claude-sonnet-4-6-v1',\n  'us.anthropic.claude-opus-4-5-20251101-v1:0',\n  'us.anthropic.claude-sonnet-4-5-20250929-v1:0',\n  'us.anthropic.claude-sonnet-4-20250514-v1:0',\n  'us.anthropic.claude-opus-4-20250514-v1:0',\n  'us.anthropic.claude-opus-4-1-20250805-v1:0',\n  'us.anthropic.claude-haiku-4-5-20251001-v1:0',\n  'global.anthropic.claude-fable-5-1',\n  'global.anthropic.claude-fable-5-2',\n  'us.meta.llama3-2-11b-instruct-v1:0',\n  'us.meta.llama3-2-3b-instruct-v1:0',\n  'us.meta.llama3-2-90b-instruct-v1:0',\n  'us.meta.llama3-2-1b-instruct-v1:0',\n  'us.meta.llama3-1-8b-instruct-v1:0',\n  'us.meta.llama3-1-70b-instruct-v1:0',\n  'us.meta.llama3-3-70b-instruct-v1:0',\n  'us.deepseek.r1-v1:0',\n  'us.mistral.pixtral-large-2502-v1:0',\n  'us.meta.llama4-scout-17b-instruct-v1:0',\n  'us.meta.llama4-maverick-17b-instruct-v1:0',\n  'amazon.nova-2-lite-v1:0',\n] as const;\n\nconst amazonBedrockEmbeddingModelEntries = {\n  'amazon.titan-embed-text-v1': embeddingEntry(\n    'amazon.titan-embed-text-v1',\n    1536,\n    false,\n  ),\n  'amazon.titan-embed-text-v2:0': embeddingEntry(\n    'amazon.titan-embed-text-v2:0',\n    1024,\n    true,\n  ),\n  'amazon.nova-embed-text-v2:0': embeddingEntry(\n    'amazon.nova-embed-text-v2:0',\n    1024,\n    true,\n  ),\n  'cohere.embed-english-v3': embeddingEntry(\n    'cohere.embed-english-v3',\n    1024,\n    false,\n  ),\n  'cohere.embed-multilingual-v3': embeddingEntry(\n    'cohere.embed-multilingual-v3',\n    1024,\n    false,\n  ),\n  'cohere.embed-v4:0': embeddingEntry('cohere.embed-v4:0', 1536, true),\n};\n\nconst amazonBedrockRerankingModelEntries = {\n  'amazon.rerank-v1:0': rerankingEntry,\n  'cohere.rerank-v3-5:0': rerankingEntry,\n};\n\nexport const amazonBedrockModelCatalog: Readonly<\n  Record<string, ModelEntry<LanguageEntry['requestConfig']>>\n> = {\n  ...Object.fromEntries(\n    languageModelIds.map(id => [id, createLanguageEntry(id)]),\n  ),\n  ...amazonBedrockEmbeddingModelEntries,\n  ...amazonBedrockRerankingModelEntries,\n\n  ...amazonBedrockImageModelCatalog,\n};\n\n/** Capabilities of the native Anthropic endpoint, distinct from Converse. */\nconst nativeAnthropicModels = {\n  'us.anthropic.claude-fable-5-1': { computerUse: true, reasoning: true },\n  'us.anthropic.claude-fable-5-2': { computerUse: true, reasoning: true },\n  'us.anthropic.claude-sonnet-5-5': { computerUse: true, reasoning: true },\n  'us.anthropic.claude-sonnet-5': { computerUse: true, reasoning: true },\n  'us.anthropic.claude-haiku-5-5': { computerUse: true, reasoning: true },\n  'us.anthropic.claude-fable-5': { computerUse: true, reasoning: true },\n  'us.anthropic.claude-opus-4-8': { computerUse: true, reasoning: true },\n  'us.anthropic.claude-opus-4-7': { computerUse: true, reasoning: true },\n  'us.anthropic.claude-opus-4-6-v1': { computerUse: true, reasoning: true },\n  'us.anthropic.claude-opus-4-5-20251101-v1:0': {\n    computerUse: true,\n    reasoning: true,\n  },\n  'us.anthropic.claude-sonnet-4-5-20250929-v1:0': {\n    computerUse: true,\n    reasoning: true,\n  },\n  'us.anthropic.claude-opus-4-20250514-v1:0': {\n    computerUse: true,\n    reasoning: true,\n  },\n  'us.anthropic.claude-sonnet-4-20250514-v1:0': {\n    computerUse: true,\n    reasoning: true,\n  },\n  'us.anthropic.claude-opus-4-1-20250805-v1:0': {\n    computerUse: true,\n    reasoning: true,\n  },\n  'us.anthropic.claude-haiku-4-5-20251001-v1:0': {\n    computerUse: true,\n    reasoning: true,\n  },\n  'us.anthropic.claude-3-5-sonnet-20241022-v2:0': {\n    computerUse: false,\n    reasoning: false,\n  },\n  // Known IDs without declared capabilities retain the custom-model fallback.\n  'anthropic.claude-3-5-haiku-20241022-v1:0': undefined,\n  'anthropic.claude-3-5-sonnet-20240620-v1:0': undefined,\n  'anthropic.claude-3-5-sonnet-20241022-v2:0': undefined,\n  'anthropic.claude-3-7-sonnet-20250219-v1:0': undefined,\n  'anthropic.claude-3-haiku-20240307-v1:0': undefined,\n  'anthropic.claude-3-opus-20240229-v1:0': undefined,\n  'anthropic.claude-3-sonnet-20240229-v1:0': undefined,\n  'anthropic.claude-fable-5': undefined,\n  'anthropic.claude-fable-5-1': undefined,\n  'anthropic.claude-fable-5-2': undefined,\n  'anthropic.claude-haiku-4-5-20251001-v1:0': undefined,\n  'anthropic.claude-haiku-5-5': undefined,\n  'anthropic.claude-opus-4-1-20250805-v1:0': undefined,\n  'anthropic.claude-opus-4-20250514-v1:0': undefined,\n  'anthropic.claude-opus-4-5-20251101-v1:0': undefined,\n  'anthropic.claude-opus-4-6-v1': undefined,\n  'anthropic.claude-opus-4-7': undefined,\n  'anthropic.claude-opus-4-8': undefined,\n  'anthropic.claude-opus-5': undefined,\n  'anthropic.claude-opus-5-5': undefined,\n  'anthropic.claude-sonnet-4-20250514-v1:0': undefined,\n  'anthropic.claude-sonnet-4-5-20250929-v1:0': undefined,\n  'anthropic.claude-sonnet-4-6-v1': undefined,\n  'anthropic.claude-sonnet-5': undefined,\n  'anthropic.claude-sonnet-5-5': undefined,\n  'global.anthropic.claude-fable-5-1': undefined,\n  'global.anthropic.claude-fable-5-2': undefined,\n  'us.anthropic.claude-3-5-haiku-20241022-v1:0': undefined,\n  'us.anthropic.claude-3-5-sonnet-20240620-v1:0': undefined,\n  'us.anthropic.claude-3-7-sonnet-20250219-v1:0': undefined,\n  'us.anthropic.claude-3-haiku-20240307-v1:0': undefined,\n  'us.anthropic.claude-3-opus-20240229-v1:0': undefined,\n  'us.anthropic.claude-3-sonnet-20240229-v1:0': undefined,\n  'us.anthropic.claude-opus-5': undefined,\n  'us.anthropic.claude-opus-5-5': undefined,\n  'us.anthropic.claude-sonnet-4-6-v1': undefined,\n};\nexport const amazonBedrockAnthropicModelCatalog = Object.fromEntries(\n  Object.entries(nativeAnthropicModels).flatMap(([id, support]) => {\n    if (support == null) return [];\n    const base = getAmazonBedrockLanguageModelEntry(id).capabilities.language;\n    const entry = {\n      capabilities: {\n        language: {\n          ...base,\n          inputs: { image: true, audio: false },\n          objectGeneration: true,\n          tools: {\n            ...base.tools,\n            usage: true,\n            streaming: true,\n            computerUse: support.computerUse,\n          },\n          reasoning: { support: support.reasoning },\n        },\n      },\n    } as const;\n    return [[id, entry satisfies ModelEntry]];\n  }),\n);\n\n/** Endpoint availability documented for Mantle's known GPT-OSS models. */\nconst mantleModels = {\n  'openai.gpt-oss-20b': { chatCompletions: true, responses: true },\n  'openai.gpt-oss-120b': { chatCompletions: true, responses: true },\n  'openai.gpt-oss-safeguard-20b': { chatCompletions: true, responses: false },\n  'openai.gpt-oss-safeguard-120b': { chatCompletions: true, responses: false },\n} as const;\nexport const amazonBedrockMantleModelCatalog = Object.fromEntries(\n  Object.entries(mantleModels).map(([id, endpoints]) => {\n    const entry = {\n      capabilities: {\n        language: {\n          ...getAmazonBedrockLanguageModelEntry(id).capabilities.language,\n          endpoints,\n        },\n      },\n    } as const;\n    return [id, entry satisfies ModelEntry];\n  }),\n);\n\n/** Known model IDs, derived from the declarations used to build the catalog. */\nexport type AmazonBedrockModelIds = {\n  language: (typeof languageModelIds)[number];\n  embedding: keyof typeof amazonBedrockEmbeddingModelEntries;\n  reranking: keyof typeof amazonBedrockRerankingModelEntries;\n  image: keyof typeof amazonBedrockImageModelCatalog;\n  anthropic: keyof typeof nativeAnthropicModels;\n  mantleChat: keyof typeof mantleModels;\n  mantleResponses: {\n    [Id in keyof typeof mantleModels]: (typeof mantleModels)[Id]['responses'] extends true\n      ? Id\n      : never;\n  }[keyof typeof mantleModels];\n};\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n  typeof __PACKAGE_VERSION__ !== 'undefined'\n    ? __PACKAGE_VERSION__\n    : '0.0.0-test';\n","import { LoadAPIKeyError } from '@ai-sdk/provider';\nimport {\n  combineHeaders,\n  resolve,\n  type Resolvable,\n  normalizeHeaders,\n  withUserAgentSuffix,\n  getRuntimeEnvironmentUserAgent,\n  type FetchFunction,\n} from '@ai-sdk/provider-utils';\nimport { AwsV4Signer } from 'aws4fetch';\nimport { VERSION } from './version';\n\nexport interface AmazonBedrockCredentials {\n  region: string;\n  accessKeyId: string;\n  secretAccessKey: string;\n  sessionToken?: string;\n}\n\n/**\n * Creates a fetch function that applies AWS Signature Version 4 signing.\n *\n * @param getCredentials - Function that returns the AWS credentials to use when signing.\n * @param fetch - Optional original fetch implementation to wrap. Defaults to global fetch.\n * @param service - The AWS service name to use for SigV4 signing scope. Defaults to 'bedrock'.\n * @returns A FetchFunction that signs requests before passing them to the underlying fetch.\n */\nexport function createSigV4FetchFunction(\n  getCredentials: () =>\n    | AmazonBedrockCredentials\n    | PromiseLike<AmazonBedrockCredentials>,\n  fetch?: FetchFunction,\n  service: string = 'bedrock',\n): FetchFunction {\n  return async (\n    input: RequestInfo | URL,\n    init?: RequestInit,\n  ): Promise<Response> => {\n    // avoid caching globalThis.fetch in case it is patched by other libraries\n    const effectiveFetch = fetch ?? globalThis.fetch;\n    const request = input instanceof Request ? input : undefined;\n    const originalHeaders = combineHeaders(\n      normalizeHeaders(request?.headers),\n      normalizeHeaders(init?.headers),\n    );\n    const headersWithUserAgent = withUserAgentSuffix(\n      originalHeaders,\n      `ai-sdk-amazon-bedrock/${VERSION}`,\n      getRuntimeEnvironmentUserAgent(),\n    );\n\n    let effectiveBody: BodyInit | undefined = init?.body ?? undefined;\n    if (effectiveBody === undefined && request && request.body !== null) {\n      try {\n        effectiveBody = await request.clone().text();\n      } catch {}\n    }\n\n    const effectiveMethod = init?.method ?? request?.method;\n\n    if (effectiveMethod?.toUpperCase() !== 'POST' || !effectiveBody) {\n      return effectiveFetch(input, {\n        ...init,\n        headers: headersWithUserAgent as HeadersInit,\n      });\n    }\n\n    const url =\n      typeof input === 'string'\n        ? input\n        : input instanceof URL\n          ? input.href\n          : input.url;\n\n    const body = prepareBodyString(effectiveBody);\n    const credentials = await getCredentials();\n    const signer = new AwsV4Signer({\n      url,\n      method: 'POST',\n      headers: Object.entries(headersWithUserAgent).filter(([, value]) =>\n        isAscii(value),\n      ),\n      body,\n      region: credentials.region,\n      accessKeyId: credentials.accessKeyId,\n      secretAccessKey: credentials.secretAccessKey,\n      sessionToken: credentials.sessionToken,\n      service,\n    });\n\n    const signingResult = await signer.sign();\n    const signedHeaders = normalizeHeaders(signingResult.headers);\n\n    // Use the combined headers directly as HeadersInit\n    const combinedHeaders = combineHeaders(headersWithUserAgent, signedHeaders);\n\n    return effectiveFetch(input, {\n      ...init,\n      body,\n      headers: combinedHeaders as HeadersInit,\n    });\n  };\n}\n\nfunction prepareBodyString(body: BodyInit | undefined): string {\n  if (typeof body === 'string') {\n    return body;\n  } else if (body instanceof Uint8Array) {\n    return new TextDecoder().decode(body);\n  } else if (body instanceof ArrayBuffer) {\n    return new TextDecoder().decode(new Uint8Array(body));\n  } else {\n    return JSON.stringify(body);\n  }\n}\n\nfunction isAscii(value: string): boolean {\n  return !/[\\u0080-\\uffff]/.test(value);\n}\n\n/**\n * Creates a fetch function that applies Bearer token authentication.\n *\n * @param apiKey - The API key to use for Bearer token authentication.\n * @param fetch - Optional original fetch implementation to wrap. Defaults to global fetch.\n * @returns A FetchFunction that adds Authorization header with Bearer token to requests.\n */\nexport function createApiKeyFetchFunction(\n  apiKey: Resolvable<string>,\n  fetch?: FetchFunction,\n): FetchFunction {\n  return async (\n    input: RequestInfo | URL,\n    init?: RequestInit,\n  ): Promise<Response> => {\n    // avoid caching globalThis.fetch in case it is patched by other libraries\n    const effectiveFetch = fetch ?? globalThis.fetch;\n    const originalHeaders = normalizeHeaders(init?.headers);\n    const headersWithUserAgent = withUserAgentSuffix(\n      originalHeaders,\n      `ai-sdk-amazon-bedrock/${VERSION}`,\n      getRuntimeEnvironmentUserAgent(),\n    );\n\n    const resolvedApiKey = await resolve(apiKey);\n    if (\n      typeof apiKey !== 'string' &&\n      (typeof resolvedApiKey !== 'string' || !resolvedApiKey.trim())\n    ) {\n      throw new LoadAPIKeyError({\n        message: 'Amazon Bedrock API key must be a non-empty string.',\n      });\n    }\n\n    const finalHeaders = combineHeaders(headersWithUserAgent, {\n      Authorization: `Bearer ${typeof apiKey === 'string' ? resolvedApiKey : resolvedApiKey.trim()}`,\n    });\n\n    return effectiveFetch(input, {\n      ...init,\n      headers: finalHeaders as HeadersInit,\n    });\n  };\n}\n","import { getAmazonBedrockLanguageModelEntry } from '../amazon-bedrock-model-catalog';\nimport {\n  OpenAIChatLanguageModel,\n  OpenAIResponsesLanguageModel,\n} from '@ai-sdk/openai/internal';\nimport {\n  InvalidArgumentError,\n  NoSuchModelError,\n  type LanguageModelV4,\n  type ProviderV4,\n} from '@ai-sdk/provider';\nimport {\n  isValidHostnamePart,\n  loadOptionalSetting,\n  loadSetting,\n  withoutTrailingSlash,\n  withUserAgentSuffix,\n  type FetchFunction,\n  type Resolvable,\n} from '@ai-sdk/provider-utils';\nimport {\n  createApiKeyFetchFunction,\n  createSigV4FetchFunction,\n  type AmazonBedrockCredentials,\n} from '../amazon-bedrock-sigv4-fetch';\nimport type {\n  BedrockMantleChatModelId,\n  BedrockMantleResponsesModelId,\n} from './bedrock-mantle-options';\nimport { VERSION } from '../version';\n\nexport interface BedrockMantleProvider extends ProviderV4 {\n  /**\n   * Creates a model for text generation using the Chat Completions API.\n   * Chat Completions has the broadest model support on Mantle.\n   */\n  (modelId: BedrockMantleChatModelId): LanguageModelV4;\n\n  /**\n   * Creates a model for text generation using the Chat Completions API.\n   */\n  languageModel(modelId: BedrockMantleChatModelId): LanguageModelV4;\n\n  /**\n   * Creates a model for text generation using the Chat Completions API.\n   */\n  chat(modelId: BedrockMantleChatModelId): LanguageModelV4;\n\n  /**\n   * Creates a model for text generation using the Responses API.\n   * Not all Mantle models support this API. Notably, gpt-oss-safeguard models\n   * are Chat-only.\n   */\n  responses(modelId: BedrockMantleResponsesModelId): LanguageModelV4;\n\n  /**\n   * @deprecated Mantle does not support embedding models.\n   */\n  textEmbeddingModel(modelId: string): never;\n}\n\nexport interface BedrockMantleProviderSettings {\n  /**\n   * The AWS region to use for the Bedrock Mantle endpoint. Defaults to the value of the\n   * `AWS_REGION` environment variable.\n   */\n  region?: string;\n\n  /**\n   * API key for authenticating requests using Bearer token authentication.\n   * A callback is resolved before each request and must return a non-empty key.\n   * When provided, this will be used instead of AWS SigV4 authentication.\n   * Defaults to the value of the `AWS_BEARER_TOKEN_BEDROCK` environment variable.\n   */\n  apiKey?: Resolvable<string>;\n\n  /**\n   * The AWS access key ID to use for SigV4 authentication. Defaults to the value of the\n   * `AWS_ACCESS_KEY_ID` environment variable.\n   */\n  accessKeyId?: string;\n\n  /**\n   * The AWS secret access key to use for SigV4 authentication. Defaults to the value of the\n   * `AWS_SECRET_ACCESS_KEY` environment variable.\n   */\n  secretAccessKey?: string;\n\n  /**\n   * The AWS session token to use for SigV4 authentication. Defaults to the value of the\n   * `AWS_SESSION_TOKEN` environment variable.\n   */\n  sessionToken?: string;\n\n  /**\n   * Base URL for the Bedrock Mantle API calls.\n   */\n  baseURL?: string;\n\n  /**\n   * Custom headers to include in the requests.\n   */\n  headers?: Record<string, string | undefined>;\n\n  /**\n   * Custom fetch implementation. You can use it as a middleware to intercept requests,\n   * or to provide a custom fetch implementation for e.g. testing.\n   */\n  fetch?: FetchFunction;\n\n  /**\n   * The AWS credential provider to use for SigV4 authentication to get dynamic\n   * credentials similar to the AWS SDK. Setting a provider here will cause its\n   * credential values to be used instead of the `accessKeyId`, `secretAccessKey`,\n   * and `sessionToken` settings.\n   */\n  credentialProvider?: () => PromiseLike<\n    Omit<AmazonBedrockCredentials, 'region'>\n  >;\n}\n\n/**\n * Create an Amazon Bedrock Mantle provider instance.\n * This provider uses the OpenAI-compatible Mantle API for models that are\n * only available through the Mantle endpoint (e.g. openai.gpt-oss-20b).\n */\nexport function createBedrockMantle(\n  options: BedrockMantleProviderSettings = {},\n): BedrockMantleProvider {\n  // Check for API key authentication first\n  const rawApiKey =\n    typeof options.apiKey === 'string' || options.apiKey == null\n      ? loadOptionalSetting({\n          settingValue: options.apiKey,\n          environmentVariableName: 'AWS_BEARER_TOKEN_BEDROCK',\n        })\n      : options.apiKey;\n\n  // Only use API key if it's a non-empty, non-whitespace string\n  const apiKey =\n    typeof rawApiKey === 'string' ? rawApiKey.trim() || undefined : rawApiKey;\n\n  // Use API key authentication if available, otherwise fall back to SigV4\n  const fetchFunction = apiKey\n    ? createApiKeyFetchFunction(apiKey, options.fetch)\n    : createSigV4FetchFunction(\n        async () => {\n          const region = loadSetting({\n            settingValue: options.region,\n            settingName: 'region',\n            environmentVariableName: 'AWS_REGION',\n            description: 'AWS region',\n          });\n\n          // If a credential provider is provided, use it to get the credentials.\n          if (options.credentialProvider) {\n            try {\n              return {\n                ...(await options.credentialProvider()),\n                region,\n              };\n            } catch (error) {\n              const errorMessage =\n                error instanceof Error ? error.message : String(error);\n              throw new Error(\n                `AWS credential provider failed: ${errorMessage}. ` +\n                  'Please ensure your credential provider returns valid AWS credentials ' +\n                  'with accessKeyId and secretAccessKey properties.',\n              );\n            }\n          }\n\n          try {\n            return {\n              region,\n              accessKeyId: loadSetting({\n                settingValue: options.accessKeyId,\n                settingName: 'accessKeyId',\n                environmentVariableName: 'AWS_ACCESS_KEY_ID',\n                description: 'AWS access key ID',\n              }),\n              secretAccessKey: loadSetting({\n                settingValue: options.secretAccessKey,\n                settingName: 'secretAccessKey',\n                environmentVariableName: 'AWS_SECRET_ACCESS_KEY',\n                description: 'AWS secret access key',\n              }),\n              sessionToken: loadOptionalSetting({\n                settingValue: options.sessionToken,\n                environmentVariableName: 'AWS_SESSION_TOKEN',\n              }),\n            };\n          } catch (error) {\n            const errorMessage =\n              error instanceof Error ? error.message : String(error);\n            if (\n              errorMessage.includes('AWS_ACCESS_KEY_ID') ||\n              errorMessage.includes('accessKeyId')\n            ) {\n              throw new Error(\n                'AWS SigV4 authentication requires AWS credentials. Please provide either:\\n' +\n                  '1. Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables\\n' +\n                  '2. Provide accessKeyId and secretAccessKey in options\\n' +\n                  '3. Use a credentialProvider function\\n' +\n                  '4. Use API key authentication with AWS_BEARER_TOKEN_BEDROCK or apiKey option\\n' +\n                  `Original error: ${errorMessage}`,\n              );\n            }\n            if (\n              errorMessage.includes('AWS_SECRET_ACCESS_KEY') ||\n              errorMessage.includes('secretAccessKey')\n            ) {\n              throw new Error(\n                'AWS SigV4 authentication requires both AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. ' +\n                  'Please ensure both credentials are provided.\\n' +\n                  `Original error: ${errorMessage}`,\n              );\n            }\n            throw error;\n          }\n        },\n        options.fetch,\n        'bedrock-mantle',\n      );\n\n  const getBaseURL = (modelId: string): string => {\n    const baseURL = withoutTrailingSlash(options.baseURL);\n    if (baseURL != null) {\n      return baseURL;\n    }\n\n    const region = loadSetting({\n      settingValue: options.region,\n      settingName: 'region',\n      environmentVariableName: 'AWS_REGION',\n      description: 'AWS region',\n    });\n    if (!isValidHostnamePart(region)) {\n      throw new InvalidArgumentError({\n        argument: 'region',\n        message:\n          'Invalid AWS region. Expected a single DNS label (letters, digits, and hyphens). Use `baseURL` for custom endpoints.',\n      });\n    }\n\n    return `https://bedrock-mantle.${region}.api.aws/${getAmazonBedrockLanguageModelEntry(modelId).requestConfig.language.mantleRoute}`;\n  };\n\n  const getHeaders = (): Record<string, string | undefined> =>\n    withUserAgentSuffix(\n      options.headers ?? {},\n      `ai-sdk-amazon-bedrock/${VERSION}`,\n    );\n\n  const url = ({ path, modelId }: { path: string; modelId: string }): string =>\n    `${getBaseURL(modelId)}${path}`;\n\n  const createChatModel = (modelId: BedrockMantleChatModelId) =>\n    new OpenAIChatLanguageModel(modelId, {\n      provider: 'bedrock-mantle.chat',\n      url,\n      headers: getHeaders,\n      fetch: fetchFunction,\n    });\n\n  const createResponsesModel = (modelId: BedrockMantleResponsesModelId) =>\n    new OpenAIResponsesLanguageModel(modelId, {\n      provider: 'bedrock-mantle.responses',\n      url,\n      headers: getHeaders,\n      fetch: fetchFunction,\n      supportsWebSearchSourcesInclude: false,\n    });\n\n  const provider = function (modelId: BedrockMantleChatModelId) {\n    if (new.target) {\n      throw new Error(\n        'The Bedrock Mantle model function cannot be called with the new keyword.',\n      );\n    }\n\n    return createChatModel(modelId);\n  };\n\n  provider.specificationVersion = 'v4' as const;\n  provider.languageModel = createChatModel;\n  provider.chat = createChatModel;\n  provider.responses = createResponsesModel;\n\n  provider.embeddingModel = (modelId: string) => {\n    throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n  };\n  provider.textEmbeddingModel = provider.embeddingModel;\n  provider.imageModel = (modelId: string) => {\n    throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n  };\n\n  return provider as BedrockMantleProvider;\n}\n\n/**\n * Default Bedrock Mantle provider instance.\n */\nexport const bedrockMantle = createBedrockMantle();\n"],"mappings":";;;;;;;AA8EA,MAAM,6BAA6B;CACjC,OAAO,EAAE,QAAQ,KAAK;CACtB,kBAAkB,EAAE,QAAQ,KAAK;AACnC;AAEA,MAAM,kBAAkB;CACtB,OAAO,EAAE,QAAQ,KAAK;CACtB,kBAAkB,EAAE,QAAQ,MAAM;AACpC;AAEA,MAAM,8BAA8B;CAClC,OAAO,EAAE,QAAQ,MAAM;CACvB,kBAAkB,EAAE,QAAQ,MAAM;AACpC;AAIA,MAAM,qCAEF;CACF,iBAAiB;CACjB,m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OAAO;EACP,WAAW;CACb;CACA,2BAA2B;EACzB,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,iCAAiC;EAC/B,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,yBAAyB;EACvB,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,8BAA8B;EAC5B,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,uBAAuB;EACrB,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,gCAAgC;EAC9B,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,iCAAiC;EAC/B,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,kCAAkC;EAChC,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,mCAAmC;EACjC,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,oCAAoC;EAClC,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,kCAAkC;EAChC,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,kCAAkC;EAChC,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,mCAAmC;EACjC,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,mCAAmC;EACjC,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,qCAAqC;EACnC,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,qCAAqC;EACnC,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,sCAAsC;EACpC,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,sCAAsC;EACpC,OAAO;EACP,kBAAkB;EAClB,OAAO;EACP,WAAW;CACb;CACA,qCAAqC;E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W;GAC7B,WAAW,WAAW;GACtB,UAAU,WAAW;GACrB,iBAAiB,WAAW,YAAY;EAC1C,EACF;CACF;AACF;AAEA,MAAa,iCAAiC,EAC5C,2BAA2B;CACzB,cAAc,EACZ,OAAO;EACL,OAAO,EACL,aACE,mGACJ;EACA,WAAW;EACX,WAAW;EACX,kBAAkB;CACpB,EACF;CACA,iBAAiB,EACf,OAAO;EACL,SAAS;EACT,cAAc;EACd,UAAU;EACV,OAAO;EACP,UAAU;EACV,YAAY;EACZ,iBAAiB;EACjB,oBAAoB;CACtB,EACF;AACF,EACF;AAsBA,MAAM,iBAAiB;CACrB,cAAc,EACZ,WAAW;EAAE,WAAW;GAAE,MAAM;GAAM,QAAQ;EAAK;EAAG,MAAM;CAAK,EACnE;CACA,iBAAiB,EACf,WAAW;EAAE,WAAW;EAAM,8BAA8B;CAAK,EACnE;AACF;AAEA,MAAM,mBAAmB;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,qCAAqC;CACzC,8BAA8B,eAC5B,8BACA,MACA,KACF;CACA,gCAAgC,eAC9B,gCACA,MACA,IACF;CACA,+BAA+B,eAC7B,+BACA,MACA,IACF;CACA,2BAA2B,eACzB,2BACA,MACA,KACF;CACA,gCAAgC,eAC9B,gCACA,MACA,KACF;CACA,qBAAqB,eAA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