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: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 readRUNCRATE_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 againstapi.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_minutesandidle_shutdown_minuteson 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 withsystemd-run --unit <name>: it survives, andjournalctl -u <name>has its log. - An instance type id from
/instances/typescan be gone a minute later (“no longer available”); create withgpu_typeand let Runcrate pick a machine of that GPU. - The MCP
create_instancetool has no launch script: the agent starts the install withssh_executeandnohup. The script passeslaunch_scriptto the REST API instead. /instances/{id}/execwaits 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-Idheader; any value works, as the key already names your workspace.