diff --git a/packages/core/src/common/model-capabilities.ts b/packages/core/src/common/model-capabilities.ts index 849cac47..ebc3ab22 100644 --- a/packages/core/src/common/model-capabilities.ts +++ b/packages/core/src/common/model-capabilities.ts @@ -1,4 +1,9 @@ -export const DEEPSEEK_V4_MODELS = new Set(["deepseek-v4-flash", "deepseek-v4-pro", "deepseek-v4-flash-vision-exp"]); +export const DEEPSEEK_V4_MODELS = new Set([ + "deepseek-v4-flash", + "deepseek-v4-pro", + "deepseek-v4-flash-vision-exp", + "deepseek-ai/deepseek-v4-pro", +]); export type MultimodalMode = "default" | "on" | "off"; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 5fb2c01f..6501176d 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -25,6 +25,8 @@ export { DEFAULT_FILE_QUOTA_CLEANUP_BATCH, DEFAULT_MAX_REQUEST_FILES_BYTES, MAX_FILES_API_TIMEOUT_MS, + ATLASCLOUD_DEFAULT_MODEL, + ATLASCLOUD_BASE_URL, } from "./settings"; export type { DeepcodingSettings, diff --git a/packages/core/src/settings.ts b/packages/core/src/settings.ts index 026d8821..8f1f6efa 100644 --- a/packages/core/src/settings.ts +++ b/packages/core/src/settings.ts @@ -587,6 +587,9 @@ export function resolveSettingsSources( ...projectEnv, ...systemEnv, }; + const explicitApiKey = trimString(env.API_KEY); + const atlasCloudApiKey = trimString(processEnv.ATLASCLOUD_API_KEY); + const useAtlasCloudDefaults = !explicitApiKey && Boolean(atlasCloudApiKey); const model = trimString(systemEnv.MODEL) || @@ -594,8 +597,9 @@ export function resolveSettingsSources( trimString(projectEnv.MODEL) || trimString(userSettings?.model) || trimString(userEnv.MODEL) || + (useAtlasCloudDefaults ? ATLASCLOUD_DEFAULT_MODEL : "") || defaults.model; - const baseURL = trimString(env.BASE_URL) || defaults.baseURL; + const baseURL = trimString(env.BASE_URL) || (useAtlasCloudDefaults ? ATLASCLOUD_BASE_URL : "") || defaults.baseURL; const contextWindow = firstTokenWindow(systemEnv.CONTEXT_WINDOW, projectSettings?.contextWindow, userSettings?.contextWindow) ?? @@ -700,7 +704,7 @@ export function resolveSettingsSources( return { env, - apiKey: trimString(env.API_KEY) || undefined, + apiKey: explicitApiKey || atlasCloudApiKey || undefined, baseURL, model, contextWindow, @@ -770,6 +774,8 @@ export function applyModelConfigSelection( export const DEFAULT_MODEL = "deepseek-v4-flash"; export const DEFAULT_BASE_URL = "https://api.deepseek.com"; +export const ATLASCLOUD_DEFAULT_MODEL = "deepseek-ai/deepseek-v4-pro"; +export const ATLASCLOUD_BASE_URL = "https://api.atlascloud.ai/v1"; // --------------------------------------------------------------------------- // Settings file I/O diff --git a/packages/core/src/tests/settings-and-notify.test.ts b/packages/core/src/tests/settings-and-notify.test.ts index 6f842438..415198a0 100644 --- a/packages/core/src/tests/settings-and-notify.test.ts +++ b/packages/core/src/tests/settings-and-notify.test.ts @@ -232,6 +232,47 @@ test("resolveSettings gives top-level model priority over env MODEL", () => { assert.equal(resolved.model, "deepseek-v4-flash"); }); +test("resolveSettings uses Atlas Cloud defaults with ATLASCLOUD_API_KEY", () => { + const resolved = resolveSettings( + {}, + { + model: "default-model", + baseURL: "https://default.example.com", + }, + { + ATLASCLOUD_API_KEY: "atlas-test-key", + } + ); + + assert.equal(resolved.apiKey, "atlas-test-key"); + assert.equal(resolved.baseURL, "https://api.atlascloud.ai/v1"); + assert.equal(resolved.model, "deepseek-ai/deepseek-v4-pro"); + assert.equal(resolved.thinkingEnabled, true); +}); + +test("resolveSettings gives explicit API settings priority over Atlas Cloud defaults", () => { + const resolved = resolveSettings( + { + env: { + API_KEY: "explicit-key", + BASE_URL: "https://explicit.example.com/v1", + MODEL: "explicit-model", + }, + }, + { + model: "default-model", + baseURL: "https://default.example.com", + }, + { + ATLASCLOUD_API_KEY: "atlas-test-key", + } + ); + + assert.equal(resolved.apiKey, "explicit-key"); + assert.equal(resolved.baseURL, "https://explicit.example.com/v1"); + assert.equal(resolved.model, "explicit-model"); +}); + test("resolveSettings derives model-specific context window defaults", () => { const regular = resolveSettings( {},