Next-Generation Fully Isolated VM-Level AI Subscription-to-API Gateway
🇨🇳 简体中文 • 🇬🇧 English • 📖 入门文档 • 🗺️ 技术路线 • 🚀 部署指南 • 📊 干净度基准 • ☕ 支持捐赠
[!NOTE] vm2api 专为高可靠 AI 订阅转化为生产级标准 API 设计。摒弃传统的简单 HTTP 逆向与易被封禁的公用代理方案,采用全隔离虚拟机/容器环境 + 官方真实客户端进程常驻 + 真实硬件指纹拟真 + 单槽单独立网络出口 + 进槽前封控拦截,实现真正稳定、长效、高并发的订阅转 API 基础设施。
在当今大模型服务中,直接使用第三方逆向脚本或共享代理极易触发风控导致封号、降权与服务中断。vm2api 是业界领先的虚拟机级 API 转换中继系统:
/v1/chat/completions、/v1/responses 与 Anthropic /v1/messages 兼容接口,任何支持标准 API 的前端、Agent 或应用均可无缝接入。对照 1.3.133。自 1.3.122 起,调用方能直接碰到的变化如下。明细和升级注意见 CHANGELOG.md,操作说明见 入门文档。
telemetry_disabled === false。虚拟机页的遥测开关与这项一致,默认开时显示为开;非必要流量和 DNT 跟着它走,不能单独拨。claude-haiku-5-5 的默认上下文、max_tokens 和输出上限是 100K;已经改过的管理员值不会被重置。
zero(完全零注入)、official、official_full 到自定义改写模板的灵活切换,满足特殊上下文场景需求。/etc/machine-id。
进槽之前,/v1 和 count_tokens 先过管理台「风险审计」(/console/#/risk)。命中即返回错误,不选槽、不打上游。顺序不能调:
| 顺序 | 关 | 拦住什么 | 结果 |
|---|---|---|---|
| 1 | 蒸馏 | 收割模板、题目指纹、套取思维链的结构。OpenAI 平台模型不扫。默认再跳过官方 Claude Code 和 0 注入。 | 403,封 device |
| 2 | 硬正则 | 色情、破解、破限和自定义正则。蒸馏类正则跟蒸馏总开关:关掉硬正则仍拦这些短语,关掉蒸馏才放行;官方客户端和 0 注入仍扫,OpenAI 不扫。 | 403 |
| 3 | 拒答缓存 | 上游已经拒过的精确正文、近似正文,以及被封的 device。硬正则和决策模型自己的拦截不写入这张缓存。 | 400,不可重试,不是登录失效 |
| 4 | 决策模型 | 安全模型逐题打分,低于阈值才拦。打分失败默认放行,并在「放行出站」里标出来。 | 403 |
| 5 | 放行出站 | 前面都没拦。上游自己的拒答单独列出,用来看漏拦。 | 进入槽位 |
每关可看今日命中和拦截流水。点开一条对正文;误伤就收这道关,不要删槽。判定记在请求日志里。这一版之前的旧日志没有判定,显示为「未经关卡」。
细则:docs/RISK.md。
/v1/messages)、OpenAI 标准格式(/v1/chat/completions)或新版 /v1/responses 格式发起请求。
vm2api 严格遵循行业最严苛的纯净度基准。入站请求不泄露官方 CLI 身份、不外漏任何未授权的系统提示词与内部内置工具。
| 评测项 | 题目说明 | 判定 | 特性说明 |
|---|---|---|---|
| 01 工具列表 | 探测是否泄露内置系统工具 | 100% 干净 | 未声明 tools 时,绝不返回 CLI 内部文件/执行工具 |
| 02 视觉识图 | 多模态图片解析能力与身份 | 100% 干净 | 原生多模态解析,无任何外挂包装痕迹 |
| 03 网页搜索 | 联网检索与外部工具调用 | 100% 干净 | 准确触发原生 web_search 并智能核算真实计费 |
| 04 自我认知 | 探测模型系统提示词与底层身份 | 100% 干净 | 表现为纯净 Claude 官方模型能力 |
| 05 角色扮演 | 复杂业务指令与预设遵从性 | 100% 干净 | 100% 服从用户设定的 System 与对话角色 |
| 06 提示词探取 | 针对底层系统 Prompt 的逆向刺探 | 安全防护 | 0 注入架构天然免疫敏感系统词泄露 |
| 07 强制工具 | 客户端指定 tool_choice 严格调度 | 100% 干净 | 完美执行客户端自定义函数定义与结构化输出 |
完整测试套件与详细数据归档请参阅:docs/benchmarks/README.md。
推荐在 Ubuntu 24.04 LTS 环境使用官方 Docker Compose 一键启动。
# 生产环境一键拉取并安装
curl -sSL https://raw.githubusercontent.com/dofastted/vm2api/main/deploy/install.sh | sudo bash
# 以后更新
curl -sSL https://raw.githubusercontent.com/dofastted/vm2api/main/deploy/install.sh | sudo bash -s -- upgrade
ARM64(aarch64)主机用同一条命令,脚本自动选择 -arm64 控制面镜像并准备 QEMU;实验性支持,见 docs/ARM64.md。
mkdir -p /opt/vm2api && cd /opt/vm2api
curl -sSLO https://raw.githubusercontent.com/dofastted/vm2api/main/docker-compose.yml
curl -sSL -o .env https://raw.githubusercontent.com/dofastted/vm2api/main/.env.example
chmod 600 .env
# 按需修改 .env 中的关键变量(VM2API_API_KEY, VM2API_ADMIN_PASSWORD, VM2API_DB_SECRET)
docker compose pull && docker compose up -d
服务启动后,系统暴露统一服务端口(默认 8787):
http://<您的IP>:8787/console(默认账号:admin / 密码:123456 或自定义环境变量)GET http://<您的IP>:8787/healthPOST http://<您的IP>:8787/v1/messagesPOST http://<您的IP>:8787/v1/chat/completions# 调用示例(以 Anthropic 原生接口为例)
curl -sS http://127.0.0.1:8787/v1/messages \
-H "Authorization: Bearer $VM2API_API_KEY" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-5-5",
"max_tokens": 128000,
"messages": [{"role": "user", "content": "Hello!"}]
}'
vm2api 内置全栈自适应网关,原生支持以下所有主流生态:
| 协议入口 | 对应标准 | 兼容客户端与场景 |
|---|---|---|
/v1/messages | Anthropic Messages API | Claude 官方 SDK、Cursor、Continue、LibreChat、Roo Code |
/v1/chat/completions | OpenAI Chat API | NextChat、Open WebUI、Lobechat、LangChain、AutoGPT |
/v1/responses | OpenAI Responses API | 新一代结构化智能体与高级编码工具生态 |
/v1/models | 标准模型列表 API | 按密钥 group_type 列出可调度模型:openai 仅 GPT,anthropic 仅 Claude,all 与 master 两者都列 |
Traditional methods of converting AI subscriptions into API endpoints via simple reverse proxies frequently result in immediate account suspensions, stealth downgrades, and token corruption. vm2api is an enterprise-grade virtual machine gateway designed for ultra-reliable subscription-to-API infrastructure:
/v1/messages and OpenAI /v1/chat/completions / /v1/responses.Since 1.3.122, the caller-visible changes are:
telemetry_disabled === false. The VM switch matches that bit and is on for the default; nonessential traffic and DNT follow it.Details: CHANGELOG.md. Guide: vm2api.fkcodex.com/zh.
zero (pure zero-injection), official, official_full, and tailored templates./etc/machine-id.
/v1 and count_tokens pass the console Risk page (/console/#/risk) before any slot is chosen. A hit returns an error and does not spend upstream quota. The order is fixed:
| Order | Gate | What it stops | Result |
|---|---|---|---|
| 1 | Distill | Harvest templates, problem fingerprints, and chain-of-thought extraction shapes. OpenAI platform models are skipped. Official Claude Code and zero-injection are skipped by default. | 403, and the device is banned |
| 2 | Hard regex | NSFW, cracking, jailbreak, and custom patterns. Distill-category patterns follow the distill switch, not the hard-regex switch, and still scan official clients and zero-injection. OpenAI platform models skip that category. | 403 |
| 3 | Refusal cache | Exact text, similar text, and devices the upstream has already refused. Hard-regex and decision-model blocks are not stored here. | 400, non-retryable, not a login failure |
| 4 | Decision model | A safety model scores the text and blocks only below the threshold. If scoring fails, the request is allowed by default and marked on the pass column. | 403 |
| 5 | Passed egress | Everything the gates allowed. The upstream's own refusals are listed separately, so a miss is visible. | Enters a slot |
Open a hit and read the body. A false positive means tighten that gate, not delete the slot. Requests from before this recording show as unchecked. Full rules: docs/RISK.md.
| Test Item | Description | Evaluation | Core Result |
|---|---|---|---|
| 01 Tools List | Inspects CLI internal tools leakage | 100% Clean | Zero internal execution tools disclosed |
| 02 Vision | Multimodal image understanding | 100% Clean | Pure model vision without extra wrappers |
| 03 Web Search | Live internet search queries | 100% Clean | Native Anthropic web_search triggered accurately |
| 04 Identity | Persona & identity probe | 100% Clean | Clean Claude model identity preserved |
| 05 Roleplay | Custom system instructions | 100% Clean | 100% adherence to caller system definitions |
| 06 Prompt Leak | Probing underlying system prompts | Protected | Zero prompt injection protects core assets |
| 07 Forced Tools | Strict function calling with tool_choice | 100% Clean | Accurate schema formatting and execution |
# Recommended one-line installation on Ubuntu 24.04 LTS
curl -sSL https://raw.githubusercontent.com/dofastted/vm2api/main/deploy/install.sh | sudo bash
After deployment, access:
http://<YOUR_IP>:8787/consolehttp://<YOUR_IP>:8787/healthPOST http://<YOUR_IP>:8787/v1/messages提交 Issue 前请阅读 ISSUE_GUIDE.md,按“版本 → 复现路线 → 环境(VPS / 代理)→ VM 与请求日志 → 源码定位(可选)→ 脱敏”收集信息,再用 Bug 报告表单 提交。
Before opening an issue, follow ISSUE_GUIDE.md: version, reproduction steps, host/proxy environment, VM and request logs, optional source pointers — and redact all secrets.
开源与持续维护离不开社区大家的支持与反馈。如果您觉得 vm2api 为您的业务或学习带来了实质帮助, 交流群或请作者喝杯咖啡!
1,103 followers · starred Sep 2026
230 followers · starred Oct 2026
792 followers · starred Sep 2026
41 followers · starred Sep 2026
Next-Generation Fully Isolated VM-Level AI Subscription-to-API Gateway
🇨🇳 简体中文 • 🇬🇧 English • 📖 入门文档 • 🗺️ 技术路线 • 🚀 部署指南 • 📊 干净度基准 • ☕ 支持捐赠
[!NOTE] vm2api 专为高可靠 AI 订阅转化为生产级标准 API 设计。摒弃传统的简单 HTTP 逆向与易被封禁的公用代理方案,采用全隔离虚拟机/容器环境 + 官方真实客户端进程常驻 + 真实硬件指纹拟真 + 单槽单独立网络出口 + 进槽前封控拦截,实现真正稳定、长效、高并发的订阅转 API 基础设施。
在当今大模型服务中,直接使用第三方逆向脚本或共享代理极易触发风控导致封号、降权与服务中断。vm2api 是业界领先的虚拟机级 API 转换中继系统:
/v1/chat/completions、/v1/responses 与 Anthropic /v1/messages 兼容接口,任何支持标准 API 的前端、Agent 或应用均可无缝接入。对照 1.3.133。自 1.3.122 起,调用方能直接碰到的变化如下。明细和升级注意见 CHANGELOG.md,操作说明见 入门文档。
telemetry_disabled === false。虚拟机页的遥测开关与这项一致,默认开时显示为开;非必要流量和 DNT 跟着它走,不能单独拨。claude-haiku-5-5 的默认上下文、max_tokens 和输出上限是 100K;已经改过的管理员值不会被重置。
zero(完全零注入)、official、official_full 到自定义改写模板的灵活切换,满足特殊上下文场景需求。/etc/machine-id。
进槽之前,/v1 和 count_tokens 先过管理台「风险审计」(/console/#/risk)。命中即返回错误,不选槽、不打上游。顺序不能调:
| 顺序 | 关 | 拦住什么 | 结果 |
|---|---|---|---|
| 1 | 蒸馏 | 收割模板、题目指纹、套取思维链的结构。OpenAI 平台模型不扫。默认再跳过官方 Claude Code 和 0 注入。 | 403,封 device |
| 2 | 硬正则 | 色情、破解、破限和自定义正则。蒸馏类正则跟蒸馏总开关:关掉硬正则仍拦这些短语,关掉蒸馏才放行;官方客户端和 0 注入仍扫,OpenAI 不扫。 | 403 |
| 3 | 拒答缓存 | 上游已经拒过的精确正文、近似正文,以及被封的 device。硬正则和决策模型自己的拦截不写入这张缓存。 | 400,不可重试,不是登录失效 |
| 4 | 决策模型 | 安全模型逐题打分,低于阈值才拦。打分失败默认放行,并在「放行出站」里标出来。 | 403 |
| 5 | 放行出站 | 前面都没拦。上游自己的拒答单独列出,用来看漏拦。 | 进入槽位 |
每关可看今日命中和拦截流水。点开一条对正文;误伤就收这道关,不要删槽。判定记在请求日志里。这一版之前的旧日志没有判定,显示为「未经关卡」。
细则:docs/RISK.md。
/v1/messages)、OpenAI 标准格式(/v1/chat/completions)或新版 /v1/responses 格式发起请求。
vm2api 严格遵循行业最严苛的纯净度基准。入站请求不泄露官方 CLI 身份、不外漏任何未授权的系统提示词与内部内置工具。
| 评测项 | 题目说明 | 判定 | 特性说明 |
|---|---|---|---|
| 01 工具列表 | 探测是否泄露内置系统工具 | 100% 干净 | 未声明 tools 时,绝不返回 CLI 内部文件/执行工具 |
| 02 视觉识图 | 多模态图片解析能力与身份 | 100% 干净 | 原生多模态解析,无任何外挂包装痕迹 |
| 03 网页搜索 | 联网检索与外部工具调用 | 100% 干净 | 准确触发原生 web_search 并智能核算真实计费 |
| 04 自我认知 | 探测模型系统提示词与底层身份 | 100% 干净 | 表现为纯净 Claude 官方模型能力 |
| 05 角色扮演 | 复杂业务指令与预设遵从性 | 100% 干净 | 100% 服从用户设定的 System 与对话角色 |
| 06 提示词探取 | 针对底层系统 Prompt 的逆向刺探 | 安全防护 | 0 注入架构天然免疫敏感系统词泄露 |
| 07 强制工具 | 客户端指定 tool_choice 严格调度 | 100% 干净 | 完美执行客户端自定义函数定义与结构化输出 |
完整测试套件与详细数据归档请参阅:docs/benchmarks/README.md。
推荐在 Ubuntu 24.04 LTS 环境使用官方 Docker Compose 一键启动。
# 生产环境一键拉取并安装
curl -sSL https://raw.githubusercontent.com/dofastted/vm2api/main/deploy/install.sh | sudo bash
# 以后更新
curl -sSL https://raw.githubusercontent.com/dofastted/vm2api/main/deploy/install.sh | sudo bash -s -- upgrade
ARM64(aarch64)主机用同一条命令,脚本自动选择 -arm64 控制面镜像并准备 QEMU;实验性支持,见 docs/ARM64.md。
mkdir -p /opt/vm2api && cd /opt/vm2api
curl -sSLO https://raw.githubusercontent.com/dofastted/vm2api/main/docker-compose.yml
curl -sSL -o .env https://raw.githubusercontent.com/dofastted/vm2api/main/.env.example
chmod 600 .env
# 按需修改 .env 中的关键变量(VM2API_API_KEY, VM2API_ADMIN_PASSWORD, VM2API_DB_SECRET)
docker compose pull && docker compose up -d
服务启动后,系统暴露统一服务端口(默认 8787):
http://<您的IP>:8787/console(默认账号:admin / 密码:123456 或自定义环境变量)GET http://<您的IP>:8787/healthPOST http://<您的IP>:8787/v1/messagesPOST http://<您的IP>:8787/v1/chat/completions# 调用示例(以 Anthropic 原生接口为例)
curl -sS http://127.0.0.1:8787/v1/messages \
-H "Authorization: Bearer $VM2API_API_KEY" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-5-5",
"max_tokens": 128000,
"messages": [{"role": "user", "content": "Hello!"}]
}'
vm2api 内置全栈自适应网关,原生支持以下所有主流生态:
| 协议入口 | 对应标准 | 兼容客户端与场景 |
|---|---|---|
/v1/messages | Anthropic Messages API | Claude 官方 SDK、Cursor、Continue、LibreChat、Roo Code |
/v1/chat/completions | OpenAI Chat API | NextChat、Open WebUI、Lobechat、LangChain、AutoGPT |
/v1/responses | OpenAI Responses API | 新一代结构化智能体与高级编码工具生态 |
/v1/models | 标准模型列表 API | 按密钥 group_type 列出可调度模型:openai 仅 GPT,anthropic 仅 Claude,all 与 master 两者都列 |
Traditional methods of converting AI subscriptions into API endpoints via simple reverse proxies frequently result in immediate account suspensions, stealth downgrades, and token corruption. vm2api is an enterprise-grade virtual machine gateway designed for ultra-reliable subscription-to-API infrastructure:
/v1/messages and OpenAI /v1/chat/completions / /v1/responses.Since 1.3.122, the caller-visible changes are:
telemetry_disabled === false. The VM switch matches that bit and is on for the default; nonessential traffic and DNT follow it.Details: CHANGELOG.md. Guide: vm2api.fkcodex.com/zh.
zero (pure zero-injection), official, official_full, and tailored templates./etc/machine-id.
/v1 and count_tokens pass the console Risk page (/console/#/risk) before any slot is chosen. A hit returns an error and does not spend upstream quota. The order is fixed:
| Order | Gate | What it stops | Result |
|---|---|---|---|
| 1 | Distill | Harvest templates, problem fingerprints, and chain-of-thought extraction shapes. OpenAI platform models are skipped. Official Claude Code and zero-injection are skipped by default. | 403, and the device is banned |
| 2 | Hard regex | NSFW, cracking, jailbreak, and custom patterns. Distill-category patterns follow the distill switch, not the hard-regex switch, and still scan official clients and zero-injection. OpenAI platform models skip that category. | 403 |
| 3 | Refusal cache | Exact text, similar text, and devices the upstream has already refused. Hard-regex and decision-model blocks are not stored here. | 400, non-retryable, not a login failure |
| 4 | Decision model | A safety model scores the text and blocks only below the threshold. If scoring fails, the request is allowed by default and marked on the pass column. | 403 |
| 5 | Passed egress | Everything the gates allowed. The upstream's own refusals are listed separately, so a miss is visible. | Enters a slot |
Open a hit and read the body. A false positive means tighten that gate, not delete the slot. Requests from before this recording show as unchecked. Full rules: docs/RISK.md.
| Test Item | Description | Evaluation | Core Result |
|---|---|---|---|
| 01 Tools List | Inspects CLI internal tools leakage | 100% Clean | Zero internal execution tools disclosed |
| 02 Vision | Multimodal image understanding | 100% Clean | Pure model vision without extra wrappers |
| 03 Web Search | Live internet search queries | 100% Clean | Native Anthropic web_search triggered accurately |
| 04 Identity | Persona & identity probe | 100% Clean | Clean Claude model identity preserved |
| 05 Roleplay | Custom system instructions | 100% Clean | 100% adherence to caller system definitions |
| 06 Prompt Leak | Probing underlying system prompts | Protected | Zero prompt injection protects core assets |
| 07 Forced Tools | Strict function calling with tool_choice | 100% Clean | Accurate schema formatting and execution |
# Recommended one-line installation on Ubuntu 24.04 LTS
curl -sSL https://raw.githubusercontent.com/dofastted/vm2api/main/deploy/install.sh | sudo bash
After deployment, access:
http://<YOUR_IP>:8787/consolehttp://<YOUR_IP>:8787/healthPOST http://<YOUR_IP>:8787/v1/messages提交 Issue 前请阅读 ISSUE_GUIDE.md,按“版本 → 复现路线 → 环境(VPS / 代理)→ VM 与请求日志 → 源码定位(可选)→ 脱敏”收集信息,再用 Bug 报告表单 提交。
Before opening an issue, follow ISSUE_GUIDE.md: version, reproduction steps, host/proxy environment, VM and request logs, optional source pointers — and redact all secrets.
开源与持续维护离不开社区大家的支持与反馈。如果您觉得 vm2api 为您的业务或学习带来了实质帮助, 交流群或请作者喝杯咖啡!
1,103 followers · starred Sep 2026
230 followers · starred Oct 2026
792 followers · starred Sep 2026
41 followers · starred Sep 2026