Vastai api

From rawveg/skillsforge-marketplace · View interactive version

Vastai api is an AI agent skill from the GitHub repository rawveg/skillsforge-marketplace. Vast.ai API Documentation - Affordable GPU Cloud Marketplace

How to use this skill

Skill file

Vastai-Api Skill

Comprehensive assistance with the Vast.ai API for managing GPU instances, machine operations, and automating AI/ML workflows. This skill provides access to official documentation for programmatically controlling the Vast.ai platform.

When to Use This Skill

This skill should be triggered when working with:

Quick Reference

Creating and Managing Instances

Create a New GPU Instance
# Create instance from an offer
vastai create instance <offer_id> \
  --image pytorch/pytorch:latest \
  --disk 50 \
  --ssh
List Your Active Instances
# Show all instances
vastai show instances

# Show specific instance details
vastai show instance <instance_id>
Manage Instance State
# Stop an instance (pause GPU billing, storage still charged)
vastai stop instance <instance_id>

# Start a stopped instance
vastai start instance <instance_id>

# Reboot instance without losing GPU priority
vastai reboot instance <instance_id>

# Destroy instance permanently (irreversible)
vastai destroy instance <instance_id>

SSH Key Management

Add SSH Key to Account
# Add your public SSH key
vastai create ssh-key "ssh-rsa AAAAB3NzaC1yc2EA... user@host"

# List all SSH keys
vastai show ssh-keys

# Attach SSH key to specific instance
vastai attach ssh <instance_id> <ssh_key>

Search and Filter Offers

Search for GPU Offers
# Search with filters
vastai search offers \
  --gpu_name RTX_4090 \
  --num_gpus 2 \
  --disk_space 100

# Order by price
vastai search offers --order dph_total

Environment Variables (Secrets)

Manage Environment Variables
# Create encrypted environment variable
vastai create env-var MY_API_KEY "secret_value_here"

# List all environment variables
vastai show env-vars

# Update existing variable
vastai update env-var MY_API_KEY "new_secret_value"

# Delete environment variable
vastai delete env-var MY_API_KEY

Billing and Credits

View Billing Information
# Show invoices
vastai show invoices

# Show earnings (for hosts)
vastai show earnings

# Show deposit for specific instance
vastai show deposit <instance_id>

# Transfer credits to another user
vastai transfer credit recipient@email.com 25.00

Instance Logs

Retrieve Container Logs
# Get last 100 lines of logs
vastai show logs <instance_id> --tail 100

# Filter logs with grep pattern
vastai show logs <instance_id> --filter "error"

# Get daemon system logs
vastai show logs <instance_id> --daemon-logs

Data Transfer Operations

Copy Between Instances
# Copy from one instance to another
vastai copy <src_id> <dst_id> /source/path /destination/path

# Cloud copy using rclone
vastai cloud copy <instance_id> remote:bucket/path /local/path

Machine Management (for Hosts)

List Your Machine for Rent
# List machine with pricing
vastai list machine <machine_id> \
  --price_gpu 0.50 \
  --price_disk 0.10

# Unlist machine (stop renting)
vastai unlist machine <machine_id>

# Schedule maintenance window
vastai schedule maint <machine_id> \
  --sdate "2025-11-01T10:00:00" \
  --duration 3600

Key Concepts

Instance Types

Pricing Model

Instance States

Authentication

Templates

Pre-configured setups containing:

Popular templates include PyTorch, TensorFlow, Jupyter, ComfyUI, and Stable Diffusion.

Network Volumes

Shared network storage that can be:

Serverless Architecture

Reference Files

This skill includes comprehensive documentation in references/:

llms-full.md

Complete API reference with all endpoints organized by category:

Each endpoint includes:

llms-txt.md

Focused documentation covering:

llms.md

Curated list of all API operations with brief descriptions and CLI examples, organized by category for quick lookup.

Working with This Skill

For Beginners

Start here:

  1. Review the QuickStart section in llms-txt.md
  2. Follow the 4-step setup process (signup, add credit, prepare SSH, create instance)
  3. Try the basic examples in Quick Reference above
  4. Learn about instance states and pricing model in Key Concepts

First tasks to try:

For Intermediate Users

Focus on:

Useful patterns:

For Advanced Users

Advanced topics:

Power user tips:

Navigation Tips

Finding API endpoints:

Quick lookups:

Understanding concepts:

Common Workflows

Setting Up a New Development Environment

  1. Create API key with appropriate permissions
  2. Add SSH key to account for access
  3. Create environment variables for secrets
  4. Search for GPU offers matching requirements
  5. Create instance from template
  6. Connect via SSH and verify setup

Managing Long-Running Training Jobs

  1. Create instance with sufficient disk space
  2. Set up auto-billing to prevent interruptions
  3. Use reserved instance with prepayment for discounts
  4. Monitor with logs endpoint
  5. Copy model checkpoints to cloud storage
  6. Stop (not destroy) when paused to save costs

Hosting Machines for Profit

  1. Set machine pricing with list command
  2. Define minimum bid thresholds
  3. Configure default jobs for background work
  4. Schedule maintenance windows when needed
  5. Monitor earnings and clean up expired contracts
  6. Adjust pricing based on market conditions

Best Practices

Cost Management

Security

Performance

Reliability

Resources

Official Links

Support

Notes

Updating

To refresh this skill with updated documentation:

  1. Re-run the scraper with the same configuration
  2. The skill will be rebuilt with the latest API information
  3. Check for API version changes or deprecated endpoints
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.