Files
2025-11-30 08:51:06 +08:00

35 KiB
Raw Permalink Blame History

Vast.ai Documentation Affordable GPU Cloud Marketplace

Docs

  • create api-key: Creates a new API key with specified permissions for the authenticated user.

CLI Usage: vastai create api-key --name <name> --permission_file <permissions_file> [--key_params <params>]

  • create env-var: Creates a new encrypted environment variable for the authenticated user. Keys are automatically converted to uppercase. Values are encrypted before storage. There is a limit on the total number of environment variables per user.

CLI Usage: vastai create env-var <key> <value>

  • create ssh-key: Creates a new SSH key and associates it with your account. The key will be automatically added to all your current instances.

CLI Usage: vastai create ssh-key <ssh_key>

  • create subaccount: Creates either a standalone user account or a subaccount under a parent account. Subaccounts can be restricted to host-only functionality.

CLI Usage: vastai create subaccount --email <email> --username <username> --password <password> [--type host]

  • delete api key: Deletes an existing API key belonging to the authenticated user. The API key is soft-deleted by setting a deleted_at timestamp.

CLI Usage: vastai delete api-key <id>

  • delete env var: Deletes an environment variable associated with the authenticated user. The variable must exist and belong to the requesting user.

CLI Usage: vastai delete env-var <name>

  • delete ssh key: Removes an SSH key from the authenticated user's account

CLI Usage: vastai delete ssh-key <id>

  • set user: Updates the user data for the authenticated user.

CLI Usage: vastai set user --file <file_path>

  • show api keys: Retrieves all API keys associated with the authenticated user.

CLI Usage: vastai show api-keys

  • show connections: Retrieves the list of cloud connections associated with the authenticated user.

CLI Usage: vastai show connections

  • show env vars: Retrieve a list of environment variables (secrets) for the authenticated user.

CLI Usage: vastai show env-vars [-s]

  • show ipaddrs: This endpoint retrieves the history of IP address accesses for the authenticated user.

CLI Usage: vastai show ipaddrs

  • show ssh keys: Retrieve a list of SSH keys associated with the authenticated user's account.

CLI Usage: vastai show ssh-keys

  • show subaccounts: Retrieve a list of subaccounts associated with the authenticated user's account.

CLI Usage: vastai show subaccounts

  • show team role: Retrieve details of a specific team role by its name.

CLI Usage: vastai show team-role <name>

  • show user: Retrieve information about the current authenticated user, excluding the API key.

CLI Usage: vastai show user

  • transfer credit: Transfers specified amount of credits from the authenticated user's account to another user's account.

The recipient can be specified by either email address or user ID.

CLI Usage: vastai transfer credit <recipient_email> <amount>

  • update env var: Updates the value of an existing environment variable for the authenticated user.

CLI Usage: vastai update env-var <key> <value>

  • update ssh key: Updates the specified SSH key with the provided value.

CLI Usage: vastai update ssh-key <id> <ssh_key>

  • search invoices: This endpoint allows users to search and retrieve invoices based on specified filters.

CLI Usage: vastai search invoices

  • show deposit: Retrieves the deposit details for a specified instance.

CLI Usage: vastai show deposit <id>

  • show earnings: Retrieves the earnings history for a specified time range and optionally per machine.

CLI Usage: vastai show earnings [options]

  • show invoices: This endpoint retrieves billing history reports for the authenticated user, including charges and credits.

CLI Usage: vastai show invoices

  • attach ssh-key: Attaches an SSH key to the specified instance, allowing SSH access using the provided key.

CLI Usage: vastai attach ssh <instance_id> <ssh_key>

  • cancel copy: Cancel a remote copy operation specified by the destination ID (dst_id).

CLI Usage: vastai cancel copy --dst_id <destination_id>

  • cancel sync: Cancels an in-progress remote sync operation identified by the destination instance ID. This operation cannot be resumed once canceled and must be restarted if needed.

CLI Usage: vastai cancel sync --dst_id <destination_id>

  • change bid: Change the current bid price of an instance to a specified price.

CLI Usage: vastai change bid <id> --price <price>

  • cloud copy: Starts a cloud copy operation by sending a command to the remote server. The operation can transfer data between an instance and a cloud service.

CLI Usage: vastai cloud copy <instance_id> <src> <dst> [options]

  • copy: Initiate a remote copy operation to transfer data from one instance to another or between an instance and the local machine.

CLI Usage: vastai copy <src_id> <dst_id> <src_path> <dst_path>

  • create instance: Creates a new instance by accepting an "ask" contract from a provider. This is the main endpoint for launching new instances on Vast.ai.

