Feat/Add ByteDance Ark provider (#226)

This commit is contained in:
Lingxuan Zuo
2026-02-28 16:44:58 +08:00
committed by GitHub
Unverified
parent 1b45d891c3
commit 8cda9235b3
6 changed files with 62 additions and 9 deletions

View File

@@ -10,6 +10,7 @@ export const BUILTIN_PROVIDER_TYPES = [
'openai',
'google',
'openrouter',
'ark',
'moonshot',
'siliconflow',
'minimax-portal',
@@ -73,6 +74,14 @@ const REGISTRY: Record<string, ProviderBackendMeta> = {
},
},
},
ark: {
envVar: 'ARK_API_KEY',
providerConfig: {
baseUrl: 'https://ark.cn-beijing.volces.com/api/v3',
api: 'openai-completions',
apiKeyEnv: 'ARK_API_KEY',
},
},
moonshot: {
envVar: 'MOONSHOT_API_KEY',
defaultModel: 'moonshot/kimi-k2.5',

View File

@@ -4,7 +4,7 @@
* Keys are stored in plain text alongside provider configs in a single electron-store.
*/
import type { ProviderType } from './provider-registry';
import { BUILTIN_PROVIDER_TYPES, type ProviderType } from './provider-registry';
import { getActiveOpenClawProviders } from './openclaw-auth';
// Lazy-load electron-store (ESM module)
@@ -216,17 +216,11 @@ export async function getAllProvidersWithKeyInfo(): Promise<
const results: Array<ProviderConfig & { hasKey: boolean; keyMasked: string | null }> = [];
const activeOpenClawProviders = await getActiveOpenClawProviders();
// We need to avoid deleting native ones like 'anthropic' or 'google'
// that don't need to exist in openclaw.json models.providers
const OpenClawBuiltinList = [
'anthropic', 'openai', 'google', 'moonshot', 'siliconflow', 'ollama'
];
for (const provider of providers) {
// Sync check: If it's a custom/OAuth provider and it no longer exists in OpenClaw config
// (e.g. wiped by Gateway due to missing plugin, or manually deleted by user)
// we should remove it from ClawX UI to stay consistent.
const isBuiltin = OpenClawBuiltinList.includes(provider.type);
const isBuiltin = BUILTIN_PROVIDER_TYPES.includes(provider.type);
// For custom/ollama providers, the OpenClaw config key is derived as
// "<type>-<suffix>" where suffix = first 8 chars of providerId with hyphens stripped.
// e.g. provider.id "custom-a1b2c3d4-..." → strip hyphens → "customa1b2c3d4..." → slice(0,8) → "customa1"
@@ -261,4 +255,3 @@ export async function getAllProvidersWithKeyInfo(): Promise<
return results;
}