exe.dev has one API, which looks like a CLI, but it can be used over multiple transports. You can run commands over SSH or send those same commands over HTTPS to https://exe.dev/exec. This extends to running commands on your VMs!
# Generate a token using your SSH key. (You can do this on the web UI as well!)
TOKEN=$(ssh exe.dev ssh-key generate-api-key --exp 1h --cmds=ssh,new --label tmp-$(date +%s) --json | jq .token -r)
# Create a new VM
curl https://exe.dev/exec -H "Authorization: Bearer $TOKEN" \
-d 'new --name example-vm'
{"vm_name":"example-vm"...
# Run "hostname" on that new VM
curl https://exe.dev/exec -H "Authorization: Bearer $TOKEN" \
-d 'ssh example-vm hostname'
example-vm
See the complete docs: https://exe.dev/docs/https-api-run-on-vm
This API shape composes nicely with the powerful primitives in your VM. So, if you want to start a task and return immediately, you can do something like the following with setsid nohup and output redirection.
curl https://exe.dev/exec -H "Authorization: Bearer $TOKEN" \
-d "ssh example-vm 'setsid nohup sleep 10 > /tmp/out 2>&1 &'"
# Returns immediately
