openclaw使用CLI Proxy API报connection error

使用curl命令直接对话都有响应,配置到claude codex也能正常使用,但是配置到openclaw中就报错,有哪位佬友知道怎么办吗?

09:51:42 debug agent/embedded {“subsystem”:“agent/embedded”} embedded run agent start: runId=51b9d2f5-b494-48ad-a066-9455f41cac95
09:51:43 warn agent/embedded {“subsystem”:“agent/embedded”} embedded run agent end: runId=51b9d2f5-b494-48ad-a066-9455f41cac95 isError=true error=Connec

==============================2026-03-13===========================
问题解决,参考配置:
“local”: {
“baseUrl”: “http://127.0.0.1:8317/v1”,
“apiKey”: “your-api-key-3”,
“api”: “openai-responses”,
“authHeader”: true,
“headers”: {
“User-Agent”: “codex_cli_rs/0.104.0 (Ubuntu 24.4.0; x86_64)”
},
“models”: [
{
“id”: “gpt-5.2”,
“name”: “gpt-5.2”,
“reasoning”: true,
“input”: [
“text”,
“image”
],
“cost”: {
“input”: 0,
“output”: 0,
“cacheRead”: 0,
“cacheWrite”: 0
}
},

10 个赞

可以试试看同机部署? 我是同一个机器部署的这两个

2 个赞

是同机,都在同一个虚拟机,cpa openclaw claudecode codex

1 个赞

cliproxyapi是docker部署的吗? 可以尝试填docker内的IP地址

1 个赞

改 ua 头,看这个

1 个赞

你检查一下~/.openclaw/agents/main/agent/models.json这个文件中的cliproxy.baseUrl的地址对不对,我也和你一样的问题,后来发现修改.openclaw/openclaw.json中的配置的cliproxy的url时上面那个文件中的不会同步修改,手动把那个model.json中的路径修改了就能解决问题。

感谢各位佬,上面的方法都试了还是connection error。github有人提了类似issue,可能还得官方修复:Transient APIConnectionError surfaced to user channel instead of being handled silently · Issue #15083 · openclaw/openclaw · GitHub

看着不像一个问题呢?

之前看到有佬友说要用https,现在改成http好了,反复验证了一下就是https的问题

根因:https://localhost:8317 — HTTPS + localhost 自签名证书

你的配置:

“baseUrl”: “https://localhost:8317/v1”,

用的是 https://。Node.js 的 globalThis.fetch(底层 undici)强制验证 TLS 证书。连接 https://localhost:8317 时:

  1. TCP 连接到 localhost:8317 成功
  2. TLS 握手开始
  3. Node.js 验证服务端证书 → 失败(自签名证书 / 本地服务根本不支持 TLS)
  4. TLS 握手中断,HTTP 请求根本没有发出
  5. 你的 API 后台看到了 TCP 连接但看不到任何 HTTP 请求

这正好解释了你描述的全部现象:

  • 服务在跑 ✓
  • curl 通(curl -k 或 curl 忽略了证书验证) ✓
  • API 后台看不到请求(TLS 层就失败了,HTTP 层根本没到达) ✓
  • “Connection error.” ✓
1 个赞