VPSDance/ai-proxy-rules

AI 服务分流规则聚合: 多源合并 | 按 provider 精修 | 每日自动同步. 覆盖 OpenAI / Anthropic / Gemini / Cursor / Copilot 等主流 AI 服务, 适配 Clash / Mihomo / sing-box / Surge 等主流客户端.

What It Is

The project publishes ready-made traffic-routing rule lists for AI services. These are the kind of rules a proxy tool (like Clash, Surge, or sing-box) uses to decide which traffic goes through a proxy (e.g., overseas AI services) and which goes direct (e.g., Chinese AI services).

It merges and deduplicates sources from upstream projects like v2fly and blackmatrix7, and adds extra sources for popular services such as OpenAI and Anthropic to fill gaps and fix mistakes. The rules are regenerated automatically every day.

How Rules Are Organized

There are four ways to pick a rule set:

  • By scope: all (everything), global (overseas AI services), cn (Chinese AI services)
  • By purpose: coding (programming tools), model (models & APIs), media (image/video/audio generators) — each includes both China and overseas services
  • By region + purpose: prefix the purpose with global- or cn-, e.g., global-coding (overseas coding tools) or cn-model (Chinese models)
  • By single service: e.g., openai, anthropic, deepseek, and many more (full list is in the README)

How to Use the Subscription Links

The README gives URLs hosted on jsDelivr (a CDN). To get a different rule set, replace the word global in the URL with the rule set name, keeping the file extension. Examples:

  • https://cdn.jsdelivr.net/gh/VPSDance/ai-proxy-rules@main/rules/clash/global.yaml — the global set for Clash
  • https://cdn.jsdelivr.net/gh/VPSDance/ai-proxy-rules@main/rules/clash/anthropic.yaml — Anthropic/Claude rules for Clash

You add the URL in your client's rule subscription, rule-set, or rule-provider feature. For Clash/Mihomo via rule-provider, the README instructs setting behavior: classical. If jsDelivr is slow in China, mirror hostnames like testingcf.jsdelivr.net or fastly.jsdelivr.net can be substituted.

Routing Order

Rules match from top to bottom — the first matching rule wins. The README shows this Clash/Mihomo snippet:

rules:
  - RULE-SET,openai,AI-US        # OpenAI uses AI-US
  - RULE-SET,global,AI-OVERSEAS  # all other overseas AI uses AI-OVERSEAS

openai / global are the rule set names you subscribed to; AI-US / AI-OVERSEAS are placeholders for your own proxy group names.

Supported Services

The README lists two categories:

Overseas AI services (global) — includes OpenAI/ChatGPT, Anthropic/Claude, Google Gemini, xAI/Grok, Meta AI, Mistral, Hugging Face, Hugging Face, OpenRouter, GitHub Copilot, Cursor, Midjourney, Suno, Runway, Perplexity, ElevenLabs, and many more. Each service is tagged by purpose: coding, model, or media.

Chinese AI services (cn) — includes DeepSeek, Moonshot/Kimi, Zhipu/GLM, Alibaba Qwen, Baidu Qianfan, Tencent Hunyuan, ByteDance AI (Trae/Coze/MarsCode), Xiaomi AI, and others, each with its Chinese brand name noted.

How It Works Internally

The repository is organized as:

  • data/sources/ — manually maintained source configs
  • data/providers/ — provider data generated from those sources
  • data/cache/ — cached upstream responses, used as a fallback if an upstream fails
  • scripts/ — the sync and generation scripts
  • rules/ — the auto-generated rule files

Maintenance commands are pnpm sync (pull upstream data) and pnpm generate (build rule files), plus pnpm check and pnpm test for verification. GitHub Actions automatically runs the sync, check, and generation when relevant files change, and commits any resulting changes to data/ or rules/.

No Extras

The README includes no license, no contribution guide, no install instructions beyond the pnpm commands, and no usage examples beyond the Clash snippet. The project's own documentation consists solely of the README. The References section lists upstream projects and IP databases used: anthropic-claude-surge-rules-set, ip.net.coffee, Anthropic docs, bgp.he.net, blackmatrix7/ios_rule_script, v2fly/domain-list-community, and SkywalkerJi/Clash-Rules.

Related

  • Project
  • Project
  • Project
  • Project