Automate the nodes you host
If you host nodes on OctaSpace, you can manage them from scripts: watch their status, change prices on a schedule and take them off rent for maintenance.
List your nodes
octa hosting list
octa hosting list -o jsonnodes, err := client.Hosting.Nodes(ctx)
for _, n := range nodes {
fmt.Println(n.Number, n.Status, n.Prices.Base, n.UptimePercent)
}const nodes = await client.hosting.nodes()The list contains your online nodes with their status, the services they are offered for, prices, hardware, location and uptime. A node that is offline is not listed, and GET /hosting/nodes/{number} returns 404 for it.
Status | Meaning |
|---|---|
idle | Online and available for rent |
rented | Running a renter's session |
verification | Being verified by the platform |
benchmark | Running a benchmark |
A node you took off rent has maintenance: true, whatever its status. A node that runs only VPN sessions stays idle.
Change prices
Only the prices you send change.
octa hosting prices 7KQ4-M2XD-4 --base 0.25 --storage 0.0001 --min-rent 15curl -s -X PATCH https://api.octa.space/hosting/nodes/7KQ4-M2XD-4/prices \
-H "Authorization: Bearer $OCTA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"base": 250000, "min_rent_minutes": 15}'err := client.Hosting.SetPrices(ctx, "7KQ4-M2XD-4", octaspace.NodePrices{
Base: octaspace.Price(250_000),
})await client.hosting.setPrices('7KQ4-M2XD-4', { base: usdToMicroUsd(0.25) })Price | Field | Range |
|---|---|---|
Per hour | base | $0.0001 to $1000 |
Per GB of disk per hour | storage | $0 to $1000 |
Per GB of traffic | traffic | $0.0001 to $1000 |
Minimum rent | min_rent_minutes | 0 to 60 minutes, 0 turns it off |
The CLI takes dollars; the API and SDKs take integer micro-USD. New prices show in the listings within a few seconds and apply to new sessions only: running sessions keep the prices they started with.
Example: price by time of day
Raise prices during peak hours with cron:
# crontab -e
0 9 * * * octa hosting prices 7KQ4-M2XD-4 --base 0.35
0 22 * * * octa hosting prices 7KQ4-M2XD-4 --base 0.20Example: follow the market
Use the GPU market statistics (public, no key needed) to keep your price near the median:
const market = await client.stats.gpuCurrent({ verified: 'yes' })
const rtx = market.gpus.find((g) => g.model === 'NVIDIA GeForce RTX 4090')
const median = rtx?.rented_price?.p50 // micro-USD per GPU-hour
if (median) {
await client.hosting.setPrices('7KQ4-M2XD-4', { base: Math.round(median * 0.95) })
}Prices in the statistics are per GPU-hour; multiply by the number of GPUs in your node.
Maintenance
Take a node off rent before you work on it, and offer it again afterwards. Sessions already running go on, and their renters are notified.
octa hosting maintenance 7KQ4-M2XD-4 on
# ... update drivers, reboot ...
octa hosting maintenance 7KQ4-M2XD-4 offcurl -s -X PUT https://api.octa.space/hosting/nodes/7KQ4-M2XD-4/maintenance -H "Authorization: Bearer $OCTA_API_KEY"
curl -s -X DELETE https://api.octa.space/hosting/nodes/7KQ4-M2XD-4/maintenance -H "Authorization: Bearer $OCTA_API_KEY"err := client.Hosting.SetMaintenance(ctx, "7KQ4-M2XD-4", true) // on
err = client.Hosting.SetMaintenance(ctx, "7KQ4-M2XD-4", false) // offMaintenance works for an offline node too, and repeating a call changes nothing.
Example: wait until the node is free
NODE=7KQ4-M2XD-4
octa hosting maintenance "$NODE" on
while [ "$(octa hosting show "$NODE" -o json | jq -r .status)" = "rented" ]; do
sleep 60
done
echo "No sessions left, safe to reboot"