Repository navigation
Description
Description
Summary
When using self-deployed Claude models or models accessed via AWS Bedrock Inference Profiles, the reasoning (extended thinking) configuration fails to apply correctly. The core issue is that the provider transformation logic fails to identify the model as an Anthropic-based model when the model ID is an ARN, causing it to apply incorrect parameters meant for Amazon Nova models.
Example Configuration
"models": {
"claude-sonnet-4.5": {
"id": "arn:aws:bedrock:us-west-2:xxxxxxxxxxxx:application-inference-profile/xxxxxxxxxxxx",
"name": "Claude Sonnet 4.5",
"attachment": true,
"reasoning": true,
"temperature": true,
"tool_call": true,
"release_date": "2025-09-29",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
}
}
}Error Logs
Running the model with reasoning enabled results in a 400 Bad Request from the Bedrock API:
opencode run "hello" --model bedrock/claude-sonnet-4.5 --variant low --format json{
"type": "error",
"timestamp": 1769399812748,
"error": {
"name": "APIError",
"data": {
"message": "undefined: The model returned the following errors: reasoningConfig: Extra inputs are not permitted",
"statusCode": 400,
"responseBody": "{\"message\":\"The model returned the following errors: reasoningConfig: Extra inputs are not permitted\"}",
"metadata": {
"url": "https://bedrock-runtime.us-west-2.amazonaws.com/model/arn%3Aaws%3Abedrock%3Aus-west-2%3Axxxxxxxxxxxx%3Aapplication-inference-profile%2Fxxxxxxxxxxxx/converse-stream"
}
}
}
}Root Cause
- ID Detection Failure: In
packages/opencode/src/provider/transform.ts, the logic only checks ifmodel.api.idcontains the string"anthropic". - Incorrect Parameter Mapping: For Bedrock Inference Profile ARNs, this check fails. The system then defaults to applying
maxReasoningEffort(the parameter used for Amazon Nova models). - API Validation Error: Claude models on Bedrock require
budgetTokensand do not supportmaxReasoningEffort. Providing the Nova parameter results in theExtra inputs are not permittederror from the Bedrock API.
Relevant Code
File: packages/opencode/src/provider/transform.ts
Lines: 440–471
case "@ai-sdk/amazon-bedrock":
// Logic only checks for "anthropic" in model.api.id
if (model.api.id.includes("anthropic")) {
return {
// ... correct budgetTokens config ...
}
}
// Fallback for Nova models: this is what gets applied incorrectly to Claude ARNs
return Object.fromEntries(
WIDELY_SUPPORTED_EFFORTS.map((effort) => [
effort,
{ reasoningConfig: { type: "enabled", maxReasoningEffort: effort } },
]),
)Suggested Fix
The detection logic should be improved to recognize Claude models even when they are addressed via ARNs by checking for both "claude" and "anthropic" in the ID.
Proposed Change:
if (
model.api.id.includes("anthropic") ||
model.api.id.includes("claude") ||
model.id.toLowerCase().includes("anthropic") ||
model.id.toLowerCase().includes("claude")
) {
// Use budgetTokens configuration
}Plugins
No response
OpenCode version
v1.1.36
Steps to reproduce
- Configure a Claude model in the
opencodeenvironment using an AWS Bedrock Inference Profile ARN as theid. - Ensure
reasoning: trueis set in the model configuration. - Execute a command that triggers reasoning, for example:
opencode run "Your prompt here" --model bedrock/claude-sonnet-4.5 --variant low - Observe that the request fails with a
ValidationException (400)because the system incorrectly sendsmaxReasoningEffortinstead ofbudgetTokens.
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Activity
github-actions commentedon Jan 26, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if this doesn't address your specific case.
xxtitan commentedon Jan 26, 2026
Update:
I’ve discovered that when using
application-inference-profileinstances, the@ai-sdk/amazon-bedrockprovider may also ignore the high-levelreasoningConfigparameters.I was able to resolve this by using
additionalModelRequestFieldsto manually inject the native Bedrock parameters (using snake_case) into the request:This ensures the
reasoning_configis correctly passed to the Bedrock Converse API even if the SDK's automatic mapping fails for ARN-based model IDs.