Skip to content

Commit 5b2bd65

Browse files
authored
add thinking budget header in getExtraHeaders (#2229)
1 parent 2dbb298 commit 5b2bd65

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/platform/endpoint/node/chatEndpoint.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,17 @@ export class ChatEndpoint implements IChatEndpoint {
168168
}
169169

170170
public getExtraHeaders(): Record<string, string> {
171+
const isAnthropicModel = this.family.startsWith('claude') || this.family.startsWith('Anthropic');
172+
const usesChatCompletionsEndpoint = !this.useMessagesApi && !this.useResponsesApi;
173+
if (isAnthropicModel && usesChatCompletionsEndpoint) {
174+
const thinkingBudget = this._configurationService.getExperimentBasedConfig(ConfigKey.AnthropicThinkingBudget, this._expService);
175+
if (thinkingBudget) {
176+
return {
177+
...(this.modelMetadata.requestHeaders ?? {}),
178+
'thinking_budget': String(thinkingBudget),
179+
};
180+
}
181+
}
171182
return this.modelMetadata.requestHeaders ?? {};
172183
}
173184

0 commit comments

Comments
 (0)