### Install Brev CLI on Windows (WSL) Source: https://docs.nvidia.com/brev/cli/getting-started.md Install Ubuntu via WSL and run the installation script within the Linux environment. ```powershell # Install WSL with Ubuntu (run in PowerShell as admin) wsl --install -d Ubuntu-22.04 # Restart your computer, then open Ubuntu and run: bash -c "$(curl -fsSL https://raw.githubusercontent.com/brevdev/brev-cli/main/bin/install-latest.sh)" ``` -------------------------------- ### ML Training Setup Workflow Source: https://docs.nvidia.com/brev/cli/composable-workflows.md Chain search, creation, setup scripts, and IDE opening into a single command pipeline. ```bash # Find a cheap A100, create with setup script, and open brev search --gpu-name A100 --sort price \ | brev create training-box \ | brev exec @setup.sh \ | brev open cursor ``` -------------------------------- ### Install Brev CLI on Linux Source: https://docs.nvidia.com/brev/cli/getting-started.md Download and execute the latest installation script. ```bash # Download and run the installer bash -c "$(curl -fsSL https://raw.githubusercontent.com/brevdev/brev-cli/main/bin/install-latest.sh)" # Verify installation brev --version ``` -------------------------------- ### Use setup scripts Source: https://docs.nvidia.com/brev/cli/instance-management.md Automate environment configuration by running scripts after instance startup. ```bash # Run a setup script from URL brev start https://github.com/user/repo.git --setup-script https://raw.githubusercontent.com/user/repo/main/setup.sh # Run a script from within the repo brev start https://github.com/user/repo.git --setup-repo . --setup-path ./scripts/setup.sh ``` -------------------------------- ### Start or create an instance Source: https://docs.nvidia.com/brev/cli/instance-management.md Start a stopped instance or create a new one from a Git URL or local path. ```bash brev start my-instance ``` -------------------------------- ### Install and Test ML Framework in Container Source: https://docs.nvidia.com/brev/troubleshooting/instances-gpus/gpu-detection-pytorch.md Install Unsloth and verify the import inside the container environment. ```bash pip install -U unsloth unsloth-zoo python - <<'PY' from unsloth import FastLanguageModel print("Unsloth import OK") PY ``` -------------------------------- ### Install via Homebrew Source: https://docs.nvidia.com/brev/troubleshooting/cli-installation/cli-installation-linux.md Alternative installation method using the Homebrew package manager. ```bash brew install brevdev/homebrew-brev/brev ``` -------------------------------- ### Manual installation script execution Source: https://docs.nvidia.com/brev/troubleshooting/cli-installation/cli-installation-linux.md Steps to download, set permissions, and execute the installation script manually to capture potential errors. ```bash curl -fsSL https://raw.githubusercontent.com/brevdev/brev-cli/main/bin/install-latest.sh -o install-latest.sh ``` ```bash chmod +x install-latest.sh ``` ```bash ./install-latest.sh ``` -------------------------------- ### Display CLI Help and Version Source: https://docs.nvidia.com/brev/cli/cli-overview.md Use these commands to verify the installation and explore available CLI functionality. ```bash # Get help on any command brev --help brev --help # Check CLI version brev --version ``` -------------------------------- ### Install Brev CLI on macOS Source: https://docs.nvidia.com/brev/cli/getting-started.md Use Homebrew to install the CLI and verify the installation. ```bash # Add the Brev tap and install brew install brevdev/homebrew-brev/brev # Verify installation brev --version ``` -------------------------------- ### Inspect Startup Logs Source: https://docs.nvidia.com/brev/troubleshooting/common-issues.md Displays the full initialization sequence to diagnose setup failures like repository cloning issues. ```bash brev shell my-instance --host sudo cat /var/log/brev-workspace.log ``` -------------------------------- ### Install Brev CLI Source: https://docs.nvidia.com/brev/getting-started/quickstart.md Commands to install the Brev CLI on different operating systems and verify the installation. ```bash # Install with Homebrew brew install brevdev/homebrew-brev/brev # Verify installation brev --version ``` ```bash # Download and run the installer bash -c "$(curl -fsSL https://raw.githubusercontent.com/brevdev/brev-cli/main/bin/install-latest.sh)" # Verify installation brev --version ``` ```powershell # First, install WSL with Ubuntu (run in PowerShell as admin) wsl --install -d Ubuntu-22.04 # Restart your computer, then open Ubuntu and run: bash -c "$(curl -fsSL https://raw.githubusercontent.com/brevdev/brev-cli/main/bin/install-latest.sh)" # Verify installation brev --version ``` -------------------------------- ### Install Brev CLI Source: https://docs.nvidia.com/brev/guides/registered-compute/register-dgx-spark.md Install the Brev CLI on your DGX Spark system. ```bash curl -fsSL https://brev.nvidia.com/install | bash ``` -------------------------------- ### Common Instance Creation Examples Source: https://docs.nvidia.com/brev/cli/instance-creation.md Standard usage patterns for creating instances with specific hardware requirements, startup scripts, and cluster configurations. ```bash # Simple creation with smart defaults brev create my-instance # Specific type with startup script brev create my-instance --type g5.xlarge -s @setup.sh # High-VRAM GPU with fallback brev create training-box --gpu-name A100 --min-vram 40 # Create 3-node cluster brev create my-cluster --count 3 --type g5.xlarge # Preview what would be created brev create my-instance --dry-run # Full pipeline: search → create → setup → open brev search --gpu-name A100 | brev create my-box | brev exec @setup.sh ``` -------------------------------- ### Install the Brev agent skill via CLI Source: https://docs.nvidia.com/brev/guides/ai-agents/cli-with-agents.md Installs the agent skill using the Brev CLI. ```bash brev agent-skill install ``` -------------------------------- ### Install Required Dependencies Source: https://docs.nvidia.com/brev/troubleshooting/instances-gpus/gpu-detection-pytorch.md Install optional dependencies like xformers and torchao required by Unsloth. ```bash pip install xformers torchao ``` -------------------------------- ### View installed skill file structure Source: https://docs.nvidia.com/brev/guides/ai-agents/cli-with-agents.md Displays the directory structure of the installed Brev CLI skill. ```text ~/.claude/skills/brev-cli/ ├── SKILL.md # Skill definition and quick reference ├── prompts/ │ ├── quick-session.md # Quick GPU session workflow │ ├── ml-training.md # ML training setup workflow │ └── cleanup.md # Instance cleanup workflow ├── reference/ │ ├── commands.md # Full command reference │ └── search-filters.md # GPU/CPU search filter details └── examples/ └── common-patterns.md # Common usage patterns ``` -------------------------------- ### One-line installation command Source: https://docs.nvidia.com/brev/troubleshooting/cli-installation/cli-installation-linux.md The standard installation command that may fail silently in certain shell configurations. ```bash bash -c "$(curl -fsSL https://raw.githubusercontent.com/brevdev/brev-cli/main/bin/install-latest.sh)" ``` -------------------------------- ### Install NGC CLI Source: https://docs.nvidia.com/brev/guides/inference-deployment/ngc-developer-guide.md Commands to install the NGC CLI via pip or by downloading the binary directly. ```bash # Using pip (recommended) pip install ngc-cli # Or download directly wget -O ngc https://api.ngc.nvidia.com/v2/resources/nvidia/ngc-apps/ngc_cli/versions/3.31.0/files/ngccli_linux.zip unzip ngccli_linux.zip chmod +x ngc-cli/ngc export PATH=$PATH:$(pwd)/ngc-cli ``` -------------------------------- ### Verify CLI installation Source: https://docs.nvidia.com/brev/troubleshooting/cli-installation/cli-installation-linux.md Commands to confirm the binary exists, is in the system PATH, and is functional. ```bash # Verify the binary exists ls ~/.local/bin/brev # Verify CLI is in PATH which brev # Verify CLI works brev --help ``` -------------------------------- ### Initialize NGC CLI and Pull Container Source: https://docs.nvidia.com/brev/guides/inference-deployment/ngc-developer-guide.md Install the CLI, configure authentication, and pull a PyTorch container image from the NGC registry. ```bash # Get started in 3 commands: pip install ngc-cli ngc config set # Enter your API key docker pull nvcr.io/nvidia/pytorch:24.01-py3 ``` -------------------------------- ### Verify GPU Setup Source: https://docs.nvidia.com/brev/guides/inference-deployment/deploying-nims Runs a test container to confirm that the NVIDIA runtime and GPU drivers are correctly configured. ```bash docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi ``` -------------------------------- ### Install the Brev agent skill via curl Source: https://docs.nvidia.com/brev/guides/ai-agents/cli-with-agents.md Installs the agent skill using a shell script via curl. ```bash curl -fsSL https://raw.githubusercontent.com/brevdev/brev-cli/main/scripts/install-agent-skill.sh | bash ``` -------------------------------- ### GPU search examples Source: https://docs.nvidia.com/brev/cli/search-discovery.md Common usage patterns for filtering and sorting GPU instance search results. ```bash # List all available GPUs (sorted by price) brev search # Wide mode with extra columns brev search gpu --wide # Filter by GPU model brev search --gpu-name A100 brev search --gpu-name H100 # Filter by VRAM brev search --min-vram 40 --sort price # Fast-booting GPUs brev search --max-boot-time 3 --sort price # Stoppable instances with minimum VRAM brev search --stoppable --min-total-vram 40 --sort price ``` -------------------------------- ### Revert to CPU-only Mode Source: https://docs.nvidia.com/brev/troubleshooting/instances-gpus/gpu-detection-pytorch.md Use this workaround if GPU/CUDA installation fails. ```bash pip uninstall unsloth unsloth-zoo pip install unsloth-cpu ``` -------------------------------- ### CPU Search Examples Source: https://docs.nvidia.com/brev/cli/search-discovery.md Common usage patterns for filtering and sorting CPU instances, including piping results to the creation command. ```bash # All CPU instances brev search cpu # AWS CPU instances brev search cpu --provider aws # High-memory instances brev search cpu --min-ram 64 --sort price # ARM architecture brev search cpu --arch arm64 # Many-core instances brev search cpu --min-vcpu 16 --sort price # Pipe to create brev search cpu --min-ram 64 | brev create my-cpu-box ``` -------------------------------- ### Check installation exit code Source: https://docs.nvidia.com/brev/troubleshooting/cli-installation/cli-installation-linux.md Captures the exit status of the last command to identify if the installation failed. ```bash echo $? ``` -------------------------------- ### Verify API Key in VM Setup Script Source: https://docs.nvidia.com/brev/concepts/launchables.md Use this bash script to validate that a required environment variable is present during the VM initialization phase. ```bash #!/usr/bin/env bash set -euo pipefail python3 - <<'PY' import os if not os.environ.get("API_KEY"): raise RuntimeError("API_KEY is required") print("API_KEY is available during setup.") # Perform one-time initialization that uses the API key here. PY ``` -------------------------------- ### Install CUDA-enabled PyTorch and Framework Source: https://docs.nvidia.com/brev/troubleshooting/instances-gpus/gpu-detection-pytorch.md Reinstall PyTorch with specific CUDA wheels if the current environment lacks GPU support. ```bash pip uninstall -y torch torchvision torchaudio pip install --index-url https://download.pytorch.org/whl/cu124 torch torchvision torchaudio ``` ```bash pip install -U unsloth unsloth-zoo ``` -------------------------------- ### Natural language agent commands Source: https://docs.nvidia.com/brev/guides/ai-agents/cli-with-agents.md Examples of natural language prompts for managing instances via an AI agent. ```text "Create an A100 instance for ML training" "Search for GPUs with 40GB VRAM under $3/hr" "Stop all my running instances" "Open my-instance in Cursor" "What GPUs are available with fast boot times?" ``` -------------------------------- ### Manage Helm Charts Source: https://docs.nvidia.com/brev/guides/inference-deployment/ngc-developer-guide.md Commands to add the NGC Helm repository and install charts like the GPU Operator. ```bash # Add NGC Helm repo helm repo add nvidia https://helm.ngc.nvidia.com/nvidia # Search for charts helm search repo nvidia # Install a chart (e.g., GPU Operator) helm install gpu-operator nvidia/gpu-operator \ --set driver.enabled=true \ --namespace gpu-operator \ --create-namespace ``` -------------------------------- ### Customize Environment Packages Source: https://docs.nvidia.com/brev/concepts/environments.md Commands for installing Python and system-level packages, and pulling Docker images within the workspace. ```bash # Navigate to workspace cd /home/ubuntu/workspace # Install Python packages pip install transformers accelerate # Install system packages sudo apt update && sudo apt install -y htop # Pull Docker images docker pull nvcr.io/nvidia/pytorch:24.01-py3 ``` -------------------------------- ### Manage Docker Compose stacks Source: https://docs.nvidia.com/brev/guides/development-tools/custom-containers.md Commands to start and monitor multi-container applications defined in a docker-compose.yml file. ```bash # Start the stack docker compose up -d # View logs docker compose logs -f ``` -------------------------------- ### Test skill changes from a branch Source: https://docs.nvidia.com/brev/guides/ai-agents/cli-with-agents.md Installs the skill from a specific branch for testing purposes. ```bash BREV_SKILL_BRANCH=my-branch brev agent-skill install ``` ```bash curl -fsSL https://raw.githubusercontent.com/brevdev/brev-cli/main/scripts/install-agent-skill.sh | bash -s -- --branch my-branch ``` -------------------------------- ### Start JupyterLab on Remote Instance Source: https://docs.nvidia.com/brev/guides/development-tools/jupyter-notebooks.md Connect to the instance and launch the JupyterLab server without opening a browser on the remote machine. ```bash # Connect to your instance brev shell my-instance # Start JupyterLab (no browser on remote) jupyter lab --no-browser --port=8888 ``` -------------------------------- ### Manage NIMs with NGC CLI Source: https://docs.nvidia.com/brev/guides/inference-deployment/deploying-nims Installs the NGC CLI, configures authentication, and lists available NIM images. ```bash # Install NGC CLI pip install ngc-cli # Configure with your API key ngc config set # List available NIMs ngc registry image list --format_type csv nvcr.io/nim/meta/* ``` -------------------------------- ### Reinstall Torch in Correct Environment Source: https://docs.nvidia.com/brev/troubleshooting/instances-gpus/gpu-detection-pytorch.md Use this if PyTorch is installed in a different environment or missing from the PATH. ```bash which python3 python3 -m pip install --force-reinstall torch ``` -------------------------------- ### Register a machine with Brev Source: https://docs.nvidia.com/brev/cli/registered-compute.md Registers a Linux machine with the Brev organization. Requires sudo access and installs the NetBird VPN agent. ```bash brev register -n ``` ```bash # Register with a name brev register -n "My DGX Spark" # Register to a specific organization brev register --name "Lab Workstation" --org my-team ``` -------------------------------- ### Pull Containers from NGC Source: https://docs.nvidia.com/brev/guides/inference-deployment/ngc-developer-guide.md Examples of pulling various public and partner container images using the Docker CLI. ```bash # Format: nvcr.io//: # NVIDIA's public containers docker pull nvcr.io/nvidia/pytorch:24.01-py3 docker pull nvcr.io/nvidia/tensorflow:24.01-tf2-py3 docker pull nvcr.io/nvidia/tritonserver:24.01-py3 # Partner containers (ISV) docker pull nvcr.io/isv-ngc-partner/company/container:version ``` -------------------------------- ### brev register Source: https://docs.nvidia.com/brev/cli/registered-compute.md Registers a Linux machine with your Brev organization, installs the NetBird mesh VPN, and profiles the hardware. ```APIDOC ## brev register ### Description Registers a Linux machine with your Brev organization. This installs the NetBird mesh VPN, profiles the machine's hardware, and registers it with the Brev API. ### Usage `brev register -n ` ### Flags - **--name** (`-n`) - Required - Display name for the machine. - **--org** (`-o`) - Optional - Organization to register with (defaults to active org). ``` -------------------------------- ### Quick Dev Session Initialization Source: https://docs.nvidia.com/brev/cli/composable-workflows.md Create a development environment and open it in Cursor in one command. ```bash # One-liner: create and open in Cursor brev create dev-box | brev open cursor ``` -------------------------------- ### Create instance with smart defaults Source: https://docs.nvidia.com/brev/cli/instance-creation.md Uses default criteria to select the cheapest available GPU instance. ```bash # Uses smart defaults — picks the cheapest GPU matching the above criteria brev create my-instance ``` -------------------------------- ### Configure startup scripts Source: https://docs.nvidia.com/brev/cli/instance-creation.md Executes commands or scripts upon instance boot using inline strings or file references. ```bash brev create my-instance -s 'pip install torch' ``` ```bash brev create my-instance -s @setup.sh brev create my-instance -s @./scripts/install-deps.sh ``` -------------------------------- ### Search for development instances Source: https://docs.nvidia.com/brev/cli/search-discovery.md Filters for instances with a maximum boot time of 3 minutes, sorted by price. ```bash brev search --max-boot-time 3 --sort price ``` -------------------------------- ### Create and Connect to Instance Source: https://docs.nvidia.com/brev/getting-started/quickstart.md Provision a new GPU instance and open a remote shell session. ```bash # Create a GPU instance with an NVIDIA L40S brev create my-instance --gpu "nebius.l40sx1.pcie" # Open a shell on your instance brev shell my-instance ``` -------------------------------- ### Initialize Workspace and Virtual Environment Source: https://docs.nvidia.com/brev/concepts/environments.md Standard commands to navigate to the persistent workspace and set up a Python virtual environment. ```bash # Navigate to workspace cd /home/ubuntu/workspace # Clone your project git clone https://github.com/your/repo.git # Create a virtual environment python3 -m venv .venv source .venv/bin/activate ``` -------------------------------- ### Create an instance with Brev CLI Source: https://docs.nvidia.com/brev/cli/instance-creation.md Basic syntax for initiating instance creation using the brev create command. ```bash brev create [name] [flags] ``` -------------------------------- ### Create empty instance Source: https://docs.nvidia.com/brev/cli/instance-management.md Initialize an instance without a linked Git repository. ```bash brev start --name my-sandbox ``` -------------------------------- ### Remove installed CLI Source: https://docs.nvidia.com/brev/troubleshooting/cli-installation/cli-installation-linux.md Deletes the Brev CLI binary from the local directory. ```bash rm -f ~/.local/bin/brev ``` -------------------------------- ### Provision a CPU instance Source: https://docs.nvidia.com/brev/guides/ai-agents/agent-sandboxes.md Create a new CPU instance for agent deployment using the Brev CLI. ```bash brev create my-agent ``` -------------------------------- ### Downloading training results Source: https://docs.nvidia.com/brev/guides/development-tools/file-transfer-scp.md Retrieves output directories from the instance. ```bash brev copy -r my-instance:/home/ubuntu/workspace/outputs ./local-outputs ``` -------------------------------- ### Create instance from Git URL Source: https://docs.nvidia.com/brev/cli/instance-management.md Initialize an instance from a remote repository with optional naming and organization scoping. ```bash # Create from GitHub brev start https://github.com/user/repo.git # With custom name brev start https://github.com/user/repo.git --name my-project # In a specific organization brev start https://github.com/user/repo.git --org my-team ``` -------------------------------- ### Preview Instance Creation with Dry Run Source: https://docs.nvidia.com/brev/cli/instance-creation.md Use the --dry-run flag to validate instance configurations without provisioning resources. ```bash brev create my-instance --dry-run brev create my-instance --gpu-name A100 --dry-run ``` -------------------------------- ### Reinstall PyTorch with CUDA Support Source: https://docs.nvidia.com/brev/troubleshooting/instances-gpus/gpu-detection-pytorch.md Fixes issues where PyTorch is installed without CUDA support. ```bash pip uninstall -y torch torchvision torchaudio pip install --index-url https://download.pytorch.org/whl/cu124 \ torch torchvision torchaudio ``` -------------------------------- ### Create instance with GPU Source: https://docs.nvidia.com/brev/cli/instance-management.md Specify the GPU type and count during instance creation. ```bash # Default GPU (T4) brev start https://github.com/user/repo.git # Specify GPU type brev start https://github.com/user/repo.git --gpu "n1-highmem-4:nvidia-tesla-a100:1" ``` -------------------------------- ### Search for production instances Source: https://docs.nvidia.com/brev/cli/search-discovery.md Filters for A100 GPU instances with a maximum boot time of 5 minutes, sorted by price. ```bash brev search --gpu-name A100 --max-boot-time 5 --sort price ``` -------------------------------- ### Configure NGC Authentication Source: https://docs.nvidia.com/brev/guides/inference-deployment/ngc-developer-guide.md Methods for authenticating the NGC CLI using interactive setup or environment variables. ```bash # Interactive setup ngc config set # Or set environment variables export NGC_API_KEY= export NGC_ORG= # Optional: for enterprise users ``` -------------------------------- ### Syncing project files Source: https://docs.nvidia.com/brev/guides/development-tools/file-transfer-scp.md Uploads an entire project directory to the instance workspace. ```bash brev copy -r ./my-ml-project my-instance:/home/ubuntu/workspace/ ``` -------------------------------- ### Search for instances Source: https://docs.nvidia.com/brev/cli/search-discovery.md Basic command structure for searching GPU or CPU instances. ```bash brev search [gpu|cpu] [flags] ``` -------------------------------- ### List instances and organizations Source: https://docs.nvidia.com/brev/cli/instance-management.md View workspaces and organizations using the list command. ```bash # List instances in current organization brev list # List all organizations you belong to brev list orgs # List instances in a specific organization brev list --org my-team ``` -------------------------------- ### Access Instance Shell Source: https://docs.nvidia.com/brev/troubleshooting/instances-gpus/instance-stuck-in-waiting-state.md Connect to a running instance via the CLI. ```bash brev shell ``` -------------------------------- ### Search for budget-conscious instances Source: https://docs.nvidia.com/brev/cli/search-discovery.md Filters for instances with at least 16GB of VRAM, sorted by price, and limits output to the top 5 results. ```bash brev search --min-vram 16 --sort price | head -5 ``` -------------------------------- ### Connect to the instance Source: https://docs.nvidia.com/brev/guides/ai-agents/agent-sandboxes.md Establish a shell connection to the running agent instance. ```bash brev shell my-agent ``` -------------------------------- ### Reset Instance State Source: https://docs.nvidia.com/brev/cli/advanced-commands.md Clears the container environment while preserving persistent storage. Useful for resolving environment corruption or starting fresh. ```bash brev reset my-instance ``` -------------------------------- ### Connect to Machine Source: https://docs.nvidia.com/brev/guides/registered-compute/managing-registered-compute.md Use this command from a local machine to connect to a registered instance after access has been granted. ```bash brev shell ``` -------------------------------- ### Create instance clusters Source: https://docs.nvidia.com/brev/cli/instance-creation.md Deploys multiple instances simultaneously using the count flag. ```bash brev create my-cluster --count 3 --type g5.xlarge ``` -------------------------------- ### Chaining create and access commands Source: https://docs.nvidia.com/brev/cli/composable-workflows.md Combine search, creation, and execution commands into a single pipeline. ```bash # Search, create, and open brev search --gpu-name A100 | brev create my-box | brev open cursor # Create and run a command brev create my-box | brev exec "nvidia-smi" # Create and run a setup script brev create my-box | brev exec @setup.sh # Create cluster and verify all nodes brev create my-cluster --count 3 | brev exec "hostname && nvidia-smi" ``` -------------------------------- ### Test GPU Detection via Python Source: https://docs.nvidia.com/brev/troubleshooting/instances-gpus/gpu-detection-pytorch.md Run a quick command to verify Unsloth detects the GPU. ```bash python -c "import unsloth; print('GPU available:', unsloth.torch.cuda.is_available())" ``` -------------------------------- ### Open VS Code on instance Source: https://docs.nvidia.com/brev/guides/development-tools/vscode-setup.md Use the Brev CLI to automatically configure and open the VS Code environment for a specific instance. ```bash brev open my-instance ``` -------------------------------- ### brev create Source: https://docs.nvidia.com/brev/cli/instance-creation.md Creates a new GPU or CPU instance using the Brev CLI with support for various configuration flags and search filters. ```APIDOC ## brev create ### Description Creates GPU and CPU instances with smart defaults, fallback chains, startup scripts, and composable piping. ### Usage `brev create [name] [flags]` ### Aliases `provision`, `gpu-create`, `gpu-retry`, `gcreate` ### Flags - **--name** (-n) - Instance name. - **--type** (-t) - Comma-separated instance types to try (fallback chain). - **--count** (-c) - Number of instances to create (default: 1). - **--parallel** (-p) - Parallel creation attempts (default: 1). - **--startup-script** (-s) - Script to run on boot (inline string or @filepath). - **--timeout** - Seconds to wait for ready (default: 300). - **--detached** (-d) - Don't wait for instance to be ready. - **--dry-run** - Show matching instance types without creating. ### Search Filter Flags - **--gpu-name** (-g) - Filter by GPU name (partial match). - **--provider** - Filter by cloud provider. - **--min-vram** (-v) - Minimum VRAM per GPU (GB). - **--min-total-vram** - Minimum total VRAM (GB). - **--min-capability** - Minimum GPU compute capability. - **--min-disk** - Minimum disk size (GB). - **--max-boot-time** - Maximum boot time (minutes). - **--stoppable** - Only stoppable instances. - **--rebootable** - Only rebootable instances. - **--flex-ports** - Only instances with configurable firewall. - **--sort** - Sort by: price, vram, boot-time, etc. - **--desc** - Sort descending. ``` -------------------------------- ### Search for latest architecture instances Source: https://docs.nvidia.com/brev/cli/search-discovery.md Filters for instances with a minimum compute capability of 9.0, sorted by price. ```bash brev search --min-capability 9.0 --sort price ``` -------------------------------- ### Pipe search results to instance creation Source: https://docs.nvidia.com/brev/cli/search-discovery.md Piping output to another command allows for direct chaining, such as creating an instance based on a specific GPU name. ```bash brev search --gpu-name A100 | brev create my-instance ``` -------------------------------- ### Open instance in an editor Source: https://docs.nvidia.com/brev/cli/connectivity.md Opens the instance in a specified editor or sets a default editor for future sessions. ```bash # Open in VS Code (default) brev open my-instance # Open in specific editor brev open my-instance cursor brev open my-instance windsurf brev open my-instance tmux # Set default editor brev open --set-default cursor ``` -------------------------------- ### Connect via SSH Source: https://docs.nvidia.com/brev/cli/connectivity.md Connect to your instance using the Brev-managed key or via SSH configuration. Manual port forwarding can also be performed using standard SSH flags. ```bash # Connect using instance name (configured by brev refresh) ssh my-instance # Or use the full SSH command ssh -i ~/.brev/brev.pem ubuntu@ # Manual port forward with SSH ssh -i ~/.brev/brev.pem -p 22 -L LOCAL_PORT:localhost:REMOTE_PORT ubuntu@ ``` -------------------------------- ### Search for ML training instances Source: https://docs.nvidia.com/brev/cli/search-discovery.md Filters for instances with at least 40GB of VRAM, sorted by price. ```bash brev search --min-vram 40 --sort price ``` -------------------------------- ### Filter instances during creation Source: https://docs.nvidia.com/brev/cli/instance-creation.md Uses search filters or piped output to select instances based on hardware requirements. ```bash brev create my-instance --gpu-name A100 --min-vram 40 ``` ```bash brev search --gpu-name A100 | brev create my-instance ``` -------------------------------- ### Connect to Brev Instance Source: https://docs.nvidia.com/brev/guides/inference-deployment/deploying-nims Establishes a shell session with the specified Brev instance. ```bash brev shell my-instance ``` -------------------------------- ### Verify GPU Access Source: https://docs.nvidia.com/brev/getting-started/quickstart.md Check that the GPU is correctly configured and accessible within the instance. ```bash nvidia-smi ``` -------------------------------- ### Open Brev instance in VS Code Source: https://docs.nvidia.com/brev/troubleshooting/ide-connectivity/vscode-windows-wsl.md Command used to initiate a connection to a Brev instance from the terminal. ```bash brev open code ``` -------------------------------- ### Troubleshoot SSH Connection Issues Source: https://docs.nvidia.com/brev/troubleshooting/common-issues.md Commands to verify instance status and refresh SSH configuration when connection is refused. ```bash # Check instance status brev list # Update SSH config brev refresh # Try connecting again brev shell my-instance ``` -------------------------------- ### Create Instance in Detached Mode Source: https://docs.nvidia.com/brev/cli/instance-creation.md Use the --detached flag to initiate creation without waiting for the instance to reach a ready state. ```bash brev create my-instance --detached ``` -------------------------------- ### Troubleshoot Login Failures Source: https://docs.nvidia.com/brev/troubleshooting/common-issues.md Alternative login methods for browser authentication issues or headless environments. ```bash # Skip auto-opening browser brev login --skip-browser # Token-based login for headless/CI brev login --token ``` -------------------------------- ### Troubleshooting instance status Source: https://docs.nvidia.com/brev/guides/development-tools/file-transfer-scp.md Commands to verify instance status and refresh configuration. ```bash brev refresh brev ls # Check instance status ``` ```bash brev ls ``` -------------------------------- ### Search CPU Instances Command Source: https://docs.nvidia.com/brev/cli/search-discovery.md Basic command structure for searching CPU-only instances. ```bash brev search cpu [flags] ``` -------------------------------- ### Manage Resources Source: https://docs.nvidia.com/brev/guides/inference-deployment/ngc-developer-guide.md Commands to list and download datasets or other resources from the NGC registry. ```bash # List resources ngc registry resource list # Download a resource ngc registry resource download-version nvidia/tao/tao_getting_started:1.0 ``` -------------------------------- ### Run and Verify GPU in Docker Source: https://docs.nvidia.com/brev/troubleshooting/common-issues.md Use these commands to enable GPU access for a container and confirm visibility via nvidia-smi. ```bash # Run with GPU access docker run --gpus all -it your-image # Verify GPU in container nvidia-smi ``` -------------------------------- ### Chain Commands with Output Piping Source: https://docs.nvidia.com/brev/cli/instance-creation.md Pipe the instance name output from brev create to subsequent commands for automated workflows. ```bash # Create and open in an editor brev create my-instance | brev open cursor # Create and run a command brev create my-instance | brev exec "nvidia-smi" # Create and run a setup script brev create my-instance | brev exec @setup.sh # Full pipeline: search, create, open brev search --gpu-name A100 | brev create my-box | brev open cursor ``` -------------------------------- ### Run NIM Container Source: https://docs.nvidia.com/brev/guides/inference-deployment/deploying-nims Executes the NIM container with necessary GPU, memory, and volume configurations. ```bash docker run -it --rm --name=$CONTAINER_NAME \ --runtime=nvidia \ --gpus all \ --shm-size=16GB \ -e NGC_CLI_API_KEY \ -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \ -u $(id -u) \ -p 8000:8000 \ $IMG_NAME ``` -------------------------------- ### Connect to DGX Spark Source: https://docs.nvidia.com/brev/guides/registered-compute/register-dgx-spark.md Initiate a shell session to the registered DGX Spark. ```bash brev shell my-dgx-spark ``` -------------------------------- ### Authenticate with Token Source: https://docs.nvidia.com/brev/troubleshooting/cli-installation/cli-ssh-authentication-macos.md Use the authentication token from the Brev dashboard to log in and verify the connection. ```bash brev login --token ``` ```bash brev ls ``` -------------------------------- ### Search for GPU instances Source: https://docs.nvidia.com/brev/cli/search-discovery.md Command structure for searching GPU instances with optional flags. ```bash brev search [flags] brev search gpu [flags] ``` -------------------------------- ### brev open Source: https://docs.nvidia.com/brev/cli/connectivity.md Opens the instance in a specified editor or environment such as VS Code, Cursor, Windsurf, or tmux. ```APIDOC ## brev open ### Description Open your instance in VS Code, Cursor, Windsurf, or tmux. ### Usage `brev open [editor]` ### Supported Editors - **VS Code** - `brev open my-instance` or `brev open my-instance code` - **Cursor** - `brev open my-instance cursor` - **Windsurf** - `brev open my-instance windsurf` - **tmux** - `brev open my-instance tmux` ### Flags - **--host** - SSH into the host machine instead of the container. - **--wait / -w** - Wait for setup to finish before opening. - **--dir / -d** - Specify directory to open. - **--set-default** - Set default editor (code, cursor, windsurf, tmux) ``` -------------------------------- ### Specify instance types Source: https://docs.nvidia.com/brev/cli/instance-creation.md Defines specific instance types or a fallback chain for creation. ```bash brev create my-instance --type g5.xlarge ``` ```bash brev create my-instance --type g5.xlarge,g5.2xlarge,g5.4xlarge ``` -------------------------------- ### Embed a Launchable badge in Markdown Source: https://docs.nvidia.com/brev/concepts/launchables.md Use this markdown snippet to add a clickable deployment button to your README or documentation files. ```markdown [![Launch on Brev](https://brev-assets.s3.us-west-1.amazonaws.com/nv-lb-dark.svg)](https://brev.nvidia.com/launchable/deploy?launchableID=your-launchable-id) ``` -------------------------------- ### Run GPU-enabled Docker containers via CLI Source: https://docs.nvidia.com/brev/guides/development-tools/custom-containers.md Use the --gpus all flag to enable GPU access for Docker containers on Brev instances. ```bash # Run PyTorch container with GPU docker run --gpus all -it nvcr.io/nvidia/pytorch:24.01-py3 python -c "import torch; print(torch.cuda.is_available())" # Run with port mapping docker run --gpus all -p 8888:8888 -it nvcr.io/nvidia/pytorch:24.01-py3 ``` -------------------------------- ### List instances in interactive mode Source: https://docs.nvidia.com/brev/cli/composable-workflows.md Displays a formatted table with headers and colors when output is directed to a terminal. ```bash brev ls ``` -------------------------------- ### Download files using brev copy Source: https://docs.nvidia.com/brev/guides/development-tools/file-transfer-scp.md Downloads files or directories from a Brev instance to the local machine. ```bash brev copy my-instance:/home/ubuntu/results.csv ./ ``` ```bash brev copy -r my-instance:/home/ubuntu/outputs ./local-outputs ``` -------------------------------- ### Manage Organization Context Source: https://docs.nvidia.com/brev/cli/advanced-commands.md Use these commands to list available organizations or switch the active organization context for subsequent operations. ```bash # List available organizations brev set # Switch to a specific organization brev set my-org ``` -------------------------------- ### Download Models via NGC CLI Source: https://docs.nvidia.com/brev/guides/inference-deployment/ngc-developer-guide.md Commands to list and download models from the NGC registry to a local directory. ```bash # List available models ngc registry model list # Download a specific model ngc registry model download-version nvidia/nemo/megatron_gpt_345m:1.0 # Download to specific directory ngc registry model download-version nvidia/nemo/megatron_gpt_345m:1.0 --dest ./models/ ``` -------------------------------- ### Preview and Execute Destructive Operations Source: https://docs.nvidia.com/brev/cli/composable-workflows.md Verify instance lists before applying destructive commands like stop or delete. ```bash # Preview what will be stopped brev ls | awk '/RUNNING/ {print $1}' # Then actually stop brev ls | awk '/RUNNING/ {print $1}' | brev stop ``` -------------------------------- ### Authenticate with Brev Source: https://docs.nvidia.com/brev/cli/advanced-commands.md Opens a browser window for authentication or refreshes existing credentials. ```bash brev login ``` -------------------------------- ### Expose NIM via Port Forwarding Source: https://docs.nvidia.com/brev/guides/inference-deployment/deploying-nims Use this command to map the local machine port to the instance port for direct API access. ```bash # From your local machine brev port-forward my-instance --port 8000:8000 # Access at localhost:8000 curl -X POST http://localhost:8000/v1/chat/completions ... ``` -------------------------------- ### Chain instance listing and stopping Source: https://docs.nvidia.com/brev/cli/composable-workflows.md Pipes the output of instance listing directly into the stop command for batch processing. ```bash brev ls | brev stop ``` -------------------------------- ### Search for large model training instances Source: https://docs.nvidia.com/brev/cli/search-discovery.md Filters for instances with at least 80GB of total VRAM, sorted by price. ```bash brev search --min-total-vram 80 --sort price ``` -------------------------------- ### Display search results as a table Source: https://docs.nvidia.com/brev/cli/search-discovery.md The default output format for interactive sessions displays instance specifications in a table. ```text TYPE GPU COUNT VRAM TOTAL $/HR BOOT FEATURES g5.xlarge A10G 1 24GB 24GB $1.00 2m S R P g5.2xlarge A10G 1 24GB 24GB $1.20 2m S R P p4d.24xlarge A100 8 40GB 320GB $32.77 5m S R ``` -------------------------------- ### Retrieve instance data as JSON Source: https://docs.nvidia.com/brev/cli/composable-workflows.md Outputs instance information in a structured JSON format for programmatic parsing. ```bash brev ls --json ``` -------------------------------- ### Performing batch operations Source: https://docs.nvidia.com/brev/cli/composable-workflows.md Pass multiple instance names directly to commands for bulk actions. ```bash # Stop multiple instances brev stop instance1 instance2 instance3 # Delete multiple instances brev delete instance1 instance2 instance3 # Start multiple instances brev start instance1 instance2 # Run on multiple instances brev exec instance1 instance2 instance3 "nvidia-smi" ``` -------------------------------- ### Stopping all instances Source: https://docs.nvidia.com/brev/cli/composable-workflows.md Use the --all flag to target every running instance. ```bash brev stop --all ``` -------------------------------- ### Upload files using brev copy Source: https://docs.nvidia.com/brev/guides/development-tools/file-transfer-scp.md Uploads local files or directories to a Brev instance. ```bash brev copy ./local-file.txt my-instance:/home/ubuntu/ ``` ```bash brev copy -r ./my-project my-instance:/home/ubuntu/ ``` -------------------------------- ### Filter GPU instances by compute capability Source: https://docs.nvidia.com/brev/cli/search-discovery.md Use the --min-capability flag to filter available instances based on their architecture generation. ```bash # Ampere or newer brev search --min-capability 8.0 # Hopper only brev search --min-capability 9.0 ``` -------------------------------- ### Configure Default Editor Source: https://docs.nvidia.com/brev/troubleshooting/common-issues.md Set the default editor for the brev open command. ```bash # Set a different default editor brev open --set-default cursor ``` -------------------------------- ### Multi-Node Cluster Orchestration Source: https://docs.nvidia.com/brev/cli/composable-workflows.md Provision multiple nodes and execute commands across the entire cluster. ```bash # Create 3 nodes, install deps on all, verify brev create my-cluster --count 3 --type g5.xlarge \ | brev exec @install-deps.sh \ | brev exec "nvidia-smi" ``` -------------------------------- ### Manage Private Registry and Access Source: https://docs.nvidia.com/brev/guides/inference-deployment/ngc-developer-guide.md Commands to tag and push containers to a private registry and assign user roles for access control. ```bash # Push to private registry docker tag my-container:latest nvcr.io/my-org/my-team/my-container:v1.0 docker push nvcr.io/my-org/my-team/my-container:v1.0 # Manage access ngc org user add --org my-org --email colleague@company.com --role REGISTRY_USER ``` -------------------------------- ### Verify GPU and CUDA Availability Source: https://docs.nvidia.com/brev/concepts/environments.md Use these commands to check driver status and verify PyTorch GPU integration. ```bash # Quick check - GPU and CUDA availability nvidia-smi nvcc --version # Framework verification (requires PyTorch installed) pip install torch # if not using a PyTorch base image python3 -c "import torch; print(f'CUDA available: {torch.cuda.is_available()}')" python3 -c "import torch; print(f'GPU: {torch.cuda.get_device_name(0)}')" ``` -------------------------------- ### Authenticate with Brev Source: https://docs.nvidia.com/brev/cli/getting-started.md Manage user authentication sessions using standard, token-based, or headless login methods. ```bash # Standard login (opens browser) brev login # Login with token (for headless/CI environments) brev login --token # Skip browser auto-open brev login --skip-browser ``` -------------------------------- ### Connect to registered compute Source: https://docs.nvidia.com/brev/cli/registered-compute.md Uses shell or port-forwarding to connect to registered compute nodes. ```bash # SSH into a registered machine brev shell my-dgx-spark # Forward a port from a registered machine brev port-forward my-dgx-spark --port 8888:8888 ``` -------------------------------- ### Pull and Run Containers Source: https://docs.nvidia.com/brev/guides/inference-deployment/ngc-developer-guide.md Commands to pull a container image from the NGC registry and execute it with GPU support. ```bash # Pull PyTorch container optimized for GPUs docker pull nvcr.io/nvidia/pytorch:24.01-py3 # Run it docker run --gpus all -it nvcr.io/nvidia/pytorch:24.01-py3 ```