Download visual references from Pexels to inspect style, mood, and composition before generating.
Use when:
Don't use when:
input_imagesRequires the PEXELS_API_KEY environment variable (free Pexels API key). The script will fail if the key is not configured. Get one at https://pexels.com/api.
bash
python3 ~/.openclaw/workspace/skills/visual-references/scripts/visual_ref.py "QUERY" [options]
FlagDefaultDescription--count N5Number of images--output DIR``/tmp/visual-refsOutput folder--orientation—landscape, portrait, square``--list-only—List URLs only, no download
ALWAYS use --output /tmp/visual-refs as the output directory. Do NOT invent unique folder names like visual-refs-salon-v2, visual-refs-v3, etc. The script automatically cleans the output folder before each search, so using the same folder every time is safe and prevents accumulation of old references.
bash
# References for a real estate hero image
python3 visual_ref.py "luxury real estate minimalist nordic" --count 5 --orientation landscape --output /tmp/visual-refs
# Square thumbnails for social media
python3 visual_ref.py "personal branding outdoor golden hour" --count 5 --orientation square --output /tmp/visual-refs
# List only, no download
python3 visual_ref.py "product photography white background" --list-only
--count 5 (not 5) to keep it fast.Receive brief with vague style or mentioned inspiration
Translate query to English — Pexels works best in English
Run ONE search with --count 5
Do NOT review or pick — pass ALL 3 references directly to generate_image
Generate with ALL references as input_images (MANDATORY): text
generate_image(
prompt: "description of the NEW asset to generate (subject, scene, format) — do NOT describe the references, the model sees them",
input_images: ["/path/to/ref_01_xxx.jpg", "/path/to/ref_02_xxx.jpg", "/path/to/ref_03_xxx.jpg"],
...
)
The generation model sees all references and picks the best style elements. Your prompt describes WHAT to create, not the style — the style comes from the reference images.
IMPORTANT: Do NOT waste tokens reviewing references with read. Do NOT pick a favorite. Pass all downloaded references as input_images and let the generation model decide.
If the brief explicitly asks to see references first ("enséñame referencias", "muéstrame antes de generar", "quiero elegir yo"), use this flow instead:
Search and download references as usual
Send ALL reference images in a SINGLE message via sessions_send:
text
sessions_send(sessionKey="<REPLY_TO>", message="5 referencias de salón editorial:\n\nArchivo: /tmp/visual-refs/ref_01_xxx.jpg\nArchivo: /tmp/visual-refs/ref_02_xxx.jpg\nArchivo: /tmp/visual-refs/ref_03_xxx.jpg\nArchivo: /tmp/visual-refs/ref_04_xxx.jpg\nArchivo: /tmp/visual-refs/ref_05_xxx.jpg\n\n¿Cuál te gusta? Puedo usar una, mezclar varias, o buscar otras.", timeoutSeconds=0)
Wait for user response before generating
Generate with the references the user chose as input_images
CRITICAL: Send references EXACTLY ONCE. Do NOT send them individually AND again in a summary. Do NOT re-send references you already sent. One single message with all file paths, that's it.
Only use this alternative flow when the user EXPLICITLY asks to see references first. Default is always: search → pass all → generate.
--output as ref_01_<id>.jpg, ref_02_<id>.jpg...refs_meta.json with metadata: path, description, author"hero shot luxury car black studio" > "car""cozy home interior warm light bokeh", "cold corporate office minimal""restaurant food flat lay", "fashion editorial outdoor", "tech startup office"