连接你的账户
你已经有 EQVPS 账户,想让脚本或代理使用它:获取令牌,写入配置,启动第一个沙箱,并保持余额充足。
整体如何衔接
1. 获取令牌
最简单:在控制台打开 设置 → API 令牌,创建令牌(以代理命名,选择有效期)并复制。令牌只显示一次。
通过命令行:用邮箱和密码登录即可获得新令牌。如果你是用邮件验证码注册、从未设置过密码,请用控制台中的令牌设置一次。也可以用 POST /auth/register 创建新账户,它会立即返回令牌。
# log in with email + password → token
curl -s https://api.eqvps.com/api/v1/eqvps/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"you@example.com","password":"your-password"}'
# → {"token":"eyJ0…","token_type":"Bearer","token_expires_at":"2027-10-03T…","user":{…}}
# signed up with an email code and have no password? set one once
# (authorise with a token from Settings → API tokens)
curl -s https://api.eqvps.com/api/v1/eqvps/auth/set-password \
-H "Authorization: Bearer $EQVPS_API_KEY" -H "Content-Type: application/json" \
-d '{"password":"new-pass-123","password_confirmation":"new-pass-123"}'
# no account yet: register straight from the API (password is optional)
curl -s https://api.eqvps.com/api/v1/eqvps/auth/register \
-H "Content-Type: application/json" -d '{"email":"you@example.com"}'
# extend a token before it expires
curl -s -X POST https://api.eqvps.com/api/v1/eqvps/auth/token/refresh \
-H "Authorization: Bearer $EQVPS_API_KEY"令牌有效期 1 年(见响应中的 token_expires_at)。用 POST /auth/token/refresh 续期;不再使用的令牌请在设置中吊销。
2. 写入配置
不要把令牌写进代码:以 EQVPS_API_KEY 导出。MCP 客户端通过 Authorization 请求头获取它。
# shell / CI secret — keep it out of the code
export EQVPS_API_KEY="eyJ0…"
# SDKs read the same variable (0.2.0+: give your code its secrets as env, not in the source)
pip install -U eqvps # Python
npm i @eqvps/sdk@latest # TypeScript / JavaScript
# Claude Code
claude mcp add --transport http eqvps https://mcp.eqvps.com/mcp \
--header "Authorization: Bearer $EQVPS_API_KEY"
# Cursor, Claude Desktop, other MCP clients (mcp.json)
{
"mcpServers": {
"eqvps": {
"type": "streamable-http",
"url": "https://mcp.eqvps.com/mcp",
"headers": { "Authorization": "Bearer <YOUR_TOKEN>" }
}
}
}3. 启动第一个沙箱
创建、运行代码、删除。非零的 exit_code 只是命令的正常结果,不是 HTTP 错误。
API=https://api.eqvps.com/api/v1/eqvps
H="Authorization: Bearer $EQVPS_API_KEY"
SB=$(curl -s -X POST $API/sandboxes -H "$H" -H "Content-Type: application/json" \
-d '{"tariff":"micro"}' | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')
curl -s -X POST $API/sandboxes/$SB/run -H "$H" -H "Content-Type: application/json" \
-d '{"language":"bash","code":"uname -sr && python3 --version && node --version"}'
# → {"exit_code":0,"stdout":"Linux 6.1…\nPython 3.12…\nv22…\n","stderr":"",…}
curl -s -X DELETE $API/sandboxes/$SB -H "$H"模式、套餐及 Python / Node.js 示例:沙箱 →
4. 充值余额
沙箱和服务器共用同一个预付余额。可在控制台充值(余额:加密货币、Monero 或优惠码),也可用 POST /balance/topup,它会返回支付链接。GET /balance 显示剩余金额。
curl -s $API/balance -H "$H"
# → {"balance":12.4,"currency":"USD","promo_balance":0,"real_balance":12.4,"promo_scope":"sandboxes"}
curl -s -X POST $API/balance/topup -H "$H" -H "Content-Type: application/json" -d '{"amount":10}'
# → {"invoice_id":…,"checkout_url":"https://…"} open the link and pay with crypto你很可能遇到的错误
- 401 Unauthenticated——缺少令牌、拼写错误、已过期或已吊销。检查 Authorization: Bearer 请求头,在设置中新建令牌或重新登录。
- 402 insufficient_balance——余额为空,因此无法启动新沙箱。充值后重试请求。正在运行的持久沙箱会被暂停而不是删除。
- 429 和 503 表示请求在执行任何操作之前就被拒绝:等待 Retry-After 后重新发送。409 sandbox_paused:充值后沙箱会继续运行。
HTTP 401 {"message":"Unauthenticated."}
HTTP 402 {"error":"insufficient_balance","message":"Your balance cannot cover this sandbox. Top up (topup_balance / POST /balance/topup) and retry."}
HTTP 429 {"error":"too_many_concurrent", …} → wait Retry-After, then retry
HTTP 503 {"error":"capacity","retry_after":30, …} → wait Retry-After, then retry
评论
暂无评论。来做第一个吧。