---
title: "使用 Dex Cloud"
description: "Dex Cloud 为你运行 Dex Server，包括它的存储、升级、容量和监控。你的 Worker 在任何地方运行你的代码，通过 TLS、使用 API key 连接到 server 的 endpoint。"
canonical_url: "https://docs.superdurable.io/zh-Hans/production-operations/use-dex-cloud/"
source: "docs/i18n/zh-Hans/docusaurus-plugin-content-docs/current/components/dex-cloud.mdx"
locale: "zh-Hans"
---

> 供 AI Agent 使用的全部页面索引：https://docs.superdurable.io/zh-Hans/llms.txt

# 使用 Dex Cloud

Dex Cloud 为你运行 Dex Server，包括它的存储、升级、容量和监控。你的 Worker 可以运行在任何地方，所以你的代码和凭证始终留在你这边。

<a id="get-started"></a>

## 开始使用

[注册 Dex Cloud](https://dex.superdurable.io/register)，然后创建一个 server。价格、区域和 SLA，请[联系 Super Durable](https://superdurable.io/about/#contact)。

Dex Cloud 也能运行整个应用。[Managed Dex App](https://docs.superdurable.io/zh-Hans/production-operations/managed-dex-app.md) 从你的 GitHub 仓库构建，并且连你的 Worker 一起运行。

<a id="connect"></a>

## 连接 Worker 和 Client

你在 Dex Cloud 创建的每个 server 都有自己的 endpoint 和 API key。Worker 和 Client 通过 TLS、使用这个 key 连接到这个 endpoint：

- key 放在 [API key credential](https://docs.superdurable.io/zh-Hans/reference/server/authentication.md#sdk-credentials) 里。
- TLS 用 SDK 的 [TLS 选项](https://docs.superdurable.io/zh-Hans/reference/server/authentication.md#tls)。

这些值来自 Dex Cloud 中的 Dex Server 页面。打开 **Management**，再打开 **Connect** 标签页。它的 **Connection values** 列出 **Endpoint**、**Server ID** 和 **Token URL**，每项都有 Copy 按钮。**API keys** 标签页用来创建 API key。Dex Cloud 只在创建时显示一次密钥。

Dex Agents CLI 命令（例如 `dex-agents-claude-sdk`）使用同样的值连接。在配置文件中把 `dex.server` 设为 `https://` 加上 endpoint。把 `dex.auth` 设为 `api_key`，并填入你复制的 **Token URL** 和 **Server ID**。把密钥导出为 `DEX_API_KEY`：

```yaml
dex:
  server: https://ENDPOINT
  auth:
    mode: api_key
    token_url: TOKEN_URL
    server_id: SERVER_ID
```

```bash
export DEX_API_KEY=...
dex-agents-claude-sdk
```

[Run against a remote Dex server](https://docs.superdurable.io/zh-Hans/reference/agents/cli-first-run.md#remote-server) 列出了全部设置，包括可以代替文件字段的 `DEX_TOKEN_URL` 和 `DEX_SERVER_ID`。

<a id="what-runs-where"></a>

## 各部分由谁运行

|                                     | 由谁运行                                 |
| ----------------------------------- | ------------------------------------ |
| Dex Server：存储、升级、容量和监控              | Super Durable                        |
| Flow 状态：Flow 输入、Attribute 和 Step 结果 | 由 Dex Server 存储，存储由 Super Durable 运维 |
| 你的 Worker 和 Flow 代码                 | 你自己，部署在你选择的地方                        |
| 你的代码调用你自己的 API 时使用的凭证               | 你自己。它们留在你的 Worker 里。                 |

[Dex Server 运行在哪里](https://docs.superdurable.io/zh-Hans/production-operations.md#where-to-run)对比了 Dex Cloud 和自托管 server。

<a id="next"></a>

## 下一步

- [Managed Dex App](https://docs.superdurable.io/zh-Hans/production-operations/managed-dex-app.md)：让 Dex Cloud 从 GitHub 仓库构建并运行你的整个应用。
- [生产环境检查清单](https://docs.superdurable.io/zh-Hans/production-operations/production-checklist.md)：关于 Worker、代码变更和数据库的检查项在 Dex Cloud 中同样适用。
- [运维和排错](https://docs.superdurable.io/zh-Hans/production-operations/operate-and-debug.md)：找到 Flow，修复停住或失败的 Flow。
