> ## Documentation Index
> Fetch the complete documentation index at: https://dify-6c0370d8-docs-new-agent-experience.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 快速开始

> 在 5 分钟内从命令行运行你的第一个 Dify 应用

> 本文档由 AI 自动翻译。如有任何不准确之处，请参考 [英文原版](/en/cli/quick-start)。

开始之前，请确认已 [安装](/zh/cli/install) `difyctl`。

## 第 1 步：登录

1. 登录到你的 Dify 主机。

   使用 Dify Cloud 时，填写 `https://cloud.dify.ai`；自部署时，使用 [控制台 API URL](/zh/self-host/deploy/configuration/environments#console_api_url)。

   ```bash theme={null}
   difyctl auth login --host https://cloud.dify.ai
   ```

   `difyctl` 会打印一个一次性验证码和一个验证 URL，然后等待：

   ```text theme={null}
   ! Copy this one-time code: WDJP-XKLM
     Open: https://cloud.dify.ai/device
   ```

2. 在浏览器中打开该 URL，输入验证码并登录。回到终端，你会看到：

   ```text theme={null}
   ✓ Logged in to cloud.dify.ai as <your-email> (<your-name>)
     Workspace: <your-workspace>
   ```

## 第 2 步：找到你的应用

列出工作空间中的应用：

```bash theme={null}
difyctl get app
```

你应该会看到类似下面的输出：

```text theme={null}
NAME          ID                                    MODE      UPDATED
Customer FAQ  0a1b2c3d-4e5f-6789-abcd-ef0123456789  chat      2026-06-08T03:14:27.521839
Daily Report  7f3e9a2b-1c4d-4e8f-9a0b-2d5c8e1f4a7b  workflow  2026-06-05T22:41:09.812016
```

复制要运行的应用的 ID。下面的示例使用此表中的两个 ID。

## 第 3 步：运行你的应用

传入输入的方式取决于应用类型。

<Tabs>
  <Tab title="聊天助手 / 对话流 / Agent / 文本生成应用">
    将消息作为位置参数传入：

    ```bash theme={null}
    difyctl run app 0a1b2c3d-4e5f-6789-abcd-ef0123456789 "What are your business hours?"
    ```

    回复会打印到 stdout。对于聊天助手、对话流和 Agent 应用，还会向 stderr 打印一条提示，方便你稍后继续同一段对话：

    ```text theme={null}
    Our business hours are Monday through Friday, 9am to 6pm PT.

    hint: continue this conversation with --conversation 4f7d8c2a-9b1e-4c6d-8a3f-5e2b7c9d0a1f
    ```
  </Tab>

  <Tab title="工作流">
    用 `--inputs` 将输入作为单个 JSON 对象传入：

    ```bash theme={null}
    difyctl run app 7f3e9a2b-1c4d-4e8f-9a0b-2d5c8e1f4a7b --inputs '{"topic":"quarterly report","audience":"executives"}'
    ```

    工作流的输出会以 JSON 形式打印到 stdout：

    ```json theme={null}
    {"summary":"Q3 revenue grew 14% YoY...","sections":["revenue","costs","outlook"]}
    ```
  </Tab>
</Tabs>

## 后续步骤

* **开箱即用的日常命令**：[常见任务](/zh/cli/common-tasks)
* **token 存储位置与会话机制**：[认证](/zh/cli/authenticate)
* **`difyctl` 的其余全部能力**：[命令索引](/zh/cli/reference/command-index)
