Skip to content

Add support for API Nodes in ComfyUI. #7726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 42 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
e2baa56
Add Ideogram generate node.
robinjhuang Apr 9, 2025
92e053d
Add staging api.
robinjhuang Apr 15, 2025
06819aa
COMFY_API_NODE_NAME node property
christian-byrne Apr 15, 2025
5327cc8
switch to boolean flag and use original node name for id
christian-byrne Apr 16, 2025
bdbde1a
add optional to type
christian-byrne Apr 16, 2025
1b42a5a
Add API_NODE and common error for missing auth token (#5)
robinjhuang Apr 16, 2025
9592c7a
Add Minimax Video Generation + Async Task queue polling example (#6)
robinjhuang Apr 19, 2025
0e32c61
[Minimax] Show video preview and embed workflow in ouput (#7)
christian-byrne Apr 20, 2025
c50f486
[API Nodes] Send empty request body instead of empty dictionary. (#8)
robinjhuang Apr 21, 2025
4902f24
Fixed: removed function from rebase.
robinjhuang Apr 21, 2025
05babb9
Add pydantic.
robinjhuang Apr 22, 2025
945ff14
Remove uv.lock
robinjhuang Apr 22, 2025
280997b
Remove polling operations.
robinjhuang Apr 22, 2025
14cf25e
Update stubs workflow.
robinjhuang Apr 22, 2025
4902edb
Remove polling comments.
robinjhuang Apr 22, 2025
08b797f
Update stubs.
robinjhuang Apr 22, 2025
824c87a
Use pydantic v2.
robinjhuang Apr 22, 2025
273f8e5
Use pydantic v2.
robinjhuang Apr 22, 2025
1c1ef2d
Add basic OpenAITextToImage node
yoland68 Apr 22, 2025
e90100e
Add.
robinjhuang Apr 22, 2025
1fa9ced
convert image to tensor.
robinjhuang Apr 22, 2025
daf1fab
Improve types.
robinjhuang Apr 22, 2025
3ae7ecf
Ruff.
robinjhuang Apr 22, 2025
429dfb7
Push tests.
robinjhuang Apr 22, 2025
79c85a9
Handle multi-form data.
robinjhuang Apr 22, 2025
9bf1fc7
Change to api.comfy.org
robinjhuang Apr 23, 2025
7c41723
Handle error code 409.
robinjhuang Apr 23, 2025
8d414a9
separate out nodes per openai model
thot-experiment Apr 23, 2025
ffb63a6
Update error message.
robinjhuang Apr 23, 2025
68838ea
fix wrong output type
thot-experiment Apr 23, 2025
cba7e59
Merge branch 'api-nodes' of https://github.com/comfyanonymous/ComfyUI…
thot-experiment Apr 23, 2025
e0bd2fd
re-categorize nodes, remove ideogram (for now)
thot-experiment Apr 23, 2025
553c8a3
oops, fix mappings
thot-experiment Apr 23, 2025
4a7aca7
fix ruff
thot-experiment Apr 23, 2025
8bd6264
Update frontend to 1.17.9
robinjhuang Apr 23, 2025
d32d00a
Merge branch 'master' into api-nodes
robinjhuang Apr 23, 2025
422d633
embargo lift rename nodes
thot-experiment Apr 23, 2025
f65b05e
remove unused autogenerated model code
thot-experiment Apr 23, 2025
cf209aa
fix API type error and add b64 support for 4o
thot-experiment Apr 23, 2025
6fb5bb1
fix ruff
thot-experiment Apr 23, 2025
18fba2a
oops forgot mask scaling code
thot-experiment Apr 23, 2025
9b0633b
Remove unused types.
robinjhuang Apr 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/update-api-stubs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Generate Pydantic Stubs from api.comfy.org

on:
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:

jobs:
generate-models:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install 'datamodel-code-generator[http]'
- name: Generate API models
run: |
datamodel-codegen --use-subclass-enum --url https://api.comfy.org/openapi --output comfy_api_nodes/apis --output-model-type pydantic_v2.BaseModel
- name: Check for changes
id: git-check
run: |
git diff --exit-code comfy_api_nodes/apis || echo "changes=true" >> $GITHUB_OUTPUT
- name: Create Pull Request
if: steps.git-check.outputs.changes == 'true'
uses: peter-evans/create-pull-request@v5
with:
commit-message: 'chore: update API models from OpenAPI spec'
title: 'Update API models from api.comfy.org'
body: |
This PR updates the API models based on the latest api.comfy.org OpenAPI specification.
Generated automatically by the a Github workflow.
branch: update-api-stubs
delete-branch: true
base: main
17 changes: 17 additions & 0 deletions comfy_api_nodes/apis/PixverseController.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# generated by datamodel-codegen:
# filename: https://api.comfy.org/openapi
# timestamp: 2025-04-23T15:56:33+00:00

from __future__ import annotations

from typing import Optional

from pydantic import BaseModel

from . import PixverseDto


class ResponseData(BaseModel):
ErrCode: Optional[int] = None
ErrMsg: Optional[str] = None
Resp: Optional[PixverseDto.V2OpenAPII2VResp] = None
57 changes: 57 additions & 0 deletions comfy_api_nodes/apis/PixverseDto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# generated by datamodel-codegen:
# filename: https://api.comfy.org/openapi
# timestamp: 2025-04-23T15:56:33+00:00

from __future__ import annotations

from typing import Optional

from pydantic import BaseModel, Field, constr


class V2OpenAPII2VResp(BaseModel):
video_id: Optional[int] = Field(None, description='Video_id')


class V2OpenAPIT2VReq(BaseModel):
aspect_ratio: str = Field(
..., description='Aspect ratio (16:9, 4:3, 1:1, 3:4, 9:16)', examples=['16:9']
)
duration: int = Field(
...,
description='Video duration (5, 8 seconds, --model=v3.5 only allows 5,8; --quality=1080p does not support 8s)',
examples=[5],
)
model: str = Field(
..., description='Model version (only supports v3.5)', examples=['v3.5']
)
motion_mode: Optional[str] = Field(
'normal',
description='Motion mode (normal, fast, --fast only available when duration=5; --quality=1080p does not support fast)',
examples=['normal'],
)
negative_prompt: Optional[constr(max_length=2048)] = Field(
None, description='Negative prompt\n'
)
prompt: constr(max_length=2048) = Field(..., description='Prompt')
quality: str = Field(
...,
description='Video quality ("360p"(Turbo model), "540p", "720p", "1080p")',
examples=['540p'],
)
seed: Optional[int] = Field(None, description='Random seed, range: 0 - 2147483647')
style: Optional[str] = Field(
None,
description='Style (effective when model=v3.5, "anime", "3d_animation", "clay", "comic", "cyberpunk") Do not include style parameter unless needed',
examples=['anime'],
)
template_id: Optional[int] = Field(
None,
description='Template ID (template_id must be activated before use)',
examples=[302325299692608],
)
water_mark: Optional[bool] = Field(
False,
description='Watermark (true: add watermark, false: no watermark)',
examples=[False],
)
Loading