> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-claude-comfy-concurrency-limits-page-s84u33.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Comfy API 快速入门

> 使用 AI 编码智能体和 comfy-cli 构建、发布本地 ComfyUI 环境，并将其部署为托管端点。

## 从智能体开始（推荐）

在你想要部署的本地 ComfyUI 安装所在的文件夹中启动 AI 编码智能体，然后粘贴以下提示词：

```text theme={null}
Install or update comfy-cli, then read its Build and Deploy skills:

pip install -U comfy-cli
comfy skills show comfy-build
comfy skills show comfy-deploy

Use comfy-build to inspect this local ComfyUI install and package its models, custom nodes, and pinned dependencies into a Comfy API Build. Show me what will be included and create a Linux/NVIDIA release. Then use comfy-deploy to show the available GPU and region options, worker bounds, and current rates. Wait for my approval before creating a deployment. After approval, deploy it and explain how to run a workflow.
```

## 快速开始

当本地安装和保存为 `workflow_api.json` 的 [API 格式工作流](/zh/development/api-development/workflow-api-format) 都准备就绪后，请使用以下命令。

<Steps>
  <Step title="初始化">
    ```bash theme={null}
    comfy build init --name "my-comfy-build" --models-dir ./models --custom-nodes-dir ./custom_nodes
    ```
  </Step>

  <Step title="推送并创建发布版本">
    推送 Build 及其资产，查看可用的目标，然后等待 Linux/NVIDIA 发布完成：

    ```bash theme={null}
    comfy build push
    comfy build refs build-targets
    comfy build release create --target linux/nvidia --watch
    ```
  </Step>

  <Step title="启动部署">
    在目录中查看可用的 GPU 与区域组合，然后将 GPU、区域和 worker 数量上下限的占位符替换为你的设置：

    ```bash theme={null}
    comfy deploy refs compute
    comfy deploy up --gpu <gpu> --region <region> --min <min-workers> --max <max-workers> --watch
    ```
  </Step>

  <Step title="运行工作流">
    将 `comfy deploy up` 打印出的部署 ID 用于 `--deployment`：

    ```bash theme={null}
    comfy deploy run \
      --workflow workflow_api.json \
      --deployment <deployment-id> \
      --output-dir ./results
    ```
  </Step>
</Steps>

## 其他开始方式

如果你的环境或工作流已存在于 Comfy桌面版或某个工作流文件中，可以使用以下方式。

<CardGroup cols={2}>
  <Card title="Comfy桌面版快照" icon="camera" href="/zh/development/serverless/build-sources#comfy-desktop-快照">
    从桌面版导出快照，然后将其导入 Build Wizard。
  </Card>

  <Card title="导入工作流 JSON" icon="file-import" href="/zh/development/serverless/build-sources#工作流-json">
    通过将已保存的工作流导入 Build Wizard 来创建 Build。
  </Card>
</CardGroup>

## 下一步

<CardGroup cols={2}>
  <Card title="Comfy 工作流" icon="magnifying-glass" href="https://comfy.org/models?type=workflows">
    浏览社区分享的 ComfyUI 工作流。
  </Card>

  <Card title="应用" icon="grid-2" href="https://comfy.org/models?type=apps">
    探索社区用 ComfyUI 构建的应用。
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.