Cloudflare AI icon

Cloudflare AI

Use Cloudflare Workers AI models for text, image, and audio processing

Overview

This node integrates with Cloudflare Workers AI models to perform various AI-powered tasks including text, image, audio processing, and embeddings generation. Specifically for the Image - Generate operation, it generates images based on a textual prompt using an AI model hosted by Cloudflare.

Common scenarios where this node is beneficial include:

  • Automatically creating images from descriptive text prompts for marketing materials or social media.
  • Generating concept art or design ideas from simple text descriptions.
  • Enhancing creative workflows by producing visual content without manual graphic design.

For example, providing the prompt "A futuristic city skyline at sunset" will generate an AI-created image representing that scene.

Properties

Name Meaning
Prompt The textual description used as input to generate an image. This should clearly describe what the generated image should depict.

Output

The output contains a binary field named data which holds the generated image file in PNG format (image/png). Alongside the binary data, the JSON part of the output includes a success flag indicating whether the image generation was successful.

Example output structure:

{
  "json": {
    "success": true
  },
  "binary": {
    "data": {
      "data": "<Buffer ...>",
      "mimeType": "image/png",
      "fileName": "generated-image.png"
    }
  }
}
  • The binary.data contains the actual image file data.
  • The json.success confirms the request succeeded.

Dependencies

  • Requires a valid Cloudflare API key credential with permissions to access the Cloudflare Workers AI endpoints.
  • The node makes HTTP POST requests to Cloudflare's AI API endpoint specific to the account ID.
  • No additional external dependencies beyond the configured Cloudflare API credentials.

Troubleshooting

  • Common issues:

    • Invalid or missing API credentials will cause authentication failures.
    • Incorrect or empty prompt strings may result in errors or undesired outputs.
    • Network connectivity problems can prevent reaching the Cloudflare API.
  • Error messages:

    • "Request failed": General failure returned by the API; check the error details in the response.
    • Errors containing messages from the API’s errors array provide more specific reasons (e.g., invalid parameters).
  • Resolutions:

    • Verify that the Cloudflare API key is correctly set up and has required permissions.
    • Ensure the prompt is meaningful and not empty.
    • Check network connectivity and retry if transient errors occur.
    • Use the node’s "Continue On Fail" option to handle errors gracefully in workflows.

Links and References

Discussion