code: def __init__(self, api_key: str):
      self.api_url = "https://console.vast.ai/api/v0".rstrip("/")
      self.api_key = api_key
      self.s = requests.Session()
      retries = Retry(
          total=5,
          backoff_factor=1,
          status_forcelist=[429, 504],
      )
      self.s.mount(
          prefix=self._url("/instances/"),
          adapter=HTTPAdapter(max_retries=retries),
      )
      self.lock = threading.Lock()
      self.instances_cache_ts: float = 0
      self.instances_cache: List[dict] = []
  
file_path: dstack/src/dstack/_internal/core/backends/vastai/api_client.py
imports: import shlex
  import threading
  import time
  from typing import List, Optional, Union
  import requests
  from requests.adapters import HTTPAdapter, Retry
  import dstack._internal.server.services.docker
  from dstack._internal.core.errors import NoCapacityError
  from dstack._internal.core.models.configurations import RegistryAuth
label_desc: Use image node_id 1 to create a new VastAIAPIClient object  with example: obj = VastAIAPIClient(api_key)