dofastted/vm2api
Tentang
vm2api: mengubah langganan menjadi API menggunakan solusi mesin virtual yang sepenuhnya disimulasikan
Bahasa pemrograman dan runtimePertumbuhan bintang terukur
- dalam 24 jam
- +3
- dalam 7 hari
- +79
- dalam 15 hari
- +188
- dalam 1 bulan
- +474
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
Aslivm2api
完全隔离的虚拟机级 AI 订阅转 API 生产网关
Next-Generation Fully Isolated VM-Level AI Subscription-to-API Gateway
[!NOTE] vm2api 专为高可靠 AI 订阅转化为生产级标准 API 设计。摒弃传统的简单 HTTP 逆向与易被封禁的公用代理方案,采用全隔离虚拟机/容器环境 + 官方真实客户端进程常驻 + 真实硬件指纹拟真 + 单槽单独立网络出口 + 进槽前封控拦截,实现真正稳定、长效、高并发的订阅转 API 基础设施。
❤️ 赞助商 / Sponsors
点击展开赞助商说明 · Click to expand
赞助商(ProxyLane):Claude Max 专用的原生静态住宅 IP:从未用于注册 Claude 账号,严格筛选 IP 与网段,Scamalytics 低欺诈评分,一个号一个独享 IP,不限流量,$7.90 起。一个槽位绑一个 IP:把 SOCKS5 host:port:user:pass 粘贴到「代理池」→「添加代理」即可。首次购买优惠码 VM2API30 享 7 折(有效期到 12 月 31 日)。详见 ProxyLane。
🇨🇳 简体中文
目录
为什么选择 vm2api?
- 订阅转标准 API:Anthropic / OpenAI 订阅与可选 API 直连(
api类密钥)统一入口。 - 虚拟机级拟真:官方 Claude Code 真实进程、硬件指纹、单槽单出口,而非简单 HTTP 逆向。
- 生产可运维:进槽前封控、多 VPS 集群、租户与密钥体系;升级以各版本 CHANGELOG 为准。
💡 项目概览
在当今大模型服务中,直接使用第三方逆向脚本或共享代理极易触发风控导致封号、降权与服务中断。vm2api 是业界领先的虚拟机级 API 转换中继系统:
- 支持平台:全面支持 Anthropic (Claude Pro / Team / Enterprise / Max) 以及 OpenAI (ChatGPT / Codex) 订阅转标准 API;另支持在管理台配置 Anthropic / OpenAI 官方 API 端点,用
api类密钥直连上游(不占用 OAuth / Codex 槽位)。 - 真实载体:Anthropic 采用官方客户端在隔离 VM / 容器内运行真实系统进程,而非第三方伪造 HTTP 模拟。
- 全链路拟真:从物理机硬件指纹(SMBIOS、MAC、Machine-ID)到独立 SOCKS5 / 本地网络出口,全方位还原真实开发者电脑环境。
- 极简集成:向上游输出标准 OpenAI
/v1/chat/completions、/v1/responses与 Anthropic/v1/messages兼容接口,任何支持标准 API 的前端、Agent 或应用均可无缝接入。
🆕 近期更新
对照 1.5.006(VERSION 当前版本)。下列为 v1.5 基线已上线、调用方或管理员能直接感知的能力与组件摘要;完整逐版条目见 CHANGELOG.md,操作说明见 入门文档。下文升级概述不能替代逐版说明,具体以各版本 CHANGELOG 的升级注意为准。
- v1.5 二进制与数据面基线:
deploy/payload.json默认钉选 CRAG5.0.0(payload-2026.12.01-crag-5.0.0,密钥零轮换)、Codexkin-codex-kernel0.4.10(payload-2026.11.29-codex-kernel-0.4.10)、CRAGGemini0.6.1(payload-2026.12.01-gemini-0.6.1)及crag-debian131.1.0;开源控制面自编二进制包含 Rustkin-scheduler与 Gokin-api-kernel、kin-redact、kin-proto-front(cc-node与kin-kernel-crag已退役)。 - Gemini 宿主机与多协议网关:Linux amd64 默认启用 Gemini 宿主候选(CRAGGemini
0.6.1常驻进程池 + Antigravity CLI),支持/v1/messages、/v1/chat/completions、/v1/responses、/v1beta与专用 Gemini 密钥、CRAGGemini 宿主兑换及维护面板,见 Gemini 宿主机候选。 - PostgreSQL + Redis 多级缓存:支持
deploy/install-pg.sh一键安装或从存量 SQLite 无缝迁移至 PostgreSQL 18 + Redis 8 L2 缓存,见 PostgreSQL 迁移指南。 - 内容脱敏(可选):设置 →「脱敏」页(
/console/#/settings/redaction)可配置凭据、个人信息与自定义规则;默认关闭。启用需本机bin/kin-redact,helper 未就绪时不能保存为开启,请求也不会回落明文。 - API 直连:在
#/api为渠道「获取模型」,已保存且未改配置的渠道会立即写入模型列表,新建或修改的渠道需点「保存」。生成密钥时选择「API 直连」和具体渠道;此密钥的/v1/models和推理都只用所选渠道,不经 OAuth / Codex 槽位。已有未绑定密钥沿用原协议范围,可编辑后绑定。Anthropic 端点可单独开关「风控前置审查」。 - 协议与计费:官方 Claude Code 透传、缓存断点 TTL 与
max_tokens默认值(如 Haiku 5.5 为 100K)与面板一致;GPT Image 模型可在 Chat / Responses 路径出图;第三方计费限制类上游错误返回 400third_party_client(不写拒答缓存,真实上游 400 按 10 分钟会话封锁处理)。 - 封控与配额:决策模型支持多组 URL / Key;托管密钥可
GET /v1/me/quota与GET /v1/me/usage;租户可看用量统计,虚拟机只读(无代理与重新授权)。 - 面板与运维:按角色隐藏无权页面;槽位官方登录执行
claude auth login;平滑停机时/health返回 503shutting_down;控制面升级由panel-upgrade.sh重建控制面并调用fleet-services.mjs(同步wrap-cli与 telemetry)及vm-maintain.mjs;升级 CRAG 请通过面板/wrap或deploy/install.sh crag-update,勿覆盖routing.json、vms/、data/、.env。 - 集群:支持运行中 / 冷迁移 Linux KVM 槽与内存扩容,见 槽位迁移说明。
功能特性
涵盖防封、拟真与生产运维相关能力(九大支柱):
0️⃣ 独家 0 提示词注入机制 & 改写引擎
- 无感透传,告别 System 篡改:传统中继依赖向 Prompt 注入大段系统人设与假装指令,不仅消耗高昂 Token,还极易引发模型“自我认知混乱”并被上游识别封号。vm2api 身份在凭证层即对齐官方形态,做到真正 0 提示词注入(Zero Prompt Injection)。
- 改写引擎与模板定制:提供从
zero(完全零注入)、official、official_full到自定义改写模板的灵活切换,满足特殊上下文场景需求。 - 提供公开 Benchmarks:随仓库公开提供干净度测试套件与判定报告,杜绝官方内置工具及泄露痕迹,供所有人测试与对比检验。
1️⃣ 真实拟真物理机环境
- 消除云主机与多开痕迹:不仅是普通 Docker 容器,更可支持真虚拟机(KVM / QEMU)。
- 全套物理硬件指纹拟真:针对上游平台的设备探测,深度拟真真实物理机的硬件特征,涵盖独立 SMBIOS 信息、网卡 MAC 地址、CPU 拓扑、系统序列号、时区与真实的
/etc/machine-id。
2️⃣ 官方 Claude Code 真实进程转发 & 槽位管理
- 官方原版二进制常驻守护:每一个 VM / 容器槽位内部均运行 Anthropic 原版 Claude Code 二进制程序,通过内核级 Unix Domain Socket 与协议路由总线通信,完全继承官方客户端签名与合规信誉,杜绝第三方逆向 HTTP 模拟带来的指纹泄露与封禁风险。
- 原生多路 Subagent 高并发调度:单槽位原生支持多达 20 路 Subagent 会话并发交互。会话上下文在槽位内部原生隔离与状态持久化,享受官方客户端热缓存(Prompt Caching)加速与极致响应速度。
- 5h / 7d 官方用量窗口智能对齐:控制面实时对齐 Anthropic 官方 5 小时滚动窗口与 7 天硬限消耗,精确计算重置倒计时(精确到分钟级)。支持设置水位报警阈值,额度逼近硬限时自动熔断并将流量平滑降级调度至空闲槽位。
- 全生命周期槽位状态机与健康监控:实时追踪槽位调度状态(在池调度、5h/7d 冷却保护、调用关闭、凭证失效)。支持优先级分级路由(高优先级 VIP 槽位专属调度)、单槽独立成本流水统计与一键额度全槽健康探测。
3️⃣ 封控拦截与风险审计
推理出站前检查设备/会话封禁、禁用工具、系统提示词改写(可关闭)、蒸馏、硬正则和拒答缓存。通过硬规则后,JEV 只审核用户会话和可解析的内联文件文本,并在常规放行、指定账号池/渠道、指定模型和拒绝之间选择。没有身份字段的第三方请求不因此被封禁。
「风险审计」(/console/#/risk)展示封禁原因和原请求、上游 HTTP 400,以及实际降级出站次数。默认设备封禁阶梯为 10 分钟、10 分钟、永久([10, 10, 0],非递减);违规会话持续封锁。普通上游 400 不计违规。
细则:docs/RISK.md。
4️⃣ 完整的隔离网络环境(1 VM = 1 独立网络出口)
- 绝不共享 IP 资源:系统严格要求每一个 VM / KVM 槽位必须且只能绑定一条独立的网络出口才能启动运行(支持专用独立 SOCKS5 代理、高匿出口池或独立本地出站网络)。
- 彻底告别关联连带封号:账号之间绝对网络物理隔离,即便单条代理波动或单个账号受限,绝不殃及集群内的其它账号。
- 安全自定义 DoH 解析:支持配置企业级自定义 HTTPS DoH(DNS-over-HTTPS)上游解析,全程代理加密传输,防止 DNS 劫持与 ISP 侧特征分析。
5️⃣ 前置协议清洗与多协议统一结构化
- 入站多协议通吃:客户端可以使用 Anthropic 原生协议(
/v1/messages)、OpenAI 标准格式(/v1/chat/completions)或新版/v1/responses格式发起请求。 - Codex 调用 Claude:在
/v1/responses指定允许的 Claude 模型。控制面先把指令、消息和工具调用/结果转为结构化 Messages,再交给选中的 Claude 内核。HTTP 续接需重发完整input历史;WebSocket 可引用同连接的previous_response_id。无法转换的字段或不完整的工具历史在本地报错,上游计费拒绝仍按实际结果返回。 - 深度清洗与官方对齐:控制面在毫秒级内完成协议清洗与规范化,纠正非法角色、清理脏工具参数、补齐结构化要求,最终向 VM 内部官方进程交付符合官方客户端完全规范的纯净载荷。
6️⃣ 官方遥测(Telemetry)可控开关
- 全量遥测模拟:目标是让官方服务判定每一个槽位都是一台完全独立、在真实开发中活跃运行的电脑。
- 细粒度自主可控:控制面提供全量遥测开关配置,可根据部署策略自主选择启用、隔离或特定遥测行为,既保留官方客户端信誉特征,又确保隐私边界。
7️⃣ 分布式集群系统(多 VPS 跨机舰队管理)
- SSH 极简跨机纳管:主控面通过原生 SSH 链接全球多台 VPS 节点,无需在远端节点繁琐部署复杂 Agent。
- 远程 Docker 统一编排:直接跨机调度与管理各节点的容器与网络,槽位支持在集群节点自由放置与负载均衡。
- 内置安全 Web 终端:基于 WebSocket + xterm 的一次性安全 Ticket 运维终端,直接在控制台一键直连管理远端槽位与 Docker 容器。
8️⃣ 完整的企业级 API 密钥与配额管理
- 多层级密钥体系:拥有主控制 Master Key 以及针对团队或租户的多级 API Key,密钥入库采用 HMAC 索引与高强度加密。
- 官方配额窗口精确对齐:对齐官方 5h / 7d 动态用量窗口与硬限保护,支持槽位独立配额覆盖,提供自动熔断、故障降级与空闲负载平衡。
- 实时审计与成本统计:提供精确到 TTFT(首 Token 延迟)、真实 Prompt / Completion / 缓存命中 Token 的详尽流水与可视化图表分析。
界面预览
![]() 品牌概览 |
![]() 槽位舰队与配额看板(脱敏) |
![]() 封控拦截 |
![]() 硬件指纹与网络隔离 |
![]() 官方遥测开关 |
📊 干净度基准评测(Benchmarks)
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 一键启动。
1. 一键脚本安装(推荐)
# 生产环境一键拉取并安装
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。
2. 手动 Docker Compose 启动
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
3. 访问与调用
服务启动后,系统暴露统一服务端口(默认 8787):
- 登录与管理台:
http://<您的IP>:8787/cc#/login(亦可用http://<您的IP>:8787/console进入欢迎页后点「登录」)。默认账号admin/123456,或由.env中VM2API_ADMIN_USER/VM2API_ADMIN_PASSWORD指定。 - 服务健康探活:
GET http://<您的IP>:8787/health(升级排空期间可能返回 503shutting_down) - Anthropic 协议调用:
POST http://<您的IP>:8787/v1/messages - OpenAI 兼容协议:
POST http://<您的IP>:8787/v1/chat/completions
生产环境升级与面板一键更新见 docs/DEPLOY.md 或 curl …/deploy/install.sh | sudo bash -s -- upgrade。
# 调用示例(以 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": 8192,
"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 / anthropic / all);api 类密钥按所配端点协议列出上游模型 |
/v1/images/* |
OpenAI Images API | GPT Image 系列;亦可通过 Chat / Responses 图像桥接调用 |
Gemini 宿主机模式默认启用(Linux amd64),支持 CRAGGemini(0.6.1)常驻进程池与 Antigravity CLI 隔离终端,并通过 /v1/messages、/v1/chat/completions、/v1/responses、/v1beta 与专用 Gemini 密钥提供多协议推理调度及宿主订阅兑换。见 Gemini 宿主机候选 与 Gemini 维护。
🇬🇧 English
Table of Contents
- Why vm2api?
- Recent changes
- Features
- Screenshots
- Cleanliness Benchmarks
- Deployment
- Development checks
- Issue reporting
Why vm2api?
- Subscription → standard APIs — Anthropic / OpenAI slots plus optional direct API keys.
- VM-fidelity — Official Claude Code processes, hardware fingerprints, one egress per slot.
- Operations-ready — Pre-hop risk gates, multi-VPS cluster, tenants and keys; per-release CHANGELOG upgrade notes.
💡 Overview
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:
- Universal Support: Seamlessly converts Anthropic (Claude Pro / Team / Enterprise / Max) and OpenAI (ChatGPT / Codex) subscriptions into robust standard APIs. Direct API keys (
apicategory) call configured Anthropic / OpenAI upstream endpoints without OAuth or Codex slots. - Genuine Client Process: Runs the authentic official Claude Code CLI system process inside an isolated VM / container instance instead of fragile HTTP emulation.
- High-Fidelity Emulation: From physical SMBIOS, NIC MAC, and Machine-ID to dedicated per-slot network egress and pre-hop risk gates.
- Standard Compatibility: Provides drop-in replacements for Anthropic
/v1/messagesand OpenAI/v1/chat/completions//v1/responses.
Recent changes (1.5.006)
Current v1.5 baseline (VERSION=1.5.006; see CHANGELOG.md for full release-by-release entries). The summary below does not replace per-release instructions—follow each release’s upgrade section in the CHANGELOG:
- v1.5 binary & payload baseline:
deploy/payload.jsonpins CRAG5.0.0(payload-2026.12.01-crag-5.0.0, zero key rotation), Codexkin-codex-kernel0.4.10(payload-2026.11.29-codex-kernel-0.4.10), CRAGGemini0.6.1(payload-2026.12.01-gemini-0.6.1), andcrag-debian131.1.0; open-source control-plane binaries built from source include Rustkin-schedulerand Gokin-api-kernel,kin-redact, andkin-proto-front(cc-nodeandkin-kernel-cragare retired). - Gemini host & multi-protocol ingress: Enabled by default on Linux amd64 (CRAGGemini
0.6.1worker pool + Antigravity CLI), supporting/v1/messages,/v1/chat/completions,/v1/responses,/v1beta, dedicated Gemini keys, host subscription redemption, and maintenance panel—see docs/gemini-host.md. - PostgreSQL + Redis multi-tier cache: One-line install or seamless SQLite migration to PostgreSQL 18 + optional Redis 8 L2 cache via
deploy/install-pg.sh—see docs/POSTGRES_MIGRATION.md. - Redaction (optional): Settings → Redaction (
/console/#/settings/redaction). Off by default; requires localbin/kin-redact—no plaintext fallback when the helper is missing. - Direct API: Panel API config at
#/api;apikeys route to upstream by endpoint protocol, not OAuth/Codex slots. Anthropic endpoints can enable pre-hop risk review separately. - Protocol & billing: Official Claude Code passthrough, cache TTL, and default
max_tokensalign with the panel; GPT Image works via Chat/Responses; upstream third-party billing limits return 400third_party_client(not added to the refusal cache; real upstream 400s apply a 10-minute session block). - Gates & tenants: Decision model supports multiple URL/key sets; keys expose
GET /v1/me/quotaandGET /v1/me/usage; tenant stats and read-only VM views. - Panel & ops: Role-based page access; slot login runs
claude auth login; draining upgrades expose 503 on/health. Panel upgrades recreate the control plane and runfleet-services.mjs(wrap-cli+ telemetry) andvm-maintain.mjs; upgrade CRAG via/wrapordeploy/install.sh crag-update, and never overwriterouting.json,vms/,data/, or.env. - Cluster: Live and cold KVM slot migration plus RAM resize—docs/slot-migration.md.
Guide: vm2api.fkcodex.com/zh.
Features
Nine pillars for anti-ban emulation and production operations:
0️⃣ Zero Prompt Injection Engine
- No System Prompt Tampering: Unlike ordinary proxies that tamper with the system prompt and poison model identity, vm2api aligns credentials at the protocol layer as a genuine Console client.
- Customizable Layouts: Switch effortlessly between
zero(pure zero-injection),official,official_full, and tailored templates. - Transparent Benchmarks: Built-in benchmark suite guarantees no leaking of internal CLI tools or hidden instructions.
1️⃣ Physical Hardware Fingerprint Emulation
- Eradicate Virtual Machine Artifacts: Supports containerized slots as well as genuine KVM/QEMU hypervisor nodes.
- Comprehensive Hardware Spoofing: Simulates realistic hardware traits including SMBIOS identifiers, NIC MAC addresses, CPU architectures, system serials, and distinct
/etc/machine-id.
2️⃣ Official Claude Code Native Process Forwarding & Slot Management
- Authentic Official Binary Daemon: Every VM / container slot runs the authentic, official Claude Code binary daemon inside an isolated hypervisor sandbox. Requests are relayed via kernel-level Unix Domain Sockets, completely eliminating heuristic fingerprint leakage caused by custom reverse proxies.
- Native 20-Subagent Concurrency per Slot: Each slot natively orchestrates up to 20 concurrent subagent threads with isolated conversation states and official prompt caching reuse.
- 5h / 7d Upstream Quota Alignment: Automatically aligns with Anthropic's rolling 5-hour and 7-day budget windows, calculating reset deadlines down to the minute. Integrates dynamic circuit breakers to gracefully divert traffic when a slot approaches its capacity limit.
- Full Slot Lifecycle & Health Observability: Visual real-time tracking of slot states (In-Pool, Cooldown Guard, Suspended, Token Expired), multi-tier priority routing, and real-time per-slot financial cost accounting.
3️⃣ Pre-hop risk gates
Before inference egress, hard rules check device and session bans, blocked tools, system-prompt rewrites, distillation, regex rules, and cached refusals. JEV reviews only user turns and readable inline file text, then can allow the standard route, narrow it to a configured pool or channel, select a configured model, or reject the request.
The Risk page (/console/#/risk) links bans to their source logs and lists upstream HTTP 400s and actual downgraded requests separately. The default device ban ladder is 10 minutes, 10 minutes, then permanent ([10, 10, 0], non-decreasing). Ordinary upstream 400s do not count as violations. Full rules: docs/RISK.md.
4️⃣ Completely Isolated Network (1 VM = 1 Egress)
- Zero Cross-Account Contamination: Every VM slot is strictly bound to its own dedicated SOCKS5 proxy or local egress gateway.
- No Shared Egress: Prevents cascade bans caused by multiple accounts sharing the same outbound IP.
- Custom HTTPS DoH: Supports custom DNS-over-HTTPS resolvers for stealthy and encrypted queries.
5️⃣ Deep Protocol Cleansing & Multi-Inbound Structuring
- Multi-Protocol Inbound: Connect with Anthropic Messages API, OpenAI Chat format, or modern Responses API.
- Structural Rectification: Normalizes invalid role sequences, corrects schema parameters, and translates inputs into clean payloads conforming to official client specifications.
6️⃣ Configurable Official Telemetry
- Single-Machine Telemetry: Accurately simulates the telemetry signatures of a standalone physical workstation.
- Granular Control: Operators can toggle and adjust telemetry forwarding based on operational privacy policies.
7️⃣ Multi-VPS Cluster Management
- Agentless SSH Node Fleet: Connect and orchestrate multiple remote VPS hosts through lightweight, secure SSH connections.
- Remote Docker Bridge: Effortlessly deploy, monitor, and place slot containers across different physical machines with built-in interactive web terminals (xterm).
8️⃣ Enterprise API Key & Quota Management
- Multi-Tenant Security: Master key architecture with secondary HMAC-indexed tenant tokens.
- Official Quota Alignment: Accurately tracks 5h/7d rolling budget windows, enforces rate limits (RPM/TPM), and provides seamless failover.
- Comprehensive Telemetry & Observability: Real-time tracking of TTFT, genuine token consumption, SLA, and failure classifications.
Screenshots
![]() Brand overview |
![]() Slot fleet dashboard (sanitized) |
![]() Risk gates |
![]() Hardware & network isolation |
![]() Telemetry controls |
📊 Cleanliness Benchmarks
| 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 |
Deployment
# Recommended one-line installation on Ubuntu 24.04 LTS
curl -sSL https://raw.githubusercontent.com/dofastted/vm2api/main/deploy/install.sh | sudo bash
# Upgrades
curl -sSL https://raw.githubusercontent.com/dofastted/vm2api/main/deploy/install.sh | sudo bash -s -- upgrade
After deployment, access:
- Login / console:
http://<YOUR_IP>:8787/cc#/login(or/consolewelcome → Sign in). Defaultadmin/123456unless set in.env. - Health Check:
http://<YOUR_IP>:8787/health(may return 503shutting_downduring drain) - API Endpoint:
POST http://<YOUR_IP>:8787/v1/messages
See docs/DEPLOY.md for panel one-click updates and compose workflows.
VM 账号用量
VM 页「总计」按当前账号累计本平台已记录的官方价费用和 token(含缓存)。同一账号迁槽不会清零,日志清理会保留账号汇总,5H/7D 仍按原窗口统计。部署前已删除的明细、以及只记录了槽位而没有账号 ID 的历史用量(包括旧 OpenAI 记录),无法归属到具体账号,不并入总计。
开发验证与 CI
提 PR 前先确认目标分支(base)是 dev。 功能与修复 PR 一律指向 dev,分支从 origin/dev 切出;main 只接受 dev → main 的发版 PR 或 hotfix/<slug>,tag 只打在 main 上。base 选错不用重开 PR,在 PR 页面标题下方的 base 下拉框改成 dev 即可。分支、工作树与发版流程见 docs/DEVELOPMENT.md。
CI 配置以 .github/workflows/test.yml 为准,使用 Node.js 22、pnpm 10、Go 1.25 和 Rust 1.86.0。日常验证优先运行本次改动涉及的核心测试或指定测试文件,完整回归按需运行。
先按需安装依赖:后端 npm ci,前端 pnpm -C web install --frozen-lockfile。以下命令均在仓库根目录执行:
| 目的 | 命令 |
|---|---|
| 后端核心集(13 个测试文件) | npm run test:ci |
| 前端核心集(9 个测试文件) | pnpm -C web test:ci |
| 指定后端测试文件 | npm run test:unit -- api-keys(也接受 api-keys.test.mjs) |
| 指定前端测试文件 | pnpm -C web exec vitest run src/lib/session.test.ts |
| 后端全量单测 | npm run test:unit |
| 前端全量单测 | pnpm -C web test |
| 前端类型检查与生产构建 | pnpm -C web build |
日常 CI 的业务结果统一为 ci,changes 负责识别改动目录:
- 后端改动运行语法检查和核心集,追加本次新增或修改的后端单测文件;前端改动运行核心集、追加新增或修改的前端测试文件,并执行类型检查与生产构建。本地
test:ci命令只运行固定核心集。 worker/、api-kernel/、redact/或protofront/改动会运行这四个 Go 模块的go test ./...;scheduler/或后端改动会检查 Rustkin-scheduler(cargo fmt --check、cargo clippy、cargo test --workspace --locked);打包相关改动才下载和校验完整 pinned payload、执行 native CLI 打包单测。日常 CI 选中oauth-binary.test.mjs时,单独准备并校验其依赖的kin-oauth-auth。- 纯文档或
VERSION改动只做目录识别与状态收尾,不安装依赖、不运行业务测试。 - 全仓格式检查与 ARM 镜像构建不作为日常 CI 的必过条件。格式工具和仅处理改动文件的方法见 docs/FORMAT.md。
需要更广的验证时,在 GitHub Actions 的 ci 工作流选择 Run workflow:full=true 运行后端、前端全量单测、四个 Go 模块测试、Rust scheduler 检查、payload/打包检查和全仓格式检查;arm64=true 独立启用原生 ARM 镜像构建及离线 smoke 测试,full 不会自动开启 ARM 检查。两项默认均为 false。
test:unit、test:ci 和 test:e2e 逐个文件起独立进程组运行,单个文件超过 5 分钟或常驻内存超过 4096 MB(仅 Linux)即被 SIGKILL 并记为失败,避免卡在原生代码里的测试耗尽宿主内存。可用 VM2API_TEST_FILE_TIMEOUT_MS、VM2API_TEST_FILE_MAX_RSS_MB 调整,设为 0 关闭对应限制。
原有 npm test / npm run test:all 仍执行后端全量单测和 npm run test:go(当前覆盖 worker 与 protofront),不包含前端、api-kernel、redact、Rust scheduler 或 E2E。CI 绿灯只表示该次实际执行的检查通过;日常 CI 不代表全量、ARM 或生产验证已经完成。
Open pull requests against dev, branched from origin/dev; main only takes release PRs from dev or hotfix/<slug>. If you opened one against main, switch the base with the dropdown — no need to reopen. Daily CI runs core tests plus added or modified test files for affected components. Full regression and formatting checks are available with full=true; native ARM packaging is enabled separately with arm64=true.
🐞 问题反馈 / Issue Reporting
提交 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.
💬 交流与赞助支持 / Community & Sponsorship
开源与持续维护离不开社区支持与反馈。欢迎加入开发者群交流部署与使用问题;若 vm2api 对您有帮助,也可请作者喝杯咖啡。
开发者交流群 / Developer community
Telegram 群组 t.me/vm2api(@VM2API):部署排障、版本升级与使用讨论。商业授权可在群内咨询。
赞助 / Sponsorship
📈 Star History
📜 许可证与免责声明 / License
- 个人与非商用:本仓库遵循 Noncommercial License,仅供个人学习、技术研究与个人自建使用。
- 商业使用授权:任何将本项目用于商业运营(包括对外付费 API、作为转售云服务基础组件、公司内部营利用途等)必须事先取得作者正式书面授权。可在开发者交流群 t.me/vm2api(
@VM2API)内咨询。 - 免责声明:vm2api 为独立的开源实验项目,与 Anthropic PBC 或 OpenAI 无任何直接关联。相关商标权属均归其对应公司所有。
集群槽位迁移与扩容
管理员可在「集群 → 机器 → 槽位行 → 迁移 / 扩容」选择目标节点或原节点扩内存。首版限定运行中的远程 Linux KVM 槽;停机迁移、预检、进度、失败回滚及人工恢复边界见 操作说明。
Jelajahi proyek terkait
Memuat…





