直接答案
sing-box 使用 JSON 配置而不是 Clash 的 YAML,多数服务商提供 sing-box 格式订阅或可通过订阅转换生成。流程:安装官方客户端(SFI / SFA / SFM / SFW)→ 添加配置(远程 URL)→ 启动。TUN 模式是 sing-box 的默认工作方式,天然适合 Codex、Claude Code 等终端工具;AI 域名固定节点在 route.rules 中添加 domain_suffix 规则即可。
目录
各平台客户端
| 平台 | 客户端 |
|---|---|
| iOS | sing-box(App Store,非大陆区) |
| Android | sing-box for Android |
| macOS | sing-box for macOS |
| Windows | sing-box 命令行 + 第三方 GUI |
第一步:获取配置
- 服务商提供 sing-box 订阅 → 直接使用。
- 只有 Clash 订阅 → 通过订阅转换生成 sing-box JSON。
第二步:添加配置
客户端「Profiles → New Profile → Remote」,填入配置 URL,设置自动更新。
第三步:启动
选择配置后点击启动,系统请求 VPN / TUN 权限,允许后即生效。
配置结构速览
{
"inbounds": [{ "type": "tun", "auto_route": true }],
"outbounds": [
{ "type": "selector", "tag": "proxy", "outbounds": ["US-01", "JP-01"] },
{ "type": "selector", "tag": "ai", "outbounds": ["US-01"] }
],
"route": {
"rules": [
{ "domain_suffix": ["openai.com", "chatgpt.com", "anthropic.com", "claude.ai"], "outbound": "ai" }
],
"final": "proxy"
}
}
ai 选择器把 AI 域名固定到指定节点,这是 Codex、Claude Code 用户最需要的设置。
常见错误
- JSON 逗号或引号错误 →
sing-box check。 - 规则集下载失败 → 需要代理时先用其他方式联网。
- 无法上网 → 检查
auto_route与 DNS 配置。
其他客户端的对比见 Clash Verge 使用教程;协议差异见 代理协议对比。
常见问题
服务商没有 sing-box 订阅怎么办?
使用支持 sing-box 输出的订阅转换工具,将 Clash 订阅转换为 sing-box JSON。
sing-box 与 Clash 系客户端怎么选?
需要多平台一致、TUN 优先、协议支持最新,选 sing-box;需要图形化规则编辑与策略组切换,选 Clash Verge。
配置启动报错?
多为 JSON 语法或版本不兼容。用 sing-box check -c config.json 定位错误。