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
26 changes: 26 additions & 0 deletions electron/shared/providers/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,32 @@ export const PROVIDER_DEFINITIONS: ProviderDefinition[] = [
defaultAuthMode: 'api_key',
supportsMultipleAccounts: true,
},
{
id: 'novita',
name: 'Novita AI',
icon: '🔮',
placeholder: 'nv-...',
model: 'Multi-Model',
requiresApiKey: true,
showModelId: true,
modelIdPlaceholder: 'moonshotai/kimi-k2.5',
defaultModelId: 'moonshotai/kimi-k2.5',
category: 'compatible',
envVar: 'NOVITA_API_KEY',
supportedAuthModes: ['api_key'],
defaultAuthMode: 'api_key',
supportsMultipleAccounts: true,
providerConfig: {
baseUrl: 'https://api.novita.ai/openai',
api: 'openai-completions',
apiKeyEnv: 'NOVITA_API_KEY',
models: [
{ id: 'moonshotai/kimi-k2.5', name: 'Kimi K2.5' },
{ id: 'zai-org/glm-5', name: 'GLM-5' },
{ id: 'minimax/minimax-m2.5', name: 'MiniMax M2.5' },
],
},
},
];

const PROVIDER_DEFINITION_MAP = new Map(
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 @@ -11,6 +11,7 @@ export const PROVIDER_TYPES = [
'qwen-portal',
'ollama',
'custom',
'novita',
] as const;

export const BUILTIN_PROVIDER_TYPES = [
Expand All @@ -25,6 +26,7 @@ export const BUILTIN_PROVIDER_TYPES = [
'minimax-portal-cn',
'qwen-portal',
'ollama',
'novita',
] as const;

export type ProviderType = (typeof PROVIDER_TYPES)[number];
Expand Down
2 changes: 2 additions & 0 deletions src/assets/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import minimaxPortal from './minimax.svg';
import qwenPortal from './qwen.svg';
import ollama from './ollama.svg';
import custom from './custom.svg';
import novita from './novita.svg';

export const providerIcons: Record<string, string> = {
anthropic,
Expand All @@ -23,4 +24,5 @@ export const providerIcons: Record<string, string> = {
'qwen-portal': qwenPortal,
ollama,
custom,
novita,
};
1 change: 1 addition & 0 deletions src/assets/providers/novita.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/lib/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const PROVIDER_TYPES = [
'qwen-portal',
'ollama',
'custom',
'novita',
] as const;
export type ProviderType = (typeof PROVIDER_TYPES)[number];

Expand All @@ -34,6 +35,7 @@ export const BUILTIN_PROVIDER_TYPES = [
'minimax-portal-cn',
'qwen-portal',
'ollama',
'novita',
] as const;

export const OLLAMA_PLACEHOLDER_API_KEY = 'ollama-local';
Expand Down Expand Up @@ -163,6 +165,7 @@ export const PROVIDER_TYPE_INFO: ProviderTypeInfo[] = [
{ id: 'qwen-portal', name: 'Qwen (Global)', icon: '☁️', placeholder: 'sk-...', model: 'Qwen', requiresApiKey: false, isOAuth: true, defaultModelId: 'coder-model' },
{ id: 'ark', name: 'ByteDance Ark', icon: 'A', placeholder: 'your-ark-api-key', model: 'Doubao', requiresApiKey: true, defaultBaseUrl: 'https://ark.cn-beijing.volces.com/api/v3', showBaseUrl: true, showModelId: true, modelIdPlaceholder: 'ep-20260228000000-xxxxx', docsUrl: 'https://www.volcengine.com/' },
{ id: 'ollama', name: 'Ollama', icon: '🦙', placeholder: 'Not required', requiresApiKey: false, defaultBaseUrl: 'http://localhost:11434/v1', showBaseUrl: true, showModelId: true, modelIdPlaceholder: 'qwen3:latest' },
{ id: 'novita', name: 'Novita AI', icon: '🔮', placeholder: 'nv-...', model: 'Multi-Model', requiresApiKey: true, defaultBaseUrl: 'https://api.novita.ai/openai', showModelId: true, modelIdPlaceholder: 'moonshotai/kimi-k2.5', defaultModelId: 'moonshotai/kimi-k2.5' },
{
id: 'custom',
name: 'Custom',
Expand Down
31 changes: 30 additions & 1 deletion tests/unit/providers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('provider metadata', () => {

it('keeps builtin provider sources in sync', () => {
expect(BUILTIN_PROVIDER_TYPES).toEqual(
expect.arrayContaining(['anthropic', 'openai', 'google', 'openrouter', 'ark', 'moonshot', 'siliconflow', 'minimax-portal', 'minimax-portal-cn', 'qwen-portal', 'ollama'])
expect.arrayContaining(['anthropic', 'openai', 'google', 'openrouter', 'ark', 'moonshot', 'siliconflow', 'minimax-portal', 'minimax-portal-cn', 'qwen-portal', 'ollama', 'novita'])
);
});

Expand Down Expand Up @@ -140,4 +140,33 @@ describe('provider metadata', () => {
expect(resolveProviderApiKeyForSave('openai', '')).toBeUndefined();
expect(resolveProviderApiKeyForSave('openai', ' sk-test ')).toBe('sk-test');
});

it('includes novita in the frontend provider registry', () => {
expect(PROVIDER_TYPES).toContain('novita');

expect(PROVIDER_TYPE_INFO).toEqual(
expect.arrayContaining([
expect.objectContaining({
id: 'novita',
name: 'Novita AI',
requiresApiKey: true,
defaultBaseUrl: 'https://api.novita.ai/openai',
showModelId: true,
defaultModelId: 'moonshotai/kimi-k2.5',
}),
])
);
});

it('includes novita in the backend provider registry', () => {
expect(BUILTIN_PROVIDER_TYPES).toContain('novita');
expect(getProviderEnvVar('novita')).toBe('NOVITA_API_KEY');
expect(getProviderConfig('novita')).toEqual(
expect.objectContaining({
baseUrl: 'https://api.novita.ai/openai',
api: 'openai-completions',
apiKeyEnv: 'NOVITA_API_KEY',
})
);
});
});