### Instance Management Source: https://docs.vast.ai/sdk/python/index Examples of starting, stopping, and launching instances. ```APIDOC ## Starting and Stopping Instances ```python vast_sdk.start_instance(ID=12345678) vast_sdk.stop_instance(ID=12345678) ``` ### Creating a New Instance Create a new instance based on given parameters (performs search offers + create instance). ```python vast_sdk.launch_instance(num_gpus="1", gpu_name="RTX_3090", image="pytorch/pytorch") ``` ``` -------------------------------- ### Get Help for SDK Methods Source: https://docs.vast.ai/sdk/python/quickstart Displays detailed documentation for a specific SDK method, such as 'search_offers'. This includes the method's description, parameters, query syntax, and usage examples, aiding in understanding and correct implementation. ```python help(vast_sdk.search_offers) ``` -------------------------------- ### Start and Stop Instances using Vast.ai Python SDK Source: https://docs.vast.ai/sdk/python/quickstart Provides examples for starting and stopping a specific instance identified by its ID. These methods allow for programmatic control over the lifecycle of your cloud instances. ```python vast_sdk.start_instance(ID=12345678) vast_sdk.stop_instance(ID=12345678) ``` -------------------------------- ### Getting Help Source: https://docs.vast.ai/sdk/python/index Use the built-in `help()` method to view detailed documentation for any SDK method, including its description, parameters, and usage examples. ```APIDOC ## Getting Help Use the built-in `help()` method to view detailed documentation for any SDK method. This will show you the method’s description, parameters, query syntax, and usage examples. ```python help(vast_sdk.search_offers) ``` ``` -------------------------------- ### Install Vast.ai Python SDK Source: https://docs.vast.ai/sdk/python/quickstart Installs the latest stable release of the vastai-sdk package from PyPI using pip. This command ensures you have the necessary library to interact with the Vast.ai API from your Python environment. ```text pip install vastai-sdk ``` -------------------------------- ### Installation Source: https://docs.vast.ai/sdk/python/index Install the latest stable release of the vastai-sdk package from PyPI. ```APIDOC ## Installation You can install the latest stable PyPI release with: ```bash pip install vastai-sdk ``` ``` -------------------------------- ### Search Offers Source: https://docs.vast.ai/sdk/python/index Example of searching for available GPU offers, such as an RTX 5090. ```APIDOC ## Search Offers Find an available RTX 5090 GPU: ```python vast_sdk.search_offers(query='gpu_name=RTX_5090 rented=False rentable=True') ``` ``` -------------------------------- ### File Copying Source: https://docs.vast.ai/sdk/python/index Example of copying files between instances using the SDK. ```APIDOC ## Copying Files Between Instances ```python vast_sdk.copy(src='source_path', dst='destination_path', identity='identity_file') ``` ``` -------------------------------- ### Instance Management API Source: https://docs.vast.ai/sdk/python/quickstart Manage your Vast.ai instances, including starting, stopping, rebooting, destroying, recycling, labeling, showing details, retrieving logs, executing commands, and launching new instances. ```APIDOC ## Instance Management API ### Description Methods for managing Vast.ai instances. ### Methods - **start_instance(ID: int)**: Start an instance. - **stop_instance(ID: int)**: Stop an instance. - **reboot_instance(ID: int)**: Reboot an instance. - **destroy_instance(id: int)**: Destroy an instance. - **destroy_instances(ids: List[int])**: Destroy multiple instances. - **recycle_instance(ID: int)**: Recycle an instance. - **label_instance(id: int, label: str)**: Label an instance. - **show_instance(id: int)**: Show details of an instance. - **show_instances(quiet: bool = False)**: Show all instances. - **logs(INSTANCE_ID: int, tail: Optional[str] = None)**: Retrieve logs for an instance. - **execute(ID: int, COMMAND: str)**: Execute a command on an instance. - **launch_instance(...)**: Launch a new instance with various parameters. ``` -------------------------------- ### SSH Key Management Source: https://docs.vast.ai/sdk/python/index Examples for creating, showing, and deleting SSH keys. ```APIDOC ## Managing SSH Keys Create a new SSH key, show all SSH keys, and delete an SSH key. ```python vast_sdk.create_ssh_key(ssh_key='your_ssh_key') ssh_keys = vast_sdk.show_ssh_keys() print(ssh_keys) vast_sdk.delete_ssh_key(ID=123456) ``` ``` -------------------------------- ### Autoscaler Management API Source: https://docs.vast.ai/sdk/python/quickstart Manage autoscalers on Vast.ai, including creating, updating, deleting, and showing autoscalers. ```APIDOC ## Autoscaler Management API ### Description Methods for managing Vast.ai autoscalers. ### Methods - **create_autoscaler(test_workers: int = 3, ...)**: Create a new autoscaler. - **update_autoscaler(ID: int, min_load: Optional[float] = None, ...)**: Update an autoscaler. - **delete_autoscaler(ID: int)**: Delete an autoscaler. - **show_autoscalers()**: Show all autoscalers. ``` -------------------------------- ### Launch New Instance using Vast.ai Python SDK Source: https://docs.vast.ai/sdk/python/quickstart Launches a new instance with specified parameters, including the number of GPUs, GPU model, and the desired Docker image. This operation combines searching for offers and creating an instance. ```python vast_sdk.launch_instance(num_gpus="1", gpu_name="RTX_3090", image="pytorch/pytorch") ``` -------------------------------- ### Import and Initialize Vast.ai Python SDK Source: https://docs.vast.ai/sdk/python/quickstart Demonstrates how to import the VastAI class from the vastai_sdk package and initialize a client instance using your API key. The initialized client object is used to make calls to the Vast.ai API. ```python from vastai_sdk import VastAI vast_sdk = VastAI(api_key='YOUR_API_KEY') ``` -------------------------------- ### API Key Management API Source: https://docs.vast.ai/sdk/python/quickstart Manage your Vast.ai API keys, including creating, deleting, resetting, showing, and setting API keys. ```APIDOC ## API Key Management API ### Description Methods for managing Vast.ai API keys. ### Methods - **create_api_key(name: Optional[str] = None, ...)**: Create a new API key. - **delete_api_key(ID: int)**: Delete an API key. - **reset_api_key()**: Reset the API key. - **show_api_key(id: int)**: Show details of an API key. - **show_api_keys()**: Show all API keys. - **set_api_key(new_api_key: str)**: Set a new API key. ``` -------------------------------- ### Show Instances using Vast.ai Python SDK Source: https://docs.vast.ai/sdk/python/quickstart Retrieves and prints a list of all current instances associated with your Vast.ai account. This is a direct equivalent to the 'vastai show instances' CLI command. ```python output = vast_sdk.show_instances() print(output) ``` -------------------------------- ### Endpoint Management API Source: https://docs.vast.ai/sdk/python/quickstart Manage endpoints on Vast.ai, including creating, updating, deleting, and showing endpoints. ```APIDOC ## Endpoint Management API ### Description Methods for managing Vast.ai endpoints. ### Methods - **create_endpoint(min_load: float = 0.0, ...)**: Create a new endpoint. - **update_endpoint(ID: int, min_load: Optional[float] = None, ...)**: Update an endpoint. - **delete_endpoint(ID: int)**: Delete an endpoint. - **show_endpoints()**: Show all endpoints. ``` -------------------------------- ### Schedule Maintenance for a Machine Source: https://docs.vast.ai/sdk/python/quickstart The `schedule_maint` function schedules maintenance for a machine. It requires the machine's ID and accepts optional start date and duration for the maintenance period. ```python def schedule_maint(id: int, sdate: Optional[float] = None, duration: Optional[float] = None): """Schedule maintenance for a machine.""" pass ``` -------------------------------- ### Search Offers using Vast.ai Python SDK Source: https://docs.vast.ai/sdk/python/quickstart Searches for available GPU offers, specifically looking for RTX 5090 GPUs that are not currently rented and are rentable. This function helps in finding suitable resources based on specified criteria. ```python vast_sdk.search_offers(query='gpu_name=RTX_5090 rented=False rentable=True') ``` -------------------------------- ### Manage SSH Keys using Vast.ai Python SDK Source: https://docs.vast.ai/sdk/python/quickstart Demonstrates the management of SSH keys through the SDK, including creating a new key with provided key material, displaying all existing SSH keys, and deleting a specific key by its ID. These operations are crucial for secure access to instances. ```python vast_sdk.create_ssh_key(ssh_key='your_ssh_key') ssh_keys = vast_sdk.show_ssh_keys() print(ssh_keys) vast_sdk.delete_ssh_key(ID=123456) ``` -------------------------------- ### Clean Up Machine Configuration and Resources Source: https://docs.vast.ai/sdk/python/quickstart The `cleanup_machine` function removes a machine's configuration and associated resources. It requires the machine's ID as an integer input. ```python def cleanup_machine(ID: int): """Clean up a machine's configuration and resources.""" pass ``` -------------------------------- ### SSH Key Management API Source: https://docs.vast.ai/sdk/python/quickstart Manage SSH keys for your Vast.ai account, including creating, deleting, showing, attaching, and detaching SSH keys from instances. ```APIDOC ## SSH Key Management API ### Description Methods for managing SSH keys on Vast.ai. ### Methods - **create_ssh_key(ssh_key: str)**: Create a new SSH key. - **delete_ssh_key(ID: int)**: Delete an SSH key. - **show_ssh_keys()**: Show all SSH keys. - **attach_ssh(instance_id: int, ssh_key: str)**: Attach an SSH key to an instance. - **detach_ssh(instance_id: int, ssh_key_id: str)**: Detach an SSH key from an instance. ``` -------------------------------- ### Copy Files using Vast.ai Python SDK Source: https://docs.vast.ai/sdk/python/quickstart Copies files between locations using the SDK, specifying the source path, destination path, and an optional identity file for authentication. This facilitates data transfer for your cloud instances. ```python vast_sdk.copy(src='source_path', dst='destination_path', identity='identity_file') ``` -------------------------------- ### Cancel Scheduled Maintenance for a Machine Source: https://docs.vast.ai/sdk/python/quickstart The `cancel_maint` function cancels any scheduled maintenance for a machine. It requires the machine's ID as an integer input. ```python def cancel_maint(id: int): """Cancel scheduled maintenance for a machine.""" pass ``` -------------------------------- ### Display List of Machines with Filtering Source: https://docs.vast.ai/sdk/python/quickstart The `show_machines` function retrieves and displays a list of available machines. It supports a quiet mode and an optional filter string to narrow down the results. ```python from typing import Optional def show_machines(quiet: bool = False, filter: Optional[str] = None): """Retrieve and display a list of machines based on specified criteria.""" pass ``` -------------------------------- ### Unlist a Machine from New Jobs Source: https://docs.vast.ai/sdk/python/quickstart The `unlist_machine` function makes a machine unavailable for new jobs. It requires the machine's ID as an integer input. ```python def unlist_machine(id: int): """Unlist a machine from being available for new jobs.""" pass ``` -------------------------------- ### List Single Machine Details with Optional Parameters Source: https://docs.vast.ai/sdk/python/quickstart The `list_machine` function retrieves details for a specific machine. It accepts the machine's ID and optional parameters for pricing (GPU, disk, internet ingress/egress), discount rate, minimum chunk size, and end date. ```python from typing import Optional def list_machine(ID: int, price_gpu: Optional[float] = None, price_disk: Optional[float] = None, price_inetu: Optional[float] = None, price_inetd: Optional[float] = None, discount_rate: Optional[float] = None, min_chunk: Optional[int] = None, end_date: Optional[str] = None): """List details of a single machine with optional pricing and configuration parameters.""" pass ``` -------------------------------- ### Remove Default Job from a Machine Source: https://docs.vast.ai/sdk/python/quickstart The `remove_defjob` function removes the default job associated with a machine. It requires the machine's ID as an integer input. ```python def remove_defjob(id: int): """Remove the default job from a machine.""" pass ``` -------------------------------- ### List Multiple Machine Details with Optional Parameters Source: https://docs.vast.ai/sdk/python/quickstart The `list_machines` function retrieves details for multiple machines. It takes a list of machine IDs and optional parameters for pricing, discount rate, minimum chunk size, and end date. ```python from typing import List, Optional def list_machines(IDs: List[int], price_gpu: Optional[float] = None, price_disk: Optional[float] = None, price_inetu: Optional[float] = None, price_inetd: Optional[float] = None, discount_rate: Optional[float] = None, min_chunk: Optional[int] = None, end_date: Optional[str] = None): """List details of multiple machines with optional pricing and configuration parameters.""" pass ``` -------------------------------- ### Set Minimum Bid Price for a Machine Source: https://docs.vast.ai/sdk/python/quickstart The `set_min_bid` function establishes the minimum bid price for a machine. It takes the machine's ID and the desired minimum price as a float. ```python def set_min_bid(id: int, price: Optional[float] = None): """Set the minimum bid price for a machine.""" pass ``` -------------------------------- ### Set Default Job on a Machine Source: https://docs.vast.ai/sdk/python/quickstart The `set_defjob` function configures a default job for a machine. It requires the machine's ID and accepts optional parameters for GPU price, internet ingress/egress prices, Docker image, and arguments for the job. ```python from typing import List, Optional def set_defjob(id: int, price_gpu: Optional[float] = None, price_inetu: Optional[float] = None, price_inetd: Optional[float] = None, image: Optional[str] = None, args: Optional[List[str]] = None): """Set a default job on a machine with specified parameters.""" pass ``` -------------------------------- ### Manage Teams: Create, Destroy, Invite, Remove, Roles (Python) Source: https://docs.vast.ai/sdk/python/quickstart Enables comprehensive management of teams within the Vast AI platform. This includes creating and destroying teams, inviting and removing members, and managing custom roles with specific permissions. These functions are crucial for collaborative environments. ```python from vast_ai_sdk.team import create_team, destroy_team, invite_team_member, remove_team_member, create_team_role, remove_team_role, update_team_role, show_team_members, show_team_role, show_team_roles # Example usage: # create_team(team_name="MyAwesomeTeam") # invite_team_member(email="user@example.com", role="developer") # remove_team_member(ID=456) # create_team_role(name="viewer", permissions="read_only") # show_team_members() # show_team_roles() ``` -------------------------------- ### Manage Files: Copy, Cancel, and SCP URL (Python) Source: https://docs.vast.ai/sdk/python/quickstart Provides functions for copying files between instances, between cloud and instances, canceling copy/sync operations, and retrieving SCP URLs for file transfers. These operations are essential for managing data within the Vast AI environment. ```python from vast_ai_sdk.utils import copy, cloud_copy, cancel_copy, cancel_sync, scp_url # Example usage: # copy("source_file.txt", "destination_instance:/path/to/destination/") # cloud_copy(src="instance:/path/to/source/file.txt", dst="/cloud/destination/") # cancel_copy("instance:/path/to/destination/") # cancel_sync("instance:/path/to/sync/") # scp_url(instance_id=123) ``` -------------------------------- ### Basic Usage Source: https://docs.vast.ai/sdk/python/index Import the VastAI client and initialize it with your API key. ```APIDOC ## Basic Usage Import the package: ```python from vastai_sdk import VastAI ``` Construct a Vast client with your API key: ```python vast_sdk = VastAI(api_key='YOUR_API_KEY') ``` ``` -------------------------------- ### Instance Management Methods Source: https://docs.vast.ai/sdk/python/index Detailed list of methods available for managing instances. ```APIDOC ## Instance Management | Method| Description ---|--- | `start_instance(ID: int)`| Start an instance. | `stop_instance(ID: int)`| Stop an instance. | `reboot_instance(ID: int)`| Reboot an instance. | `destroy_instance(id: int)`| Destroy an instance. | `destroy_instances(ids: List[int])`| Destroy multiple instances. | `recycle_instance(ID: int)`| Recycle an instance. | `label_instance(id: int, label: str)`| Label an instance. | `show_instance(id: int)`| Show details of an instance. | `show_instances(quiet: bool = False)`| Show all instances. | `logs(INSTANCE_ID: int, tail: Optional[str] = None)`| Retrieve logs for an instance. | `execute(ID: int, COMMAND: str)`| Execute a command on an instance. | `launch_instance(...)`| Launch a new instance with various parameters. ``` -------------------------------- ### Search for GPU Offers Source: https://docs.vast.ai/sdk/python/index Searches for available GPU offers matching specific criteria, like 'RTX_5090', and filters for non-rented and rentable GPUs. This is useful for finding suitable hardware for your needs. ```python vast_sdk.search_offers(query='gpu_name=RTX_5090 rented=False rentable=True) ``` -------------------------------- ### Autoscaler Management Methods Source: https://docs.vast.ai/sdk/python/index Detailed list of methods available for managing autoscalers. ```APIDOC ## Autoscaler Management | Method| Description ---|--- | `create_autoscaler(test_workers: int = 3, ...)`| Create a new autoscaler. | `update_autoscaler(ID: int, min_load: Optional[float] = None, ...)`| Update an autoscaler. | `delete_autoscaler(ID: int)`| Delete an autoscaler. | `show_autoscalers()`| Show all autoscalers. ``` -------------------------------- ### API Key Management Methods Source: https://docs.vast.ai/sdk/python/index Detailed list of methods available for managing API keys. ```APIDOC ## API Key Management | Method| Description ---|--- | `create_api_key(name: Optional[str] = None, ...)`| Create a new API key. | `delete_api_key(ID: int)`| Delete an API key. | `reset_api_key()`| Reset the API key. | `show_api_key(id: int)`| Show details of an API key. | `show_api_keys()`| Show all API keys. | `set_api_key(new_api_key: str)`| Set a new API key. ``` -------------------------------- ### SSH Key Management Methods Source: https://docs.vast.ai/sdk/python/index Detailed list of methods available for managing SSH keys. ```APIDOC ## SSH Key Management | Method| Description ---|--- | `create_ssh_key(ssh_key: str)`| Create a new SSH key. | `delete_ssh_key(ID: int)`| Delete an SSH key. | `show_ssh_keys()`| Show all SSH keys. | `attach_ssh(instance_id: int, ssh_key: str)`| Attach an SSH key to an instance. | `detach_ssh(instance_id: int, ssh_key_id: str)`| Detach an SSH key from an instance. ``` -------------------------------- ### Host Management API Source: https://docs.vast.ai/sdk/python/index API endpoints for managing host machines, including configuration, pricing, and job scheduling. ```APIDOC ## Host Management API ### Description Provides methods for managing host machines, including cleaning up resources, listing machine details, setting default jobs, managing bids, scheduling maintenance, and unlisting machines. ### Methods #### `cleanup_machine(ID: int)` **Description:** Clean up a machine’s configuration and resources. **Method:** Not applicable (function call) **Parameters:** - `ID` (int) - Required - The ID of the machine to clean up. #### `list_machine(ID: int, price_gpu: Optional[float] = None, price_disk: Optional[float] = None, price_inetu: Optional[float] = None, price_inetd: Optional[float] = None, discount_rate: Optional[float] = None, min_chunk: Optional[int] = None, end_date: Optional[str] = None)` **Description:** List details of a single machine with optional pricing and configuration parameters. **Method:** Not applicable (function call) **Parameters:** - `ID` (int) - Required - The ID of the machine. - `price_gpu` (Optional[float]) - Optional - GPU price. - `price_disk` (Optional[float]) - Optional - Disk price. - `price_inetu` (Optional[float]) - Optional - Included internet price. - `price_inetd` (Optional[float]) - Optional - Included internet duration price. - `discount_rate` (Optional[float]) - Optional - Discount rate. - `min_chunk` (Optional[int]) - Optional - Minimum chunk size. - `end_date` (Optional[str]) - Optional - End date for the listing. #### `list_machines(IDs: List[int], price_gpu: Optional[float] = None, price_disk: Optional[float] = None, price_inetu: Optional[float] = None, price_inetd: Optional[float] = None, discount_rate: Optional[float] = None, min_chunk: Optional[int] = None, end_date: Optional[str] = None)` **Description:** List details of multiple machines with optional pricing and configuration parameters. **Method:** Not applicable (function call) **Parameters:** - `IDs` (List[int]) - Required - A list of machine IDs. - `price_gpu` (Optional[float]) - Optional - GPU price. - `price_disk` (Optional[float]) - Optional - Disk price. - `price_inetu` (Optional[float]) - Optional - Included internet price. - `price_inetd` (Optional[float]) - Optional - Included internet duration price. - `discount_rate` (Optional[float]) - Optional - Discount rate. - `min_chunk` (Optional[int]) - Optional - Minimum chunk size. - `end_date` (Optional[str]) - Optional - End date for the listing. #### `remove_defjob(id: int)` **Description:** Remove the default job from a machine. **Method:** Not applicable (function call) **Parameters:** - `id` (int) - Required - The ID of the machine. #### `set_defjob(id: int, price_gpu: Optional[float] = None, price_inetu: Optional[float] = None, price_inetd: Optional[float] = None, image: Optional[str] = None, args: Optional[List[str]] = None)` **Description:** Set a default job on a machine with specified parameters. **Method:** Not applicable (function call) **Parameters:** - `id` (int) - Required - The ID of the machine. - `price_gpu` (Optional[float]) - Optional - GPU price for the job. - `price_inetu` (Optional[float]) - Optional - Included internet price for the job. - `price_inetd` (Optional[float]) - Optional - Included internet duration price for the job. - `image` (Optional[str]) - Optional - The Docker image to use for the job. - `args` (Optional[List[str]]) - Optional - Arguments for the job. #### `set_min_bid(id: int, price: Optional[float] = None)` **Description:** Set the minimum bid price for a machine. **Method:** Not applicable (function call) **Parameters:** - `id` (int) - Required - The ID of the machine. - `price` (Optional[float]) - Optional - The minimum bid price. #### `schedule_maint(id: int, sdate: Optional[float] = None, duration: Optional[float] = None)` **Description:** Schedule maintenance for a machine. **Method:** Not applicable (function call) **Parameters:** - `id` (int) - Required - The ID of the machine. - `sdate` (Optional[float]) - Optional - The start date/time for maintenance. - `duration` (Optional[float]) - Optional - The duration of the maintenance. #### `cancel_maint(id: int)` **Description:** Cancel scheduled maintenance for a machine. **Method:** Not applicable (function call) **Parameters:** - `id` (int) - Required - The ID of the machine. #### `unlist_machine(id: int)` **Description:** Unlist a machine from being available for new jobs. **Method:** Not applicable (function call) **Parameters:** - `id` (int) - Required - The ID of the machine. #### `show_machines(quiet: bool = False, filter: Optional[str] = None)` **Description:** Retrieve and display a list of machines based on specified criteria. **Method:** Not applicable (function call) **Parameters:** - `quiet` (bool) - Optional - If True, suppresses output. - `filter` (Optional[str]) - Optional - A filter string to narrow down the results. ### Request Example ```python # Example for list_machine function vast_ai_sdk.list_machine(ID=12345, price_gpu=0.5) # Example for set_defjob function vast_ai_sdk.set_defjob(id=12345, image="ubuntu:latest", args=["--bash"]) # Example for show_machines function vast_ai_sdk.show_machines(filter="gpu_name=RTX 3090") ``` ### Response (Responses are typically return values of the function calls, not HTTP responses) #### Success Response - Return values depend on the specific function called (e.g., machine details, confirmation status, list of machines). #### Response Example ```json // For list_machine: { "id": 12345, "gpu_name": "NVIDIA RTX 3090", "price_gpu": 0.5 } // For show_machines: [ { "id": 12345, "gpu_name": "NVIDIA RTX 3090", "status": "running" } ] ``` ``` -------------------------------- ### Endpoint Management Methods Source: https://docs.vast.ai/sdk/python/index Detailed list of methods available for managing endpoints. ```APIDOC ## Endpoint Management | Method| Description ---|--- | `create_endpoint(min_load: float = 0.0, ...)`| Create a new endpoint. | `update_endpoint(ID: int, min_load: Optional[float] = None, ...)`| Update an endpoint. | `delete_endpoint(ID: int)`| Delete an endpoint. | `show_endpoints()`| Show all endpoints. ``` -------------------------------- ### File Management API Source: https://docs.vast.ai/sdk/python/index API endpoints for managing files, including copying, canceling operations, and retrieving SCP URLs. ```APIDOC ## File Management API ### Description Provides methods for managing files on Vast.ai instances, including copying between instances or cloud, canceling operations, and obtaining secure file transfer URLs. ### Methods #### `copy(src: str, dst: str, identity: Optional[str] = None)` **Description:** Copy files between instances. **Method:** Not applicable (function call) **Parameters:** - `src` (str) - Required - Source file path. - `dst` (str) - Required - Destination file path. - `identity` (Optional[str]) - Optional - Identity for the copy operation. #### `cloud_copy(src: Optional[str] = None, dst: Optional[str] = "/workspace", ...)` **Description:** Copy files between cloud storage and an instance. **Method:** Not applicable (function call) **Parameters:** - `src` (Optional[str]) - Optional - Source file path (defaults to None). - `dst` (Optional[str]) - Optional - Destination file path (defaults to "/workspace"). #### `cancel_copy(dst: str)` **Description:** Cancel a file copy operation. **Method:** Not applicable (function call) **Parameters:** - `dst` (str) - Required - Destination path of the copy operation to cancel. #### `cancel_sync(dst: str)` **Description:** Cancel a file synchronization operation. **Method:** Not applicable (function call) **Parameters:** - `dst` (str) - Required - Destination path of the sync operation to cancel. #### `scp_url(id: int)` **Description:** Get the SCP URL for transferring files to/from an instance. **Method:** Not applicable (function call) **Parameters:** - `id` (int) - Required - The ID of the instance. ### Request Example ```python # Example for copy function vast_ai_sdk.copy(src="/path/to/local/file.txt", dst="/path/on/instance/file.txt") # Example for cloud_copy function vast_ai_sdk.cloud_copy(src="/path/to/cloud/file.txt", dst="/path/on/instance/") # Example for scp_url function vast_ai_sdk.scp_url(id=12345) ``` ### Response (Responses are typically return values of the function calls, not HTTP responses) #### Success Response - Return values depend on the specific function called (e.g., boolean for success, URL string for `scp_url`). #### Response Example ```json // For scp_url: "scp://user@host:port/path/to/file" ``` ``` -------------------------------- ### Other Utility Methods API Source: https://docs.vast.ai/sdk/python/index API endpoints for various utility functions, including retrieving GPU names, showing account details, and managing credits. ```APIDOC ## Other Utility Methods API ### Description Provides access to various utility functions such as retrieving available GPU names, viewing connection and deposit details, showing earnings and invoices, managing IP addresses, user details, subaccounts, and transferring credits. ### Methods #### `get_gpu_names()` **Description:** Returns a set of GPU names available on Vast.ai. **Method:** Not applicable (function call) #### `show_connections()` **Description:** Show all active connections. **Method:** Not applicable (function call) #### `show_deposit(ID: int)` **Description:** Show deposit details for an instance. **Method:** Not applicable (function call) **Parameters:** - `ID` (int) - Required - The ID of the instance. #### `show_earnings(quiet: bool = False, start_date: Optional[str] = None, end_date: Optional[str] = None, machine_id: Optional[int] = None)` **Description:** Show earnings information. **Method:** Not applicable (function call) **Parameters:** - `quiet` (bool) - Optional - If True, suppresses output. - `start_date` (Optional[str]) - Optional - Start date for filtering earnings. - `end_date` (Optional[str]) - Optional - End date for filtering earnings. - `machine_id` (Optional[int]) - Optional - Filter earnings by machine ID. #### `show_invoices(quiet: bool = False, start_date: Optional[str] = None, end_date: Optional[str] = None, ...)` **Description:** Show invoice details. **Method:** Not applicable (function call) **Parameters:** - `quiet` (bool) - Optional - If True, suppresses output. - `start_date` (Optional[str]) - Optional - Start date for filtering invoices. - `end_date` (Optional[str]) - Optional - End date for filtering invoices. #### `show_ipaddrs()` **Description:** Show all IP addresses associated with the account. **Method:** Not applicable (function call) #### `show_user(quiet: bool = False)` **Description:** Show user details. **Method:** Not applicable (function call) **Parameters:** - `quiet` (bool) - Optional - If True, suppresses output. #### `show_subaccounts(quiet: bool = False)` **Description:** Show all subaccounts of the current user. **Method:** Not applicable (function call) **Parameters:** - `quiet` (bool) - Optional - If True, suppresses output. #### `transfer_credit(recipient: str, amount: float)` **Description:** Transfer credit to another account. **Method:** Not applicable (function call) **Parameters:** - `recipient` (str) - Required - The account ID or username of the recipient. - `amount` (float) - Required - The amount of credit to transfer. #### `update_ssh_key(id: int, ssh_key: str)` **Description:** Update an SSH key for a machine. **Method:** Not applicable (function call) **Parameters:** - `id` (int) - Required - The ID of the machine. - `ssh_key` (str) - Required - The new SSH public key. #### `generate_pdf_invoices(quiet: bool = False, start_date: Optional[str] = None, end_date: Optional[str] = None, only_charges: bool = False, only_credits: bool = False)` **Description:** Generate PDF invoices based on specified filters. **Method:** Not applicable (function call) **Parameters:** - `quiet` (bool) - Optional - If True, suppresses output. - `start_date` (Optional[str]) - Optional - Start date for the invoice period. - `end_date` (Optional[str]) - Optional - End date for the invoice period. - `only_charges` (bool) - Optional - If True, only include charges. - `only_credits` (bool) - Optional - If True, only include credits. ### Request Example ```python # Example for get_gpu_names function vast_ai_sdk.get_gpu_names() # Example for transfer_credit function vast_ai_sdk.transfer_credit(recipient="another_user", amount=10.5) # Example for generate_pdf_invoices function vast_ai_sdk.generate_pdf_invoices(start_date="2023-01-01", end_date="2023-01-31") ``` ### Response (Responses are typically return values of the function calls, not HTTP responses) #### Success Response - Return values depend on the specific function called (e.g., set of GPU names, confirmation of transfer, PDF file path or data). #### Response Example ```json // For get_gpu_names: { "NVIDIA RTX 3090", "NVIDIA A100" } // For show_user: { "id": 123, "email": "user@example.com", "balance": 50.75 } ``` ``` -------------------------------- ### Team Management API Source: https://docs.vast.ai/sdk/python/index API endpoints for managing teams, members, and roles within the Vast.ai platform. ```APIDOC ## Team Management API ### Description Provides methods for creating, managing, and modifying teams, inviting members, assigning roles, and viewing team-related information. ### Methods #### `create_team(team_name: Optional[str] = None)` **Description:** Create a new team. **Method:** Not applicable (function call) **Parameters:** - `team_name` (Optional[str]) - Optional - The name for the new team. #### `destroy_team()` **Description:** Destroy the current team. **Method:** Not applicable (function call) #### `invite_team_member(email: Optional[str] = None, role: Optional[str] = None)` **Description:** Invite a new member to the team. **Method:** Not applicable (function call) **Parameters:** - `email` (Optional[str]) - Optional - The email address of the person to invite. - `role` (Optional[str]) - Optional - The role to assign to the invited member. #### `remove_team_member(ID: int)` **Description:** Remove a member from the team. **Method:** Not applicable (function call) **Parameters:** - `ID` (int) - Required - The ID of the member to remove. #### `create_team_role(name: Optional[str] = None, permissions: Optional[str] = None)` **Description:** Create a new team role. **Method:** Not applicable (function call) **Parameters:** - `name` (Optional[str]) - Optional - The name of the new role. - `permissions` (Optional[str]) - Optional - The permissions associated with the role. #### `remove_team_role(NAME: str)` **Description:** Remove a role from the team. **Method:** Not applicable (function call) **Parameters:** - `NAME` (str) - Required - The name of the role to remove. #### `update_team_role(ID: int, name: Optional[str] = None, permissions: Optional[str] = None)` **Description:** Update details of a team role. **Method:** Not applicable (function call) **Parameters:** - `ID` (int) - Required - The ID of the role to update. - `name` (Optional[str]) - Optional - The new name for the role. - `permissions` (Optional[str]) - Optional - The new permissions for the role. #### `show_team_members()` **Description:** Show all team members. **Method:** Not applicable (function call) #### `show_team_role(NAME: str)` **Description:** Show details of a specific team role. **Method:** Not applicable (function call) **Parameters:** - `NAME` (str) - Required - The name of the role to show. #### `show_team_roles()` **Description:** Show all team roles. **Method:** Not applicable (function call) ### Request Example ```python # Example for create_team function vast_ai_sdk.create_team(team_name="MyAwesomeTeam") # Example for invite_team_member function vast_ai_sdk.invite_team_member(email="member@example.com", role="developer") # Example for show_team_members function vast_ai_sdk.show_team_members() ``` ### Response (Responses are typically return values of the function calls, not HTTP responses) #### Success Response - Return values depend on the specific function called (e.g., team object, list of members, role details). #### Response Example ```json // For show_team_members: [ {"id": 1, "email": "member@example.com", "role": "developer"} ] ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.