comfyui-llm-node-for-amazon-bedrock

comfyui-llm-node-for-amazon-bedrock
★ 30

ComfyUIAmazon Bedrock大模型SageMaker部署
在 ComfyUI 中直接调用 Amazon Bedrock 的基础模型,方便在管线内接入高性能大模型,支持 SageMaker/CloudFormation 或手动安装,简化部署与集成。
💡 在 ComfyUI 流程中直接调用 Bedrock 基础模型进行生成。
🍴 16 Forks💻 Python🔄 2025-03-07
📦
网盘下载
复制链接后前往夸克网盘下载
https://pan.quark.cn/s/6862a2001521
📦 requirements.txt
boto3
requests
retry
📄 README

Amazon Bedrock nodes for ComfyUI

*Amazon Bedrock* is a fully managed service that offers a choice of high-performing foundation models (FMs) from leading AI companies.

This repo is the ComfyUI nodes for Bedrock service. You can invoke foundation models in your ComfyUI pipeline.

Installation (SageMaker by CloudFormation)

Using __*Amazon SageMaker*__ is the easiest way to develop your AI model. You can deploy a ComfyUI on SageMaker notebook using CloudFormation.

  • Open CloudFormation console, and upload ./assets/comfyui_on_sagemaker.yaml by “Upload a template file”.
  • Next enter a stack name, choose a instance type fits for you. Just next and next and submit.
  • Wait for a moment, and you will find the ComfyUI url is ready for you. Enjoy!
  • Installation (Manually)

  • Clone this repository to your ComfyUI custom_nodes directory:
  • cd ComfyUI/custom_nodes
    git clone https://github.com/aws-samples/comfyui-llm-node-for-amazon-bedrock.git
    pip install -r comfyui-llm-node-for-amazon-bedrock/requirements.txt
    
    # better to work with some third-party nodes
    git clone https://github.com/WASasquatch/was-node-suite-comfyui.git
    git clone https://github.com/pythongosssss/ComfyUI-Custom-Scripts.git

  • You need to make sure your access to Bedrock models are granted. Go to aws console *https://console.aws.amazon.com/bedrock/home#/modelaccess* . Make sure these models in the figure are checked.
  • You need configure credential for your environments with IAM Role or AKSK.
  • IAM Role
  • If you are runing ComfyUI on your aws instance, you could use IAM role to control the policy to access to Bedrock service without AKSK configuration.

    Open the IAM role console of your running instance, and attach AmazonBedrockFullAccess policy to your role.

    Alternatively, you can create an inline policy to your role like this:

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": "bedrock:*",
                "Resource": "*"
            }
        ]
    }

  • AKSK (AccessKeySecretKey)
  • You need to make sure the AKSK user has same policy as the IAM role described before. You can use the aws command tool to configure your credentials file:

    aws configure

    Alternatively, you can create the credentials file yourself. By default, its location is ~/.aws/credentials. At a minimum, the credentials file should specify the access key and secret access key. In this example, the key and secret key for the account are specified in the default profile:

    [default]
    aws_access_key_id = YOUR_ACCESS_KEY
    aws_secret_access_key = YOUR_SECRET_KEY

    You may also want to add a default region to the AWS configuration file, which is located by default at ~/.aws/config:

    [default]
    region=us-east-1

    If you haven’t set the default region and running on aws instance, this nodes will automatically use the same region as the running instance.

    Example

    Workflow examples are in ./workflows. To import these workflows, click “Load” in the ComfyUI UI, go to workflows directory and choose the one you want to experiment with.

    Text to image with prompt translation and refinement

    Automatically refine the text prompt to generate high quality images.

    Download this workflow file and load in ComfyUI

    You can use the Bedrock LLM to refine and translate the prompt. It then utilize the image generation model (eg. SDXL, Titan Image) provided by Bedrock.

    The result is much better after preprocessing of prompt compared to the original SDXL model (the bottom output in figure) which doesn’t have the capability of understanding Chinese.

    Image Caption with Claude 3

    Generate captions of a provided image.

    Download this workflow file and load in ComfyUI

    This workflow uses Bedrock Claude 3 multimodal to caption image.

    Inpainting with natural language

    Use natural language to describe an item in the image and replace it.

    Download this workflow file and load in ComfyUI

    This workflow leverages Claude3 to analyze the replacement information in the prompt. Additionally, it utilizes Bedrock Titan Image to detect objects with text and perform inpainting in a single step.

    Generate Image Variation

    Use natural language to generate variation of an image.

    Download this workflow file and load in ComfyUI

    This workflow begins by using Bedrock Claude3 to refine the image editing prompt. It then utilizes Bedrock Titan Image’s variation feature to generate similar images based on the refined prompt.

    Generate Image Variation with Image Caption

    Use natural language to generate variation of an image without re-describing the original image content.

    Download this workflow file and load in ComfyUI

    This workflow begins by using Bedrock Claude3 to refine the image editing prompt, generation caption of the original image, and merge the two image description into one. It then utilizes Bedrock Titan Image’s variation feature to generate similar images based on the refined prompt.

    Nova Canvas Examples

    Generate stunning images using Amazon’s Nova Canvas model, supporting following capabilities:

  • text-to-image including color-palette support and reference image for style reference
  • image-to-image for generating variations
  • image-to-image for background replacement
  • You’ll find all nodes in this workflow file or download the png below and drag’n’drop it into ComfyUI

    This workflows showcases all available Amazon Nova Canvas Nodes.

    Text to Video with Amazon Nova Reel

    Generate engaging videos using Amazon’s Nova Reel model, supporting both text-to-video and image-to-video generation.

    Text-to-Video Workflow: Download this workflow file or the png below and load in ComfyUI

    Image-to-Video Workflow: Download this workflow file or the png below and load in ComfyUI

    This workflows showcases Amazon Nova Reel’s capabilities to transform text descriptions or images into dynamic video content.

    The workflow combines:

  • Nova Reel’s text-to-video and image-to-video generation
  • Use dimension 1280×720
  • Controls for seed and have the option to control_after_generate
  • Support for S3 bucket destination configuration
  • Example output:

    Text to Video with Luma Ray

    Generate high-quality videos from text descriptions using Luma AI’s Ray model.

    Download this workflow file or the png below and load in ComfyUI

    This workflow demonstrates how to use Luma AI’s Ray model through Bedrock to create dynamic videos from text prompts.

    The workflow combines:

  • Luma Ray’s advanced text-to-video capabilities
  • Options to control aspect-ratio, resolution, video duration, destination_bucket, and loop option
  • Example output:

    Stability AI Models Nodes

    Generate stunning images using Stability AIs most recent models, supporting following capabilities:

  • text-to-image
  • SD3 Large
  • SD3.5 Large
  • Stable Image Ultra
  • Stable Image Core
  • image-to-image for generating variations
  • SD3 & SD3.5 Large
  • You’ll find all nodes in this workflow file or download the png below and drag’n’drop it into ComfyUI

    This workflows showcases all available Amazon Nova Canvas Nodes.

    Supported models

    Here are models ready for use, more models are coming soon.

  • Luma:
  • [X] Ray2
  • Anthropic:
  • [X] Claude (1.x, 2.0, 2.1, haiku, sonnet, opus)
  • [X] Claude Instant (1.x)
  • Amazon:
  • Nova LLM
  • [X] Nova Lite
  • [X] Nova Pro
  • Nova Canvas
  • [X] text to image
  • [ ] inpainting
  • [ ] outpainting
  • [X] image variation
  • [ ] image conditioning
  • [X] background replacement (with prompt)
  • Nova Reel
  • [X] text to video
  • [X] image to video
  • Titan Image Generator G1 (1.x)
  • [X] text to image
  • [X] inpainting
  • [X] outpainting
  • [X] image variation
  • Stability AI:
  • Stable Diffusion XL (1.0)
  • [X] text to image
  • [ ] image to image
  • [ ] image to image (masking)
  • SD3 Large (1.0)
  • [X] text to image
  • [X] image to image
  • SD3.5 Large (1.0)
  • [X] text to image
  • [X] image to image
  • Stable Diffusion Image Core (v1.1)
  • [X] text to image
  • Stable Diffusion Image Ultra (v1.1)
  • [X] text to image
  • Security

    See CONTRIBUTING for more information.

    License

    This library is licensed under the MIT-0 License. See the LICENSE file.