Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit a682355

Browse files
author
Andy Lemin
committed
fix(bedrock): disable temperature for Claude Opus 4.7
Claude Opus 4.7 does not support the temperature parameter (deprecated). Previously, temperature was always sent in inferenceConfig which caused a 400 error: 'temperature is deprecated for this model'. Changes: - Add supportsTemperature: false to anthropic.claude-opus-4-7 model def - Skip sending temperature in inferenceConfig when supportsTemperature is false (both createMessage and completePrompt paths) - The UI already conditionally hides the Custom Temperature setting based on supportsTemperature !== false
1 parent 36ac4d3 commit a682355

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

packages/types/src/providers/bedrock.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ export const bedrockModels = {
173173
supportsImages: true,
174174
supportsPromptCache: true,
175175
supportsReasoningBudget: true,
176+
supportsTemperature: false, // Temperature is deprecated for this model
176177
inputPrice: 5.0, // $5 per million input tokens (≤200K context)
177178
outputPrice: 25.0, // $25 per million output tokens (≤200K context)
178179
cacheWritesPrice: 6.25, // $6.25 per million tokens

src/api/providers/bedrock.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,10 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
435435

436436
const inferenceConfig: BedrockInferenceConfig = {
437437
maxTokens: modelConfig.maxTokens || (modelConfig.info.maxTokens as number),
438-
temperature: modelConfig.temperature ?? (this.options.modelTemperature as number),
438+
// Only include temperature if the model supports it (Opus 4.7 deprecated temperature)
439+
...(modelConfig.info.supportsTemperature !== false && {
440+
temperature: modelConfig.temperature ?? (this.options.modelTemperature as number),
441+
}),
439442
}
440443

441444
// Check if 1M context is enabled for supported Claude 4 models
@@ -775,7 +778,10 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
775778

776779
const inferenceConfig: BedrockInferenceConfig = {
777780
maxTokens: modelConfig.maxTokens || (modelConfig.info.maxTokens as number),
778-
temperature: modelConfig.temperature ?? (this.options.modelTemperature as number),
781+
// Only include temperature if the model supports it (Opus 4.7 deprecated temperature)
782+
...(modelConfig.info.supportsTemperature !== false && {
783+
temperature: modelConfig.temperature ?? (this.options.modelTemperature as number),
784+
}),
779785
}
780786

781787
// For completePrompt, use a unique conversation ID based on the prompt

0 commit comments

Comments
 (0)