Cluster Management via GraphQL

Use the Tensor One GraphQL API to programmatically manage Clusters, including creation, startup, shutdown, and monitoring.

Authentication

All GraphQL requests must include an API Key for authentication.
  • Get your API key in Settings from the Tensor One Web
  • Append it to requests as a query parameter:
https://api.tensorone.ai/graphql?api_key=${YOUR_API_KEY}
For full API specs, see the GraphQL Reference.

Cluster Resource Overview

A Cluster in Tensor One includes:
  • 0 or more GPUs - Optional, but needed for GPU-accelerated workloads
  • vCPU & RAM - Required compute resources
  • Container Disk - Temporary, billed only while running
  • Instance Volume - Persistent, billed even when stopped

Creating Clusters

On-Demand Cluster

curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tensorone.ai/graphql?api_key=${YOUR_API_KEY}' \
--data '{
  "query": "mutation {
    clusterFindAndDeployOnDemand(input: {
      cloudType: ALL,
      gpuCount: 1,
      volumeInGb: 40,
      containerDiskInGb: 40,
      minVcpuCount: 2,
      minMemoryInGb: 15,
      gpuTypeId: \"NVIDIA RTX A6000\",
      name: \"Tensor One Tensorflow\",
      imageName: \"tensorone/tensorflow\",
      dockerArgs: \"\",
      ports: \"8888/http\",
      volumeMountPath: \"/workspace\",
      env: [{ key: \"JUPYTER_PASSWORD\", value: \"your_password\" }]
    }) {
      id imageName env machineId machine { clusterHostId }
    }
  }"
}'

Spot Cluster

curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tensorone.ai/graphql?api_key=${YOUR_API_KEY}' \
--data '{
  "query": "mutation {
    clusterRentInterruptable(input: {
      bidPerGpu: 0.2,
      cloudType: SECURE,
      gpuCount: 1,
      volumeInGb: 40,
      containerDiskInGb: 40,
      minVcpuCount: 2,
      minMemoryInGb: 15,
      gpuTypeId: \"NVIDIA RTX A6000\",
      name: \"Tensor One Pytorch\",
      imageName: \"tensorone/pytorch\",
      dockerArgs: \"\",
      ports: \"8888/http\",
      volumeMountPath: \"/workspace\",
      env: [{ key: \"JUPYTER_PASSWORD\", value: \"your_password\" }]
    }) {
      id imageName env machineId machine { clusterHostId }
    }
  }"
}'

Starting Clusters

Start On-Demand Cluster

curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tensorone.ai/graphql?api_key=${YOUR_API_KEY}' \
--data '{
  "query": "mutation {
    clusterResume(input: {
      clusterId: \"your_cluster_id\",
      gpuCount: 1
    }) {
      id desiredStatus imageName env machineId machine { clusterHostId }
    }
  }"
}'

Start Spot Cluster

curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tensorone.ai/graphql?api_key=${YOUR_API_KEY}' \
--data '{
  "query": "mutation {
    clusterBidResume(input: {
      clusterId: \"your_cluster_id\",
      bidPerGpu: 0.2,
      gpuCount: 1
    }) {
      id desiredStatus imageName env machineId machine { clusterHostId }
    }
  }"
}'

Stopping Clusters

curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tensorone.ai/graphql?api_key=${YOUR_API_KEY}' \
--data '{
  "query": "mutation {
    clusterStop(input: {
      clusterId: \"your_cluster_id\"
    }) {
      id desiredStatus
    }
  }"
}'

Listing Clusters

List All Clusters

curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tensorone.ai/graphql?api_key=${YOUR_API_KEY}' \
--data '{
  "query": "query clusters {
    myself {
      clusters {
        id name
        runtime {
          uptimeInSeconds
          ports {
            ip isIpPublic privatePort publicPort type
          }
          gpus {
            id gpuUtilPercent memoryUtilPercent
          }
          container {
            cpuPercent memoryPercent
          }
        }
      }
    }
  }"
}'

Get Cluster by ID

curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tensorone.ai/graphql?api_key=${YOUR_API_KEY}' \
--data '{
  "query": "query cluster {
    cluster(input: {
      clusterId: \"your_cluster_id\"
    }) {
      id name
      runtime {
        uptimeInSeconds
        ports {
          ip isIpPublic privatePort publicPort type
        }
        gpus {
          id gpuUtilPercent memoryUtilPercent
        }
        container {
          cpuPercent memoryPercent
        }
      }
    }
  }"
}'

GPU Type Queries

List All GPU Types

curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tensorone.ai/graphql?api_key=${YOUR_API_KEY}' \
--data '{
  "query": "query GpuTypes {
    gpuTypes {
      id displayName memoryInGb
    }
  }"
}'

Get GPU Type by ID

curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tensorone.ai/graphql?api_key=${YOUR_API_KEY}' \
--data '{
  "query": "query GpuTypes {
    gpuTypes(input: { id: \"NVIDIA GeForce RTX 3090\" }) {
      id displayName memoryInGb
      secureCloud
      communityCloud
      lowestPrice(input: { gpuCount: 1 }) {
        minimumBidPrice
        uninterruptablePrice
      }
    }
  }"
}'