• 请不要在回答技术问题时复制粘贴 AI 生成的内容
hcqenjoy2
V2EX  ›  程序员

求助 claude code 升级为 2.1.222 后,无法使用自定义供应商

  •  
  •   hcqenjoy2 · 20 days ago · 2463 views

    claude code 好几天不升级,一升级就用不了了,原来 2.1.220 用第三方没问题,升级 2.1.221 2.1.220 提示 API error 和✻ Unable to connect to API (ECONNRESET) 查了半天 没有解决,无代理 和 代理情况下都不行, 是官方限制了?还是需要调整配置?有没有遇到同样问题的 使用 CC-Switch 管理配置

    11 replies    2026-08-25 17:22:30 +08:00
    xiaomushen
        1
    xiaomushen  
       20 days ago
    刚刚从 221 升级到 222 ,没有任何问题
    linzyu2
        2
    linzyu2  
       20 days ago
    刚刚升级到 222 ,可以用 cc switch 配置第三方供应商
    BaiMiao
        3
    BaiMiao  
       20 days ago
    2.1.222 版本,没有遇到,你有配置全局出站代理吗?
    hcqenjoy2
        4
    hcqenjoy2  
    OP
       20 days ago
    用 2.1.220 版本 拉了 npx -y @anthropic-ai/[email protected] 测试,用火山的 glm5.2 给了个这么个结论

    版本对照

    ┌──────────────────────┬──────────────────┬────────────────────────────────────────────────┐
    │ 版本 │ 测试 │ 结果 │
    ├──────────────────────┼──────────────────┼────────────────────────────────────────────────┤
    │ 2.1.222 │ 极简 "hi" │ 4/4 必现 ECONNRESET(first chunk → 11ms 内 RST) │
    ├──────────────────────┼──────────────────┼────────────────────────────────────────────────┤
    │ 2.1.220 │ 1000 字长文 ×6 次 │ 0/6 RST,全部一次成功 │
    ├──────────────────────┼──────────────────┼────────────────────────────────────────────────┤
    │ 裸 Python urllib │ 20+ 次 │ 0 RST │
    ├──────────────────────┼──────────────────┼────────────────────────────────────────────────┤
    │ 裸 Node undici/fetch │ 8 次 │ 0 RST │
    └──────────────────────┴──────────────────┴────────────────────────────────────────────────┘

    根因

    ECONNRESET 是 2.1.222 的客户端 transport bug,不是 Ark / 代理 / 请求内容问题。

    - 2.1.222 changelog item 4 把 API 请求改用 "proxy-aware transport"。这个新 transport 在火山方舟 relay 下,收到第一个 SSE chunk 后 ~11ms 内必然 ECONNRESET 。
    - 极简 "hi" 也必现 → 与 body 规模/tools/system/thinking 全部无关。
    - 裸 Python/Node 同一网络同栈都不 RST → 不是网络或代理。
    - 2.1.220 同 prompt 6/6 零 RST → 纯粹是 2.1.222 客户端 regression 。

    修复建议

    1. 保持 2.1.220,不要升级 2.1.222 ✅(你已正确降级)。这就是"2.1.222 不能用"的真正原因。
    2. 你当前 2.1.220 会话偶发的 attempt 6/10 是 Ark 端极低频间歇(控制测试 6 次零复现),重试通常恢复,可容忍。长会话累积大上下文时流式更长,暴露窗口略增。
    3. 若想进一步减少偶发:关闭 extended thinking(alwaysThinkingEnabled: false)可缩短单次流式时长,间接降低暴露--但治标,根因在 Ark 端。




    extended thinking(alwaysThinkingEnabled: false) 这个改了 还是不行,

    上面可以的朋友 你们用的哪个中转 我注册个试试
    jetsung
        5
    jetsung  
       20 days ago
    看看你是不是用了 cc switch 之类的,直接看 ~/.claude/settings.json 文件中的配置怎样
    Maxwe11
        6
    Maxwe11  
       20 days ago
    跟上面那个兄弟说的一样:

    1. 进去 claude 时,把 thinking 关掉;
    2. 在 cc 配置里,[body 覆盖]写上:
    '''
    {
    "thinking": {
    "type": "enabled"
    }
    }
    '''
    hcqenjoy2
        7
    hcqenjoy2  
    OP
       19 days ago
    {
    "alwaysThinkingEnabled": true,
    "effortLevel": "high",
    "enabledPlugins": {
    "andrej-karpathy-skills@karpathy-skills": true,
    "claude-hud@claude-hud": true,
    "claude-md-management@claude-plugins-official": true,
    "code-review@claude-plugins-official": true,
    "everything-claude-code@everything-claude-code": true,
    "jdtls-lsp@claude-plugins-official": true,
    "ralph-loop@claude-plugins-official": true,
    "skill-creator@claude-plugins-official": true,
    "superpowers@claude-plugins-official": true
    },
    "env": {
    "ANTHROPIC_AUTH_TOKEN": "ark-xxxxxxx-xxxxxxx-4bxxxxxxxx2a-xxxxxx-xxxxxx-6f588",
    "ANTHROPIC_BASE_URL": "https://ark.cn-beijing.volces.com/api/coding",
    "ANTHROPIC_DEFAULT_FABLE_MODEL": "minimax-m3",
    "ANTHROPIC_DEFAULT_FABLE_MODEL_NAME": "minimax-m3",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "minimax-m3",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME": "minimax-m3",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "minimax-m3",
    "ANTHROPIC_DEFAULT_OPUS_MODEL_NAME": "minimax-m3",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "minimax-m3",
    "ANTHROPIC_DEFAULT_SONNET_MODEL_NAME": "minimax-m3",
    "ANTHROPIC_MODEL": "minimax-m3",
    "API_TIMEOUT_MS": "3000000",
    "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "95",
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "140000",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "32768",
    "ECC_DISABLED_HOOKS": "pre:edit-write:gateguard-fact-force",
    "NO_PROXY": "*"
    },
    "extraKnownMarketplaces": {
    "claude-hud": {
    "source": {
    "repo": "jarrodwatts/claude-hud",
    "source": "github"
    }
    },
    "everything-claude-code": {
    "source": {
    "repo": "affaan-m/everything-claude-code",
    "source": "git",
    "url": "https://github.com/affaan-m/everything-claude-code.git"
    }
    },
    "karpathy-skills": {
    "source": {
    "repo": "forrestchang/andrej-karpathy-skills",
    "source": "github"
    }
    },
    "thedotmack": {
    "source": {
    "repo": "thedotmack/claude-mem",
    "source": "github"
    }
    }
    },
    "hooks": {
    "PostToolUse": [
    {
    "hooks": [
    {
    "command": "node \"C:/Users/hcq/.claude/hooks/gitnexus/gitnexus-hook.cjs\"",
    "statusMessage": "Checking GitNexus index freshness...",
    "timeout": 10,
    "type": "command"
    }
    ],
    "matcher": "Bash"
    }
    ],
    "PreToolUse": [
    {
    "hooks": [
    {
    "command": "npx [email protected]",
    "type": "command"
    }
    ],
    "matcher": "Bash"
    }
    ],
    "SessionStart": [
    {
    "hooks": [
    {
    "command": "bash -c 'if ! curl -s --noproxy \"*\" http://127.0.0.1:3210/health >/dev/null 2>&1; then echo \"[open-websearch] 端口 3210 未监听,正在启动...\"; PROXY_URL=http://127.0.0.1:7890 DEFAULT_SEARCH_ENGINE=bing DEFAULT_LIMIT=30 nohup npx -y open-websearch@latest serve --port 3210 >/dev/null 2>&1 & sleep 3; if curl -s --noproxy \"*\" http://127.0.0.1:3210/health >/dev/null 2>&1; then echo \"[open-websearch] 启动成功\"; else echo \"[open-websearch] 启动失败,请手动检查\"; fi; else echo \"[open-websearch] 已在运行 (端口 3210)\"; fi'",
    "timeout": 15,
    "type": "command"
    }
    ],
    "matcher": "*"
    }
    ]
    },
    "includeCoAuthoredBy": false,
    "model": "glm-5",
    "permissions": {
    "allow": [
    "mcp__codegraph__codegraph_explore",
    "mcp__codegraph__codegraph_search",
    "mcp__codegraph__codegraph_node",
    "mcp__codegraph__codegraph_callers",
    "mcp__codegraph__codegraph_callees",
    "mcp__codegraph__codegraph_impact",
    "mcp__codegraph__codegraph_files",
    "mcp__codegraph__codegraph_status"
    ],
    "defaultMode": "bypassPermissions"
    },
    "skipDangerousModePermissionPrompt": true,
    "statusLine": {
    "command": "bash -c 'plugin_dir=$(ls -d \"${CLAUDE_CONFIG_DIR:-$HOME/.claude}\"/plugins/cache/claude-hud/claude-hud/*/ 2>/dev/null | awk -F/ '\"'\"'{ print $(NF-1) \"\\t\" $(0) }'\"'\"' | sort -t. -k1,1n -k2,2n -k3,3n -k4,4n | tail -1 | cut -f2-); exec \"/c/Program Files/nodejs/node\" \"${plugin_dir}dist/index.js\"'",
    "type": "command"
    },
    "theme": "auto"
    }
    hcqenjoy2
        8
    hcqenjoy2  
    OP
       19 days ago
    @Maxwe11 是在这样配置 就没问题??

    上面是 ~/.claude/settings.json 文件
    Maxwe11
        9
    Maxwe11  
       19 days ago
    @hcqenjoy2 不能完全确认,只能试试,这个主要还是 claude 和供应商 api 的兼容问题:

    1. 最上面:
    "alwaysThinkingEnabled": true, /* 改成 false */
    "effortLevel": "high", /* 删掉这行配置 */

    2. cc 的配置供应商页面里(我没有 windows ,不太清楚界面是否是完全一样的,以 mac 版为例,但内容是一样的),你找一下“本地代理请求覆盖”,下面有两个覆盖块,一个是 Header 覆盖,一个是 Body 覆盖,把 thinking 写在 body 覆盖里:
    {
    "thinking": {
    "type": "enabled"
    }
    }

    前提:假设你连的是 openai 兼容协议的服务,而且也只能尝试覆盖保留思考能力,因为每个供应商的协议部分格式可能有细微不同,理想情况是这样能运行了,但是不保证运行质量,这是较为通用的处理办法,如果还不行就只能用供应商给的文档分析它具体是怎么传的了。

    只能试试,实在不行,如果不是充了钱不得不用,那就换个供应商吧,或者换 pi 之类的 code agent 跑,没 claude 这么狗。
    yy417168602
        10
    yy417168602  
       15h 34m ago
    兄弟你解决了吗 ,一模一样我研究了半天,发现也是这样的 221 就有问题,220 就是好的
    yy417168602
        11
    yy417168602  
       12h 56m ago
    兄弟我找到原因了,Bun 底层的 Socket 实现与 Windows 系统中残留的第三方 Winsock LSP (分层服务提供者)发生严重冲突,导致在流式传输( SSE )读取到第 1 个包时被 LSP 强行 RST 重置( ECONNRESET / The socket connection was closed unexpectedly )。

    详情看下面这个 github issue
    https://github.com/anthropics/claude-code/issues/84211
    看看电脑有没有装什么加速器或者抓包工具之类的

    执行这个命令 netsh winsock reset 然后重启电脑就好了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   986 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 22:18 · PVG 06:18 · LAX 15:18 · JFK 18:18
    ♥ Do have faith in what you're doing.