feat: use inference profiles for on-demand Claude models []#10711
Merged
Mitch Goudy (mgoudy91) merged 4 commits intomasterfrom Mar 18, 2026
Merged
feat: use inference profiles for on-demand Claude models []#10711Mitch Goudy (mgoudy91) merged 4 commits intomasterfrom
Mitch Goudy (mgoudy91) merged 4 commits intomasterfrom
Conversation
… Claude models - Add getInvokeId(region) and pass region into invokeCommand so InvokeModel uses inference profile IDs for Sonnet 4.x, 3.5 Haiku, 3 Haiku, v3 Sonnet - Keep backward compatibility: stored model id unchanged; v2.1, Instant, Llama, Mistral still use foundation model ID - Treat models with getInvokeId as in-region when not in ListFoundationModels and rely on invoke check for availability Made-with: Cursor
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Bedrock content generator to invoke certain on-demand Anthropic Claude models via inference profile IDs (instead of raw foundation model IDs) to avoid Bedrock ValidationException errors and improve model availability detection.
Changes:
- Add inference profile routing (
getInvokeId, region→prefix mapping) for Claude models that require it. - Pass region into invoke command construction so the correct invoke-time
modelIdis used for streaming and availability checks. - Adjust the config UI’s region-availability logic and update related unit test expectations.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| apps/bedrock-content-generator/src/utils/aiApi/index.ts | Pass region into invoke inputs; invoke using computed modelId for streaming and availability checks. |
| apps/bedrock-content-generator/src/configs/aws/featuredModels.ts | Introduce getInvokeId + inference profile selection helpers; update featured Claude models to use inference profiles. |
| apps/bedrock-content-generator/src/components/config/model/Model.tsx | Loosen NOT_IN_REGION determination for models that use inference profiles so they still get an invoke-based availability check. |
| apps/bedrock-content-generator/src/components/config/model/Model.spec.tsx | Update assertion for the NOT_IN_REGION warning text now that fewer models are classified as region-missing from the foundation list. |
Comments suppressed due to low confidence (2)
apps/bedrock-content-generator/src/utils/aiApi/index.ts:92
- Now that more models rely on the invoke-time ID (inference profile),
getModelAvailabilityshould classify the common “not available in this region / invalid modelId for region” failures asNOT_IN_REGIONinstead of returning a rawError(which becomesOTHER_ERROR). Consider handlingValidationException/ResourceNotFoundException(and/or matching their messages) to returnNOT_IN_REGIONso the config UI shows the correct availability state.
const invokeInput = model.invokeCommand('', '', 1, this.region);
await this.bedrockRuntimeClient.send(new InvokeModelCommand(invokeInput));
} catch (e: unknown) {
if (!(e instanceof Error)) {
return Error('An unexpected error has occurred');
}
if (e instanceof AccessDeniedException) {
if (e.message.includes('is not authorized to perform: bedrock:InvokeModel'))
return 'FORBIDDEN';
if (e.message.includes("You don't have access to the model with the specified model ID."))
return 'NOT_IN_ACCOUNT';
}
apps/bedrock-content-generator/src/components/config/model/Model.tsx:86
isInRegionis now computed asisInFoundationList || !!featuredModel.getInvokeId, which means models withgetInvokeIdare treated as “in region” even when they’re absent fromListFoundationModels. This makes the variable name/meaning misleading and can mask genuineNOT_IN_REGIONcases unless the invoke error is mapped accordingly. Consider renaming this flag to something likeshouldCheckAvailability(or similar) to reflect its purpose and avoid confusion.
const isInFoundationList = allModels.some((m) => m.modelId === featuredModel.id);
// Models that use inference profiles may not appear in ListFoundationModels; still run availability check (invoke with profile ID).
const isInRegion = isInFoundationList || !!featuredModel.getInvokeId;
return {
...featuredModel,
invokeCommand: featuredModel.invokeCommand,
availability: isInRegion ? 'AVAILABLE' : 'NOT_IN_REGION',
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
apps/bedrock-content-generator/src/components/config/model/Model.spec.tsx
Show resolved
Hide resolved
apps/bedrock-content-generator/src/configs/aws/featuredModels.ts
Outdated
Show resolved
Hide resolved
apps/bedrock-content-generator/src/configs/aws/featuredModels.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…edModels.ts Made-with: Cursor
ryunsong-contentful
approved these changes
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Followup to #10706
Fixes Bedrock
ValidationException: "Invocation of model ID ... with on-demand throughput isn't supported. Retry your request with the ID or ARN of an inference profile that contains this model."See:
Changes
us.anthropic.claude-sonnet-4-5-20250929-v1:0,global.anthropic.claude-sonnet-4-6) when callingInvokeModel/InvokeModelWithResponseStream.id; only the value sent at invoke time changes. v2.1, Instant, Llama, Mistral continue to use foundation model ID.getInvokeIdare no longer marked NOT_IN_REGION solely for missing fromListFoundationModels; availability is determined by the invoke check with the profile ID.Testing
npm run buildand affected unit tests (featuredModels, Model, aiApi) pass.