mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
feat(xai): add Grok OAuth presets for Claude and Claude Desktop
Register the xai_oauth provider type constant and add xAI (Grok) presets targeting grok-4.5. The Desktop preset routes branded claude-* model IDs to grok-4.5 upstream so it passes Desktop's third-party model validation.
This commit is contained in:
@@ -56,7 +56,7 @@ export interface ClaudeDesktopProviderPreset {
|
||||
mode: "direct" | "proxy";
|
||||
apiFormat?: ClaudeDesktopApiFormat;
|
||||
modelRoutes?: ClaudeDesktopRoutePreset[];
|
||||
providerType?: "github_copilot" | "codex_oauth";
|
||||
providerType?: "github_copilot" | "codex_oauth" | "xai_oauth";
|
||||
requiresOAuth?: boolean;
|
||||
|
||||
endpointCandidates?: string[];
|
||||
@@ -398,6 +398,19 @@ export const claudeDesktopProviderPresets: ClaudeDesktopProviderPreset[] = [
|
||||
icon: "openai",
|
||||
iconColor: "#000000",
|
||||
},
|
||||
{
|
||||
name: "xAI (Grok)",
|
||||
websiteUrl: "https://x.ai/grok",
|
||||
category: "third_party",
|
||||
baseUrl: "https://api.x.ai/v1",
|
||||
mode: "proxy",
|
||||
apiFormat: "openai_responses",
|
||||
providerType: "xai_oauth",
|
||||
requiresOAuth: true,
|
||||
modelRoutes: brandedRoutes("grok-4.5", "grok-4.5", "grok-4.5"),
|
||||
icon: "xai",
|
||||
iconColor: "#000000",
|
||||
},
|
||||
{
|
||||
name: "DeepSeek",
|
||||
websiteUrl: "https://platform.deepseek.com",
|
||||
|
||||
@@ -60,7 +60,7 @@ export interface ProviderPreset {
|
||||
// 供应商类型标识(用于特殊供应商检测)
|
||||
// - "github_copilot": GitHub Copilot 供应商(需要 OAuth 认证)
|
||||
// - "codex_oauth": OpenAI Codex via ChatGPT Plus/Pro 反代(需要 OAuth 认证)
|
||||
providerType?: "github_copilot" | "codex_oauth";
|
||||
providerType?: "github_copilot" | "codex_oauth" | "xai_oauth";
|
||||
|
||||
// 是否需要 OAuth 认证(而非 API Key)
|
||||
requiresOAuth?: boolean;
|
||||
@@ -1269,6 +1269,26 @@ export const providerPresets: ProviderPreset[] = [
|
||||
icon: "openai",
|
||||
iconColor: "#000000",
|
||||
},
|
||||
{
|
||||
name: "xAI (Grok)",
|
||||
websiteUrl: "https://x.ai/grok",
|
||||
settingsConfig: {
|
||||
env: {
|
||||
// The proxy enforces both this origin and the Responses wire format.
|
||||
ANTHROPIC_BASE_URL: "https://api.x.ai/v1",
|
||||
ANTHROPIC_MODEL: "grok-4.5",
|
||||
ANTHROPIC_DEFAULT_HAIKU_MODEL: "grok-4.5",
|
||||
ANTHROPIC_DEFAULT_SONNET_MODEL: "grok-4.5",
|
||||
ANTHROPIC_DEFAULT_OPUS_MODEL: "grok-4.5",
|
||||
},
|
||||
},
|
||||
category: "third_party",
|
||||
apiFormat: "openai_responses",
|
||||
providerType: "xai_oauth",
|
||||
requiresOAuth: true,
|
||||
icon: "xai",
|
||||
iconColor: "#000000",
|
||||
},
|
||||
{
|
||||
name: "Nvidia",
|
||||
websiteUrl: "https://build.nvidia.com",
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
export const PROVIDER_TYPES = {
|
||||
GITHUB_COPILOT: "github_copilot",
|
||||
CODEX_OAUTH: "codex_oauth",
|
||||
XAI_OAUTH: "xai_oauth",
|
||||
} as const;
|
||||
|
||||
// 用量脚本模板类型常量
|
||||
|
||||
Reference in New Issue
Block a user