mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-05-15 17:20:45 +08:00
feat(presets): add OpenClaw provider presets
- Create openclawProviderPresets.ts with provider templates - Include Chinese officials (DeepSeek, Zhipu, Qwen, Kimi, MiniMax) - Include aggregators (AiHubMix, DMXAPI, OpenRouter, ModelScope) - Include third party partners (PackyCode, Cubence, AIGoCode) - Include OpenAI Compatible custom template
This commit is contained in:
@@ -0,0 +1,386 @@
|
||||
/**
|
||||
* OpenClaw provider presets configuration
|
||||
* OpenClaw uses models.providers structure with custom provider configs
|
||||
*/
|
||||
import type { ProviderCategory, OpenClawProviderConfig } from "../types";
|
||||
import type { PresetTheme, TemplateValueConfig } from "./claudeProviderPresets";
|
||||
|
||||
export interface OpenClawProviderPreset {
|
||||
name: string;
|
||||
websiteUrl: string;
|
||||
apiKeyUrl?: string;
|
||||
/** OpenClaw settings_config structure */
|
||||
settingsConfig: OpenClawProviderConfig;
|
||||
isOfficial?: boolean;
|
||||
isPartner?: boolean;
|
||||
partnerPromotionKey?: string;
|
||||
category?: ProviderCategory;
|
||||
/** Template variable definitions */
|
||||
templateValues?: Record<string, TemplateValueConfig>;
|
||||
/** Visual theme config */
|
||||
theme?: PresetTheme;
|
||||
/** Icon name */
|
||||
icon?: string;
|
||||
/** Icon color */
|
||||
iconColor?: string;
|
||||
/** Mark as custom template (for UI distinction) */
|
||||
isCustomTemplate?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* OpenClaw API protocol options
|
||||
*/
|
||||
export const openclawApiProtocols = [
|
||||
{ value: "openai-completions", label: "OpenAI Completions" },
|
||||
{ value: "anthropic", label: "Anthropic" },
|
||||
{ value: "google-generative-ai", label: "Google Generative AI" },
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* OpenClaw provider presets list
|
||||
*/
|
||||
export const openclawProviderPresets: OpenClawProviderPreset[] = [
|
||||
// ========== Chinese Officials ==========
|
||||
{
|
||||
name: "DeepSeek",
|
||||
websiteUrl: "https://platform.deepseek.com",
|
||||
apiKeyUrl: "https://platform.deepseek.com/api_keys",
|
||||
settingsConfig: {
|
||||
baseUrl: "https://api.deepseek.com/v1",
|
||||
apiKey: "",
|
||||
api: "openai-completions",
|
||||
models: [
|
||||
{ id: "deepseek-chat", name: "DeepSeek V3.2" },
|
||||
{ id: "deepseek-reasoner", name: "DeepSeek R1" },
|
||||
],
|
||||
},
|
||||
category: "cn_official",
|
||||
icon: "deepseek",
|
||||
iconColor: "#1E88E5",
|
||||
templateValues: {
|
||||
apiKey: {
|
||||
label: "API Key",
|
||||
placeholder: "sk-...",
|
||||
editorValue: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Zhipu GLM",
|
||||
websiteUrl: "https://open.bigmodel.cn",
|
||||
apiKeyUrl: "https://www.bigmodel.cn/claude-code?ic=RRVJPB5SII",
|
||||
settingsConfig: {
|
||||
baseUrl: "https://open.bigmodel.cn/api/paas/v4",
|
||||
apiKey: "",
|
||||
api: "openai-completions",
|
||||
models: [{ id: "glm-4.7", name: "GLM-4.7" }],
|
||||
},
|
||||
category: "cn_official",
|
||||
isPartner: true,
|
||||
partnerPromotionKey: "zhipu",
|
||||
icon: "zhipu",
|
||||
iconColor: "#0F62FE",
|
||||
templateValues: {
|
||||
baseUrl: {
|
||||
label: "Base URL",
|
||||
placeholder: "https://open.bigmodel.cn/api/paas/v4",
|
||||
defaultValue: "https://open.bigmodel.cn/api/paas/v4",
|
||||
editorValue: "",
|
||||
},
|
||||
apiKey: {
|
||||
label: "API Key",
|
||||
placeholder: "",
|
||||
editorValue: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Qwen Coder",
|
||||
websiteUrl: "https://bailian.console.aliyun.com",
|
||||
apiKeyUrl: "https://bailian.console.aliyun.com/#/api-key",
|
||||
settingsConfig: {
|
||||
baseUrl: "https://dashscope.aliyuncs.com/compatible-mode/v1",
|
||||
apiKey: "",
|
||||
api: "openai-completions",
|
||||
models: [{ id: "qwen3-max", name: "Qwen3 Max" }],
|
||||
},
|
||||
category: "cn_official",
|
||||
icon: "qwen",
|
||||
iconColor: "#FF6A00",
|
||||
templateValues: {
|
||||
baseUrl: {
|
||||
label: "Base URL",
|
||||
placeholder: "https://dashscope.aliyuncs.com/compatible-mode/v1",
|
||||
defaultValue: "https://dashscope.aliyuncs.com/compatible-mode/v1",
|
||||
editorValue: "",
|
||||
},
|
||||
apiKey: {
|
||||
label: "API Key",
|
||||
placeholder: "sk-...",
|
||||
editorValue: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Kimi k2.5",
|
||||
websiteUrl: "https://platform.moonshot.cn/console",
|
||||
apiKeyUrl: "https://platform.moonshot.cn/console/api-keys",
|
||||
settingsConfig: {
|
||||
baseUrl: "https://api.moonshot.cn/v1",
|
||||
apiKey: "",
|
||||
api: "openai-completions",
|
||||
models: [{ id: "kimi-k2.5", name: "Kimi K2.5" }],
|
||||
},
|
||||
category: "cn_official",
|
||||
icon: "kimi",
|
||||
iconColor: "#6366F1",
|
||||
templateValues: {
|
||||
baseUrl: {
|
||||
label: "Base URL",
|
||||
placeholder: "https://api.moonshot.cn/v1",
|
||||
defaultValue: "https://api.moonshot.cn/v1",
|
||||
editorValue: "",
|
||||
},
|
||||
apiKey: {
|
||||
label: "API Key",
|
||||
placeholder: "sk-...",
|
||||
editorValue: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "MiniMax",
|
||||
websiteUrl: "https://platform.minimaxi.com",
|
||||
apiKeyUrl: "https://platform.minimaxi.com/subscribe/coding-plan",
|
||||
settingsConfig: {
|
||||
baseUrl: "https://api.minimaxi.com/v1",
|
||||
apiKey: "",
|
||||
api: "openai-completions",
|
||||
models: [{ id: "MiniMax-M2.1", name: "MiniMax M2.1" }],
|
||||
},
|
||||
category: "cn_official",
|
||||
isPartner: true,
|
||||
partnerPromotionKey: "minimax_cn",
|
||||
theme: {
|
||||
backgroundColor: "#f64551",
|
||||
textColor: "#FFFFFF",
|
||||
},
|
||||
icon: "minimax",
|
||||
iconColor: "#FF6B6B",
|
||||
templateValues: {
|
||||
apiKey: {
|
||||
label: "API Key",
|
||||
placeholder: "",
|
||||
editorValue: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ========== Aggregators ==========
|
||||
{
|
||||
name: "AiHubMix",
|
||||
websiteUrl: "https://aihubmix.com",
|
||||
apiKeyUrl: "https://aihubmix.com",
|
||||
settingsConfig: {
|
||||
baseUrl: "https://aihubmix.com/v1",
|
||||
apiKey: "",
|
||||
api: "anthropic",
|
||||
models: [
|
||||
{ id: "claude-sonnet-4-5-20250929", name: "Claude Sonnet 4.5" },
|
||||
{ id: "claude-opus-4-5-20251101", name: "Claude Opus 4.5" },
|
||||
],
|
||||
},
|
||||
category: "aggregator",
|
||||
icon: "aihubmix",
|
||||
iconColor: "#006FFB",
|
||||
templateValues: {
|
||||
apiKey: {
|
||||
label: "API Key",
|
||||
placeholder: "",
|
||||
editorValue: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "DMXAPI",
|
||||
websiteUrl: "https://www.dmxapi.cn",
|
||||
apiKeyUrl: "https://www.dmxapi.cn",
|
||||
settingsConfig: {
|
||||
baseUrl: "https://www.dmxapi.cn/v1",
|
||||
apiKey: "",
|
||||
api: "anthropic",
|
||||
models: [
|
||||
{ id: "claude-sonnet-4-5-20250929", name: "Claude Sonnet 4.5" },
|
||||
{ id: "claude-opus-4-5-20251101", name: "Claude Opus 4.5" },
|
||||
],
|
||||
},
|
||||
category: "aggregator",
|
||||
isPartner: true,
|
||||
partnerPromotionKey: "dmxapi",
|
||||
templateValues: {
|
||||
apiKey: {
|
||||
label: "API Key",
|
||||
placeholder: "",
|
||||
editorValue: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "OpenRouter",
|
||||
websiteUrl: "https://openrouter.ai",
|
||||
apiKeyUrl: "https://openrouter.ai/keys",
|
||||
settingsConfig: {
|
||||
baseUrl: "https://openrouter.ai/api/v1",
|
||||
apiKey: "",
|
||||
api: "openai-completions",
|
||||
models: [
|
||||
{ id: "anthropic/claude-sonnet-4.5", name: "Claude Sonnet 4.5" },
|
||||
{ id: "anthropic/claude-opus-4.5", name: "Claude Opus 4.5" },
|
||||
],
|
||||
},
|
||||
category: "aggregator",
|
||||
icon: "openrouter",
|
||||
iconColor: "#6566F1",
|
||||
templateValues: {
|
||||
apiKey: {
|
||||
label: "API Key",
|
||||
placeholder: "sk-or-...",
|
||||
editorValue: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ModelScope",
|
||||
websiteUrl: "https://modelscope.cn",
|
||||
apiKeyUrl: "https://modelscope.cn/my/myaccesstoken",
|
||||
settingsConfig: {
|
||||
baseUrl: "https://api-inference.modelscope.cn/v1",
|
||||
apiKey: "",
|
||||
api: "openai-completions",
|
||||
models: [{ id: "ZhipuAI/GLM-4.7", name: "GLM-4.7" }],
|
||||
},
|
||||
category: "aggregator",
|
||||
icon: "modelscope",
|
||||
iconColor: "#624AFF",
|
||||
templateValues: {
|
||||
baseUrl: {
|
||||
label: "Base URL",
|
||||
placeholder: "https://api-inference.modelscope.cn/v1",
|
||||
defaultValue: "https://api-inference.modelscope.cn/v1",
|
||||
editorValue: "",
|
||||
},
|
||||
apiKey: {
|
||||
label: "API Key",
|
||||
placeholder: "",
|
||||
editorValue: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ========== Third Party Partners ==========
|
||||
{
|
||||
name: "PackyCode",
|
||||
websiteUrl: "https://www.packyapi.com",
|
||||
apiKeyUrl: "https://www.packyapi.com/register?aff=cc-switch",
|
||||
settingsConfig: {
|
||||
baseUrl: "https://www.packyapi.com/v1",
|
||||
apiKey: "",
|
||||
api: "anthropic",
|
||||
models: [
|
||||
{ id: "claude-sonnet-4-5-20250929", name: "Claude Sonnet 4.5" },
|
||||
{ id: "claude-opus-4-5-20251101", name: "Claude Opus 4.5" },
|
||||
],
|
||||
},
|
||||
category: "third_party",
|
||||
isPartner: true,
|
||||
partnerPromotionKey: "packycode",
|
||||
icon: "packycode",
|
||||
templateValues: {
|
||||
apiKey: {
|
||||
label: "API Key",
|
||||
placeholder: "",
|
||||
editorValue: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Cubence",
|
||||
websiteUrl: "https://cubence.com",
|
||||
apiKeyUrl: "https://cubence.com/signup?code=CCSWITCH&source=ccs",
|
||||
settingsConfig: {
|
||||
baseUrl: "https://api.cubence.com/v1",
|
||||
apiKey: "",
|
||||
api: "anthropic",
|
||||
models: [
|
||||
{ id: "claude-sonnet-4-5-20250929", name: "Claude Sonnet 4.5" },
|
||||
{ id: "claude-opus-4-5-20251101", name: "Claude Opus 4.5" },
|
||||
],
|
||||
},
|
||||
category: "third_party",
|
||||
isPartner: true,
|
||||
partnerPromotionKey: "cubence",
|
||||
icon: "cubence",
|
||||
iconColor: "#000000",
|
||||
templateValues: {
|
||||
apiKey: {
|
||||
label: "API Key",
|
||||
placeholder: "",
|
||||
editorValue: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "AIGoCode",
|
||||
websiteUrl: "https://aigocode.com",
|
||||
apiKeyUrl: "https://aigocode.com/invite/CC-SWITCH",
|
||||
settingsConfig: {
|
||||
baseUrl: "https://api.aigocode.com/v1",
|
||||
apiKey: "",
|
||||
api: "anthropic",
|
||||
models: [
|
||||
{ id: "claude-sonnet-4-5-20250929", name: "Claude Sonnet 4.5" },
|
||||
{ id: "claude-opus-4-5-20251101", name: "Claude Opus 4.5" },
|
||||
],
|
||||
},
|
||||
category: "third_party",
|
||||
isPartner: true,
|
||||
partnerPromotionKey: "aigocode",
|
||||
icon: "aigocode",
|
||||
iconColor: "#5B7FFF",
|
||||
templateValues: {
|
||||
apiKey: {
|
||||
label: "API Key",
|
||||
placeholder: "",
|
||||
editorValue: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ========== Custom Template ==========
|
||||
{
|
||||
name: "OpenAI Compatible",
|
||||
websiteUrl: "",
|
||||
settingsConfig: {
|
||||
baseUrl: "",
|
||||
apiKey: "",
|
||||
api: "openai-completions",
|
||||
models: [],
|
||||
},
|
||||
category: "custom",
|
||||
isCustomTemplate: true,
|
||||
icon: "generic",
|
||||
iconColor: "#6B7280",
|
||||
templateValues: {
|
||||
baseUrl: {
|
||||
label: "Base URL",
|
||||
placeholder: "https://api.example.com/v1",
|
||||
editorValue: "",
|
||||
},
|
||||
apiKey: {
|
||||
label: "API Key",
|
||||
placeholder: "",
|
||||
editorValue: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user