From 22504ee2b2466028f09057ebb11ee0cb22171cd3 Mon Sep 17 00:00:00 2001 From: rushichavda Date: Mon, 9 Feb 2026 23:37:21 +0530 Subject: [PATCH] feat: add DeepSeek as LLM provider MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add DeepSeek AI as a new LLM provider with DeepSeek V3 (deepseek-chat) and DeepSeek R1 (deepseek-reasoner) models. DeepSeek's API is OpenAI-compatible, so the integration uses ChatOpenAI with a custom base URL — same pattern as xAI/Grok and Moonshot/Kimi. --- env.example | 1 + src/components/ModelSelector.tsx | 8 ++++++++ src/model/llm.ts | 10 ++++++++++ src/utils/env.ts | 1 + 4 files changed, 20 insertions(+) diff --git a/env.example b/env.example index 245aa133..375a9236 100644 --- a/env.example +++ b/env.example @@ -5,6 +5,7 @@ GOOGLE_API_KEY=your-api-key XAI_API_KEY=your-api-key OPENROUTER_API_KEY=your-api-key MOONSHOT_API_KEY=your-api-key +DEEPSEEK_API_KEY=your-api-key # Ollama (Local LLM) OLLAMA_BASE_URL=http://127.0.0.1:11434 diff --git a/src/components/ModelSelector.tsx b/src/components/ModelSelector.tsx index ad75e557..03c3c9d2 100644 --- a/src/components/ModelSelector.tsx +++ b/src/components/ModelSelector.tsx @@ -53,6 +53,14 @@ const PROVIDERS: Provider[] = [ { id: 'kimi-k2-5', displayName: 'Kimi K2.5' }, ], }, + { + displayName: 'DeepSeek', + providerId: 'deepseek', + models: [ + { id: 'deepseek-chat', displayName: 'DeepSeek V3' }, + { id: 'deepseek-reasoner', displayName: 'DeepSeek R1' }, + ], + }, { displayName: 'OpenRouter', providerId: 'openrouter', diff --git a/src/model/llm.ts b/src/model/llm.ts index c47cfb0d..c892c5b8 100644 --- a/src/model/llm.ts +++ b/src/model/llm.ts @@ -23,6 +23,7 @@ const FAST_MODELS: Record = { xai: 'grok-4-1-fast-reasoning', openrouter: 'openrouter:openai/gpt-4o-mini', moonshot: 'kimi-k2-5', + deepseek: 'deepseek-chat', }; /** @@ -101,6 +102,15 @@ const MODEL_PROVIDERS: Record = { baseURL: 'https://api.moonshot.cn/v1', }, }), + 'deepseek-': (name, opts) => + new ChatOpenAI({ + model: name, + ...opts, + apiKey: getApiKey('DEEPSEEK_API_KEY', 'DeepSeek'), + configuration: { + baseURL: 'https://api.deepseek.com', + }, + }), 'ollama:': (name, opts) => new ChatOllama({ model: name.replace(/^ollama:/, ''), diff --git a/src/utils/env.ts b/src/utils/env.ts index c788ab5d..6f095f82 100644 --- a/src/utils/env.ts +++ b/src/utils/env.ts @@ -15,6 +15,7 @@ const PROVIDERS: Record = { anthropic: { displayName: 'Anthropic', apiKeyEnvVar: 'ANTHROPIC_API_KEY' }, google: { displayName: 'Google', apiKeyEnvVar: 'GOOGLE_API_KEY' }, moonshot: { displayName: 'Moonshot', apiKeyEnvVar: 'MOONSHOT_API_KEY' }, + deepseek: { displayName: 'DeepSeek', apiKeyEnvVar: 'DEEPSEEK_API_KEY' }, openrouter: { displayName: 'OpenRouter', apiKeyEnvVar: 'OPENROUTER_API_KEY' }, ollama: { displayName: 'Ollama' }, };