Skip to main content

Cross-cloud GPU provisioning with GitOps automation and HuggingFace Spaces deployment

Project description

Terradev CLI v2.9.5

BYOAPI: Cross-cloud GPU provisioning and cost optimization platform with GitOps automation.

License: Business Source License 1.1 (BUSL-1.1) - Free for evaluation, testing, and internal business use.

๐Ÿ”— GitHub Repository: https://github.com/theoddden/terradev

๐Ÿ“„ License Details: https://github.com/theoddden/terradev?tab=License-1-ov-file

Developers overpay by only accessing single-cloud workflows or using sequential provisioning with inefficient egress + rate-limiting.

Terradev is a cross-cloud compute-provisioning CLI that compresses + stages datasets, provisions optimal instances + nodes, and deploys 3-5x faster than sequential provisioning.

Terradev is integrated with Kubernetes and Karpenter: We generate Helm templates.

Other integrations: Grafana/Prometheus, OpenPolicyAgent, Weights&Biases, Kserve, DataVersionControl, MLFlow, Ray, vLLM, Ollama, GitOps Automation (ArgoCD/Flux)

๐Ÿš€ GitOps Automation

Production-ready GitOps workflows based on real-world Kubernetes experience:

# Initialize GitOps repository
terradev gitops init --provider github --repo my-org/infra --tool argocd --cluster production

# Bootstrap GitOps tool on cluster
terradev gitops bootstrap --tool argocd --cluster production

# Sync cluster with Git repository
terradev gitops sync --cluster production --environment prod

# Validate configuration
terradev gitops validate --dry-run --cluster production

GitOps Features

  • Multi-Provider Support: GitHub, GitLab, Bitbucket, Azure DevOps
  • Tool Integration: ArgoCD and Flux CD support
  • Repository Structure: Automated GitOps repository setup
  • Policy as Code: Gatekeeper/Kyverno policy templates
  • Multi-Environment: Dev, staging, production environments
  • Resource Management: Automated quotas and network policies
  • Validation: Dry-run and apply validation
  • Security: Best practices and compliance policies

GitOps Repository Structure

my-infra/
โ”œโ”€โ”€ clusters/
โ”‚   โ”œโ”€โ”€ dev/
โ”‚   โ”œโ”€โ”€ staging/
โ”‚   โ””โ”€โ”€ prod/
โ”œโ”€โ”€ apps/
โ”œโ”€โ”€ infra/
โ”œโ”€โ”€ policies/
โ””โ”€โ”€ monitoring/

Deploy any HuggingFace model to Spaces with one command:

# Install HF Spaces support
pip install terradev-cli[hf]

# Set your HF token
export HF_TOKEN=your_huggingface_token

# Deploy Llama 2 with one click
terradev hf-space my-llama --model-id meta-llama/Llama-2-7b-hf --template llm

# Deploy custom model with GPU
terradev hf-space my-model --model-id microsoft/DialoGPT-medium \
  --hardware a10g-large --sdk gradio

# Result:
# Space URL: https://huggingface.co/spaces/username/my-llama
# 100k+ researchers can now access your model!

HF Spaces Features

  • One-Click Deployment: No manual configuration required
  • Template-Based: LLM, embedding, and image model templates
  • Multi-Hardware: CPU-basic to A100-large GPU tiers
  • Auto-Generated Apps: Gradio, Streamlit, and Docker support
  • Revenue Streams: Hardware upgrades, private spaces, template licensing

Available Templates

# LLM Template (A10G GPU)
terradev hf-space my-llama --model-id meta-llama/Llama-2-7b-hf --template llm

# Embedding Template (CPU-upgrade)
terradev hf-space my-embeddings --model-id sentence-transformers/all-MiniLM-L6-v2 --template embedding

# Image Model Template (T4 GPU)
terradev hf-space my-image --model-id runwayml/stable-diffusion-v1-5 --template image

Installation

pip install terradev-cli

With HF Spaces support:

pip install terradev-cli[hf]        # HuggingFace Spaces deployment
pip install terradev-cli[all]        # All cloud providers + ML services + HF Spaces

Quick Start

# 1. Get setup instructions for any provider
terradev setup runpod --quick
terradev setup aws --quick

# 2. Configure your cloud credentials (BYOAPI โ€” you own your keys)
terradev configure --provider runpod
terradev configure --provider aws
terradev configure --provider vastai

# 3. Deploy to HuggingFace Spaces (NEW!)
terradev hf-space my-llama --model-id meta-llama/Llama-2-7b-hf --template llm
terradev hf-space my-embeddings --model-id sentence-transformers/all-MiniLM-L6-v2 --template embedding
terradev hf-space my-image --model-id runwayml/stable-diffusion-v1-5 --template image

# 4. Get enhanced quotes with conversion prompts
terradev quote -g A100
terradev quote -g A100 --quick  # Quick provision best quote

# 5. Provision the cheapest instance (real API call)
terradev provision -g A100

# 6. Configure ML services
terradev configure --provider wandb --dashboard-enabled true
terradev configure --provider langchain --tracing-enabled true

