Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions electron/shared/providers/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,37 @@ export const PROVIDER_DEFINITIONS: ProviderDefinition[] = [
],
},
},
{
id: 'moonshot-global',
name: 'Moonshot (Global)',
icon: '🌙',
placeholder: 'sk-...',
model: 'Kimi',
requiresApiKey: true,
defaultBaseUrl: 'https://api.moonshot.ai/v1',
defaultModelId: 'kimi-k2.5',
category: 'official',
envVar: 'MOONSHOT_GLOBAL_API_KEY',
supportedAuthModes: ['api_key'],
defaultAuthMode: 'api_key',
supportsMultipleAccounts: true,
providerConfig: {
baseUrl: 'https://api.moonshot.ai/v1',
api: 'openai-completions',
apiKeyEnv: 'MOONSHOT_GLOBAL_API_KEY',
models: [
{
id: 'kimi-k2.5',
name: 'Kimi K2.5',
reasoning: false,
input: ['text'],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 256000,
maxTokens: 8192,
},
],
},
},
{
id: 'siliconflow',
name: 'SiliconFlow (CN)',
Expand Down
2 changes: 2 additions & 0 deletions electron/shared/providers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const PROVIDER_TYPES = [
'openrouter',
'ark',
'moonshot',
'moonshot-global',
'siliconflow',
'minimax-portal',
'minimax-portal-cn',
Expand All @@ -20,6 +21,7 @@ export const BUILTIN_PROVIDER_TYPES = [
'openrouter',
'ark',
'moonshot',
'moonshot-global',
'siliconflow',
'minimax-portal',
'minimax-portal-cn',
Expand Down
3 changes: 3 additions & 0 deletions src/lib/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const PROVIDER_TYPES = [
'openrouter',
'ark',
'moonshot',
'moonshot-global',
'siliconflow',
'minimax-portal',
'minimax-portal-cn',
Expand All @@ -29,6 +30,7 @@ export const BUILTIN_PROVIDER_TYPES = [
'openrouter',
'ark',
'moonshot',
'moonshot-global',
'siliconflow',
'minimax-portal',
'minimax-portal-cn',
Expand Down Expand Up @@ -172,6 +174,7 @@ export const PROVIDER_TYPE_INFO: ProviderTypeInfo[] = [
{ id: 'openrouter', name: 'OpenRouter', icon: '🌐', placeholder: 'sk-or-v1-...', model: 'Multi-Model', requiresApiKey: true, showModelId: true, modelIdPlaceholder: 'openai/gpt-5.4', defaultModelId: 'openai/gpt-5.4', docsUrl: 'https://openrouter.ai/models' },
{ id: 'minimax-portal-cn', name: 'MiniMax (CN)', icon: '☁️', placeholder: 'sk-...', model: 'MiniMax', requiresApiKey: false, isOAuth: true, supportsApiKey: true, defaultModelId: 'MiniMax-M2.7', showModelId: true, showModelIdInDevModeOnly: true, modelIdPlaceholder: 'MiniMax-M2.7', apiKeyUrl: 'https://platform.minimaxi.com/' },
{ id: 'moonshot', name: 'Moonshot (CN)', icon: '🌙', placeholder: 'sk-...', model: 'Kimi', requiresApiKey: true, defaultBaseUrl: 'https://api.moonshot.cn/v1', defaultModelId: 'kimi-k2.5', docsUrl: 'https://platform.moonshot.cn/' },
{ id: 'moonshot-global', name: 'Moonshot (Global)', icon: '🌙', placeholder: 'sk-...', model: 'Kimi', requiresApiKey: true, defaultBaseUrl: 'https://api.moonshot.ai/v1', defaultModelId: 'kimi-k2.5', docsUrl: 'https://platform.moonshot.ai/' },
{ id: 'siliconflow', name: 'SiliconFlow (CN)', icon: '🌊', placeholder: 'sk-...', model: 'Multi-Model', requiresApiKey: true, defaultBaseUrl: 'https://api.siliconflow.cn/v1', showModelId: true, showModelIdInDevModeOnly: true, modelIdPlaceholder: 'deepseek-ai/DeepSeek-V3', defaultModelId: 'deepseek-ai/DeepSeek-V3', docsUrl: 'https://docs.siliconflow.cn/cn/userguide/introduction' },
{ id: 'minimax-portal', name: 'MiniMax (Global)', icon: '☁️', placeholder: 'sk-...', model: 'MiniMax', requiresApiKey: false, isOAuth: true, supportsApiKey: true, defaultModelId: 'MiniMax-M2.7', showModelId: true, showModelIdInDevModeOnly: true, modelIdPlaceholder: 'MiniMax-M2.7', apiKeyUrl: 'https://platform.minimax.io' },
{ id: 'modelstudio', name: 'Model Studio', icon: '☁️', placeholder: 'sk-...', model: 'Qwen', requiresApiKey: true, defaultBaseUrl: 'https://coding.dashscope.aliyuncs.com/v1', showBaseUrl: true, defaultModelId: 'qwen3.5-plus', showModelId: true, showModelIdInDevModeOnly: true, modelIdPlaceholder: 'qwen3.5-plus', apiKeyUrl: 'https://bailian.console.aliyun.com/', hidden: true },
Expand Down
37 changes: 37 additions & 0 deletions tests/e2e/provider-moonshot-global.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { completeSetup, expect, test } from './fixtures/electron';

const TEST_PROVIDER_ID = 'moonshot-global-e2e';
const TEST_PROVIDER_LABEL = 'Moonshot Global E2E';

async function seedTestProvider(page: Parameters<typeof completeSetup>[0]): Promise<void> {
await page.evaluate(async ({ providerId, providerLabel }) => {
const now = new Date().toISOString();
await window.electron.ipcRenderer.invoke('provider:save', {
id: providerId,
name: providerLabel,
type: 'moonshot-global',
baseUrl: 'https://api.moonshot.ai/v1',
model: 'kimi-k2.5',
enabled: true,
createdAt: now,
updatedAt: now,
});
}, { providerId: TEST_PROVIDER_ID, providerLabel: TEST_PROVIDER_LABEL });
}

test.describe('Moonshot Global provider lifecycle', () => {
test('shows a saved moonshot-global provider with correct defaults and removes it cleanly', async ({ page }) => {
await completeSetup(page);
await seedTestProvider(page);

await page.getByTestId('sidebar-nav-models').click();
await expect(page.getByTestId('providers-settings')).toBeVisible();
await expect(page.getByTestId(`provider-card-${TEST_PROVIDER_ID}`)).toContainText(TEST_PROVIDER_LABEL);

await page.getByTestId(`provider-card-${TEST_PROVIDER_ID}`).hover();
await page.getByTestId(`provider-delete-${TEST_PROVIDER_ID}`).click();

await expect(page.getByTestId(`provider-card-${TEST_PROVIDER_ID}`)).toHaveCount(0);
await expect(page.getByText(TEST_PROVIDER_LABEL)).toHaveCount(0);
});
});
Loading