openclaw - 💡(How to fix) Fix [Bug]: 【Bug修复】OpenClaw Gateway模式下newapi自定义提供商报network connection error [1 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#61799Fetched 2026-04-08 02:54:20
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
labeled ×1

Error Message

  1. Gateway模式失败:默认不带--local参数时报错:LLM request failed: network connection error.

Code Example

<!-- 代理配置 -->
<key>HTTP_PROXY</key>
<string>http://127.0.0.1:7890</string>
<key>HTTPS_PROXY</key>
<string>http://127.0.0.1:7890</string>
<key>ALL_PROXY</key>
<string>socks5://127.0.0.1:7890</string>
<!-- 内网网段不走代理 -->
<key>NO_PROXY</key>
<string>localhost,127.0.0.1,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12</string>

### Actual behavior

## 验证步骤
1. 重新加载服务配置:

---

2. 测试调用:

---

3. ✅ 成功返回`pong`表示修复完成

### OpenClaw version

OpenClaw | 2026.4.1 (da64a97) |

### Operating system

MacOS 26.3.1

### Install method

npm

### Model

all

### Provider / routing chain

local/newapi

### Additional provider/model setup details

_No response_

### Logs, screenshots, and evidence
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

问题现象

  1. 已正确配置newapi自定义提供商:
    • 协议:anthropic-messages
    • 地址:http://192.168.88.2:3000/v1
    • 模型:glm-5.1
  2. 本地模式正常openclaw agent --local --agent main -m "pong" 成功返回 pong
  3. Gateway模式失败:默认不带--local参数时报错:LLM request failed: network connection error.
  4. 日志确认:Gateway已成功加载newapi/glm-5.1模型配置,排除配置加载错误

Steps to reproduce

根因分析

  • macOS LaunchAgent系统服务运行在独立的沙箱网络上下文,不会继承当前用户shell的代理配置
  • 内网newapi服务需要经过本地代理访问,Gateway进程默认无代理配置导致网络不通
  • auth.profiles.zai:default陈旧配置不影响新provider加载,非根因

Expected behavior

解决方案

修改系统LaunchAgent配置文件 ~/Library/LaunchAgents/ai.openclaw.gateway.plist,在EnvironmentVariables节点下添加代理配置:

<!-- 代理配置 -->
<key>HTTP_PROXY</key>
<string>http://127.0.0.1:7890</string>
<key>HTTPS_PROXY</key>
<string>http://127.0.0.1:7890</string>
<key>ALL_PROXY</key>
<string>socks5://127.0.0.1:7890</string>
<!-- 内网网段不走代理 -->
<key>NO_PROXY</key>
<string>localhost,127.0.0.1,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12</string>

### Actual behavior

## 验证步骤
1. 重新加载服务配置:
   ```bash
   launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist && launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist
  1. 测试调用:
    openclaw agent --agent main -m "pong"
  2. ✅ 成功返回pong表示修复完成

OpenClaw version

OpenClaw | 2026.4.1 (da64a97) |

Operating system

MacOS 26.3.1

Install method

npm

Model

all

Provider / routing chain

local/newapi

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

Modify the LaunchAgent configuration file to include proxy settings to resolve the network connection error.

Guidance

  • Identify the proxy configuration required for your network setup and add it to the ~/Library/LaunchAgents/ai.openclaw.gateway.plist file.
  • Ensure the HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, and NO_PROXY environment variables are correctly set in the configuration file.
  • Reload the LaunchAgent configuration after making changes to apply the new settings.
  • Verify the fix by testing the openclaw agent command without the --local parameter.

Example

<key>EnvironmentVariables</key>
<dict>
    <key>HTTP_PROXY</key>
    <string>http://127.0.0.1:7890</string>
    <key>HTTPS_PROXY</key>
    <string>http://127.0.0.1:7890</string>
    <key>ALL_PROXY</key>
    <string>socks5://127.0.0.1:7890</string>
    <key>NO_PROXY</key>
    <string>localhost,127.0.0.1,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12</string>
</dict>

Notes

The provided solution assumes that the proxy configuration is the root cause of the issue. If the problem persists after applying the fix, further investigation into the network setup and LaunchAgent configuration may be necessary.

Recommendation

Apply the workaround by modifying the LaunchAgent configuration file to include the proxy settings, as this is the most likely cause of the network connection error.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING