Automated summary
Automates deployment of ML training jobs and inference services on the Vast.ai GPU cloud, including Docker image optimization, a provisioning script, and data transfer guidance.
Strengths
- Ships a ready-to-use Dockerfile tuned for fast pulls on Vast.ai
- Includes a complete Python script that searches offers, filters by price and reliability, creates the instance, and polls until it is running
- Gives concrete build/push commands and size-based data transfer strategies
Limitations
- Assumes the vastai CLI is already authenticated and a Docker image is already published to a registry
- The script parses vastai CLI JSON output, which can change between versions
- Does not cover stopping or destroying instances, so cost cleanup is left to the user
Use it when you want a repeatable scripted way to launch a training run or inference service on hourly-rented GPUs.
Avoid it if you are targeting another cloud provider or need managed orchestration such as Kubernetes or SageMaker instead of on-demand GPU instances.
Security analysis
CautionThe skill is a straightforward deployment guide for Vast.ai. All commands target the user's own Vast.ai account, docker registry, and remote GPU hosts; there is no obfuscation, no piped curl|sh, no secret/token exfiltration, and no destructive filesystem commands. Risk comes from ordinary but powerful capabilities: spawning billable GPU instances, root SSH to rented hosts, and disabling SSH host key checking. That warrants a caution rating rather than safe, but nothing here is malicious.
- •Uses Bash(ssh:) and Bash(docker:) against remote hosts, including root@ logins to third-party GPU instances
- •Health-check block disables host key verification (`-o StrictHostKeyChecking=no`), weakening SSH integrity guarantees
- •Provisions and bills paid cloud GPU instances via `vastai create instance`; script can spawn costly resources without a confirmation/dry-run step
- •Example fetches a dataset with `wget` from a placeholder host over plain HTTPS with no checksum verification
- •Shell heredoc/remote commands are parameterized by unset env vars ($PORT, $HOST), risking execution against the wrong host if misconfigured
Examples
Write a Vast.ai deployment script that finds an RTX 4090 under $0.40/hr with reliability above 0.95 and launches my ghcr.io/acme/training:v1 image with 50GB disk.Create a Dockerfile.vastai for my PyTorch training code that pulls fast on Vast.ai, then show the build and push commands.My dataset is 40GB — what's the best way to transfer it to my Vast.ai instance once it's running?name: vastai-deploy-integration description: 'Deploy ML training jobs and inference services on Vast.ai GPU cloud.
Use when deploying GPU workloads, configuring Docker images,
or setting up automated deployment scripts.
Trigger with phrases like "deploy vastai", "vastai deployment",
"vastai docker", "vastai production deploy".
' allowed-tools: Read, Write, Edit, Bash(vastai:), Bash(docker:), Bash(ssh:*) version: 1.11.0 license: MIT author: Jeremy Longshore jeremy@intentsolutions.io tags:
- saas
- vast-ai
- deployment compatibility: Designed for Claude Code, also compatible with Codex and OpenClaw
Vast.ai Deploy Integration
Overview
Deploy ML training jobs and inference services on Vast.ai GPU cloud. Covers Docker image optimization, automated provisioning scripts, data transfer strategies, and deployment automation.
Prerequisites
- Vast.ai CLI authenticated
- Docker image published to a registry
- Training/inference code tested locally
Instructions
Step 1: Optimized Docker Image
# Dockerfile.vastai — optimized for fast pulls on Vast.ai
FROM pytorch/pytorch:2.2.0-cuda12.1-cudnn8-runtime
# Install dependencies in a single layer
COPY requirements.txt /tmp/
RUN pip install --no-cache-dir -r /tmp/requirements.txt && rm /tmp/requirements.txt
# Copy application code
COPY src/ /workspace/src/
COPY scripts/ /workspace/scripts/
WORKDIR /workspace
CMD ["python", "src/train.py"]
# Build and push
docker build -t ghcr.io/yourorg/training:v1 -f Dockerfile.vastai .
docker push ghcr.io/yourorg/training:v1
Step 2: Automated Deployment Script
#!/usr/bin/env python3
"""deploy.py — Automated Vast.ai deployment with monitoring."""
import subprocess, json, time, argparse, sys
def deploy(args):
# Search for matching offer
query = (f"num_gpus={args.gpus} gpu_name={args.gpu} "
f"reliability>{args.reliability} dph_total<={args.max_price} "
f"disk_space>={args.disk} rentable=true")
offers = json.loads(subprocess.run(
["vastai", "search", "offers", query, "--order", "dph_total",
"--raw", "--limit", "5"],
capture_output=True, text=True, check=True).stdout)
if not offers:
print(f"ERROR: No offers matching: {query}", file=sys.stderr)
sys.exit(1)
offer = offers[0]
print(f"Selected: {offer['gpu_name']} ${offer['dph_total']:.3f}/hr "
f"(ID: {offer['id']})")
# Create instance
cmd = ["vastai", "create", "instance", str(offer["id"]),
"--image", args.image, "--disk", str(args.disk)]
if args.onstart:
cmd.extend(["--onstart-cmd", args.onstart])
result = json.loads(subprocess.run(
cmd, capture_output=True, text=True, check=True).stdout)
instance_id = result["new_contract"]
print(f"Instance {instance_id} provisioning...")
# Wait for running
for _ in range(30):
info = json.loads(subprocess.run(
["vastai", "show", "instance", str(instance_id), "--raw"],
capture_output=True, text=True).stdout)
if info.get("actual_status") == "running":
print(f"READY: ssh -p {info['ssh_port']} root@{info['ssh_host']}")
return instance_id, info
time.sleep(10)
raise TimeoutError("Instance did not start")
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--gpu", default="RTX_4090")
parser.add_argument("--gpus", type=int, default=1)
parser.add_argument("--image", required=True)
parser.add_argument("--disk", type=int, default=50)
parser.add_argument("--max-price", type=float, default=0.50)
parser.add_argument("--reliability", type=float, default=0.95)
parser.add_argument("--onstart", default="")
deploy(parser.parse_args())
Step 3: Data Transfer Strategies
# Small datasets (<5GB): SCP directly
scp -P $PORT ./data.tar.gz root@$HOST:/workspace/
# Large datasets (>5GB): Use rsync with compression
rsync -avz --progress -e "ssh -p $PORT" ./data/ root@$HOST:/workspace/data/
# Very large datasets: Pre-stage on cloud storage
ssh -p $PORT root@$HOST "wget -q https://storage.example.com/dataset.tar.gz -O /workspace/data.tar.gz"
Step 4: Health Check After Deploy
ssh -p $PORT -o StrictHostKeyChecking=no root@$HOST << 'CHECK'
echo "=== Deploy Health Check ==="
nvidia-smi --query-gpu=name,memory.total --format=csv,noheader
python -c "import torch; print(f'CUDA: {torch.cuda.is_available()}')"
df -h /workspace | tail -1
echo "=== Ready ==="
CHECK
Output
- Optimized Docker image for fast Vast.ai pulls
- Automated deployment script with GPU/price selection
- Data transfer patterns (SCP, rsync, cloud storage)
- Post-deploy health check verification
Error Handling
| Error | Cause | Solution |
|-------|-------|----------|
| Docker pull timeout | Image too large (>10GB) | Use multi-stage builds; minimize image layers |
| Disk space exhausted | Insufficient disk allocation | Increase --disk parameter |
| SSH timeout after deploy | Instance still loading image | Wait longer or use smaller base image |
| CUDA version mismatch | Image CUDA > host CUDA | Filter offers by cuda_max_good |
Resources
Next Steps
For event-driven workflows, see vastai-webhooks-events.
Examples
One-command deploy: python deploy.py --gpu A100 --image ghcr.io/org/train:v1 --max-price 2.00 --disk 100
Multi-GPU deploy: Set --gpus 4 and --gpu H100_SXM for distributed training with torchrun.
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/vast-ai-deploy-integration-mrx3xze2/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/vast-ai-deploy-integration-mrx3xze2' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/vast-ai-deploy-integration-mrx3xze2/download' --output '.skill-downloads/vast-ai-deploy-integration-mrx3xze2/SKILL.md.part' && mv '.skill-downloads/vast-ai-deploy-integration-mrx3xze2/SKILL.md.part' '.skill-downloads/vast-ai-deploy-integration-mrx3xze2/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Environment declared by the author: Designed for Claude Code, also compatible with Codex and OpenClaw
Tools declared by the author (check availability in your agent): Read, Write, Edit, Bash(vastai:*), Bash(docker:*), Bash(ssh:*)
Original excerpt: Prerequisites
- Vast.ai CLI authenticated
- Docker image published to a registry
- Training/inference code tested locally
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/vast-ai-deploy-integration-mrx3xze2/SKILL.md' && test -s '.skill-downloads/vast-ai-deploy-integration-mrx3xze2/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/vastai-deploy-integration' && cp -R '.skill-downloads/vast-ai-deploy-integration-mrx3xze2' '.claude/skills/vastai-deploy-integration'Codex
test -f '.skill-downloads/vast-ai-deploy-integration-mrx3xze2/SKILL.md' && test -s '.skill-downloads/vast-ai-deploy-integration-mrx3xze2/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/vastai-deploy-integration' && cp -R '.skill-downloads/vast-ai-deploy-integration-mrx3xze2' '.agents/skills/vastai-deploy-integration'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/vast-ai-deploy-integration-mrx3xze2'openskills read 'vast-ai-deploy-integration-mrx3xze2'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/vast-ai-deploy-integration-mrx3xze2/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
Configure a Chat Channel with SecretRefs
DevOps
Set up chat channels using non-interactive commands, with secrets only as SecretRefs. Covers gather, mutate, repair, and prove steps for reliable delivery.
Investigate ClickHouse CI Failures
DevOps
Investigate a ClickHouse CI failure end-to-end from a PR or S3 report URL. Fetches failed tests, classifies flaky vs real regression, and checks for existing issues/fixes.
Ansible PR Review
DevOps
Reviews an Ansible PR following the project's standardized process, including changelog checks, test coverage validation, and feedback tracking.