Skip to content

DavidJKTofan/cf-ai-image-generator

Repository files navigation

FLUX-2 Image Generator

Cloudflare Workers AI image generator using FLUX-2-dev with optional Llama prompt enhancement and multi-reference image support.

Features

  • Text-to-image generation with automatic prompt enhancement via Llama 3.2 3B
  • Multi-reference image support (up to 4 PNG images)
  • Real-time error handling for capacity and content moderation
  • Comprehensive logging for debugging

Setup

Deploy to Cloudflare

Usage

Text-only generation

Enter a prompt. Llama enhances it before FLUX generates the image.

Multi-reference generation

Upload 1-4 PNG images and provide a prompt. FLUX uses images as references.

Error Codes

  • 3040: Capacity exceeded. Retry after brief delay.
  • 3030: Content moderation flag. Modify prompt to avoid copyrighted or public persona references.

Logs

View real-time logs:

wrangler tail

Models

Llama LLM requests are routed through Cloudflare AI Gateway (ai-gateway-image-generator) for analytics, caching, and rate limiting.

Disclaimer

For educational purposes only.

About

Simple Workers AI image generator using FLUX-2-dev

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Contributors