Esta página ainda está em inglês. A tradução para português está em andamento.
AI Image Creator
Generate PNG images using AI models — Gemini, FLUX.2, Riverflow, SeedDream, GPT-5 Image — routed through Cloudflare AI Gateway (BYOK) or directly via OpenRouter/Google AI Studio. Also analyzes and describes existing images using multimodal vision. Skill name:ai-image-creator
Trigger: “generate an image”, “create a PNG”, “make an icon”, “describe this image”, “analyze this image”
Overview
Theai-image-creator skill wraps a Python script (generate-image.py) that calls image generation APIs and saves the result as a PNG. It supports:
Multimodal models (gemini, gpt5) accept reference images for editing/style transfer and can analyze existing images. Image-only models (riverflow, flux2, seedream) generate from text prompts only.
A companion script (
composite-banners.py) generates consistent logo banners across multiple standard sizes using ImageMagick — no API calls required.
Setup Option A: Cloudflare AI Gateway (Recommended)
Cloudflare AI Gateway acts as a proxy that stores your provider API keys server-side (BYOK — Bring Your Own Key). Your actual keys never leave Cloudflare; only the gateway token is stored locally. This also gives you request logs, caching, and rate limiting.Step 1: Create a Cloudflare account
Sign up at dash.cloudflare.com (free tier works).Step 2: Create an AI Gateway
- In the Cloudflare dashboard, go to AI > AI Gateway
- Click Create Gateway
- Enter a name (e.g.,
my-ai-gateway) — this becomes yourAI_IMG_CREATOR_CF_GATEWAY_ID - Click Create
dash.cloudflare.com/{account_id}/...
Step 3: Enable authentication
- In your gateway settings, enable Authentication
- Copy the auth token — this is your
AI_IMG_CREATOR_CF_TOKEN
Step 4: Add BYOK provider keys
Store your provider keys inside Cloudflare so the script never sends them in request headers. Add OpenRouter key:- In gateway dashboard, go to Provider Keys > Add
- Select OpenRouter as the provider
- Paste your OpenRouter API key (
sk-or-...) - Set alias to
default> Save
- Provider Keys > Add again
- Select Google AI Studio
- Paste your Google AI Studio key (
AI...) - Set alias to
aistudio> Save
Step 5: Set environment variables
source ~/.zshrc
Setup Option B: OpenRouter Direct (Simplest)
No Cloudflare account needed. One environment variable.Step 1: Create an OpenRouter account
Sign up at openrouter.ai.Step 2: Get an API key
Go to openrouter.ai/keys > Create Key. Copy the key (starts withsk-or-...).
Step 3: Add credits
Go to openrouter.ai/credits and add pay-as-you-go credits. Check model pricing at openrouter.ai/models.Step 4: Set environment variable
Setup Option C: Google AI Studio Direct
For using the Gemini model via Google’s API directly (without OpenRouter).Step 1: Get an API key
Go to aistudio.google.com/apikey > Create API Key. Select or create a Google Cloud project. Copy the key (starts withAI...).
Step 2: Enable billing (required for image generation)
The free tier has a quota of 0 forgemini-3.1-flash-image image generation. You must enable billing on the linked Google Cloud project. Without billing, requests return 429 RESOURCE_EXHAUSTED. OpenRouter (Option B) is simpler if you want to avoid GCP billing setup.
Step 3: Set environment variable
Environment Variables Reference
*For Option A (gateway), provider keys are stored in Cloudflare as BYOK — you do not need to set
OPENROUTER_KEY or GEMINI_KEY locally. Gateway mode activates when all three CF_* vars are set and falls back to direct mode if the gateway fails.
Add these to your .env file (used by the workspace) or directly to your shell profile. See env-variables.md for full reference.
Usage Examples
Basic image generation (default model: gemini)
Specific model
Transparent background
brew install ffmpeg imagemagick.
Reference image editing (multimodal models only)
Image analysis
Composite banners (existing logo → multiple sizes)
Cost tracking
Agent Integration
@canvas-designer
Canvas uses/ai-image-creator to generate visual assets when implementing UI components — icons, hero images, product shots, backgrounds, and mockup assets. Canvas does not rely on external stock imagery; it generates what the design requires.
Typical Canvas workflow:
- Identify required image assets from the design spec
- Write detailed prompts aligned with the design direction (colors, style, mood)
- Generate with
ai-image-creator, selecting the model best suited to the asset type - Post-process with ImageMagick if resizing or format conversion is needed
- Reference the generated files in the component code
@pixel (Social Media)
Pixel uses/ai-image-creator to generate original imagery for social media posts when assets are not available — thumbnails, banners, carousel visuals, story backgrounds, post artwork.
Typical Pixel workflow:
- Determine the visual direction from the content calendar entry
- Generate platform-specific images (using
-afor aspect ratio and-sfor size) - Use
composite-banners.pywhen the brand needs consistent logo treatment across multiple sizes