← Back to docs

run_on_gpu

Complete reference for the primary MCP tool.

Parameters

code

string, required

Python code to execute. Runs in an isolated container with full GPU access. Files written to /output/ become downloadable artifacts.

gpu

string, optional

GPU tier to use. Options: “4090”, “A100”, “H100”. Default: “4090”.

timeout

int, optional

Maximum execution time in seconds. The run is killed if it exceeds this limit. Default: 300. Max: 3600.

packages

list, optional

Additional pip packages to install before execution. Example: [“transformers”, “diffusers”, “accelerate”].

Response

{
  "run_id": "run_8Kx2mPqR...",
  "status": "complete",
  "gpu": "A100",
  "duration_seconds": 47,
  "cost_cents": 28,
  "stdout": "Training complete. Loss: 0.0234\n",
  "stderr": "",
  "artifacts": [
    {
      "filename": "model.safetensors",
      "url": "https://r2.volspan.dev/run_8Kx2mP.../model.safetensors",
      "size_bytes": 548000000
    }
  ]
}

Response fields

run_id

Unique identifier for this run.

status

Current state of the run.

gpu

GPU tier that was used.

duration_seconds

Wall-clock execution time.

cost_cents

Exact cost in integer cents deducted from Vault.

stdout

Standard output captured during execution.

stderr

Standard error captured during execution.

artifacts

Array of files written to /output/, each with filename, signed URL, and size.

Status values

queued

Run accepted, waiting for a worker.

provisioning

Worker assigned, container starting.

running

Code is actively executing on GPU.

complete

Execution finished successfully.

failed

Code raised an unhandled exception.

timeout

Execution exceeded the timeout limit and was killed.

Example call

run_on_gpu(
  code="""
import torch
print(f"CUDA available: {torch.cuda.is_available()}")
print(f"GPU: {torch.cuda.get_device_name(0)}")
x = torch.randn(10000, 10000, device="cuda")
y = torch.mm(x, x)
print(f"Matrix mult result shape: {y.shape}")
""",
  gpu="4090",
  timeout=60
)

Need help? Reach out at [email protected]