Skip to content

Commit 7060e3b

Browse files
author
Mr. House
committed
Strip temperature only for Opus 4.7 (MODELS_NO_TEMPERATURE), not all models
1 parent f1ff207 commit 7060e3b

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

anthropic-proxy.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,22 @@ function modelsResponse() {
5656
// Parameters SillyTavern sends that Anthropic doesn't support — strip them
5757
const STRIP_PARAMS = ['presence_penalty', 'frequency_penalty', 'logit_bias', 'seed', 'response_format', 'function_call', 'functions'];
5858

59+
// Models that reject temperature parameter via the Anthropic API
60+
// (Opus 4.7 introduced this restriction; other models accept it)
61+
const MODELS_NO_TEMPERATURE = ['claude-opus-4-7'];
62+
5963
// Convert OpenAI chat/completions format to Anthropic messages format
6064
function openAIToAnthropic(body, isOAuth) {
6165
const payload = JSON.parse(body);
6266

63-
// Strip unsupported OpenAI parameters before conversion
67+
// Strip SillyTavern-specific unsupported parameters
6468
for (const p of STRIP_PARAMS) delete payload[p];
6569

70+
// Strip temperature only for models that reject it
71+
if (payload.model && MODELS_NO_TEMPERATURE.includes(payload.model)) {
72+
delete payload.temperature;
73+
}
74+
6675
const result = {
6776
model: payload.model,
6877
max_tokens: payload.max_tokens || 4096,

0 commit comments

Comments
 (0)