# Compute

URL: https://docs.hanzo.ai/docs/openapi/compute

> The compute you rent from Hanzo: machines, GPUs and clusters — launch one, resize it, tear it down.

Also for this capability: **API** · [CLI](https://docs.hanzo.ai/docs/cli/compute) · [MCP](https://docs.hanzo.ai/docs/mcp-tools/compute) · [SDKs](https://docs.hanzo.ai/docs/sdks)

The compute you rent from Hanzo: machines, GPUs and clusters — launch one, resize it, tear it down.

> [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|                |                                        |
| -------------- | -------------------------------------- |
| **Base URL**   | `https://api.hanzo.ai`                 |
| **Operations** | 30                                     |
| **Auth**       | `Authorization: Bearer $HANZO_API_KEY` |

## Specification

Specification pending — no HIP in [hanzoai/hips](https://github.com/hanzoai/hips) declares `capability: compute` yet. What this capability serves is below, from the API document; what it is — the store it owns, how it meters, what it publishes — is written as a HIP under HIP-0139.

## Four surfaces

| Surface  | Reaches this capability as                      | Coverage                                                                    |
| -------- | ----------------------------------------------- | --------------------------------------------------------------------------- |
| **REST** | `compute` at its own prefix                     | 30 operations                                                               |
| **CLI**  | `hanzo compute …`                               | 30 of 30                                                                    |
| **SDK**  | `ComputeApi` in every published client          | 30 methods                                                                  |
| **MCP**  | tool `compute` on `https://api.hanzo.ai/v1/mcp` | 28 operations, 26 under the document's own id — ask `describe` for the rest |

## Quickstart

```bash
export HANZO_API_KEY=sk-...   # console.hanzo.ai → API keys
```

Then the first call — a read that needs nothing but the key. `GET /v1/compute/gpus`, operation `listGpus`:

**CLI**

```bash
hanzo compute gpus get
```

**SDK**

**.ts**

```ts
import { Configuration, ComputeApi } from 'hanzoai';

const api = new ComputeApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.listGpus();
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import ComputeApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = ComputeApi(client).list_gpus()
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.ComputeAPI.ListGpus(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, compute_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = compute_api::list_gpus(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.ComputeApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new ComputeApi(client).listGpus();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/compute/gpus \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

Tool `compute`, op `listGpus` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "compute",
         "arguments": {
           "op": "listGpus",
           "input": {}
         }
       }
     }'
```

Answers `200` with `object` — ok.

## Endpoints

| Endpoint                                                                                                                      | What it does                                                                                                                                                                                                              |
| ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`POST /v1/compute/clusters/{clusterId}/pools/{poolId}/scale`](https://docs.hanzo.ai/docs/openapi/compute/scalenodepool)      | Resizes a node pool to an absolute node count and returns the pool as Visor reports it after the change.                                                                                                                  |
| [`DELETE /v1/compute/clusters/{clusterId}/pools/{poolId}`](https://docs.hanzo.ai/docs/openapi/compute/deletenodepool)         | Removes a node pool from one of the caller org's clusters.                                                                                                                                                                |
| [`POST /v1/compute/clusters/{clusterId}/pools`](https://docs.hanzo.ai/docs/openapi/compute/createnodepool)                    | Adds a node pool to one of the caller org's clusters and answers 201 with the created pool.                                                                                                                               |
| [`DELETE /v1/compute/clusters/{id}`](https://docs.hanzo.ai/docs/openapi/compute/detachcluster)                                | Removes a BYO cluster from the caller org's fleet.                                                                                                                                                                        |
| [`GET /v1/compute/clusters`](https://docs.hanzo.ai/docs/openapi/compute/listclusters)                                         | Returns the caller org's clusters from both sources: the managed clusters projected from Visor's node pools, and the BYO clusters attached to the caller's project.                                                       |
| [`POST /v1/compute/clusters`](https://docs.hanzo.ai/docs/openapi/compute/attachcluster)                                       | Attaches a BYO cluster to the caller's org — the kubeconfig is validated, KMS-sealed and added to the fleet — and answers 201 with the cluster as it now appears on GET /v1/compute/clusters.                             |
| [`POST /v1/compute/fleet/jobs/{id}/cancel`](https://docs.hanzo.ai/docs/openapi/compute/cancelfleetjob)                        | Cancels a queued or running render in the caller's org.                                                                                                                                                                   |
| [`GET /v1/compute/fleet/jobs`](https://docs.hanzo.ai/docs/openapi/compute/listfleetjobs)                                      | Returns the caller org's gpu-jobs render queue, each row tagged with the GPU it targets (empty = the shared any-GPU lane) and the node claiming it, optionally narrowed to one GPU's queue and/or one status.             |
| [`GET /v1/compute/fleet/samples`](https://docs.hanzo.ai/docs/openapi/compute/listfleetsamples)                                | Returns the caller org's utilization series, oldest first.                                                                                                                                                                |
| [`POST /v1/compute/fleet/samples`](https://docs.hanzo.ai/docs/openapi/compute/recordfleetsample)                              | Records a BYO worker's live GPU utilization into the SAME series the fleet board overlays.                                                                                                                                |
| [`GET /v1/compute/fleet/workers`](https://docs.hanzo.ai/docs/openapi/compute/listfleetworkers)                                | Returns the caller org's BYO machines — the ones that dialed in via `hanzo link` — with everything each host reported about itself.                                                                                       |
| [`GET /v1/compute/fleet`](https://docs.hanzo.ai/docs/openapi/compute/listfleet)                                               | Returns every compute unit the caller's org has, from every source, each carrying its latest utilization: agent run-targets, the BYO machines that dialed in, attached BYO clusters and Visor-provisioned machines.       |
| [`GET /v1/compute/gpus/alerts`](https://docs.hanzo.ai/docs/openapi/compute/listgpualerts)                                     | An HONEST empty surface: Visor exposes no GPU alert inventory, so this returns \[] rather than fabricating alerts.                                                                                                        |
| [`GET /v1/compute/gpus`](https://docs.hanzo.ai/docs/openapi/compute/listgpus)                                                 | Returns one row per physical accelerator the caller's org has, derived from its real GPU machines (the size slug says how many cards a node holds) and from the accelerators BYO workers report through nvidia-smi.       |
| [`GET /v1/compute/k8s/clusters/{id}`](https://docs.hanzo.ai/docs/openapi/compute/getkubernetescluster)                        | Returns one cluster's detail: node pools + worker nodes.                                                                                                                                                                  |
| [`DELETE /v1/compute/k8s/clusters/{id}`](https://docs.hanzo.ai/docs/openapi/compute/deletekubernetescluster)                  | Destroys a DOKS cluster by id and answers 204.                                                                                                                                                                            |
| [`GET /v1/compute/k8s/clusters`](https://docs.hanzo.ai/docs/openapi/compute/listkubernetesclusters)                           | Lists the org's DOKS clusters (Visor, house account) folded with the org's BYO clusters — ONE fleet cluster view under the unified k8s noun.                                                                              |
| [`POST /v1/compute/k8s/clusters`](https://docs.hanzo.ai/docs/openapi/compute/createkubernetescluster)                         | Provisions a DOKS cluster for the caller's org and answers 201.                                                                                                                                                           |
| [`GET /v1/compute/k8s/nodes`](https://docs.hanzo.ai/docs/openapi/compute/listkubernetesnodes)                                 | Returns every DOKS worker node in the org's clusters as a machine — the SAME set the fleet folds in (managedMachines), exposed directly under the k8s noun.                                                               |
| [`POST /v1/compute/machines/{id}/{action}`](https://docs.hanzo.ai/docs/openapi/compute/post-compute-machines-by-id-by-action) | Message a bot, or stop it, by naming the action in the path                                                                                                                                                               |
| [`GET /v1/compute/machines/{id}/agent`](https://docs.hanzo.ai/docs/openapi/compute/getmachineagent)                           | Returns the agent binding of one of the caller org's machines, or 404 when the machine runs no bot runtime.                                                                                                               |
| [`PUT /v1/compute/machines/{id}/agent`](https://docs.hanzo.ai/docs/openapi/compute/bindmachineagent)                          | Binds a cloud Agent to one of the caller org's machines: the machine is recorded as running that Agent's @hanzo/bot runtime.                                                                                              |
| [`DELETE /v1/compute/machines/{id}/agent`](https://docs.hanzo.ai/docs/openapi/compute/unbindmachineagent)                     | Detaches the agent runtime from one of the caller org's machines.                                                                                                                                                         |
| [`GET /v1/compute/machines/{id}`](https://docs.hanzo.ai/docs/openapi/compute/getmachine)                                      | Returns one of the caller org's machines by its org-scoped name.                                                                                                                                                          |
| [`DELETE /v1/compute/machines/{id}`](https://docs.hanzo.ai/docs/openapi/compute/deletemachine)                                | Terminates one of the caller org's machines.                                                                                                                                                                              |
| [`GET /v1/compute/machines/agents`](https://docs.hanzo.ai/docs/openapi/compute/listmachineagents)                             | Returns every agent↔machine binding in the caller's org — which machines are running which cloud Agent, with vm's own reconciled status.                                                                                  |
| [`GET /v1/compute/machines`](https://docs.hanzo.ai/docs/openapi/compute/listmachines)                                         | Returns every machine the caller's org has — Visor's registry, the live DigitalOcean droplets and the DOKS worker nodes (deduped into one union), plus the BYO machines that dialed in via `hanzo link` (provider "byo"). |
| [`POST /v1/compute/machines`](https://docs.hanzo.ai/docs/openapi/compute/post-compute-machines)                               | Launch a metered machine for your org, or price one first with dryRun                                                                                                                                                     |
| [`GET /v1/compute/regions`](https://docs.hanzo.ai/docs/openapi/compute/get-compute-regions)                                   | Lists the regions a machine can be launched in.                                                                                                                                                                           |
| [`GET /v1/compute/sizes`](https://docs.hanzo.ai/docs/openapi/compute/get-compute-sizes)                                       | Lists the machine sizes available to launch, with their specifications.                                                                                                                                                   |

---

[All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
