# Clusters and endpoints

> The devnet cluster's public endpoints and nodes, and how to point the CLI and the Python SDK at a cluster.

Source: https://docs.compute.dev.ddcdragon.com/reference/clusters/

A cluster is where your code runs: it puts your sandboxes on its nodes and serves the API, the egress proxy and the
inference API they use. Your bucket and your login belong to one cluster. Devnet is the cluster that runs today, and
the CLI and the SDK use it by default.

## Devnet endpoints

| Endpoint | URL | What it is |
|---|---|---|
| API | `https://agent-gateway.compute.dev.ddcdragon.com/v1` | The sandbox API: sandboxes, secrets, the egress log and usage records. See [HTTP API](https://docs.compute.dev.ddcdragon.com/reference/http-api/). |
| Developer Console | `https://developer.compute.dev.ddcdragon.com` | Sandboxes, Agents, Inference and Access tokens for your bucket. |
| Sign-in page | `https://developer.compute.dev.ddcdragon.com/cli/authorize` | Where `cere login` sends you to approve a sign-in with your wallet. See [Signing in](https://docs.compute.dev.ddcdragon.com/guides/signing-in/). |
| Inference API, OpenAI-compatible | `https://inference-gateway.compute.dev.ddcdragon.com/openai/v1` | Base URL for OpenAI clients. See [Inference API](https://docs.compute.dev.ddcdragon.com/guides/inference/). |
| Inference API, Anthropic-compatible | `https://inference-gateway.compute.dev.ddcdragon.com/anthropic` | Base URL for Anthropic clients. |
| S3 gateway | `https://ddc-s3-gateway.compute.dev.ddcdragon.com` | Where the agent commands keep definitions in your bucket (`cere login --s3-...`). See [Agents](https://docs.compute.dev.ddcdragon.com/guides/agents/). |
| Developer docs | `https://docs.compute.dev.ddcdragon.com` | This site; [`/llms.txt`](https://docs.compute.dev.ddcdragon.com/llms.txt) for coding agents. See [Build with AI](https://docs.compute.dev.ddcdragon.com/reference/build-with-ai/). |

The API takes your login token or an access token (Developer Console > Access tokens). The inference API takes those
too, or an inference API key (Developer Console > Inference > API keys). The S3 gateway takes an S3 credential from
Developer Console > Access tokens. The API and the inference gateway also answer an unauthenticated health
check:

```sh
curl https://agent-gateway.compute.dev.ddcdragon.com/health
```

```json
{"status":"ok"}
```

A call without a token answers `401`:

```sh
curl https://agent-gateway.compute.dev.ddcdragon.com/v1/sandboxes
```

```json
{"code":"UNAUTHORIZED","error":"authorization required: present a DDC access token in the X-Auth-Token header or as Authorization: Bearer <token>"}
```

## Devnet nodes

Devnet's sandboxes run on x86_64 and arm64 nodes. The largest sandbox is 4 vCPU and 8192 MiB.

A sandbox shows the architecture of its node:

```sh
ID=$(cere sandbox create --image python:3.12-slim --cpu 0.25 --memory 256 --timeout 120 -q)
cere sandbox exec "$ID" -- uname -m
cere sandbox terminate "$ID"
```

```text
x86_64
sb-01m89qxk9cb7pkb2dfk3s3brzd terminated: terminated by API
...
```

:::caution
A sandbox can run on an arm64 node. Use images built for both `linux/amd64` and `linux/arm64` (the official
`python`, `node` and `ubuntu` images are), or the sandbox fails with
`failed: image pull image has no build for this node's platform`.
:::

## Point the CLI at a cluster

The CLI reads the cluster's API URL, without `/v1`, from these, first match wins:

| Source | Scope |
|---|---|
| `CERE_API_URL` | This shell. |
| `api_url` in the saved login, set by `cere login --api-url <url>` | Every command, until the next `cere login --api-url`. |
| The default, `https://agent-gateway.compute.dev.ddcdragon.com` | Devnet. |

`CERE_TOKEN` overrides the saved token the same way. Check what is in effect with `cere whoami`:

```sh
export CERE_TOKEN=<access token>
CERE_API_URL=https://agent-gateway.compute.dev.ddcdragon.com cere whoami
```

```text
api         https://agent-gateway.compute.dev.ddcdragon.com
bucket      <bucket-id>
owner       <owner-key>
operations  COMPUTE
expires     2026-12-24T21:57:01Z (in 29d09h)
levels      1
token from  CERE_TOKEN
s3          not configured (agent definitions from local files only)
```

To sign in to another cluster, give its API URL to `cere login`. The sign-in page is the cluster's Developer
Console: `--console-url`, else `CERE_CONSOLE_URL`, else derived from the API URL, `agent-gateway.<domain>` becoming
`developer.<domain>`:

```sh
cere login --no-browser --api-url https://agent-gateway.compute.dev.ddcdragon.com
```

```text
Open this URL in a browser on any computer, check that the page shows the code ..., and approve:

  https://developer.compute.dev.ddcdragon.com/cli/authorize?...
```

An API URL of another shape needs the console named:

```text
error: cannot tell the developer console from the API URL https://sandbox.example.test; give it with --console-url or CERE_CONSOLE_URL
```

`cere secret set --from-login` stores your login for the same cluster's inference gateway,
`inference-gateway.<domain>`.

### The saved login

`cere login` saves the API URL and the token to one file, mode `0600`: `$CERE_CONFIG` if set, else
`$XDG_CONFIG_HOME/cere/config.json`, else `$HOME/.config/cere/config.json`. The Python SDK reads the same file with the same
overrides, so one login serves both. `cere logout` removes the token and the S3 credential from it and keeps the API
URL.

## Point the Python SDK at a cluster

By default the SDK uses the saved login and `CERE_API_URL` / `CERE_TOKEN`, like the CLI. To choose in code, build a
`cere.Client` and pass it as `client=` to a call, or make it the default for every call that names none:

```python
import os
import cere

client = cere.Client(
    api_url="https://agent-gateway.compute.dev.ddcdragon.com",
    token=os.environ["CERE_TOKEN"],
)
cere.set_default_client(client)  # calls that name no client use this one

print(client)
for sb in cere.Sandbox.list(limit=2):
    print(sb.id, sb.status)
```

```text
Client('https://agent-gateway.compute.dev.ddcdragon.com')
sb-01m89a3w4epkpghhep4s218rap terminated
sb-01m89a3q0xca1r5j8f54xg3zhp terminated
```

`cere.set_default_client(None)` goes back to the saved login.

## Related

- [Next: Build with AI](https://docs.compute.dev.ddcdragon.com/reference/build-with-ai/)
- [Signing in](https://docs.compute.dev.ddcdragon.com/guides/signing-in/)
- [HTTP API](https://docs.compute.dev.ddcdragon.com/reference/http-api/)
- [CLI](https://docs.compute.dev.ddcdragon.com/reference/cli/)
- [Python SDK](https://docs.compute.dev.ddcdragon.com/reference/python-sdk/)
