VA

vastai-local-dev-loop

Sets up a fast, reproducible local development loop for Vast.ai GPU projects to minimize cloud costs.

Install

mkdir -p .claude/skills/vastai-local-dev-loop && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/5336" && unzip -o skill.zip -d .claude/skills/vastai-local-dev-loop && rm skill.zip

Installs to .claude/skills/vastai-local-dev-loop

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Configure Vast.ai local development with testing and fast iteration.
68 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Structure projects with API clients and job runners
  • Mock Vast.ai API responses for unit testing
  • Test Docker images locally in CPU mode
  • Verify CLI authentication and account balance
  • Implement dry-run workflows for training scripts

How it works

It establishes a local development loop by mocking the Vast.ai API and using Docker to simulate the containerized environment. This allows developers to validate logic and job orchestration without incurring cloud GPU costs.

Inputs & outputs

You give it
Training code and Dockerfile
You get back
Verified local development environment and mocked test suite

When to use vastai-local-dev-loop

  • Setting up local development environments
  • Testing GPU job provisioning
  • Mocking Vast.ai API for fast iteration

About this skill

Vast.ai Local Dev Loop

Overview

Set up a fast, reproducible local development workflow for Vast.ai GPU workloads. Test Docker images locally, mock API responses for CI, and minimize cloud GPU costs during development.

Prerequisites

  • Completed vastai-install-auth setup
  • Docker installed locally
  • Python 3.8+ with pytest

Instructions

Step 1: Project Structure

vastai-project/
  src/
    vastai_client.py      # API client wrapper
    job_runner.py          # Job orchestration logic
    instance_manager.py   # Instance lifecycle management
  docker/
    Dockerfile            # GPU workload image
    requirements.txt      # Python dependencies for GPU job
  tests/
    test_client.py        # Unit tests with mocked API
    test_job_runner.py    # Integration tests
    conftest.py           # Shared fixtures and mocks
  scripts/
    test-connection.sh    # Quick API verification
    benchmark-gpu.py      # GPU benchmark script
  .env.development        # Dev API key (low spending limit)
  .env.production         # Prod API key (gitignored)

Step 2: Mock the Vast.ai API for Testing

# tests/conftest.py
import pytest
from unittest.mock import MagicMock

@pytest.fixture
def mock_vast_client():
    client = MagicMock()
    client.search_offers.return_value = {
        "offers": [
            {"id": 12345, "gpu_name": "RTX_4090", "gpu_ram": 24,
             "dph_total": 0.22, "reliability2": 0.99,
             "inet_down": 500, "ssh_host": "test.host", "ssh_port": 22},
        ]
    }
    client.create_instance.return_value = {"new_contract": 67890}
    client.show_instances.return_value = [
        {"id": 67890, "actual_status": "running",
         "ssh_host": "test.host", "ssh_port": 22}
    ]
    return client

Step 3: Test Docker Images Locally

# Build and test your GPU image locally (CPU mode)
docker build -t my-training:dev -f docker/Dockerfile .
docker run --rm my-training:dev python -c "import torch; print('OK')"

# Test training script in CPU mode
docker run --rm -v $(pwd)/data:/workspace/data my-training:dev \
  python train.py --epochs 1 --batch-size 4 --device cpu --dry-run

Step 4: Quick Connection Test Script

#!/bin/bash
set -euo pipefail
echo "Testing Vast.ai connection..."
vastai show user 2>/dev/null && echo "  CLI auth: OK" || echo "  CLI auth: FAIL"
BALANCE=$(vastai show user --raw 2>/dev/null | python3 -c "import sys,json; print(json.load(sys.stdin).get('balance',0))")
echo "  Balance: \$$BALANCE"
echo "Connection verified."

Step 5: Development Workflow

# 1. Edit Docker image and training code locally
# 2. Test locally with CPU mode
docker build -t my-training:dev . && docker run --rm my-training:dev python train.py --dry-run
# 3. Push image to registry
docker tag my-training:dev ghcr.io/yourorg/training:dev && docker push ghcr.io/yourorg/training:dev
# 4. Rent cheapest GPU for real test
vastai create instance OFFER_ID --image ghcr.io/yourorg/training:dev --disk 20
# 5. Monitor, verify, destroy
vastai show instances && vastai destroy instance INSTANCE_ID

Output

  • Project structure with client, tests, and Docker setup
  • Mocked Vast.ai client for unit tests (no API calls)
  • Local Docker testing workflow (CPU mode)
  • Connection verification script

Error Handling

ErrorCauseSolution
Docker build failsMissing CUDA locallyUse CPU-compatible base image for local testing
Mock assertions failAPI interface changedUpdate mock return values to match current API
Balance too low for testingDev account underfundedAdd $5 credits for dev testing
Image push rejectedRegistry auth missingRun docker login ghcr.io first

Resources

Next Steps

Proceed to vastai-sdk-patterns for production-ready API patterns.

Examples

TDD workflow: Write tests that mock search_offers and create_instance, implement the job runner to pass tests, then run one real integration test against the API.

Cost-controlled dev: Set dph_total<=0.10 in search queries and auto-destroy after 30 minutes to keep testing costs under $0.05.

When not to use it

  • Testing code that requires actual GPU hardware acceleration
  • Performance benchmarking on CPU-only environments

Prerequisites

Completed vastai-install-auth setupDocker installed locallyPython 3.8+ with pytest

Limitations

  • Local testing uses CPU mode which may not catch GPU-specific errors
  • Mock return values must be manually updated if the API interface changes

How it compares

It shifts testing from the cloud to a local containerized environment, reducing costs and iteration time compared to deploying to a remote GPU instance for every change.

Compared to similar skills

vastai-local-dev-loop side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
vastai-local-dev-loop (this skill)126dReviewIntermediate
documenso-local-dev-loop226dReviewBeginner
gentleman-e2e17moReviewIntermediate
nx-run-tasks16moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

You might also like

documenso-local-dev-loop

jeremylongshore

Set up local development environment and testing workflow for Documenso. Use when configuring dev environment, setting up test workflows, or establishing rapid iteration patterns with Documenso. Trigger with phrases like "documenso local dev", "documenso development", "test documenso locally", "documenso dev environment".

26

gentleman-e2e

Gentleman-Programming

Docker-based E2E testing patterns for Gentleman.Dots installer. Trigger: When editing files in installer/e2e/, writing E2E tests, or adding platform support.

13

nx-run-tasks

nrwl

Helps with running tasks in an Nx workspace. USE WHEN the user wants to execute build, test, lint, serve, or run any other tasks defined in the workspace.

13

firecrawl-local-dev-loop

jeremylongshore

Configure FireCrawl local development with hot reload and testing. Use when setting up a development environment, configuring test workflows, or establishing a fast iteration cycle with FireCrawl. Trigger with phrases like "firecrawl dev setup", "firecrawl local development", "firecrawl dev environment", "develop with firecrawl".

12

bazel-build-optimization

wshobson

Optimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.

14116

modal

davila7

Run Python code in the cloud with serverless containers, GPUs, and autoscaling. Use when deploying ML models, running batch processing jobs, scheduling compute-intensive tasks, or serving APIs that require GPU acceleration or dynamic scaling.

587

Search skills

Search the agent skills registry