CLI Usage: vastai create instance <offer_id> [options]

  • destroy instance: Destroys/deletes an instance permanently. This is irreversible and will delete all data.

CLI Usage: vastai destroy instance <id>

  • detach ssh-key: Detaches an SSH key from a specified instance, removing SSH access for that key.

CLI Usage: vastai detach <instance_id> <ssh_key_id>

  • execute: Executes a constrained remote command on a specified instance. The command output can be retrieved from the returned result URL.

CLI Usage: vastai execute <instance_id> <command>

  • manage instance: Manage instance state and labels. The operation is determined by the request body parameters.

CLI Usage:

  • To stop: vastai stop instance <id>
  • To start: vastai start instance <id>
  • To label: vastai label instance <id> <label>
  • prepay instance: Deposit credits into a reserved instance to receive usage discounts. The discount rate is calculated based on how many months of usage the prepaid amount covers. Maximum discount is typically 40%.

CLI Usage: vastai prepay instance <id> <amount>

  • reboot instance: Stops and starts a container without losing GPU priority. Updates container status to 'rebooting' and executes docker stop/start commands on the host machine.

CLI Usage: vastai reboot instance <id>

  • recycle instance: Destroys and recreates container in place (from newly pulled image) without losing GPU priority. Updates container status to 'recycling' and executes docker stop/remove commands on the host machine.

CLI Usage: vastai recycle instance <id>

  • show instance: Retrieves the details of a specific instance for the authenticated user. This endpoint returns detailed information including SSH connection parameters, instance state, resource utilization, template data, and pricing details.

CLI Usage: vastai show instance [--api-key <api_key>] [--raw]

  • show instances: Retrieve a list of instances for the authenticated user.

CLI Usage: vastai show instances [options] [--api-key <api_key>] [--raw]

  • show logs: Request logs from a specific instance. The logs will be uploaded to S3 and can be retrieved from a generated URL. Supports both container logs and daemon system logs.

CLI Usage: vastai show logs <instance_id> [--tail <lines>] [--filter <grep>] [--daemon-logs]

  • show ssh-keys: Retrieves the SSH keys associated with a specific instance.

CLI Usage: vastai show ssh-keys <instance_id>

CLI Usage: vastai cancel maint <machine_id>

  • cleanup machine: This endpoint removes expired contracts on a specified machine, freeing up space.

CLI Usage: vastai cleanup machine <machine_id>

  • list machine: Creates or updates ask contracts for a machine to list it for rent on the vast.ai platform. Allows setting pricing, minimum GPU requirements, end date and discount rates.

CLI Usage: vastai list machine <machine_id> [options]

  • remove defjob: Deletes the default job (background instances) for a specified machine.

CLI Usage: vastai remove defjob <machine_id>

  • schedule maint: Schedules a maintenance window for a specified machine and notifies clients.

CLI Usage: vastai schedule maint <machine_id> --sdate <sdate> --duration <duration>

  • set defjob: Creates default jobs (background instances) for a specified machine with the given parameters.

CLI Usage: vastai set defjob <machine_id> --price_gpu <price> --price_inetu <price> --price_inetd <price> --image <image> [--args <args>]

  • set min-bid: Sets the minimum bid price for a specified machine.

CLI Usage: vastai set min-bid <machine_id> --price <price>

  • show machines: Fetches data for multiple machines associated with the authenticated user.

CLI Usage: vastai show machines [--user_id <user_id>]

  • show reports: Retrieves a list of the most recent reports for a given machine. Each report includes details such as the problem identified, a message describing the issue, and the timestamp when the report was created.

CLI Usage: vastai reports <machine_id>

  • unlist machine: Removes all 'ask' type offer contracts for a specified machine, effectively unlisting it from being available for rent.

CLI Usage: vastai unlist machine <id>

  • add network-disk: Adds a network disk to be used to create network volume offers, or adds machines to an existing network disk.

CLI Usage: vastai add network_disk <machine_id>... <mount_point> [options]

CLI Usage: vastai create network-volume <offer_id> <size> [--name <name>]

  • list network-volume: Lists a network disk for rent as network volumes, or updates an existing listing with a new price/size/end date/discount.

CLI Usage: vastai list network-volume <disk_id> [options]

CLI Usage: vastai search network-volumes <query> [--order <field>]

CLI Usage: vastai unlist volume <offer_id>

CLI Usage: vastai search benchmarks

  • search offers: Search for available GPU machine offers with advanced filtering and sorting.

Each filter parameter (such as verified, gpu_name, num_gpus, etc.) should be an object specifying the operator and value you want to match.

Filter operators:

