# Signing in

> Sign the cere CLI and the Python SDK in to your bucket: in the browser, without a browser, or with an access token for CI.

Source: https://docs.compute.dev.ddcdragon.com/guides/signing-in/

Every `cere` command and every Python SDK call acts for one bucket, with the login that `cere login` saves. Only the
CLI signs in; the SDK reads the same login, or `CERE_TOKEN`. `pip install cere` brings both.

> Until `cere` is on PyPI, install it from the GitHub release instead (members of the Cerebellum-Network organization, with `gh` signed in): `gh release download cli/v0.1.7 -R Cerebellum-Network/ddc-node -p 'cere-*.whl' -D cere-wheels && pip install --no-index --find-links cere-wheels cere`

## Sign in in the browser

Run `cere login`. It opens the Developer Console and waits up to 10 minutes for you to approve.

```sh
cere login
```

```
Opening the developer console to sign in. Approve only if the page shows this code: 8RER-BE7X
If the browser didn't open, visit:

  https://developer.compute.dev.ddcdragon.com/cli/authorize?code=8RER-BE7X&days=7&host=<hostname>&key=35791d53...&port=50662&state=...

Waiting for you to approve (up to 10 minutes; Ctrl-C to cancel)...
```

The page, **Sign in the cere CLI**, shows:

- **The request**: the code, which must match the one in your terminal (deny if it does not), the machine's name as
  the CLI reports it, and the fingerprint of the CLI's key.
- **What it gets**: COMPUTE on one bucket (a picker when your wallet owns more than one), that is, sandboxes,
  agents, secrets, their logs and usage, and the inference API, all billed to that bucket. Nothing else: no storage
  reads or writes, no payments. If you have no bucket yet, approving creates one first.
- **Expires in**: 1, 7 or 30 days. `--days` sets what the page proposes (default 7); you can change it there.

Choose **Approve** and confirm with your SSCP wallet's passkey. The wallet signs a grant of COMPUTE on the bucket to a
key the CLI has just made; the page hands the grant to the CLI on `127.0.0.1`, and the CLI's own page says it is
signed in and that you can close the tab. The terminal prints `Logged in to <api> for bucket <bucket-id> through the
browser; the login expires <time>.` **Deny** tells the CLI, and nothing is saved.

The CLI signs its own token under the grant with its key and saves the token, the grant and the key to
`$HOME/.config/cere/config.json` (or `$XDG_CONFIG_HOME/cere/config.json`, or the file `CERE_CONFIG` names), mode 0600.
The API refuses the grant presented without a token signed by that key, and the key never leaves your machine, so a
copy of the grant alone is useless.

:::note
If you have no SSCP wallet yet, the Developer Console creates one when you sign in: you give an email address, enter
the one-time code sent to it, and your device makes a passkey. After that, the passkey approves each sign-in.
:::

## Sign in without a browser

On a machine without a browser (SSH, a container), `cere login --no-browser` prints the URL to open on any computer.
Approve there, then paste the code the page shows; the input is hidden.

```sh
cere login --no-browser
```

```
Open this URL in a browser on any computer, check that the page shows the code EYTC-6CE2, and approve:

  https://developer.compute.dev.ddcdragon.com/cli/authorize?code=EYTC-6CE2&days=7&host=<hostname>&key=ba058262...&state=...

Paste the code from the browser (input hidden):
```

The same prompt takes an access token instead.

## Choose the lifetime and the console

`--days` is 1, 7 or 30. `--console-url` (or `CERE_CONSOLE_URL`) names the Developer Console to sign in through; by
default it is the one of the API's cluster (`agent-gateway.<domain>` signs in through `developer.<domain>`).

```sh
cere login --days 2
```

```
error: --days 2: the console offers 1, 7 or 30
```

`--api-url` points the login at another cluster's API; see [Clusters and endpoints](https://docs.compute.dev.ddcdragon.com/reference/clusters/).

## Check who you are

`cere whoami` shows the API, the bucket, its owner, the operation, when the token expires, and where the token comes
from.

```sh
cere whoami
```

```
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  $HOME/.config/cere/config.json
s3          not configured (agent definitions from local files only)
```

`levels 1` is an access token. After a browser sign-in it reads `levels 2 (signed in through the browser: the owner's
grant to this CLI's key <fingerprint>, and a token that key signed)`. `s3` is the credential for agent definitions in
your bucket; see [Agents](https://docs.compute.dev.ddcdragon.com/guides/agents/#run-an-agent-by-name-from-your-bucket). `--json` prints the same as JSON.

## Use an access token in CI

Create a token in Developer Console > **Access tokens** > **A token for CI**: pick 1, 7 or 30 days and approve with
your wallet. It is shown once and cannot be revoked, so keep it in your CI's secret store. Save it as the login with
`--token-stdin`:

```sh
cere login --token-stdin < token.txt
```

```
Logged in to https://agent-gateway.compute.dev.ddcdragon.com for bucket <bucket-id>; the token expires 2026-12-24T21:57:01Z (in 29d09h).
Saved to $HOME/.config/cere/config.json.
```

## Use a token without saving it

`CERE_TOKEN` and `CERE_API_URL` override the saved login, for the CLI and the SDK alike.

**CLI**

```sh
export CERE_TOKEN="$(cat token.txt)"
export CERE_API_URL=https://agent-gateway.compute.dev.ddcdragon.com
cere whoami
```

```
api         https://agent-gateway.compute.dev.ddcdragon.com
bucket      <bucket-id>
...
token from  CERE_TOKEN
```

**Python**

```python
import cere  # reads CERE_TOKEN and CERE_API_URL, ahead of the saved login

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

```
sb-01m89a3w4epkpghhep4s218rap terminated
sb-01m89a3q0xca1r5j8f54xg3zhp terminated
sb-01m89a3fga4175js2vqevqd2by terminated
```

With neither a login nor `CERE_TOKEN`, every command says so:

```
error: not logged in: run `cere login` or set CERE_TOKEN (an access token from Developer Console -> Access tokens)
```

## Sign out

`cere logout` removes the token, the grant, the key and the S3 credential from the config file.

```sh
cere logout
```

```
Logged out; $HOME/.config/cere/config.json holds no credential.
```

A `CERE_TOKEN` set in the shell still applies after `cere logout`; the CLI says so.

## When the login expires

A login lasts until the lifetime you chose; it cannot be revoked before then. After it expires:

- every command and SDK call is refused with `401`, and `cere whoami` marks the expiry `(EXPIRED)`;
- a secret stored with `--from-login` (such as the example agents' `ddc-inference`) holds the expired token, so model
  calls through it are refused too.

Sign in again, then store the secret again:

```sh
cere login
cere secret set ddc-inference --from-login
```

## Related

- [Next: CLI](https://docs.compute.dev.ddcdragon.com/reference/cli/)
- [Clusters and endpoints](https://docs.compute.dev.ddcdragon.com/reference/clusters/)
- [Egress and secrets](https://docs.compute.dev.ddcdragon.com/guides/egress-and-secrets/)
- [Inference API](https://docs.compute.dev.ddcdragon.com/guides/inference/)
- [Quickstart](https://docs.compute.dev.ddcdragon.com/quickstart/)
