Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI, Telegram or More.
feat: add Atlas Cloud provider preset (#94)
nb21363f0fd0961b2
diff --git a/.env.example b/.env.exampleindex b89e497f..6f71e194 100644--- a/.env.example+++ b/.env.example@@ -28,6 +28,11 @@ GROK_API_KEY=GROK_BASE_URL=https://api.x.ai/v1GROK_MODEL=grok-4+# Atlas Cloud (OpenAI-compatible API)+ATLASCLOUD_API_KEY=+ATLASCLOUD_BASE_URL=https://api.atlascloud.ai/v1+ATLASCLOUD_MODEL=qwen/qwen3.5-flash+# Ollama Cloud (API key required for ollama.com/v1)OLLAMA_CLOUD_API_KEY=OLLAMA_CLOUD_BASE_URL=https://ollama.com/v1@@ -55,7 +60,7 @@ MIMO_TOKEN_PLAN_BASE_URL=https://token-plan-cn.xiaomimimo.com/v1MIMO_TOKEN_PLAN_MODEL=mimo-v2.5-proMIMO_TOKEN_PLAN_ENABLED=false-# Default provider: deepseek | openai | anthropic | grok | ollamaCloud | ollamaLocal | openaiCompat | mimo | mimoTokenPlan+# Default provider: deepseek | openai | anthropic | grok | atlascloud | ollamaCloud | ollamaLocal | openaiCompat | mimo | mimoTokenPlanDEFAULT_PROVIDER=deepseek# ── Telegram ──diff --git a/src/cloud/pairing-flow.ts b/src/cloud/pairing-flow.tsindex ad413720..38105198 100644--- a/src/cloud/pairing-flow.ts+++ b/src/cloud/pairing-flow.ts@@ -414,6 +414,7 @@ function isProviderConfiguredSafe(p: import('../utils/config.js').ProviderConfigif (!p.enabled) return false;if (p.name === 'ollamaLocal') return p.baseUrl.length > 0 && p.model.length > 0;if (p.name === 'ollamaCloud') return p.apiKey.length > 0 && p.baseUrl.length > 0;+ if (p.name === 'atlascloud') return p.apiKey.length > 0 && p.baseUrl.length > 0 && p.model.length > 0;if (p.name === 'openaiCompat') return p.baseUrl.length > 0 && p.model.length > 0;if (p.name === 'chatgptWeb' || p.name === 'githubCopilot') return p.model.length > 0;return p.apiKey.length > 0;diff --git a/src/index.ts b/src/index.tsindex 28c811da..cf8deeab 100644--- a/src/index.ts+++ b/src/index.ts@@ -151,6 +151,7 @@ const PROVIDER_OPTIONS: Array<{ key: ProviderName; label: string }> = [{ key: 'anthropic', label: 'Anthropic' },{ key: 'githubCopilot', label: 'GitHub Copilot' },{ key: 'grok', label: 'Grok (xAI)' },+ { key: 'atlascloud', label: 'Atlas Cloud' },{ key: 'ollamaCloud', label: 'Ollama Cloud' },{ key: 'ollamaLocal', label: 'Ollama Local' },{ key: 'openaiCompat', label: 'OpenAI Compilations' },@@ -1334,6 +1335,23 @@ async function configure(existingConfig?: MercuryConfig): Promise<void> {continue;}+ if (provider === 'atlascloud') {+ const mask = isReconfig && config.providers.atlascloud.apiKey ? ` [${maskKey(config.providers.atlascloud.apiKey)}]` : '';+ const result = await promptApiKeyWithModelSelection(+ config,+ 'atlascloud',+ 'Atlas Cloud',+ chalk.white(` Atlas Cloud API key${mask}${isReconfig ? '' : ' (Enter to skip)'}: `),+ isReconfig,+ );+ if (!result.skipped && result.apiKey && result.model) {+ config.providers.atlascloud.apiKey = result.apiKey;+ config.providers.atlascloud.model = result.model;+ config.providers.atlascloud.enabled = true;+ }+ continue;+ }+if (provider === 'ollamaCloud') {const mask = isReconfig && config.providers.ollamaCloud.apiKey ? ` [${maskKey(config.providers.ollamaCloud.apiKey)}]` : '';const result = await promptApiKeyWithModelSelection(diff --git a/src/providers/registry.ts b/src/providers/registry.tsindex 95de5fb1..a000d339 100644--- a/src/providers/registry.ts+++ b/src/providers/registry.ts@@ -21,7 +21,7 @@ export async function createProvider(pc: ProviderConfig, tokenStore?: import('..// this entirely.const { OpenAICompatProvider } = await import('./openai-compat.js');return new OpenAICompatProvider(pc, { useChatApi: true });- } else if (pc.name === 'ollamaCloud' || pc.name === 'openaiCompat') {+ } else if (pc.name === 'atlascloud' || pc.name === 'ollamaCloud' || pc.name === 'openaiCompat') {const { OpenAICompatProvider } = await import('./openai-compat.js');return new OpenAICompatProvider(pc, { useChatApi: true });} else if (pc.name === 'mimo' || pc.name === 'mimoTokenPlan') {@@ -61,6 +61,7 @@ export class ProviderRegistry {config.providers.openai,config.providers.anthropic,config.providers.grok,+ config.providers.atlascloud,config.providers.ollamaCloud,config.providers.ollamaLocal,config.providers.openaiCompat,diff --git a/src/utils/config.ts b/src/utils/config.tsindex c2b74d10..5a233626 100644--- a/src/utils/config.ts+++ b/src/utils/config.ts@@ -59,6 +59,7 @@ export type ProviderName =| 'anthropic'| 'deepseek'| 'grok'+ | 'atlascloud'| 'ollamaCloud'| 'ollamaLocal'| 'openaiCompat'@@ -93,6 +94,7 @@ export interface MercuryConfig {anthropic: ProviderConfig;deepseek: ProviderConfig;grok: ProviderConfig;+ atlascloud: ProviderConfig;ollamaCloud: ProviderConfig;ollamaLocal: ProviderConfig;openaiCompat: ProviderConfig;@@ -281,6 +283,13 @@ export function getDefaultConfig(): MercuryConfig {model: getEnv('GROK_MODEL', 'grok-4'),enabled: getEnvBool('GROK_ENABLED', true),},+ atlascloud: {+ name: 'atlascloud',+ apiKey: getEnv('ATLASCLOUD_API_KEY', ''),+ baseUrl: getEnv('ATLASCLOUD_BASE_URL', 'https://api.atlascloud.ai/v1'),+ model: getEnv('ATLASCLOUD_MODEL', 'qwen/qwen3.5-flash'),+ enabled: getEnvBool('ATLASCLOUD_ENABLED', true),+ },ollamaCloud: {name: 'ollamaCloud',apiKey: getEnv('OLLAMA_CLOUD_API_KEY', ''),@@ -611,6 +620,9 @@ export function isProviderConfigured(provider: ProviderConfig): boolean {if (provider.name === 'ollamaCloud') {return provider.apiKey.length > 0 && provider.baseUrl.length > 0;}+ if (provider.name === 'atlascloud') {+ return provider.apiKey.length > 0 && provider.baseUrl.length > 0 && provider.model.length > 0;+ }if (provider.name === 'openaiCompat') {return provider.baseUrl.length > 0 && provider.model.length > 0;}diff --git a/src/utils/provider-models.test.ts b/src/utils/provider-models.test.tsindex adf8def4..6295a57d 100644--- a/src/utils/provider-models.test.ts+++ b/src/utils/provider-models.test.ts@@ -1,5 +1,9 @@-import { describe, expect, it } from 'vitest';-import { buildModelCatalog } from './provider-models.js';+import { afterEach, describe, expect, it, vi } from 'vitest';+import { buildModelCatalog, fetchProviderModelCatalog } from './provider-models.js';++afterEach(() => {+ vi.unstubAllGlobals();+});describe('buildModelCatalog', () => {it('prefers the provider recommended OpenAI model when available', () => {@@ -80,6 +84,18 @@ describe('buildModelCatalog', () => {expect(catalog.models).toContain('gpt-oss:20b');});+ it('prefers the Atlas Cloud fast Qwen model when available', () => {+ const catalog = buildModelCatalog('atlascloud', [+ 'deepseek-ai/deepseek-v4-pro',+ 'qwen/qwen3.5-flash',+ 'another-chat-model',+ ]);++ expect(catalog.recommendedModel).toBe('qwen/qwen3.5-flash');+ expect(catalog.models).toContain('deepseek-ai/deepseek-v4-pro');+ expect(catalog.models).toContain('another-chat-model');+ });+it('falls back to the current Ollama Cloud model when no preferred default is available', () => {const catalog = buildModelCatalog('ollamaCloud',@@ -110,3 +126,27 @@ describe('buildModelCatalog', () => {expect(catalog.recommendedModel).toBe('model-a');});});++describe('fetchProviderModelCatalog', () => {+ it('excludes non-text Atlas Cloud models using output modality metadata', async () => {+ vi.stubGlobal('fetch', vi.fn().mockResolvedValue(new Response(JSON.stringify({+ data: [+ { id: 'qwen/qwen3.5-flash', output_modalities: ['text'] },+ { id: 'another-chat-model', output_modalities: ['text'] },+ { id: 'black-forest-labs/flux-kontext-pro', output_modalities: ['image'] },+ ],+ }), { status: 200 })));++ const catalog = await fetchProviderModelCatalog('atlascloud', {+ name: 'atlascloud',+ apiKey: 'test-key',+ baseUrl: 'https://api.atlascloud.ai/v1',+ model: 'qwen/qwen3.5-flash',+ enabled: true,+ });++ expect(catalog.recommendedModel).toBe('qwen/qwen3.5-flash');+ expect(catalog.models).toContain('another-chat-model');+ expect(catalog.models).not.toContain('black-forest-labs/flux-kontext-pro');+ });+});diff --git a/src/utils/provider-models.ts b/src/utils/provider-models.tsindex 4c0c2453..ad7ebf15 100644--- a/src/utils/provider-models.ts+++ b/src/utils/provider-models.ts@@ -43,6 +43,11 @@ const GROK_PREFERRED_MODELS = ['grok-3-latest',] as const;+const ATLASCLOUD_PREFERRED_MODELS = [+ 'qwen/qwen3.5-flash',+ 'deepseek-ai/deepseek-v4-pro',+] as const;+const OLLAMA_CLOUD_PREFERRED_MODELS = ['gpt-oss:120b','gpt-oss:120b-cloud',@@ -116,6 +121,7 @@ export function getPreferredModelsForProvider(provider: ProviderName): string[]openai: OPENAI_PREFERRED_MODELS,anthropic: ANTHROPIC_PREFERRED_MODELS,grok: GROK_PREFERRED_MODELS,+ atlascloud: ATLASCLOUD_PREFERRED_MODELS,ollamaCloud: OLLAMA_CLOUD_PREFERRED_MODELS,ollamaLocal: OLLAMA_LOCAL_PREFERRED_MODELS,openaiCompat: OPENAI_COMPAT_PREFERRED_MODELS,@@ -129,7 +135,7 @@ export function getPreferredModelsForProvider(provider: ProviderName): string[]}interface OpenAIModelResponse {- data?: Array<{ id?: string }>;+ data?: Array<{ id?: string; output_modalities?: string[] }>;}interface AnthropicModelResponse {@@ -223,6 +229,7 @@ function chooseRecommendedModel(openai: OPENAI_PREFERRED_MODELS,anthropic: ANTHROPIC_PREFERRED_MODELS,grok: GROK_PREFERRED_MODELS,+ atlascloud: ATLASCLOUD_PREFERRED_MODELS,ollamaCloud: OLLAMA_CLOUD_PREFERRED_MODELS,ollamaLocal: OLLAMA_LOCAL_PREFERRED_MODELS,openaiCompat: OPENAI_COMPAT_PREFERRED_MODELS,@@ -262,6 +269,7 @@ export function buildModelCatalog(openai: OPENAI_PREFERRED_MODELS,anthropic: ANTHROPIC_PREFERRED_MODELS,grok: GROK_PREFERRED_MODELS,+ atlascloud: ATLASCLOUD_PREFERRED_MODELS,ollamaCloud: OLLAMA_CLOUD_PREFERRED_MODELS,ollamaLocal: OLLAMA_LOCAL_PREFERRED_MODELS,openaiCompat: OPENAI_COMPAT_PREFERRED_MODELS,@@ -289,6 +297,8 @@ async function fetchOpenAICompatModels(provider: ProviderName, config: ProviderClet errorMessage: string;if (provider === 'grok') {errorMessage = 'Mercury could not fetch models for this Grok key. Please re-enter it.';+ } else if (provider === 'atlascloud') {+ errorMessage = 'Mercury could not fetch models for this Atlas Cloud key. Please re-enter it.';} else if (provider === 'deepseek') {errorMessage = 'Mercury could not fetch models for this DeepSeek key. Please re-enter it.';} else if (provider === 'openaiCompat') {@@ -304,16 +314,31 @@ async function fetchOpenAICompatModels(provider: ProviderName, config: ProviderC);const ids = (data.data ?? [])- .map((model) => model.id?.trim() ?? '')- .filter((id) => {+ .map((model) => ({+ id: model.id?.trim() ?? '',+ outputModalities: model.output_modalities,+ }))+ .filter(({ id, outputModalities }) => {if (provider === 'deepseek') {return id.startsWith('deepseek-');}if (provider === 'openaiCompat') {return id.length > 0;}+ if (provider === 'atlascloud') {+ const lower = id.toLowerCase();+ return id.length > 0+ && (outputModalities == null || outputModalities.includes('text'))+ && !lower.includes('embedding')+ && !lower.includes('image')+ && !lower.includes('video')+ && !lower.includes('audio')+ && !lower.includes('tts')+ && !lower.includes('whisper');+ }return isOpenAIChatModel(id);- });+ })+ .map(({ id }) => id);return buildModelCatalog(provider, ids, config.model);}diff --git a/src/web/api/providers.ts b/src/web/api/providers.tsindex e2ab277d..e139d707 100644--- a/src/web/api/providers.ts+++ b/src/web/api/providers.ts@@ -26,7 +26,7 @@ providers.post('/api/providers/:name', async (c) => {const body = await c.req.json();const config = loadConfig();- const validNames: ProviderName[] = ['mercuryCloud', 'openai', 'anthropic', 'deepseek', 'grok', 'ollamaCloud', 'ollamaLocal', 'openaiCompat', 'mimo', 'mimoTokenPlan'];+ const validNames: ProviderName[] = ['mercuryCloud', 'openai', 'anthropic', 'deepseek', 'grok', 'atlascloud', 'ollamaCloud', 'ollamaLocal', 'openaiCompat', 'mimo', 'mimoTokenPlan'];if (!validNames.includes(providerName)) {return c.json({ error: 'Unknown provider' }, 400);}@@ -59,4 +59,4 @@ providers.post('/api/providers/:name/test', async (c) => {}});-export default providers;\ No newline at end of file+export default providers;