mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-09-07 02:47:03 +08:00
31 lines
1.3 KiB
Markdown
31 lines
1.3 KiB
Markdown
# ComfyUI API Nodes
|
|
|
|
## Introduction
|
|
|
|
Below are a collection of nodes that work by calling external APIs. More information available in our [docs](https://docs.comfy.org/tutorials/api-nodes/overview#api-nodes).
|
|
|
|
## Development
|
|
|
|
API stubs are generated through automatic codegen tools from OpenAPI definitions. Since the Comfy Org OpenAPI definition contains many things from the Comfy Registry as well, we use redocly/cli to filter out only the paths relevant for API nodes.
|
|
|
|
### Redocly Instructions
|
|
|
|
**Tip**
|
|
When developing locally, use the `redocly-dev.yaml` file to generate pydantic models. This lets you use stubs for APIs that are not marked `Released` yet.
|
|
|
|
Before your API node PR merges, make sure to add the `Released` tag to the `openapi.yaml` file and test in staging.
|
|
|
|
```bash
|
|
# Download the OpenAPI file from prod server.
|
|
curl -o openapi.yaml https://api.comfy.org/openapi
|
|
|
|
# Filter out unneeded API definitions.
|
|
npm install -g @redocly/cli
|
|
redocly bundle openapi.yaml --output filtered-openapi.yaml --config comfy_api_nodes/redocly-dev.yaml --remove-unused-components
|
|
|
|
# Generate the pydantic datamodels for validation.
|
|
datamodel-codegen --use-subclass-enum --input filtered-openapi.yaml --output comfy_api_nodes/apis/__init__.py --output-model-type pydantic_v2.BaseModel
|
|
|
|
```
|
|
|