# 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-cn/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` 会停止所有机器并暂停租用。

## 智能体令牌

```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 为本地智能体提供同样的工具。

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