# Create clusters — POST /v1/compute/k8s/clusters

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

> Provisions a DOKS cluster for the caller's org and answers 201.

`POST /v1/compute/k8s/clusters`

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

|               |                                                |
| ------------- | ---------------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/compute/k8s/clusters` |
| **Method**    | `POST`                                         |
| **Operation** | `createKubernetesCluster`                      |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`         |

Provisions a DOKS cluster for the caller's org and answers 201.
ADMIN-GATED — a SuperAdmin, or an OrgAdmin of the caller's own org — because
provisioning spends real infrastructure on the house account. The request is
validated at this boundary, then Visor owns provisioning and the hanzo-org
ownership tag.

## Request

7 fields, body `application/json` (required).

| Field            | In   | Type            | Required | Description                                                                                                      |
| ---------------- | ---- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------- |
| `name`           | body | string          | —        | Name is the cluster's name.                                                                                      |
| `nodePool`       | body | object          | —        | NodePool is the ONE pool the cluster is born with — a cluster with no nodes runs nothing, so it is not optional. |
| `nodePool.count` | body | integer (int64) | —        |                                                                                                                  |
| `nodePool.name`  | body | string          | —        |                                                                                                                  |
| `nodePool.size`  | body | string          | —        |                                                                                                                  |
| `region`         | body | string          | —        | Region is the provider region slug (e.g. "nyc3").                                                                |
| `version`        | body | string          | —        | Version is the Kubernetes version slug; empty takes the provider default.                                        |

## Response

| Status    | Body                | Meaning |
| --------- | ------------------- | ------- |
| `200`     | compute.clusterView | ok      |
| `default` | problem-details     | refused |

`200` body — 19 fields.

| Field                   | In   | Type                    | Always | Description                                                                                                                                                                                                                                                                          |
| ----------------------- | ---- | ----------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `amdGpu`                | body | integer (int64)         | —      | AmdGPU is the same count for `amd.com/gpu`: AMD accelerators across the BYO cluster's nodes, as of the attach.                                                                                                                                                                       |
| `createdAt`             | body | string                  | —      | CreatedAt is when the cluster started existing: the earliest creation time among its pools for a managed cluster, and for a BYO one the RFC 3339 moment it was attached.                                                                                                             |
| `doClusterId`           | body | string                  | —      | DoClusterID carries the SAME id as DoksClusterID.                                                                                                                                                                                                                                    |
| `doksClusterId`         | body | string                  | —      | DoksClusterID is the provider's own id for the cluster, and the value the /v1/compute/k8s/clusters/:id routes take.                                                                                                                                                                  |
| `kind`                  | body | string                  | —      | Kind says which of the two kinds of cluster this row is, and there are only two: "managed" — Visor provisioned it and Hanzo's account pays the provider — or "byo", an existing cluster the org attached by kubeconfig.                                                              |
| `name`                  | body | string                  | —      | Name is the cluster's name: the provider's for a managed cluster, and for a BYO one the lower-cased fleet name it was attached under — which is also how the detach route addresses it.                                                                                              |
| `nodeCount`             | body | integer (int64)         | —      | NodeCount is how many worker nodes the cluster has — the sum over its pools for a managed cluster, and for a BYO one the node count read off the cluster when it was attached.                                                                                                       |
| `nodePools`             | body | compute.nodePoolView\[] | —      | NodePools is the authoritative node inventory — every pool, each with its own size and count.                                                                                                                                                                                        |
| `nodePools[].autoScale` | body | boolean                 | —      | AutoScale reports whether the provider's cluster autoscaler owns this pool's size, moving Count between MinNodes and MaxNodes as workloads demand.                                                                                                                                   |
| `nodePools[].count`     | body | integer (int64)         | —      | Count is how many nodes the pool has right now.                                                                                                                                                                                                                                      |
| `nodePools[].maxNodes`  | body | integer (int64)         | —      | MaxNodes is the ceiling the autoscaler will not grow the pool past, and so the bound on what this pool can cost.                                                                                                                                                                     |
| `nodePools[].minNodes`  | body | integer (int64)         | —      | MinNodes is the floor the autoscaler will not shrink the pool below.                                                                                                                                                                                                                 |
| `nodePools[].name`      | body | string                  | —      | Name is the pool's name as the provider knows it.                                                                                                                                                                                                                                    |
| `nodePools[].poolId`    | body | string                  | —      | PoolID is the provider's id for the pool — the value the scale and delete routes address it by.                                                                                                                                                                                      |
| `nodePools[].size`      | body | string                  | —      | Size is the provider size slug every node in the pool runs at ("s-4vcpu-8gb", "gpu-h100x8-640gb").                                                                                                                                                                                   |
| `nodeSize`              | body | string                  | —      | NodeSize is a display convenience: the size slug of the FIRST pool.                                                                                                                                                                                                                  |
| `nvidiaGpu`             | body | integer (int64)         | —      | NvidiaGPU is how many NVIDIA accelerators the cluster's nodes advertise, the sum of `nvidia.com/gpu` allocatable across them.                                                                                                                                                        |
| `region`                | body | string                  | —      | Region is the provider region slug for a managed cluster.                                                                                                                                                                                                                            |
| `status`                | body | string                  | —      | Status is the cluster's state: the provider's own word for a managed cluster ("running", "provisioning"), "unknown" when the provider stated none, and always "attached" for a BYO cluster — that one says the kubeconfig is on file, not that the cluster is reachable this second. |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo compute k8s clusters create
```

**SDK**

**.ts**

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

const api = new ComputeApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.createKubernetesCluster({ name: "<name>", nodePool: {"count":0,"name":"<name>","size":"<size>"} });
```

**.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).create_kubernetes_cluster(name="<name>", node_pool={"count":0,"name":"<name>","size":"<size>"})
```

**.go**

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

resp, _, err := client.ComputeAPI.CreateKubernetesCluster(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::create_kubernetes_cluster(&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).createKubernetesCluster();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/compute/k8s/clusters \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "name": "<name>",
       "nodePool": {
         "count": 0,
         "name": "<name>",
         "size": "<size>"
       }
     }'
```

**MCP**

Tool `compute`, op `createKubernetesCluster` — 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": "createKubernetesCluster",
           "input": {
             "name": "<name>",
             "nodePool": {
               "count": 0,
               "name": "<name>",
               "size": "<size>"
             }
           }
         }
       }
     }'
```

---

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