Metadata-Version: 2.4
Name: terradev-cli
Version: 1.6.1
Summary: BYOAPI Parallel provisioning and orchestration for cross-cloud cost optimization
Home-page: https://github.com/terradev/terradev-cli
Author: Terradev Team
Author-email: Terradev Team <team@terradev.com>
Maintainer-email: Terradev Team <team@terradev.com>
License: MIT
Project-URL: Homepage, https://terradev.com
Project-URL: Documentation, https://docs.terradev.com
Project-URL: Repository, https://github.com/terradev/terradev
Project-URL: Bug Tracker, https://github.com/terradev/terradev/issues
Project-URL: Changelog, https://github.com/terradev/terradev/blob/main/CHANGELOG.md
Keywords: cloud,provisioning,gpu,compute,multi-cloud,aws,gcp,azure,kubernetes,devops,infrastructure,automation,cost-optimization,parallel,egress,rate-limiting,arbitrage
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: OS Independent
Classifier: Environment :: Console
Classifier: Natural Language :: English
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.0.0
Requires-Dist: aiohttp>=3.9.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: cryptography>=41.0.0
Provides-Extra: aws
Requires-Dist: boto3>=1.34.0; extra == "aws"
Provides-Extra: gcp
Requires-Dist: google-cloud-compute>=1.8.0; extra == "gcp"
Provides-Extra: azure
Requires-Dist: azure-mgmt-compute>=29.0.0; extra == "azure"
Requires-Dist: azure-identity>=1.12.0; extra == "azure"
Provides-Extra: all
Requires-Dist: boto3>=1.34.0; extra == "all"
Requires-Dist: google-cloud-compute>=1.8.0; extra == "all"
Requires-Dist: azure-mgmt-compute>=29.0.0; extra == "all"
Requires-Dist: azure-identity>=1.12.0; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: black>=22.0.0; extra == "dev"
Requires-Dist: flake8>=5.0.0; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# Terradev

**BYOAPI Parallel provisioning and orchestration for cross-cloud cost optimization.**

Developers overpay for compute by only accessing single-cloud workflows or using slow sequential provisioning with inefficient egress and rate-limiting.

Terradev is a cross-cloud provisioning CLI that saves developers **60%** on end-to-end compute provisioning costs. It works faster than any sequential tool to compress + stage datasets, parallel-provision optimal instances + nodes, and deploy **5x faster** than baseline provisions, at an average of **3 minutes**, with egress optimization.

Terradev is built modular, managing APIs through the end-client's discrete portfolio of cloud credentials (BYOAPI).

## What's New in v1.4.0

- **ML Services Integration**: Ray, LangChain, LangGraph, SGLang, W&B, MLflow, Hugging Face with dashboard integration
- **Setup Command**: Step-by-step setup instructions for all 11 cloud providers
- **Enhanced Monitoring**: Prometheus/Grafana

## Installation

```bash
pip install terradev-cli
```

With cloud provider extras:

```bash
pip install terradev-cli[all]        # AWS + GCP + Azure + ML services
pip install terradev-cli[aws]        # Just AWS (boto3)
pip install terradev-cli[gcp]        # Just GCP
pip install terradev-cli[azure]      # Just Azure
pip install terradev-cli[ml]         # ML services (LangChain, W&B, etc.)
pip install terradev-cli[monitoring] # Prometheus + Grafana
```

## Quick Start

```bash
# 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. Get enhanced quotes with conversion prompts
terradev quote -g A100
terradev quote -g A100 --quick  # Quick provision best quote

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

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

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

# 7. View analytics
python user_analytics.py

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

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

# 10. 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

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

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

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

# 10. Find cheaper alternatives for running instances
terradev optimize

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

# 12. 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 integrations` | Show status of W&B, Prometheus, and infra hooks |

## 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

| | 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 |

## Integrations

### Jupyter / Colab / VS Code Notebooks

```bash
pip install terradev-jupyter
```

```python
%load_ext terradev_jupyter

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

### GitHub Actions

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

### Docker (One-Command Workloads)

```bash
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

MIT License - see LICENSE file for details