# 7. Use ML services
terradev ml wandb --test
terradev ml langchain --create-workflow my-workflow

# 8. View analytics
python user_analytics.py

# 9. Provision 4x H100s in parallel across multiple clouds
terradev provision -g H100 -n 4 --parallel 6

# 10. Dry-run to see the allocation plan without launching
terradev provision -g A100 -n 2 --dry-run

# 11. Manage running instances
terradev status --live
terradev manage -i <instance-id> -a stop
terradev manage -i <instance-id> -a start
terradev manage -i <instance-id> -a terminate

# 12. Execute commands on provisioned instances
terradev execute -i <instance-id> -c "python train.py"

# 13. Stage datasets near compute (compress + chunk + upload)
terradev stage -d ./my-dataset --target-regions us-east-1,eu-west-1

# 14. View cost analytics from the tracking database
terradev analytics --days 30

# 15. Find cheaper alternatives for running instances
terradev optimize

# 16. One-command Docker workload (provision + deploy + run)
terradev run --gpu A100 --image pytorch/pytorch:latest -c "python train.py"

# 17. Keep an inference server alive
terradev run --gpu H100 --image vllm/vllm-openai:latest --keep-alive --port 8000

BYOAuth โ€” Bring Your Own Authentication

Terradev never touches, stores, or proxies your cloud credentials through a third party. Your API keys stay on your machine in ~/.terradev/credentials.json โ€” encrypted at rest, never transmitted.

How it works:

  1. You run terradev configure --provider <name> and enter your API key
  2. Credentials are stored locally in your home directory โ€” never sent to Terradev servers
  3. Every API call goes directly from your machine to the cloud provider
  4. No middleman account, no shared credentials, no markup on provider pricing

Why this matters:

  • Zero trust exposure โ€” No third party holds your AWS/GCP/Azure keys
  • No vendor lock-in โ€” If you stop using Terradev, your cloud accounts are untouched
  • Enterprise-ready โ€” Compliant with SOC2, HIPAA, and internal security policies that prohibit sharing credentials with SaaS vendors
  • Full audit trail โ€” Every provision is logged locally with provider, cost, and timestamp

CLI Commands

Command Description
terradev configure Set up API credentials for any provider
terradev quote Get real-time GPU pricing across all clouds
terradev provision Provision instances with parallel multi-cloud arbitrage
terradev manage Stop, start, terminate, or check instance status
terradev status View all instances and cost summary
terradev execute Run commands on provisioned instances
terradev stage Compress, chunk, and stage datasets near compute
terradev analytics Cost analytics with daily spend trends
terradev optimize Find cheaper alternatives for running instances
terradev run Provision + deploy Docker container + execute in one command
terradev hf-space NEW: One-click HuggingFace Spaces deployment
terradev up NEW: Manifest cache + drift detection
terradev rollback NEW: Versioned rollback to any deployment
terradev manifests NEW: List cached deployment manifests
terradev integrations Show status of W&B, Prometheus, and infra hooks

HF Spaces Commands (NEW!)

# Deploy Llama 2 to HF Spaces
terradev hf-space my-llama --model-id meta-llama/Llama-2-7b-hf --template llm

# Deploy with custom hardware
terradev hf-space my-model --model-id microsoft/DialoGPT-medium \
  --hardware a10g-large --sdk gradio --private

# Deploy embedding model
terradev hf-space my-embeddings --model-id sentence-transformers/all-MiniLM-L6-v2 \
  --template embedding --env BATCH_SIZE=64

Manifest Cache Commands (NEW!)

# Provision with manifest cache
terradev up --job my-training --gpu-type A100 --gpu-count 4

# Fix drift automatically
terradev up --job my-training --fix-drift

# Rollback to previous version
terradev rollback my-training@v2

# List all cached manifests
terradev manifests --job my-training

Observability & ML Integrations

Terradev facilitates connections to your existing tools via BYOAPI โ€” your keys stay local, all data flows directly from your instances to your services.

Integration What Terradev Does Setup
Weights & Biases Auto-injects WANDB_* env vars into provisioned containers terradev configure --provider wandb --api-key YOUR_KEY
Prometheus Pushes provision/terminate metrics to your Pushgateway terradev configure --provider prometheus --api-key PUSHGATEWAY_URL
Grafana Exports a ready-to-import dashboard JSON terradev integrations --export-grafana

Infrastructure Hooks

Terradev integrates with end-user managed infrastructure when available:

  • Kubernetes โ€” Deploy to existing K8s clusters
  • Karpenter โ€” Multi-cloud node provisioning via Karpenter CRDs
  • Grafana โ€” Dashboard creation for training job monitoring
  • Open Policy Agent โ€” Policy-as-code compliance enforcement

Cost Savings Examples

GPU Type On-Demand (AWS) Best Spot Price Terradev Best Savings
A100 $4.06/hr $1.22/hr $0.84/hr 79%
H100 $7.20/hr $2.16/hr $1.50/hr 79%
RTX 4090 $1.21/hr $0.36/hr $0.25/hr 79%

Prices queried in real-time from all 10+ providers. Actual savings vary by availability.

Project Structure

