### Install dstack Server with uv Source: https://dstack.ai/docs/installation Installs the dstack server and all its dependencies using uv. This command also starts the server. ```shell $ uv tool install "dstack[all]" -U $ dstack server Applying ~/.dstack/server/config.yml... The admin token is "bbae0f28-d3dd-4820-bf61-8f4bb40815da" The server is running at http://127.0.0.1:3000/ ``` -------------------------------- ### Install dstack Server with pip Source: https://dstack.ai/docs/installation Installs the dstack server and all its dependencies using pip. This command also starts the server. ```shell $ pip install "dstack[all]" -U $ dstack server Applying ~/.dstack/server/config.yml... The admin token is "bbae0f28-d3dd-4820-bf61-8f4bb40815da" The server is running at http://127.0.0.1:3000/ ``` -------------------------------- ### Initialize Dev Environment with Commands Source: https://dstack.ai/docs/concepts/dev-environments Pre-configure a dev environment by specifying a list of commands to run at startup using the `init` property. This example installs the `wandb` package. ```yaml type: dev-environment name: vscode python: "3.11" ide: vscode init: - pip install wandb ``` -------------------------------- ### Install and Run dstack Server with uv Source: https://dstack.ai/docs/guides/server-deployment This snippet shows how to install the dstack server using uv, a fast Python package installer. Git and OpenSSH are prerequisites. ```shell $ uv tool install 'dstack[all]' -U $ dstack server Applying ~/.dstack/server/config.yml... The admin token is "bbae0f28-d3dd-4820-bf61-8f4bb40815da" The server is running at http://127.0.0.1:3000/ ``` -------------------------------- ### Install dstack CLI with uv Source: https://dstack.ai/docs/installation Installs the dstack CLI tool using uv. ```shell $ uv tool install dstack -U ``` -------------------------------- ### Runpod Backend Selection Example Source: https://dstack.ai/docs/concepts/backends This example demonstrates how dstack lists available Runpod instances, differentiating between Secure Cloud and Community Cloud regions based on their identifiers. ```shell $ dstack apply -f .dstack.yml -b runpod # BACKEND REGION INSTANCE SPOT PRICE 1 runpod CA NVIDIA A100 80GB PCIe yes $0.6 2 runpod CA-MTL-3 NVIDIA A100 80GB PCIe yes $0.82 ``` -------------------------------- ### Install dstack with Fluent-bit extras Source: https://dstack.ai/docs/guides/server-deployment Install the necessary extras for Fluent-bit log storage functionality. ```shell $ pip install "dstack[all]" -U # or $ pip install "dstack[fluentbit]" -U ``` -------------------------------- ### Install dstack CLI with pip Source: https://dstack.ai/docs/installation Installs the dstack CLI tool using pip. ```shell $ pip install dstack -U ``` -------------------------------- ### Schedule Dev Environment with Cron Source: https://dstack.ai/docs/dev-environments Use the `schedule` property with cron syntax to start a dev environment periodically. This example schedules an environment to start at 8:00 UTC from Monday through Friday. It can be combined with `max_duration` or `utilization_policy` for automatic shutdown. ```yaml type: dev-environment ide: vscode schedule: cron: "0 8 * * mon-fri" # at 8:00 UTC from Monday through Friday .dstack.yml ``` -------------------------------- ### Install dstack Skills for AI Agents Source: https://dstack.ai/docs/installation Install the dstack skills package using npx to enable AI agents to use the CLI and manage configuration files. ```shell $ npx skills add dstackai/dstack ``` -------------------------------- ### Define a Service with a Specific Python Version Source: https://dstack.ai/docs/concepts/services Configure a service to use a specific Python version. This example sets the Python version to 3.12 and starts a simple HTTP server. ```yaml type: service name: http-server-service python: 3.12 commands: - python3 -m http.server port: 8000 ``` -------------------------------- ### Apply Run Plan Source: https://dstack.ai/docs/reference/api/python Apply a pre-generated run plan to start a run. This method is used when you have obtained a `RunPlan` object, for example, from `get_run_plan`. ```python from dstack.api import Client, RunPlan client = Client.from_config() # Assume run_plan is a RunPlan object obtained elsewhere run_plan: RunPlan = ... run = client.runs.apply_plan(run_plan=run_plan) ``` -------------------------------- ### Fluent-bit configuration for Elasticsearch/OpenSearch Source: https://dstack.ai/docs/guides/server-deployment Example Fluent-bit configuration to receive logs and forward them to Elasticsearch or OpenSearch. ```ini [INPUT] Name forward Listen 0.0.0.0 Port 24224 [OUTPUT] Name es Match dstack.* Host elasticsearch.example.com Port 9200 Index dstack-logs Suppress_Type_Name On ``` -------------------------------- ### Specifying Service Account Data with jq Source: https://dstack.ai/docs/reference/server/config.yml Example of how to specify service account file contents as a string using `jq` for processing. ```shell cat my-service-account-file.json | jq -c | jq -R ``` -------------------------------- ### Display dstack init help Source: https://dstack.ai/docs/reference/cli/dstack/init View available options for initializing dstack, including how to set custom Git credentials. ```shell $ dstack init --help ``` -------------------------------- ### Configure Vast.ai Backend Source: https://dstack.ai/docs/concepts/backends Configure the Vast.ai backend by providing your API key in the `config.yml` file. This is the standard setup for using Vast.ai with dstack. ```yaml projects: - name: main backends: - type: vastai creds: type: api_key api_key: d75789f22f1908e0527c78a283b523dd73051c8c7d05456516fc91e9d4efd8c5 ``` -------------------------------- ### Init Repo Source: https://dstack.ai/docs/reference/api/http Initializes a new repository for a project. ```APIDOC ## POST /api/project/{project_name}/repos/init ### Description Init Repo ### Method POST ### Endpoint /api/project/{project_name}/repos/init ### Parameters #### Path Parameters - **project_name** (string) - Required - The name of the project ``` -------------------------------- ### Enable NVCC for CUDA Development Source: https://dstack.ai/docs/concepts/dev-environments Set 'nvcc' to true to include nvcc in the base Docker image, required for building custom CUDA kernels. Includes an example of installing flash_attn. ```yaml type: dev-environment name: vscode python: 3.12 nvcc: true ide: vscode init: - uv pip install flash_attn --no-build-isolation ``` -------------------------------- ### Run a Streamlit application as a dstack task Source: https://dstack.ai/docs/guides/protips Configure a dstack task to run a Streamlit application. This example installs Streamlit and then runs the 'streamlit hello' command. The task exposes port 8501. ```yaml type: task name: streamlit-task python: 3.12 commands: - uv pip install streamlit - streamlit hello ports: - 8501 ``` -------------------------------- ### Initialize a dstack Plugin Package Source: https://dstack.ai/docs/reference/plugins/python Use `uv init --library` to quickly set up the basic structure for a new Python library, which can then be developed into a dstack plugin. ```bash uv init --library ``` -------------------------------- ### Get Next Redirect Source: https://dstack.ai/docs/reference/api/http Gets the next redirect URL for authentication. ```APIDOC ## POST /api/auth/get_next_redirect ### Description Get Next Redirect ### Method POST ### Endpoint /api/auth/get_next_redirect ``` -------------------------------- ### Configure Lambda Backend Source: https://dstack.ai/docs/concepts/backends Set up the Lambda backend by providing your API key. Ensure the API key is generated from your Lambda Cloud account. ```yaml projects: - name: main backends: - type: lambda creds: type: api_key api_key: eersct_yrpiey-naaeedst-tk-_cb6ba38e1128464aea9bcc619e4ba2a5.iijPMi07obgt6TZ87v5qAEj61RVxhd0p ``` -------------------------------- ### Dev Environment with Initialization Commands Source: https://dstack.ai/docs/dev-environments Pre-configure a dev environment by specifying initialization commands to run at startup using the `init` property. ```yaml type: dev-environment name: vscode python: "3.11" ide: vscode init: - pip install wandb examples/.dstack.yml ``` -------------------------------- ### Schedule Dev Environment Startup with Cron Source: https://dstack.ai/docs/concepts/dev-environments Use the `schedule` property with cron syntax to start a dev environment periodically at specific UTC times. This allows for automated, time-based environment provisioning. ```yaml type: dev-environment ide: vscode schedule: cron: "0 8 * * mon-fri" # at 8:00 UTC from Monday through Friday ``` -------------------------------- ### Display help for dstack offer Source: https://dstack.ai/docs/reference/cli/dstack/offer Use the --help flag to view all available options and arguments for the `dstack offer` command. ```shell dstack offer --help ``` -------------------------------- ### Get Instance Details Source: https://dstack.ai/docs/reference/api/http/openapi.json Retrieves detailed information about a specific instance. Use this endpoint to get configuration and status of an instance. ```APIDOC ## GET /instances/{id} ### Description Retrieves detailed information about a specific instance. ### Method GET ### Endpoint /instances/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the instance. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the instance. - **name** (string) - The name of the instance. - **status** (string) - The current status of the instance (e.g., 'running', 'stopped'). - **ip_address** (string) - The IP address assigned to the instance. #### Response Example ```json { "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "name": "my-instance", "status": "running", "ip_address": "192.168.1.100" } ``` ``` -------------------------------- ### dstack secret get --help Source: https://dstack.ai/docs/reference/cli/dstack/secret View help for the dstack secret get command. Use this to retrieve the value of a specific secret. ```shell dstack secret get --help ``` -------------------------------- ### Initialize Repository Source: https://dstack.ai/docs/reference/api/python Initializes a repository and configures its credentials. Must be called before mounting the repo to a run. Supports overriding default Git credentials. ```python repo = RemoteRepo.from_url( repo_url="https://github.com/dstackai/dstack-examples", repo_branch="main", ) client.repos.init(repo) ``` -------------------------------- ### Start dstack Server with PostgreSQL Source: https://dstack.ai/docs/guides/server-deployment Set the DSTACK_DATABASE_URL environment variable to connect to a PostgreSQL database. Ensure the database instance meets minimum requirements or adjust pool sizes. ```shell $ DSTACK_DATABASE_URL=postgresql+asyncpg://user:password@db-host:5432/dstack dstack server ``` -------------------------------- ### Get a specific secret value Source: https://dstack.ai/docs/concepts/secrets Use `dstack secret get` to retrieve the actual value of a specific secret. This is useful for inspecting secret contents. ```shell $ dstack secret get my_secret NAME VALUE my_secret some_secret_value ``` -------------------------------- ### Initialize Repository Source: https://dstack.ai/docs/reference/api/python Initializes a repository and configures its credentials. This must be called before mounting the repo to a run. ```APIDOC ## dstack.api.RepoCollection.init(repo, git_identity_file=None, oauth_token=None, creds=None) ### Description Initializes the repo and configures its credentials in the project. Must be invoked before mounting the repo to a run. ### Parameters #### Path Parameters - **repo** (Repo) - Required - The repo to initialize. - **git_identity_file** (Optional[PathLike]) - Optional - The private SSH key path for accessing the remote repo. Defaults to `None`. - **oauth_token** (Optional[str]) - Optional - The GitHub OAuth token to access the remote repo. Defaults to `None`. - **creds** (Optional[RemoteRepoCreds]) - Optional - Optional prepared repo credentials. If specified, both `git_identity_file` and `oauth_token` are ignored. Defaults to `None`. ### Example ```python repo = RemoteRepo.from_url( repo_url="https://github.com/dstackai/dstack-examples", repo_branch="main", ) client.repos.init(repo) ``` By default, it uses the default Git credentials configured on the machine. You can override these credentials via the `git_identity_file` or `oauth_token` arguments of the `init` method. Once the repo is initialized, you can pass the repo object to the run: ```python run = client.runs.apply_configuration( configuration=..., repo=repo, ) ``` ``` -------------------------------- ### Configure a Service Run Source: https://dstack.ai/docs/quickstart Deploy a model or web app as a service endpoint. Specify the Docker image, commands to run the service, exposed ports, model name (if applicable), and required resources like GPUs. ```yaml type: service name: qwen36-service image: lmsysorg/sglang:v0.5.10.post1 commands: - | sglang serve \ --model-path Qwen/Qwen3.6-27B \ --host 0.0.0.0 \ --port 30000 \ --reasoning-parser qwen3 # Expose the SGLang server port port: 30000 # Specify a name if it's an OpenAI-compatible model model: Qwen/Qwen3.6-27B # Required resources resources: gpu: H100 ``` -------------------------------- ### Display dstack server help Source: https://dstack.ai/docs/reference/cli/dstack/server Use the --help flag to view all available options for the dstack server command. ```shell $ dstack server --help ``` -------------------------------- ### Use Instance Volume for Pip Caching Source: https://dstack.ai/docs/concepts/volumes Mount a directory on the instance to a specific path within the container to cache pip installations. This speeds up subsequent runs by reusing previously installed packages. ```yaml type: task volumes: - /dstack-cache/pip:/root/.cache/pip ``` -------------------------------- ### Display help for dstack project list Source: https://dstack.ai/docs/reference/cli/dstack/project View the help message for the `dstack project list` command to understand how to list all configured projects on the client. ```shell $ dstack project list --help ``` -------------------------------- ### Get Instance Source: https://dstack.ai/docs/reference/api/http/openapi.json Returns an instance given its ID. ```APIDOC ## POST /api/project/{project_name}/instances/get ### Description Returns an instance given its ID. ### Method POST ### Endpoint /api/project/{project_name}/instances/get ### Parameters #### Path Parameters - **project_name** (string) - Required - Project Name ### Request Body - **request** (GetInstanceRequestRequest) - Required ### Response #### Success Response (200) - **response** (InstanceRequest) - Successful Response ``` -------------------------------- ### Get Server Info Source: https://dstack.ai/docs/reference/api/http/openapi.json Retrieves information about the server. ```APIDOC ## POST /api/server/get_info ### Description Retrieves information about the server. ### Method POST ### Endpoint /api/server/get_info ### Response #### Success Response (200) - **schema**: ServerInfoRequest ``` -------------------------------- ### Apply Run Configuration Source: https://dstack.ai/docs/reference/api/python Apply a run configuration (Task, Service, or DevEnvironment) to start a run. The `repo` argument can be used to mount additional files or code. ```python from dstack.api import Task, Client client = Client.from_config() task = Task( name="my-task", image="my-image:latest", commands=["echo hello"] ) run = client.runs.apply_configuration(configuration=task) ``` -------------------------------- ### OCI Backend with Client Credentials Source: https://dstack.ai/docs/concepts/backends Configure an OCI backend using client credentials. This requires user, tenancy, region, fingerprint, and a private key file. ```yaml projects: - name: main backends: - type: oci creds: type: client user: ocid1.user.oc1..g5vlaeqfu47akmaafq665xsgmyaqjktyfxtacfxc4ftjxuca7aohnd2ev66m tenancy: ocid1.tenancy.oc1..ajqsftvk4qarcfaak3ha4ycdsaahxmaita5frdwg3tqo2bcokpd3n7oizwai region: eu-frankfurt-1 fingerprint: 77:32:77:00:49:7c:cb:56:84:75:8e:77:96:7d:53:17 key_file: "~/.oci/private_key.pem" ``` -------------------------------- ### Get Run Source: https://dstack.ai/docs/reference/api/http Retrieves details of a specific run. ```APIDOC ## POST /api/project/{project_name}/runs/get ### Description Get Run ### Method POST ### Endpoint /api/project/{project_name}/runs/get ### Parameters #### Path Parameters - **project_name** (string) - Required - The name of the project ``` -------------------------------- ### Configure a Dev Environment Run Source: https://dstack.ai/docs/quickstart Use this configuration to provision a development instance accessible with your desktop IDE. Specify the Python version and optionally request resources like GPUs. ```yaml type: dev-environment name: vscode # If `image` is not specified, dstack uses its default image python: "3.11" #image: dstackai/base:py3.13-0.7-cuda-12.1 ide: vscode # Uncomment to request resources #resources: # gpu: 24GB ``` -------------------------------- ### Get Repo Source: https://dstack.ai/docs/reference/api/http Retrieves details of a specific repository. ```APIDOC ## POST /api/project/{project_name}/repos/get ### Description Get Repo ### Method POST ### Endpoint /api/project/{project_name}/repos/get ### Parameters #### Path Parameters - **project_name** (string) - Required - The name of the project ``` -------------------------------- ### Create dstack Client Source: https://dstack.ai/docs/reference/api/python Creates a Client instance using the default configuration from `~/.dstack/config.yml`. Optionally specify project name, server URL, and user token. ```python from dstack.api import Client client = Client.from_config() ``` -------------------------------- ### Get Instance Source: https://dstack.ai/docs/reference/api/http Retrieves details of a specific instance. ```APIDOC ## POST /api/project/{project_name}/instances/get ### Description Get Instance ### Method POST ### Endpoint /api/project/{project_name}/instances/get ### Parameters #### Path Parameters - **project_name** (string) - Required - The name of the project ``` -------------------------------- ### Get Fleet Source: https://dstack.ai/docs/reference/api/http Retrieves details of a specific fleet. ```APIDOC ## POST /api/project/{project_name}/fleets/get ### Description Get Fleet ### Method POST ### Endpoint /api/project/{project_name}/fleets/get ### Parameters #### Path Parameters - **project_name** (string) - Required - The name of the project ``` -------------------------------- ### OCI Backend with Default Credentials Source: https://dstack.ai/docs/concepts/backends Configure an OCI backend using default credentials. Ensure you have `~/.oci/config` set up. ```yaml projects: - name: main backends: - type: oci creds: type: default ``` -------------------------------- ### Install dstack Server with Docker Source: https://dstack.ai/docs/installation Runs the dstack server using a Docker container, mapping the host's .dstack/server directory to the container and exposing port 3000. ```shell $ docker run -p 3000:3000 \ -v $HOME/.dstack/server/:/root/.dstack/server \ dstackai/dstack Applying ~/.dstack/server/config.yml... The admin token is "bbae0f28-d3dd-4820-bf61-8f4bb40815da" The server is running at http://127.0.0.1:3000/ ``` -------------------------------- ### Get Project Source: https://dstack.ai/docs/reference/api/http Retrieves details of a specific project. ```APIDOC ## POST /api/projects/{project_name}/get ### Description Get Project ### Method POST ### Endpoint /api/projects/{project_name}/get ### Parameters #### Path Parameters - **project_name** (string) - Required - The name of the project ``` -------------------------------- ### Configure Nebius Backend with Private Key File Source: https://dstack.ai/docs/concepts/backends Configure the Nebius backend using a service account and a private key file. The private key file path should be correctly specified. ```yaml projects: - name: main backends: - type: nebius creds: type: service_account service_account_id: serviceaccount-e00dhnv9ftgb3cqmej public_key_id: publickey-e00ngaex668htswqy4 private_key_file: ~/path/to/key.pem ``` -------------------------------- ### Get User Source: https://dstack.ai/docs/reference/api/http Retrieves information about a specific user. ```APIDOC ## POST /api/users/get_user ### Description Get User ### Method POST ### Endpoint /api/users/get_user ``` -------------------------------- ### Get Run Plan Source: https://dstack.ai/docs/reference/api/http Retrieves the plan for a specific run. ```APIDOC ## POST /api/project/{project_name}/runs/get_plan ### Description Get Plan ### Method POST ### Endpoint /api/project/{project_name}/runs/get_plan ### Parameters #### Path Parameters - **project_name** (string) - Required - The name of the project ``` -------------------------------- ### Create Project Source: https://dstack.ai/docs/reference/api/http Creates a new project. ```APIDOC ## POST /api/projects/create ### Description Create Project ### Method POST ### Endpoint /api/projects/create ``` -------------------------------- ### Get Fleet Plan Source: https://dstack.ai/docs/reference/api/http Retrieves the plan for a specific fleet. ```APIDOC ## POST /api/project/{project_name}/fleets/get_plan ### Description Get Plan ### Method POST ### Endpoint /api/project/{project_name}/fleets/get_plan ### Parameters #### Path Parameters - **project_name** (string) - Required - The name of the project ``` -------------------------------- ### Display dstack apply help information Source: https://dstack.ai/docs/reference/cli/dstack/apply Use this command to view the available options and usage instructions for `dstack apply`. ```shell dstack apply --help ``` -------------------------------- ### Get Backend Yaml Source: https://dstack.ai/docs/reference/api/http Retrieves the YAML configuration of a backend. ```APIDOC ## POST /api/project/{project_name}/backends/{backend_name}/get_yaml ### Description Get Backend Yaml ### Method POST ### Endpoint /api/project/{project_name}/backends/{backend_name}/get_yaml ### Parameters #### Path Parameters - **project_name** (string) - Required - The name of the project - **backend_name** (string) - Required - The name of the backend ``` -------------------------------- ### MPI with Slurm Source: https://dstack.ai/docs/guides/migration/slurm Set up Slurm for MPI workloads, including GPU allocation and memory. This example configures the environment variables for master address and port, creates a hostfile, and runs an NCCL performance test. ```bash #!/bin/bash #SBATCH --nodes=2 #SBATCH --ntasks=16 #SBATCH --gres=gpu:8 #SBATCH --mem=200G #SBATCH --time=24:00:00 export MASTER_ADDR=$(scontrol show hostnames $SLURM_NODELIST | head -n1) export MASTER_PORT=12345 # Convert SLURM_JOB_NODELIST to hostfile format HOSTFILE=$(mktemp) scontrol show hostnames $SLURM_JOB_NODELIST | awk -v slots=$SLURM_NTASKS_PER_NODE '{print $0" slots="slots}' > $HOSTFILE # MPI with NCCL tests or custom MPI application mpirun \ --allow-run-as-root \ --hostfile $HOSTFILE \ -n $SLURM_NTASKS \ --bind-to none \ /opt/nccl-tests/build/all_reduce_perf -b 8 -e 8G -f 2 -g 1 rm -f $HOSTFILE ``` -------------------------------- ### Get My User Source: https://dstack.ai/docs/reference/api/http Retrieves information about the currently authenticated user. ```APIDOC ## POST /api/users/get_my_user ### Description Get My User ### Method POST ### Endpoint /api/users/get_my_user ``` -------------------------------- ### dstack secret get Source: https://dstack.ai/docs/reference/cli/dstack/secret Shows the value of a specified secret. ```APIDOC ## dstack secret get ### Description Shows the value of a specified secret. ### Usage ```shell dstack secret get [name] ``` ### Parameters #### Path Parameters - **name** (string) - Required - The name of the secret to retrieve. ### Example ```shell dstack secret get MY_API_KEY ``` ``` -------------------------------- ### Get Fleet Plan Source: https://dstack.ai/docs/reference/api/http/openapi.json Retrieves the plan for a fleet based on its specification. ```APIDOC ## POST /fleet/plan ### Description Retrieves the plan for a fleet based on its specification. ### Method POST ### Endpoint /fleet/plan ### Request Body - **spec** (FleetSpecRequest) - Required - The specification of the fleet for which to retrieve the plan. ``` -------------------------------- ### Apply Task Configuration Source: https://dstack.ai/docs/quickstart Apply the task configuration using `dstack apply`. This will provision an instance and run the specified commands. Forwarded ports will be accessible via `localhost`. ```shell $ dstack apply -f task.dstack.yml # BACKEND REGION RESOURCES SPOT PRICE 1 gcp us-west4 2xCPU, 8GB, 100GB (disk) yes $0.010052 2 azure westeurope 2xCPU, 8GB, 100GB (disk) yes $0.0132 3 gcp europe-central2 2xCPU, 8GB, 100GB (disk) yes $0.013248 Submit the run streamlit? [y/n]: y Provisioning `streamlit`... ---> 100% Welcome to Streamlit. Check out our demo in your browser. Local URL: http://localhost:8501 ``` -------------------------------- ### Initiate Rolling Deployment Source: https://dstack.ai/docs/concepts/services Use `dstack apply` to update a running service. `dstack` detects changes and prompts for a rolling update. ```shell $ dstack apply -f my-service.dstack.yml Active run my-service already exists. Detected changes that can be updated in-place: - Repo state (branch, commit, or other) - File archives - Configuration properties: - env - files Update the run? [y/n]: ``` -------------------------------- ### Get Models Source: https://dstack.ai/docs/reference/api/http/openapi.json Retrieves a list of models associated with a specific project. ```APIDOC ## GET /proxy/models/{project_name}/models ### Description Retrieves a list of models for a given project. ### Method GET ### Endpoint /proxy/models/{project_name}/models ### Parameters #### Path Parameters - **project_name** (string) - Required - The name of the project. ### Response #### Success Response (200) - Description: Successful Response - **ModelsResponseRequest**: A response object containing models. #### Error Response (422) - Description: Validation Error ``` -------------------------------- ### Inspect Available Offers Source: https://dstack.ai/docs/guides/troubleshooting Use the `dstack offer` command to inspect available instance offers. You can filter by GPU type or by a specific fleet. ```shell # All matching offers, ignoring fleet configurations $ dstack offer --gpu H100 # Offers available through a specific fleet $ dstack offer --gpu H100 --fleet my-fleet ``` -------------------------------- ### Get Gateway Source: https://dstack.ai/docs/reference/api/http/openapi.json Retrieves details of a specific gateway within a project. ```APIDOC ## POST /api/project/{project_name}/gateways/get ### Description Retrieves details of a specific gateway within a project. ### Method POST ### Endpoint /api/project/{project_name}/gateways/get ### Parameters #### Path Parameters - **project_name** (string) - Required - The name of the project. #### Request Body - **name** (string) - Required - The name of the gateway to retrieve. ### Request Example ```json { "name": "example_gateway_name" } ``` ### Response #### Success Response (200) - **name** (string) - The name of the gateway. - **url** (string) - The URL of the gateway. #### Response Example ```json { "name": "example_gateway_name", "url": "http://example.com" } ``` ``` -------------------------------- ### dstack.api.Client.from_config Source: https://dstack.ai/docs/reference/api/python Creates a Client using the default configuration from ~/.dstack/config.yml if it exists. ```APIDOC ## `dstack.api.Client.from_config` ### Description Creates a Client using the default configuration from `~/.dstack/config.yml` if it exists. ### Method `staticmethod` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python client = Client.from_config() ``` ### Response #### Success Response (200) - **client** (`Client`) - A client instance. #### Response Example ```json { "client": "" } ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters #### Path Parameters None #### Query Parameters - **project_name** (Optional[str]) - The name of the project. required if `server_url` and `user_token` are specified. Default: `None` - **server_url** (Optional[str]) - The dstack server URL (e.g. `http://localhost:3000/` or `https://sky.dstack.ai`). Default: `None` - **user_token** (Optional[str]) - The dstack user token. Default: `None` ### Request Example ```python client = Client.from_config(project_name='my-project', server_url='http://localhost:3000/', user_token='my-token') ``` ### Response #### Success Response (200) - **client** (`Client`) - A client instance. #### Response Example ```json { "client": "" } ``` ``` -------------------------------- ### Get Secret Source: https://dstack.ai/docs/reference/api/http/openapi.json Retrieves a specific secret by its name within a project. ```APIDOC ## POST /api/project/{project_name}/secrets/get ### Description Retrieves a specific secret by its name within a project. ### Method POST ### Endpoint /api/project/{project_name}/secrets/get ### Parameters #### Path Parameters - **project_name** (string) - Required - The name of the project. #### Request Body - **name** (string) - Required - The name of the secret to retrieve. ### Request Example ```json { "name": "example_secret_name" } ``` ### Response #### Success Response (200) - **name** (string) - The name of the secret. - **value** (string) - The value of the secret. #### Response Example ```json { "name": "example_secret_name", "value": "example_secret_value" } ``` ``` -------------------------------- ### Slurm Container Data Access and Mounting Source: https://dstack.ai/docs/guides/migration/slurm This example is for Slurm jobs using containers. It shows how to explicitly mount shared filesystems into the container and utilize local scratch space for training. ```bash #!/bin/bash #SBATCH --nodes=4 #SBATCH --gres=gpu:8 #SBATCH --time=24:00:00 # Shared filesystem mounted at /datasets and /checkpoints DATASET_PATH=/datasets/imagenet # Local scratch accessible via $SLURM_TMPDIR (host storage mounted into container) # Copy dataset to local scratch, then train srun --container-image=/shared/images/pytorch-2.0-cuda11.8.sif \ --container-mounts=/shared/datasets:/datasets,/shared/checkpoints:/checkpoints \ cp -r $DATASET_PATH $SLURM_TMPDIR/dataset srun --container-image=/shared/images/pytorch-2.0-cuda11.8.sif \ --container-mounts=/shared/datasets:/datasets,/shared/checkpoints:/checkpoints \ python train.py \ --data=$SLURM_TMPDIR/dataset \ --checkpoint-dir=/checkpoints \ --epochs=100 # \$SLURM_TMPDIR automatically cleaned when job ends # Checkpoints saved to mounted shared filesystem persist ``` -------------------------------- ### Get Job Metrics Source: https://dstack.ai/docs/reference/api/http Retrieves metrics for a specific job run. ```APIDOC ## GET /api/project/{project_name}/metrics/job/{run_name} ### Description Get Job Metrics ### Method GET ### Endpoint /api/project/{project_name}/metrics/job/{run_name} ### Parameters #### Path Parameters - **project_name** (string) - Required - The name of the project - **run_name** (string) - Required - The name of the run ``` -------------------------------- ### Initialize and Mount RemoteRepo Source: https://dstack.ai/docs/reference/api/python Initialize a RemoteRepo instance with the client and then pass it to a run configuration. This mounts the repository into the run environment. Git credentials can be overridden using `git_identity_file` or `oauth_token`. ```python client.repos.init(repo) ``` ```python run = client.runs.apply_configuration( configuration=..., repo=repo, ) ``` -------------------------------- ### Get File Archive by Hash Source: https://dstack.ai/docs/reference/api/http/openapi.json Retrieves a file archive using its hash. ```APIDOC ## GET /file/archive ### Description Retrieves a file archive using its hash. ### Method GET ### Endpoint /file/archive ### Parameters #### Query Parameters - **hash** (string) - Required - The hash of the file archive to retrieve. ``` -------------------------------- ### Get Upstream Source: https://dstack.ai/docs/reference/api/http/openapi.json Retrieves upstream information, likely for SSH proxy configuration. ```APIDOC ## POST /api/sshproxy/get_upstream ### Description Fetches upstream details for SSH proxy. ### Method POST ### Endpoint /api/sshproxy/get_upstream ### Request Body - **GetUpstreamRequestRequest** (object) - Required - Request body for getting upstream information. ### Responses #### Success Response (200) - **GetUpstreamResponseRequest** (object) - Successful Response #### Error Responses - **400** - Bad request - **403** - Access denied - **422** - Validation Error ``` -------------------------------- ### Configure Hot Aisle Backend Source: https://dstack.ai/docs/concepts/backends Set up the Hot Aisle backend with your team handle and API key. Ensure the API key has the necessary Owner and Operator roles. ```yaml projects: - name: main backends: - type: hotaisle team_handle: hotaisle-team-handle creds: type: api_key api_key: 9c27a4bb7a8e472fae12ab34.3f2e3c1db75b9a0187fd2196c6b3e56d2b912e1c439ba08d89e7b6fcd4ef1d3f ``` -------------------------------- ### Get Plan Source: https://dstack.ai/docs/reference/api/http/openapi.json Generates a fleet plan based on the provided fleet configuration. ```APIDOC ## POST /api/project/{project_name}/fleets/get_plan ### Description Returns a fleet plan for the given fleet configuration. ### Method POST ### Endpoint /api/project/{project_name}/fleets/get_plan ### Parameters #### Path Parameters - **project_name** (string) - Required - The name of the project. #### Request Body - **GetFleetPlanRequestRequest** (object) - Required - Request body schema for getting a fleet plan. ### Response #### Success Response (200) - **FleetPlanRequest** (object) - The fleet plan object. #### Error Responses - **400** - Bad request - **403** - Access denied - **422** - Validation Error ``` -------------------------------- ### Get Repository Source: https://dstack.ai/docs/reference/api/python Retrieves repository information by its ID. Optionally includes credentials. ```APIDOC ## dstack.api.RepoCollection.get(repo_id, *, with_creds=False) ### Description Returns the repo by `repo_id` ### Parameters #### Path Parameters - **repo_id** (str) - Required - The repo ID. - **with_creds** (bool) - Optional - include repo credentials in the response. Defaults to `False`. ### Returns - **Optional[Union[RepoHead, RepoHeadWithCreds]]** - The repo or `None` if the repo is not found. ```