連接您的帳戶
您已經有 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
評論
目前還沒有評論。歡迎成為第一位。