MCPcopy Index your code
hub / github.com/codeaashu/claude-code / applyBedrockRegionPrefix

Function applyBedrockRegionPrefix

src/utils/model/bedrock.ts:248–265  ·  view source on GitHub ↗
(
  modelId: string,
  prefix: BedrockRegionPrefix,
)

Source from the content-addressed store, hash-verified

246 * - applyBedrockRegionPrefix("claude-sonnet-4-5-20250929", "eu") → "claude-sonnet-4-5-20250929" (not a Bedrock model)
247 */
248export function applyBedrockRegionPrefix(
249 modelId: string,
250 prefix: BedrockRegionPrefix,
251): string {
252 // Check if it already has a region prefix and replace it
253 const existingPrefix = getBedrockRegionPrefix(modelId)
254 if (existingPrefix) {
255 return modelId.replace(`${existingPrefix}.`, `${prefix}.`)
256 }
257
258 // Check if it's a foundation model (anthropic.*) and add the prefix
259 if (isFoundationModel(modelId)) {
260 return `${prefix}.${modelId}`
261 }
262
263 // Not a Bedrock model format, return as-is
264 return modelId
265}
266

Callers 1

applyParentRegionPrefixFunction · 0.85

Calls 2

getBedrockRegionPrefixFunction · 0.85
isFoundationModelFunction · 0.85

Tested by

no test coverage detected