diff --git a/src/platform/endpoint/node/chatEndpoint.ts b/src/platform/endpoint/node/chatEndpoint.ts index 9ca61213ac..968fcfa909 100644 --- a/src/platform/endpoint/node/chatEndpoint.ts +++ b/src/platform/endpoint/node/chatEndpoint.ts @@ -168,6 +168,17 @@ export class ChatEndpoint implements IChatEndpoint { } public getExtraHeaders(): Record { + const isAnthropicModel = this.family.startsWith('claude') || this.family.startsWith('Anthropic'); + const usesChatCompletionsEndpoint = !this.useMessagesApi && !this.useResponsesApi; + if (isAnthropicModel && usesChatCompletionsEndpoint) { + const thinkingBudget = this._configurationService.getExperimentBasedConfig(ConfigKey.AnthropicThinkingBudget, this._expService); + if (thinkingBudget) { + return { + ...(this.modelMetadata.requestHeaders ?? {}), + 'thinking_budget': String(thinkingBudget), + }; + } + } return this.modelMetadata.requestHeaders ?? {}; }