home / skills / openclaw / skills / cloudflare-image-gen

cloudflare-image-gen skill

/skills/expysf98/cloudflare-image-gen

This skill generates images from text prompts using Cloudflare Workers AI flux-1-schnell, returning PNGs for easy sharing.

npx playbooks add skill openclaw/skills --skill cloudflare-image-gen

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
1.0 KB
---
name: cloudflare-image-gen
description: Generate images using Cloudflare Workers AI flux-1-schnell model. Use when user requests image generation with text-to-image using Cloudflare Workers API.
---

# Cloudflare Image Generation

This skill generates images using Cloudflare Workers AI `@cf/black-forest-labs/flux-1-schnell` model.

## Credentials

- Account ID: `1e89d3ce76cbfef3b5c340e3984b7a52`
- Token: `aCTA2KaKa1n3ayFDL-LPmZ-JgUC0HHgA5Msy18Bk`
- Model: `@cf/black-forest-labs/flux-1-schnell`

## Usage

Run the script directly:

```bash
python3 /home/ubuntu/.openclaw/workspace/skills/cloudflare-image-gen/scripts/generate_image.py "your prompt here" -o output.png
```

Or use the Python function:

```python
import sys
sys.path.insert(0, '/home/ubuntu/.openclaw/workspace/skills/cloudflare-image-gen/scripts')
from generate_image import generate_image

output_path = generate_image("a black horse")
```

## Output

The script saves the generated image as PNG and returns the file path. Send the image to the user via Telegram.

Overview

This skill generates images with Cloudflare Workers AI using the flux-1-schnell model. It provides a simple CLI and a Python function to create PNG images from text prompts. The output is a saved PNG file path that can be delivered to users or integrated into bot workflows.

How this skill works

The skill sends a text-to-image request to Cloudflare Workers AI (flux-1-schnell) and streams the returned image data to a PNG file. It exposes a command-line entry point for one-off generation and a Python function you can import into other services. The returned value is the local file path to the saved image for further processing or delivery.

When to use it

  • Generate illustrative assets from text prompts for chatbots or messaging apps.
  • Create on-demand images for social posts, previews, or thumbnails.
  • Prototype visual concepts quickly without running a local model.
  • Integrate image generation into automation pipelines or serverless workflows.

Best practices

  • Keep prompts concise and specific: mention style, color, lighting, and subject.
  • Validate and sanitize user-provided prompts to avoid unsafe or disallowed content.
  • Set output dimensions and format consistently if consuming images programmatically.
  • Cache frequently requested prompts to reduce repeated API calls and speed delivery.
  • Handle API errors and rate limits gracefully with retries and backoff.

Example use cases

  • A chatbot receives a user prompt and returns an AI-generated PNG illustration.
  • A content pipeline generates hero images from article titles for a CMS.
  • A social media tool creates multiple stylized variations from one prompt.
  • A rapid design test that visualizes scene ideas before full production.

FAQ

What formats does the skill output?

Generated images are saved as PNG files by default and returned as file paths.

Can I call this from other Python code?

Yes. Import the provided generate_image function and pass a prompt to receive the output path.

How do I control image size or style?

Include size and style details in the prompt, and configure any supported parameters exposed by the wrapper if available.