Disclaimer: This is a work-in-progress. Use at your own risk
Buy a completed AI task — or rent raw GPU inference — from a network of independent hosts. Companion project to PaySafe — payments flow over x402 (USDC on Base), and PaySafe screens counterparties.
Renter/Agent ──x402──▶ Relay (Render) ──WSS──▶ Host agent ──▶ local Ollama ──▶ GPU
│ task routing · validation · registry · ledger · canaries
└─ optional PaySafe reputation screening
Two pieces: relay/ (server, deploy next to PaySafe on Render) and agent/ (what friends install — Windows/NVIDIA, macOS/Apple Silicon, or Linux/NVIDIA).
Submit a small task; the relay routes it to the cheapest capable model on the network, validates the output deterministically, and silently escalates to a stronger model if validation fails. In x402 mode, payment settles only when a validator passes — if every attempt fails you get a 422 and are never charged. That's the quality guarantee: not a promise, a settlement rule.
| Endpoint | Price (default) | Guarantee checked |
|---|---|---|
POST /v1/task/classify |
$0.002 | output is exactly one of your labels |
POST /v1/task/extract |
$0.003 | output parses as JSON and conforms to your schema |
POST /v1/task/summarize |
$0.01 | within max_words, shorter than the input |
POST /v1/task/generate |
$0.01 | optional JSON-schema or min/max word bounds |
All classes also reject empty outputs and refusals. Request shape (class comes from the path):
curl -X POST https://<relay>/v1/task/classify -H 'content-type: application/json' -d '{
"input": "This product broke after one day.",
"labels": ["positive", "negative", "neutral"]
}'
curl -X POST https://<relay>/v1/task/extract -H 'content-type: application/json' -d '{
"input": "Ada Lovelace, born 1815, London.",
"json_schema": {
"type": "object",
"properties": { "name": {"type":"string"}, "birth_year": {"type":"integer"} },
"required": ["name", "birth_year"],
"additionalProperties": false
}
}'Optional fields: instructions, max_words / min_words, language (best-effort, prompt-only), max_attempts (≤ relay's TASK_MAX_ATTEMPTS), options.seed. Responses include output (parsed JSON when a schema applied), model, and the full attempts trail.
Supported JSON-schema subset (schemas outside it are rejected with a 400, never silently unchecked): type (object/array/string/number/integer/boolean/null), properties, required, items, enum, const, minLength/maxLength, minimum/maximum, minItems/maxItems, additionalProperties: false. Max 8KB, depth ≤ 8. No pattern, $ref, oneOf, format.
curl -X POST https://<relay>/v1/run -H 'content-type: application/json' -d '{
"model": "llama3.2:3b",
"messages": [{"role":"user","content":"Say hi in five words."}]
}'/v1/run is priced flat ($0.005 default) with no validation — you pick the model, you own the output quality.
In PAYMENT_MODE=dev (default) everything is free. In PAYMENT_MODE=x402 the relay uses the official @x402/express resource-server stack: unpaid requests get a 402 challenge (PAYMENT-REQUIRED header); any x402 client (@x402/fetch, x402-requests) pays and retries automatically. X402_FACILITATOR=x402org targets Base Sepolia for testing; mainnet uses cdp (Coinbase facilitator + CDP_API_KEY_ID/SECRET). The full mainnet checklist lives in docs/MAINNET-RUNBOOK.md.
Mint an invite code per user:
curl -X POST https://<relay>/v1/invites -H "Authorization: Bearer $ADMIN_KEY"
- Windows — open PowerShell and run:
irm https://raw.githubusercontent.com/corbinallison/paysafe-node/main/installer/install.ps1 | iexmacOS / Linux — open a terminal and run:curl -fsSL https://raw.githubusercontent.com/corbinallison/paysafe-node/main/installer/install.sh | bash- Paste the invite code I gave you and a wallet address (Coinbase Wallet is free).
- Run
paysafe-node start. That's it —paysafe-node statusshows your jobs.
Requirements: ~5GB disk and one of — Windows 10/11 or Linux with an NVIDIA GPU (8GB+ VRAM comfortable for the default llama3.2:3b), or an Apple Silicon Mac (M1 or newer, 16GB unified memory recommended). Hosts earn 80% of every job their node completes (the winning attempt only, credited after payment settles); payouts are weekly USDC on Base.
- The relay blueprint (
relay/render.yaml) uses Render's starter plan with a 1GB persistent disk at/var/data(DATA_DIR). The disk keeps the ledger, node registrations, invites, and the audit log across deploys/restarts; paid instances also don't sleep. Without it (free tier), every restart wipes state and disconnects all nodes — the relay logs a loud warning at boot ifDATA_DIRis unset. GET /v1/nodes(admin) — who's online, GPUs, reputation (incl.taskOk/taskFail), quarantine stateGET /v1/ledger(admin) — USDC owed per host (80% share)POST /v1/payouts(admin) —{nodeId, txHash}or{all:true}: records the payout in the hash-chained audit log and zeroes the balanceGET /v1/audit/head | verify | export(admin) — tamper-evident money-event log (settlements + payouts)- Canary probes run automatically every ~10 min against idle nodes; 3 consecutive failures quarantine a node. Task-validation failures never quarantine (capability ≠ dishonesty) — they only steer routing stats.
ALLOWED_MODELSenv is the curated catalog;MODEL_CATALOG(JSON) overrides the cost/capability table used for task routing.
relay/ express + @x402/express server — task routing (tasks/catalog/validators),
payments, WS signaling, ledger, hash-chained audit log
agent/ host CLI (Node 20, dep: ws) — setup | start | status | logs
installer/ install.ps1 (Windows/winget) + install.sh (macOS/Linux) — install Node+Ollama, verify checksum, PATH shim
docs/ MAINNET-RUNBOOK.md — the flip-to-real-money checklist
SECURITY.md which security-plan measures are implemented vs deferred
# from the repo root — the zip MUST contain the agent/ prefix (both installers expect agent/src/cli.js)
zip -r paysafe-node-agent-0.2.0.zip agent -x 'agent/node_modules/*'
shasum -a 256 paysafe-node-agent-0.2.0.zip
# paste the hash into installer/install.ps1 ($AgentSha256) AND installer/install.sh (AGENT_SHA256),
# tag the GitHub release, upload the zip