Claude model deprecations (#4306) * Claude: deprecate Claude 2 models * Claude: flatten tool call schema * Remove deprecated Sonnet 3 from captioning list

fdc51a1211f0574f5088ad51af3292ef6d8a1692

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
3 files changed, +5 -10Ignore whitespace
public/index.html+0 -3
@@ -3021,10 +3021,7 @@
30213021 <option value="claude-3-5-haiku-latest">claude-3-5-haiku-latest</option>
30223022 <option value="claude-3-5-haiku-20241022">claude-3-5-haiku-20241022</option>
30233023 <option value="claude-3-opus-20240229">claude-3-opus-20240229</option>
3024- <option value="claude-3-sonnet-20240229">claude-3-sonnet-20240229</option>
30253024 <option value="claude-3-haiku-20240307">claude-3-haiku-20240307</option>
3026- <option value="claude-2.1">claude-2.1</option>
3027- <option value="claude-2.0">claude-2.0</option>
30283025 </optgroup>
30293026 </select>
30303027 </div>
public/scripts/extensions/caption/settings.html+0 -1
@@ -85,7 +85,6 @@
8585 <option data-type="anthropic" value="claude-3-5-haiku-latest">claude-3-5-haiku-latest</option>
8686 <option data-type="anthropic" value="claude-3-5-haiku-20241022">claude-3-5-haiku-20241022</option>
8787 <option data-type="anthropic" value="claude-3-opus-20240229">claude-3-opus-20240229</option>
88- <option data-type="anthropic" value="claude-3-sonnet-20240229">claude-3-sonnet-20240229</option>
8988 <option data-type="anthropic" value="claude-3-haiku-20240307">claude-3-haiku-20240307</option>
9089 <option data-type="google" value="gemini-2.5-pro">gemini-2.5-pro</option>
9190 <option data-type="google" value="gemini-2.5-pro-preview-06-05">gemini-2.5-pro-preview-06-05</option>
src/endpoints/backends/chat-completions.js+5 -6
@@ -107,11 +107,10 @@ async function sendClaudeRequest(request, response) {
107107 const apiUrl = new URL(request.body.reverse_proxy || API_CLAUDE).toString();
108108 const apiKey = request.body.reverse_proxy ? request.body.proxy_password : readSecret(request.user.directories, SECRET_KEYS.CLAUDE);
109109 const divider = '-'.repeat(process.stdout.columns);
110- const isClaude3or4 = /^claude-(3|opus-4|sonnet-4)/.test(request.body.model);
110+ const enableSystemPromptCache = getConfigValue('claude.enableSystemPromptCache', false, 'boolean');
111- const enableSystemPromptCache = getConfigValue('claude.enableSystemPromptCache', false, 'boolean') && isClaude3or4;
112111 let cachingAtDepth = getConfigValue('claude.cachingAtDepth', -1, 'number');
113112 // Disabled if not an integer or negative, or if the model doesn't support it
114113 if (!Number.isInteger(cachingAtDepth) || cachingAtDepth < 0 || !isClaude3or4) {
115114 cachingAtDepth = -1;
116115 }
117116
@@ -128,7 +127,7 @@ async function sendClaudeRequest(request, response) {
128127 });
129128 const additionalHeaders = {};
130129 const betaHeaders = ['output-128k-2025-02-19'];
131130 const useTools = isClaude3or4 && Array.isArray(request.body.tools) && request.body.tools.length > 0;
132131 const useSystemPrompt = Boolean(request.body.claude_use_sysprompt);
133132 const convertedPrompt = convertClaudeMessages(request.body.messages, request.body.assistant_prefill, useSystemPrompt, useTools, getPromptNames(request));
134133 const useThinking = /^claude-(3-7|opus-4|sonnet-4)/.test(request.body.model);
@@ -167,7 +166,7 @@ async function sendClaudeRequest(request, response) {
167166 requestBody.tools = request.body.tools
168167 .filter(tool => tool.type === 'function')
169168 .map(tool => tool.function)
170169 .map(fn => ({ name: fn.name, description: fn.description, input_schema: flattenSchema(fn.parameters, request.body.chat_completion_source) }));
171170
172171 if (enableSystemPromptCache && requestBody.tools.length) {
173172 requestBody.tools[requestBody.tools.length - 1]['cache_control'] = { type: 'ephemeral', ttl: cacheTTL };