Clash Verge full config
This page is for when you were given a subscription that already carries the routing rules, such as a /clash/… link generated by a 3x-ui panel. If you only want to merge the AI rules into your own config, Clash / mihomo is all you need.
Routing
The groups and rules in such a subscription are Clash/template.yaml. Group names are in Chinese because the users are:
| Group | Options | Default | Traffic |
|---|---|---|---|
♻️ 节点 (nodes) | every node in the subscription | first node | Claude, OpenAI, claude.exe — always proxied (no DIRECT in this group) |
🌍 大陆境外网站(香港选直连,大陆选节点) (sites outside mainland China) | DIRECT / ♻️ 节点 / subscriptions you add | DIRECT | Google, YouTube, Telegram, blocked sites, non-CN TLDs |
🏠 其他流量(默认直连,香港建议直连) (everything else) | DIRECT / 🌍 大陆境外网站 | DIRECT | whatever matched nothing above |
Mainland China sites, LAN and Apple / iCloud always go direct.
Install Clash Verge Rev
- Download from GitHub Releases:
x64-setup.exeon Windows,aarch64.dmgon Apple silicon Macs,x64.dmgon Intel Macs. - Open Profiles, paste the
/clash/…link, click Import, then click the profile card to make it active. - In Settings, install Service Mode first, then turn on TUN mode. Browsers, terminals and IDEs are then all covered without per-app proxy settings.
- Done. The rules are maintained upstream and the profile refreshes on the interval the subscription sets; right-click the card → Update to refresh now.
- To stop: turn TUN off, or quit Clash Verge from the tray icon.
Adding other subscriptions (extension script)
Clash Verge uses one profile at a time. To also use nodes from another subscription — your own VPN for Google and YouTube, say, while AI keeps using the profile above — keep the active profile as it is and inject the others as node sources into a group. Fill in the form and copy the script:
// Clash Verge Rev 扩展脚本 / extension script
// https://ma-wenqian.github.io/ai-proxy-rules/zh/guide/clash-verge
// 每个订阅作为 proxy-provider 加进指定的组;节点名前面加 [名字],不同订阅的同名节点不会冲突。
const SUBS = [
// fill in a subscription link above
];
function main(config, profileName) {
const groups = config["proxy-groups"] || [];
const providers = { ...(config["proxy-providers"] || {}) };
for (const s of SUBS) {
if (!s.url.startsWith("https://")) continue;
// 先按全名找;组名改过措辞时退回按开头的 emoji 找(emoji 不变)
const group = groups.find((g) => g.name === s.group) || groups.find((g) => [...g.name][0] === [...s.group][0]);
if (!group) continue; // 当前订阅里没有这个组:跳过,别让整份配置加载失败
providers[s.name] = {
type: "http",
url: s.url,
interval: 86400,
path: `./proxy_providers/${encodeURIComponent(s.name)}.yaml`,
override: { "additional-prefix": `[${s.name}] ` },
"health-check": { enable: true, url: "https://www.gstatic.com/generate_204", interval: 600 },
};
group.use = [...new Set([...(group.use || []), s.name])];
}
config["proxy-providers"] = providers;
return config;
}
The script is built in this page only. Your links are not sent anywhere.
Where to paste it:
| Where | Applies to | When |
|---|---|---|
| Right-click the profile card → Extend Script | that profile only | usually this |
| Global Extend Script on the Profiles page | every profile | you switch between profiles and want the nodes in all of them |
Replace everything in the editor with the copied script and save. In Proxies, the group you picked now lists nodes starting with [name] ….
You only paste it once: on every refresh Clash Verge downloads the profile, runs the script, then loads the result, so upstream rule changes never drop the nodes you added.
What the script does
It adds each subscription as a proxy-provider (nodes only, that subscription's own rules are ignored) and appends it to the chosen group's use. Nothing else changes. If the active profile has no group with that name, the entry is skipped instead of breaking the whole config.
Plain mihomo, no Verge
Use Clash/template.yaml as the body of your config and add a node source. ♻️ 节点 uses include-all-proxies, which only sees nodes written under proxies:; with a subscription link, switch it to use:
proxy-providers:
my-sub:
type: http
url: "https://your-subscription-link"
interval: 43200
path: ./proxy_providers/my-sub.yaml
proxy-groups:
- name: ♻️ 节点
type: select
use: [my-sub]
# the other groups, rule-providers and rules as in the templateNotes
- Don't rename the groups. Rules and the extension script find groups by name; a renamed group makes the config fail to load.
- Meta kernel only (mihomo: Clash Verge Rev, FlClash, Clash Meta for Android). Old Clash for Windows doesn't understand
include-all-proxies. - Rule sets download straight from jsDelivr, not through a node. If jsDelivr is unreachable there is no error, the rules just don't match — with the two AI lists missing, Claude / OpenAI fall through to direct. If AI suddenly stops working, check the rule sets in the Rules page first.