mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-29 02:01:50 +08:00
feat(claude): route OpenCode Go preset directly to /messages
/v1/messages only accepts x-api-key: switch env from ANTHROPIC_AUTH_TOKEN to ANTHROPIC_API_KEY and add top-level apiKeyField. Drop apiFormat so Claude Code connects directly (providerNeedsRouting no longer triggers) instead of through the proxy. Desktop keeps mode: proxy (it cannot rename models itself) but switches to anthropic passthrough.
This commit is contained in:
@@ -831,7 +831,9 @@ export const claudeDesktopProviderPresets: ClaudeDesktopProviderPreset[] = [
|
||||
category: "third_party",
|
||||
baseUrl: "https://opencode.ai/zen/go",
|
||||
mode: "proxy",
|
||||
apiFormat: "openai_chat",
|
||||
// Go 网关 /messages 收除 grok-4.5 外全部模型(Chat 组靠服务端转换),
|
||||
// anthropic 透传即可;上游只认 x-api-key,apiKey 直填默认即该头。
|
||||
apiFormat: "anthropic",
|
||||
modelRoutes: brandedRoutes(
|
||||
"deepseek-v4-flash",
|
||||
"deepseek-v4-flash",
|
||||
|
||||
@@ -832,10 +832,15 @@ export const providerPresets: ProviderPreset[] = [
|
||||
websiteUrl: "https://opencode.ai/go",
|
||||
apiKeyUrl: "https://opencode.ai/go?ref=2YTRG2NGTX",
|
||||
partnerPromotionKey: "opencode_go",
|
||||
// Go 网关 /v1/messages 只认 x-api-key(Bearer 被静默忽略),
|
||||
// 必须用 ANTHROPIC_API_KEY,不能换回 ANTHROPIC_AUTH_TOKEN。
|
||||
// 直连 Anthropic 端点可用除 grok-4.5 外的全部 Go 模型;
|
||||
// Chat 组模型(DeepSeek/GLM/Kimi 等)依赖网关服务端格式转换(未见文档承诺)。
|
||||
apiKeyField: "ANTHROPIC_API_KEY",
|
||||
settingsConfig: {
|
||||
env: {
|
||||
ANTHROPIC_BASE_URL: "https://opencode.ai/zen/go",
|
||||
ANTHROPIC_AUTH_TOKEN: "",
|
||||
ANTHROPIC_API_KEY: "",
|
||||
ANTHROPIC_MODEL: "deepseek-v4-flash",
|
||||
ANTHROPIC_DEFAULT_HAIKU_MODEL: "deepseek-v4-flash",
|
||||
ANTHROPIC_DEFAULT_SONNET_MODEL: "deepseek-v4-flash",
|
||||
@@ -843,7 +848,6 @@ export const providerPresets: ProviderPreset[] = [
|
||||
},
|
||||
},
|
||||
category: "third_party",
|
||||
apiFormat: "openai_chat",
|
||||
endpointCandidates: ["https://opencode.ai/zen/go"],
|
||||
icon: "opencode",
|
||||
iconColor: "#211E1E",
|
||||
|
||||
Reference in New Issue
Block a user