Operator Meaning Example
eq Equal to { "eq": true }
neq Not equal to { "neq": false }
gt Greater than { "gt": 0.99 }
lt Less than { "lt": 10000 }
gte Greater than or equal { "gte": 4 }
lte Less than or equal { "lte": 8 }
in Value is in a list { "in": ["RTX_3090", "RTX_4090"] }
nin Value is not in a list { "nin": ["TW", "SE"] }

Default filters: verified=true, rentable=true, rented=false (unless --no-default is used)

CLI Usage: vastai search offers 'reliability > 0.99 num_gpus>=4' --order=dph_total

  • search templates: Searches for templates based on query parameters and retrieves matching templates.

CLI Usage: vastai search templates

  • create endpoint: This endpoint creates a new job processing endpoint with specified parameters.

CLI Usage: vastai create endpoint [options]

  • create workergroup: Creates a new workergroup configuration that manages worker instances for a serverless endpoint.

CLI Usage: vastai create workergroup --template_hash <hash> --endpoint_name <name> [options]

  • delete endpoint: Deletes an endpoint group by ID. Associated workergroups will also be deleted.

CLI Usage: vastai delete endpoint <id>

CLI Usage: vastai delete workergroup <id>

CLI Usage: vastai get endpoint logs <endpoint_name> [--tail <num_lines>]

  • get endpoint workers: Retrieves the current list and status of workers for a specific endpoint. Useful for monitoring, debugging connectivity issues, and understanding resource usage.

CLI Usage: vastai get endpoint workers <id>

CLI Usage: vastai get workergroup logs <id> [--tail <num_lines>]

  • get workergroup workers: Retrieves the current list and status of workers for a specific workergroup. Useful for monitoring, debugging connectivity issues, and understanding resource usage within a workergroup.

CLI Usage: vastai get workergroup workers <id>

  • route: Calls on the serverless engine to retrieve a GPU instance address within your endpoint for processing a request. The engine will return either a ready worker URL or status information if no workers are available.

CLI Usage: vastai route <endpoint> <cost>

  • show endpoints: Retrieve a list of endpoint jobs for the authenticated user.

CLI Usage: vastai show endpoints

  • show workergroup: Retrieves the list of workergroups associated with the authenticated user.

CLI Usage: vastai show workergroups

  • update workergroup: Updates the properties of an existing workergroup based on the provided parameters.

CLI Usage: vastai update workergroup <id> [options]

  • create team: Creates a new team with given name and following default roles:

  • Owner: Full access to all team resources, settings, and member management. The team owner is the user who creates the team.

  • Manager: All permissions of owner except team deletion.

  • Member: Can view, create, and interact with instances, but cannot access billing, team management, autoscaler, or machines.

  • The API key used to create the team becomes the team key and is used for all team operations (e.g., creating roles, deleting the team).

  • You can optionally transfer credits from your personal account to the new team account using the transfer_credit field.

CLI Usage: vastai create team --team_name <team_name> [--transfer_credit <amount>]

  • create team role: Creates a new role within a team. Only team owners or managers with the appropriate permissions can perform this operation.

CLI Usage: vastai create team role --name <role_name> --permissions <permissions_json>

  • destroy team: Deletes a team and all associated data including API keys, rights, invitations, memberships and metadata. The team owner's master API key is converted to a normal client key.

CLI Usage: vastai destroy team

  • invite team member: Sends an invitation email to the specified user to join the team with the given role.

CLI Usage: vastai invite team-member --email <email> --role <role>

  • remove team member: Removes a member from the team by revoking their team-related API keys and updating membership status. Cannot remove the team owner.

CLI Usage: vastai remove team-member <id>

  • remove team role: Removes a role from the team. Cannot remove the team owner role.

CLI Usage: vastai remove team-role <name>

  • show team members: Retrieve a list of team members associated with the authenticated user's team.

CLI Usage: vastai show team-members

  • show team roles: Retrieve a list of all roles for a team, excluding the owner' role.

CLI Usage: vastai show team-roles

CLI Usage: vastai update team-role <id> --name <new_name> --permissions <new_permissions_json>

  • create template: Creates a new template for launching instances. If an identical template already exists, returns the existing template instead of creating a duplicate.

CLI Usage: vastai create template [options]

CLI Usage: vastai delete volume <volume_id>

  • list volumes: Retrieve information about all volumes rented by you.

CLI Usage: vastai show volumes

  • rent volume: Rent/create a new volume with specified parameters.

CLI Usage: vastai create volume <id> --size <size_gb>

  • search volumes: Search for available volumes based on specified criteria.

CLI Usage: vastai search volumes <query> [options]

CLI Usage: vastai unlist volume <volume_id>