tensorone logo

SDKs

Manage GraphQL Clusters

Learn how to manage Clusters using GraphQL.


Authentication and Cluster Management via GraphQL API

Tensor One uses API Keys for all authenticated API requests. To manage your keys, navigate to Settings in the Web Interface.

For full specifications of queries, mutations, fields, and inputs, refer to the Tensor One GraphQL Spec.


Cluster Resource Overview

A Cluster on Tensor One includes:

  • 0 or more GPUs – Can operate without GPUs, but GPU-accelerated features will not function.
  • vCPU & RAM – Required compute resources.
  • Container Disk – Temporary storage; billed only while running.
  • Instance Volume – Persistent storage; billed even when the Cluster is stopped.

Creating Clusters

Create On-Demand Cluster

curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tpu.one/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: \"rn51hunbpgtltcpac3ol\" }] } ) { id imageName env machineId machine { clusterHostId } } }"}'

Create Spot Cluster

curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tpu.one/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: \"vunw9ybnzqwpia2795p2\" }] } ) { id imageName env machineId machine { clusterHostId } } }"}'

Starting Clusters

Start On-Demand Cluster

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

Start Spot Cluster

curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tpu.one/graphql?api_key=${YOUR_API_KEY}' \
--data '{"query": "mutation { clusterBidResume( input: { clusterId: \"d62t7qg9n5vtan\", 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.tpu.one/graphql?api_key=${YOUR_API_KEY}' \
--data '{"query": "mutation { clusterStop(input: {clusterId: \"riixlu8oclhp\"}) { id desiredStatus } }"}'

Listing Clusters

List All Clusters

curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tpu.one/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.tpu.one/graphql?api_key=${YOUR_API_KEY}' \
--data '{"query": "query cluster { cluster(input: {clusterId: \"ldl1dxirsim64n\"}) { 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.tpu.one/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.tpu.one/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 } } }"}'
Previous
GraphQL Configurations