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

feat: allow default gpt api model before frontend customization

Danny Avila4a94ee7af8f3
diff --git a/api/.env.example b/api/.env.example
index 7a1c9b15f9..30f097f759 100644
--- a/api/.env.example
+++ b/api/.env.example
@@ -18,6 +18,12 @@ MONGO_URI="mongodb://127.0.0.1:27017/chatgpt-clone"
# API key configuration.
# Leave blank if you don't want them.
OPENAI_KEY=
+
+# Default ChatGPT API Model, options: 'gpt-4', 'text-davinci-003', 'gpt-3.5-turbo', 'gpt-3.5-turbo-0301'
+# you will have errors if you don't have access to a model like 'gpt-4', defaults to turbo if left empty/excluded.
+DEFAULT_API_GPT=gpt-3.5-turbo
+
+# _U Cookies Value from bing.com
BING_TOKEN=
# ChatGPT Browser Client (free but use at your own risk)
diff --git a/api/app/clients/chatgpt-client.js b/api/app/clients/chatgpt-client.js
index 04368e85bd..7b20a18f82 100644
--- a/api/app/clients/chatgpt-client.js
+++ b/api/app/clients/chatgpt-client.js
@@ -1,5 +1,6 @@
require('dotenv').config();
const { KeyvFile } = require('keyv-file');
+const set = new Set(['gpt-4', 'text-davinci-003', 'gpt-3.5-turbo', 'gpt-3.5-turbo-0301']);
const clientOptions = {
modelOptions: {
@@ -9,6 +10,10 @@ const clientOptions = {
debug: false
};
+if (set.has(process.env.DEFAULT_API_GPT)) {
+ clientOptions.modelOptions.model = process.env.DEFAULT_API_GPT;
+}
+
const askClient = async ({ text, onProgress, convo, abortController }) => {
const ChatGPTClient = (await import('@waylaidwanderer/chatgpt-api')).default;
const store = {