Clepsy docs
Wrap any command, pay only for the seconds it ran, and get back a receipt signed by the node that ran it.
Quickstart
Needs Node 18.17 or newer. The package has no dependencies.
# run once without installing
npx clepsy run -- echo hello
# or install the command
npm install -g clepsy
Without --cloud the command runs on your own machine. Seconds are metered and the receipt is signed for real, but no money moves (settlement: simulated). Use it to see how billing works before you fund anything.
$ clepsy run --budget 2.00 -- python scraper.py
✓ session opened 0x7f3a…c21e
⧗ metered 412s ████████████ 0.1648 USDG
✓ receipt signed ~/.clepsy/receipts/0x7f3a….json
✓ settled 0.1648 USDG · refund 1.8352 USDG (simulated)
Run in the cloud
Your account is the ed25519 key the CLI creates at ~/.clepsy/node.key. There is no sign-up and no API key: every request is signed with that key.
# --cloud sends the command to the Clepsy node
clepsy account --cloud # your account id and balance
clepsy run --cloud --worker python --budget 0.05 -- python -c "print(6*7)"
# or set it once for every command
export CLEPSY_CLOUD=https://api.clepsy.cloud
- Opening a session holds the budget from your balance. Stopping it pays for the seconds the sandbox was up and returns the rest.
- When the budget runs out the sandbox is destroyed.
- Workers:
shell(Alpine 3.20),python(3.12),node(22). - To run several commands, wrap them in one shell:
clepsy run --worker shell -- sh -c 'cmd1; cmd2'.
Fund your account
Balances are paid in USDG on Robinhood Chain through the ClepsyVault contract. The node credits your account after 3 confirmations.
In the browser
Run clepsy account to get your account id, then open clepsy.cloud/fund. Connect a wallet, approve USDG and deposit. The CLI also prints a link with your account already filled in.
From a wallet or script
Approve the vault for the amount, then call deposit(bytes20 account, uint256 amount). USDG has 6 decimals, so 1 USDG is 1000000.
| Item | Value |
|---|---|
| Chain | Robinhood Chain (4663) |
| Vault | 0x5649715C2B4084f3fA9528fC03143E53EACd14C7 |
| Token | USDG 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168 |
Deposits pay for compute on this node. They cannot be withdrawn back to the depositor. Unused session budget always returns to your balance.
Sandbox limits
Each session gets its own container under gVisor, a user-space kernel that keeps your code away from the host.
/workCommands
| Command | What it does |
|---|---|
clepsy run -- <cmd> | Runs the command, meters it by the second, stops it when the budget runs out, signs a receipt. Takes --budget, --worker, --cloud. |
clepsy account | Your account id. With a node: balance, deposits and recent sessions. |
clepsy quote <seconds> | What that many seconds cost. |
clepsy receipts | Every receipt on this machine, newest first. Add --json for scripts. |
clepsy verify <file> | Checks a receipt's signature. Any edit to any field breaks it. |
clepsy whoami | Your key's id and public key. |
run exits with the command's own exit code, or 124 when the budget ran out.
Receipts
Every session ends in a JSON receipt saved under ~/.clepsy/receipts/.
{
"session": "0x7f3a…c21e",
"worker": "python",
"seconds": 412,
"paid": "0.164800 USDG",
"refund": "1.835200 USDG",
"status": "completed",
"settlement": "ledger",
"output": "sha256:91c7…",
"node": { "id": "0xbf86…c85d", "pub": "MCow…" },
"sig": "5d0a…"
}
outputis the sha256 of everything the command wrote to stdout and stderr, in order.sigis an ed25519 signature over the canonical JSON of every other field.node.idis derived from the node's public key, so a receipt cannot swap in another key.
SDK
import clepsy from "clepsy";
const session = await clepsy.open({ worker: "python", seconds: 600, cloud: "https://api.clepsy.cloud" });
const out = await session.exec("python main.py"); // { code, stdout, stderr }
const receipt = await session.stop();
clepsy.verifyReceipt(receipt); // { ok: true }
open takes budget or seconds, plus an onTick callback. Leave out cloud to run locally.
HTTP API
Base URL https://api.clepsy.cloud. The CLI and SDK sign requests for you.
| Endpoint | Returns |
|---|---|
GET /v1/node | Node id, rate, workers, deposit details. Public. |
GET /v1/account | Balance, held funds, deposits, recent sessions. |
POST /v1/sessions | Opens a sandbox and holds the budget. Body {worker, budget}. |
POST /v1/sessions/:id/exec | Runs {cmd}, output streamed as NDJSON. |
POST /v1/sessions/:id/stop | Closes, settles, returns the signed receipt. |
GET /v1/receipts/:id | A closed session's receipt. Public. |
Signed requests carry x-clepsy-key, x-clepsy-ts, x-clepsy-nonce and x-clepsy-sig, an ed25519 signature over METHOD\nPATH\nTS\nNONCE\nsha256(body). Requests older than 60 seconds or with a reused nonce are refused.