Install
openclaw skills install azure-flux-image-genGenerate images using Black Forest Labs FLUX.2-pro via Azure AI Foundry. Use when asked to create, generate, or produce images, illustrations, photos, artwork, posters, or visual content. Supports custom dimensions, seeds for reproducibility, and Chinese text overlay via Node.js Canvas. Requires FLUX_ENDPOINT and FLUX_API_KEY environment variables.
openclaw skills install azure-flux-image-genGenerate high-quality images from text prompts using FLUX.2-pro on Azure AI Foundry.
Set environment variables (typically in OpenClaw config or shell profile):
export FLUX_ENDPOINT="https://<resource>.services.ai.azure.com/providers/blackforestlabs/v1/flux-2-pro?api-version=preview"
export FLUX_API_KEY="YOUR_KEY_HERE"
Use the bundled script:
node scripts/generate.mjs --prompt "a red fox in autumn forest" --output fox.png
node scripts/generate.mjs --prompt "cute robot" --width 1440 --height 816 --output robot.png
When the script isn't suitable, call the API directly:
curl -s -X POST "$FLUX_ENDPOINT" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $FLUX_API_KEY" \
-d '{"prompt":"a cat","width":1024,"height":1024,"n":1,"model":"FLUX.2-pro"}' \
| node -e "process.stdin.on('data',d=>{const j=JSON.parse(d);require('fs').writeFileSync('out.png',Buffer.from(j.data[0].b64_json,'base64'))})"
Critical parameters: "n": 1 and "model": "FLUX.2-pro" are mandatory. Omitting them causes HTTP 500.
FLUX cannot render CJK characters. Overlay text with Node.js Canvas:
import { createCanvas, loadImage, registerFont } from "canvas";
registerFont("NotoSansCJK-Bold.otf", { family: "NotoSansCJK" });
const img = await loadImage("base.png");
const canvas = createCanvas(img.width, img.height);
const ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);
ctx.font = 'bold 48px "NotoSansCJK"';
ctx.fillStyle = "#ffffff";
ctx.fillText("你好世界", 100, 100);
Requires: npm install canvas + a CJK font file (e.g., NotoSansCJK-Bold.otf).
See references/api.md for full request/response schema and size options.