Extensions/comfyui-aimlapi-custom-nodes
ComfyUI Extension

comfyui-aimlapi-custom-nodes

Production-ready ComfyUI nodes for AI/ML API video and image endpoints, supporting text-to-image, image-to-image, and video generation.

By konradbjk·Created 7 months ago·Updated 7 months ago· 1
konradbjk/comfyui-aimlapi-custom-nodes
Nodes
On cloudLocal install
Stars1
Updated7 months ago
Readme

AI/ML API Custom Nodes for ComfyUI

Overview

This repository provides production-ready ComfyUI nodes for the AI/ML API video and image endpoints. Each node class lives in its own module so contributors can reason about one workflow at a time while sharing common helpers in aimlapi_shared.py.

Features

  • Text-to-image and image-to-image support for Google Nano Banana Pro and ByteDance Seedream 4.5
  • Video generation for LTXV-2 and Google Veo 3.1 image-to-video
  • Video plus audio alignment via Veed Fabric 1.0
  • First/last frame interpolation for Kling Video O1, Google Veo fast first/last, and Runway Gen-4 Turbo
  • Shared submission and polling utilities with consistent error reporting

Repository Layout

  • aimlapi_image_generator.py – Text-to-image node
  • aimlapi_image_editor.py – Image-to-image node
  • aimlapi_video_generator.py – Single-image video node covering LTXV-2 and Veo 3.1
  • aimlapi_video_with_audio.py – Fabric 1.0 node that binds to an audio track
  • aimlapi_video_first_last.py – Keyframe-based video node for Kling, Veo, and Runway
  • aimlapi_shared.py – Aspect-ratio helpers, tensor serialization, API submission, and polling
  • aimlapi_node_registry.py – Central node registration consumed by __init__.py

Installation

  • macOS/Linux: run ./install_macos.sh [path-to-ComfyUI]. The script defaults to ~/ComfyUI, copies every module, and installs dependencies with uv (falling back to pip).
  • Windows: run install_windows.bat [path-to-ComfyUI] from a Developer Command Prompt or PowerShell. It mirrors the same steps using %USERPROFILE%\ComfyUI as the default target.
  • Manual: copy all .py files into a folder inside ComfyUI/custom_nodes and run uv pip install requests pillow numpy torch inside the ComfyUI virtual environment.

Obtaining an API Key

Create or log into your AI/ML API account and generate a key at https://aimlapi.com/app/keys. The nodes expose an api_key input with the ComfyUI password widget so the value stays masked on screen. You can also feed the key through hidden inputs or environment variables if you need fully headless execution.

Available Nodes

| Node | Description | Key Model Options | | --- | --- | --- | | AI/ML API Image Generator | Text prompt to image output | google/nano-banana-pro, bytedance/seedream-4-5 | | AI/ML API Image Editor | Image editing with prompt guidance | google/nano-banana-pro-edit, bytedance/seedream-4-5 | | AI/ML API Video Generator | Prompt plus optional reference frame to video | ltxv/ltxv-2, google/veo-3-1-image-to-video | | AI/ML API Video + Audio | Reference frame plus audio track to lip-synced video | veed/fabric-1.0 | | AI/ML API Video Keyframes | First/last frame interpolation or single-frame-to-motion | kling-ai/video-o1-image-to-video, google/veo-3-1-first-last-image-to-video-fast, runway/gen4_turbo |

Each node returns a video URL plus the generation ID so you can chain downloads or log metadata downstream.

Usage Notes

  • All video jobs flow through https://api.aimlapi.com/v2/video/generations; payloads differ only by model-specific fields such as fps, tail_image_url, or audio_url.
  • The helper functions throttle polling (default five seconds) and throw detailed errors when the API reports failure states such as canceled or expired.
  • For tensor inputs, the helpers convert the first image in the batch to PNG data URIs. Provide direct HTTPS URLs if you want to bypass tensor encoding.
  • Logging uses the prefix [AI/ML API] so you can filter ComfyUI output easily.

Development

  1. Create a virtual environment or reuse ComfyUI’s uv environment.
  2. Run PYTHONPYCACHEPREFIX=/tmp python -m py_compile *.py before sending pull requests to catch syntax issues without cluttering the repo with __pycache__.
  3. Keep API-specific logic inside the dedicated node module and extend the shared helper file only when multiple nodes will use the new functionality.
  4. Update README.md and AGENTS.md whenever you add or rename nodes so downstream users have accurate docs.

Troubleshooting

  • If a node fails with API request failed, review the exact status code and message surfaced in the exception.
  • Confirm your key has quota and that the selected model supports the provided parameters (for example, Veo fast first/last only allows 720p or 1080p output).

License

Released under the MIT License. See __init__.py for version and author metadata.