Skip to main content
ComfyUI on your laptop is slow and on a rented GPU it is a chore: pick a machine, install, download a checkpoint, start the server, remember to turn it off. An agent with the Runcrate MCP server does the chore. It picks the lowest hourly rate, sets a hard stop and an idle stop before anything else, installs ComfyUI and one checkpoint at boot, queues a graph over ComfyUI’s own API without exposing a port, brings the image home, and deletes the machine in a finally so a crash never leaves it billing.

Build it in your project

Paste this line into your agent (Claude Code, Codex, Cursor, OpenCode, Cline). It sets up your key, then builds the pipeline in your project:
The agent does this with the MCP tools list_gpu_types, create_instance (with max_runtime_minutes and idle_shutdown_minutes), ssh_execute, file_upload, file_download and delete_instance. The files below are the same steps scripted against the REST API those tools call, for CI or a cron.

The code

One file per language. Both read RUNCRATE_API_KEY from the environment; nothing secret is in the code.

What the proof run cost

The Python file on an A6000 (the lowest-priced GPU listed at the time), rendering “a lighthouse on a cliff at dusk, oil painting” at 512x512, 25 steps. Times are from the start of the script. Measured on 2026-10-23 against api.runcrate.ai; costs are what the account was billed, read from each response’s X-LLM-Cost header or usage.cost. On the proof run the server started late: the boot script used nohup ... &, and the process was stopped when the script ended, so ComfyUI was started by hand on the instance with the systemd-run line the script now uses (the setup itself, clone, requirements and checkpoint, had finished on its own). The instance was deleted by the script’s finally and runcrate instances list was empty afterwards. The TypeScript file was run with --dry-run (it picks the GPU and prints the create call) to stay within the proof’s GPU budget.

Scale it

  • Many renders: keep the instance for the batch and queue many graphs; the boot is the slow part, not the render.
  • Your own models: keep checkpoints on a volume (storage_id) so the next machine does not download them again.
  • A team: share a link to the instance’s port with an HTTPS link instead of SSH.
  • Guardrails always: max_runtime_minutes and idle_shutdown_minutes on every create, and the environment budget as the last line.

Gotchas found in the proof run

  • A process started with nohup ... & in a launch script is stopped when the script ends. Start long-lived servers with systemd-run --unit <name>: it survives, and journalctl -u <name> has its log.
  • An instance type id from /instances/types can be gone a minute later (“no longer available”); create with gpu_type and let Runcrate pick a machine of that GPU.
  • The MCP create_instance tool has no launch script: the agent starts the install with ssh_execute and nohup. The script passes launch_script to the REST API instead.
  • /instances/{id}/exec waits at most 60 s per command: start long installs in the background and poll.
  • With an API key instead of the OAuth sign-in, the MCP server today also needs an X-Project-Id header; any value works, as the key already names your workspace.