Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🔧 fix: Anthropic Agent Model Assignment

Danny Avila951bb9d0d0ac
diff --git a/api/server/services/Endpoints/anthropic/initialize.js b/api/server/services/Endpoints/anthropic/initialize.js
index 2ca68d14cf..3f1336ff31 100644
--- a/api/server/services/Endpoints/anthropic/initialize.js
+++ b/api/server/services/Endpoints/anthropic/initialize.js
@@ -3,7 +3,7 @@ const { getUserKey, checkUserKeyExpiry } = require('~/server/services/UserServic
const { getLLMConfig } = require('~/server/services/Endpoints/anthropic/llm');
const { AnthropicClient } = require('~/app');
-const initializeClient = async ({ req, res, endpointOption, optionsOnly }) => {
+const initializeClient = async ({ req, res, endpointOption, overrideModel, optionsOnly }) => {
const { ANTHROPIC_API_KEY, ANTHROPIC_REVERSE_PROXY, PROXY } = process.env;
const expiresAt = req.body.key;
const isUserProvided = ANTHROPIC_API_KEY === 'user_provided';
@@ -40,10 +40,13 @@ const initializeClient = async ({ req, res, endpointOption, optionsOnly }) => {
{
reverseProxyUrl: ANTHROPIC_REVERSE_PROXY ?? null,
proxy: PROXY ?? null,
- modelOptions: endpointOption.modelOptions,
+ modelOptions: endpointOption.model_parameters,
},
clientOptions,
);
+ if (overrideModel) {
+ requestOptions.modelOptions.model = overrideModel;
+ }
return getLLMConfig(anthropicApiKey, requestOptions);
}