terradev_cli/
โ”œโ”€โ”€ cli.py                   # Main CLI (quote, provision, manage, status, etc.)
โ”œโ”€โ”€ core/
โ”‚   โ”œโ”€โ”€ cost_tracker.py      # SQLite cost tracking database
โ”‚   โ”œโ”€โ”€ dataset_stager.py    # Compression, chunking, parallel staging
โ”‚   โ”œโ”€โ”€ egress_optimizer.py  # Cross-cloud data transfer cost optimization
โ”‚   โ”œโ”€โ”€ parallel_provisioner.py  # Concurrent multi-cloud deployment engine
โ”‚   โ”œโ”€โ”€ tier_manager.py      # Research / Research+ / Enterprise tier logic
โ”‚   โ””โ”€โ”€ rate_limiter.py      # API rate limiting
โ”œโ”€โ”€ providers/
โ”‚   โ”œโ”€โ”€ base_provider.py     # Abstract provider interface
โ”‚   โ”œโ”€โ”€ aws_provider.py      # AWS EC2 (boto3)
โ”‚   โ”œโ”€โ”€ gcp_provider.py      # Google Cloud Compute
โ”‚   โ”œโ”€โ”€ azure_provider.py    # Azure Compute
โ”‚   โ”œโ”€โ”€ runpod_provider.py   # RunPod GraphQL API
โ”‚   โ”œโ”€โ”€ vastai_provider.py   # Vast.ai REST API
โ”‚   โ”œโ”€โ”€ lambda_labs_provider.py  # Lambda Cloud API
โ”‚   โ”œโ”€โ”€ coreweave_provider.py    # CoreWeave API
โ”‚   โ”œโ”€โ”€ tensordock_provider.py   # TensorDock API
โ”‚   โ”œโ”€โ”€ crusoe_provider.py       # Crusoe Cloud API
โ”‚   โ””โ”€โ”€ provider_factory.py  # Dynamic provider instantiation
โ”œโ”€โ”€ integrations/
โ”‚   โ”œโ”€โ”€ wandb_integration.py     # W&B BYOAPI facilitation
โ”‚   โ””โ”€โ”€ prometheus_integration.py # Prometheus Pushgateway metrics
โ””โ”€โ”€ utils/
    โ””โ”€โ”€ formatters.py        # Output formatting

Pricing Tiers

Feature Research (Free) Research+ ($49.99/mo) Enterprise ($299.99/mo)
Provisions/month 10 100 Unlimited
Max concurrent instances 1 4 32
Providers All 11 All 11 All 11 + priority
Cost tracking Yes Yes Yes
Dataset staging Yes Yes Yes
Egress optimization Basic Full Full + custom routes

<<<<<<< HEAD

Integrations

Jupyter / Colab / VS Code Notebooks

pip install terradev-jupyter
%load_ext terradev_jupyter

%terradev quote -g A100
%terradev provision -g H100 --dry-run
%terradev run --gpu A100 --image pytorch/pytorch:latest --dry-run

=======

Supported Datasets

658c96a2ec31e6765baf5a2e8bffcc2b2e59e36f

GitHub Actions

- uses: theodden/terradev-action@v1
  with:
    gpu-type: A100
    max-price: "1.50"
  env:
    TERRADEV_RUNPOD_KEY: ${{ secrets.RUNPOD_API_KEY }}

Docker (One-Command Workloads)

terradev run --gpu A100 --image pytorch/pytorch:latest -c "python train.py"
terradev run --gpu H100 --image vllm/vllm-openai:latest --keep-alive --port 8000

Requirements

  • Python >= 3.9
  • Cloud provider API keys (configured via terradev configure)

License

Business Source License 1.1 (BUSL-1.1) - see LICENSE file for details

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

terradev_cli-2.9.5.tar.gz (2.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

terradev_cli-2.9.5-py3-none-any.whl (934.1 kB view details)

Uploaded Python 3

File details

Details for the file terradev_cli-2.9.5.tar.gz.

File metadata

  • Download URL: terradev_cli-2.9.5.tar.gz
  • Upload date:
  • Size: 2.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for terradev_cli-2.9.5.tar.gz
Algorithm Hash digest
SHA256 1347351b1a4d6ac822f6672aa9d1be9c7c58f184f03e25bb4fbc8d48fe447cfc
MD5 5f0fcc73fbe3cae784f64fca85915ba1
BLAKE2b-256 63e97a1bbe38c4fd67af53088490903f23ecdc3b5920a7c3f5cd6477b4278bd3

See more details on using hashes here.

File details

Details for the file terradev_cli-2.9.5-py3-none-any.whl.

File metadata

  • Download URL: terradev_cli-2.9.5-py3-none-any.whl
  • Upload date:
  • Size: 934.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for terradev_cli-2.9.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6f7b0b65d2b6aa9fce9993fe232ff985f201f212b5dd08d9a28fa6cb9757cdde
MD5 3c2ca6cb9bcd7953c6ca3ba2698df647
BLAKE2b-256 89ad00c272f7664a3578cd41bb49312537298e3ef5fd8dcb6a1da08f6a37783f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page