# CLI

使用 arrakis 命令，在終端中搜尋、租用和管理機器。

> `arrakis` 命令即將公開發布。它能做的一切，也都可以在控制台、透過 MCP 或 API 完成。

## 登入

CLI 使用 API 權杖。在 **API & agents** 頁面建立一個，然後：

```sh
export ARRAKIS_TOKEN=ark_...
arrakis whoami
```

`arrakis market` 無需權杖。

## 查詢並租用

```sh
arrakis market
arrakis gpus search --gpu-type B200
arrakis instances create --node-id <node> --termination-hours 4 --ssh-public-key ~/.ssh/id_ed25519.pub
```

按需新增 `--gpu-count`、`--template-id` 或 `--idempotency-key`；加上 `--json` 可輸出原始資料。

## 映像

```sh
arrakis images list
arrakis images add vllm/vllm-openai:v0.11.0 --start image
arrakis instances create --node-id <node> --image vllm/vllm-openai:v0.11.0 --start image --termination-hours 2
```

`--image` 接受任意公開映像；扣費之前會先向其映像倉庫核驗。私有映像需要先用 `arrakis images add IMAGE --username NAME --password-stdin` 儲存，再透過 `--template-id` 租用。參見[映像](/zh-tw/docs/images)。

## 管理機器

```sh
arrakis instances list
arrakis instances get <id>
arrakis instances schedule-removal <id> --in 3h
arrakis instances terminate <id>
```

## 資金

```sh
arrakis billing status
arrakis billing add 50
arrakis billing auto-recharge --on --threshold 20 --amount 50
arrakis billing stop
```

`billing add` 開啟 Stripe 付款頁面；`billing stop` 會停止所有機器並暫停租用。

## AI 代理權杖

```sh
arrakis tokens create --name eval-agent --scope read --scope rent --spend-limit 50 --max-rental-hours 6
```

## 在本地執行 MCP

```sh
arrakis mcp
```

設定好 `ARRAKIS_TOKEN` 後，透過 stdio 為本地 AI 代理提供同樣的工具。

更多：[全部文件](/zh-tw/docs.md) · [OpenAPI](/openapi.json) · [llms.txt](/zh-tw/llms.txt)
