Luma Image Generator

Luma imagegen

by davila7 · MIT license · ★ 32,299 on GitHub

Luma imagegen cover

Use when the user asks to generate images via the Luma AI API (Dream Machine / Photon); collects a prompt and options interactively, then calls the API using the bundled script. Requires LUMA_API_KEY — will prompt the user if missing.

---
name: "luma-imagegen"
description: "Use when the user asks to generate images via the Luma AI API (Dream Machine / Photon); collects a prompt and options interactively, then calls the API using the bundled script. Requires LUMA_API_KEY — will prompt the user if missing."
author: lumalabs
---

# Luma Image Generation Skill

Generates images using the Luma AI Photon model (Dream Machine API). Handles API key detection, interactive prompt collection, parameter selection, async polling, and final image download — all via the bundled `scripts/luma_imagegen.py` CLI.

## When to use
- Generate a new image from a text description using Luma AI (Photon / Photon Flash)
- Use a reference image to guide style, structure, or character consistency
- Modify or stylize an existing image using Luma's `modify_image_ref`

## Workflow

1. **Check API key** — detect `LUMA_API_KEY` in environment. If missing, guide the user (see below).

Overview

Generates images using the Luma AI Photon model (Dream Machine API). Handles API key detection, interactive prompt collection, parameter selection, async polling, and final image download — all via the bundled scripts/luma_imagegen.py CLI.

What you get

  • Save final images to output/luma/ with descriptive filenames (e.g., photon1_hero
  • Log the generation ID for reference (useful to retrieve the image later).
  • If the generation fails, show the failure_reason from the API response.
Manual install (npx, ZIP)
Claude Codenpx skills add davila7/claude-code-templates --skill luma-imagegen -g -a claude-code
Claude Code (degit)npx degit davila7/claude-code-templates/cli-tool/components/skills/creative-design/luma-imagegen#main ~/.claude/skills/luma-imagegen
Claude.ai / desktopZip the folder and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md6.6 KB
Read SKILL.md here
davila7/main1 file shown
SKILL.md
Show the full text147 lines

Luma Image Generation Skill

Generates images using the Luma AI Photon model (Dream Machine API). Handles API key detection, interactive prompt collection, parameter selection, async polling, and final image download — all via the bundled scripts/luma_imagegen.py CLI.

When to use

  • Generate a new image from a text description using Luma AI (Photon / Photon Flash)
  • Use a reference image to guide style, structure, or character consistency
  • Modify or stylize an existing image using Luma's modify_image_ref

Workflow

  1. Check API key — detect LUMA_API_KEY in environment. If missing, guide the user (see below).
  2. Collect inputs — ask the user for: prompt, aspect ratio, model choice, and any optional reference images.
  3. Build the structured prompt — augment the user's description into a labeled spec (see prompt template below).
  4. Run the bundled CLI — execute scripts/luma_imagegen.py with the collected parameters.
  5. Poll until complete — the script handles async polling automatically; wait for state: completed.
  6. Display result — show the final image URL and download the image to output/luma/.
  7. Iterate — if the result doesn't match expectations, adjust the prompt and re-run.

API key detection & setup

Before any API call, check for the key:

python3 ${CLAUDE_SKILL_DIR}/scripts/luma_imagegen.py --check-key

If LUMA_API_KEY is missing:

  1. Tell the user the key is not set.
  2. Direct them to generate one: https://lumalabs.ai/dream-machine/api/keys
  3. Ask them to add it to their .env file or export it in their shell:
    export LUMA_API_KEY=your_key_here
    
  4. Never ask the user to paste the key in chat. Ask them to set it locally and confirm when ready.
  5. Once confirmed, retry the --check-key command to verify.

Interactive questions to ask the user

Ask these questions before running the generation:

  1. Prompt (required): "What image do you want to generate? Describe the scene, subject, style, and any important details."
  2. Aspect ratio (optional, default 16:9): "What aspect ratio? Options: 1:1, 3:4, 4:3, 9:16, 16:9 (default), 9:21, 21:9"
  3. Model (optional, default photon-1): "Use photon-1 (higher quality) or photon-flash-1 (faster and cheaper)?"
  4. Reference image (optional): "Do you have a reference image URL for style or structure guidance?"

Only ask what's needed — skip questions the user has already answered in their message.

Running the CLI

python3 ${CLAUDE_SKILL_DIR}/scripts/luma_imagegen.py \
  --prompt "YOUR AUGMENTED PROMPT" \
  --aspect-ratio 16:9 \
  --model photon-1 \
  [--image-ref "https://example.com/ref.jpg" --image-ref-weight 0.85] \
  [--out output/luma/]

All flags:

Flag Default Description
--prompt (required) Text description of the image
--aspect-ratio 16:9 1:1, 3:4, 4:3, 9:16, 16:9, 9:21, 21:9
--model photon-1 photon-1 or photon-flash-1
--image-ref — Public URL for style/structure reference
--image-ref-weight 0.85 Weight of reference image (0.0–1.0)
--modify-ref — Base image URL to modify
--modify-ref-weight 0.5 Weight for modification fidelity
--out output/luma/ Output directory for downloaded images
--poll-interval 3 Seconds between polling requests
--check-key — Verify LUMA_API_KEY is set and exit

Output conventions

  • Save final images to output/luma/ with descriptive filenames (e.g., photon1_hero_16x9.png). The output directory is relative to the current working directory when the script is invoked.
  • Log the generation ID for reference (useful to retrieve the image later).
  • If the generation fails, show the failure_reason from the API response.

Prompt augmentation

Reformat the user's description into a structured spec. Only make implied details explicit — do not invent new requirements.

Template (include only relevant lines):

Primary request: <user's main prompt>
Scene/background: <environment or setting>
Subject: <main subject>
Style/medium: <photo/illustration/3D/cinematic/etc>
Composition/framing: <wide/close-up/overhead; subject placement>
Lighting/mood: <lighting type and emotional tone>
Color palette: <dominant colors or palette notes>
Aspect ratio: <e.g., 16:9 landscape>
Avoid: <elements to exclude>

Augmentation rules:

  • Keep it concise — add only what the user implied or provided.
  • Always include "Avoid:" to prevent common quality issues (watermarks, logos, blur).
  • For modification requests, explicitly list what should change and what must stay the same.

Example augmented prompts

Landscape hero image
Primary request: a misty mountain lake at sunrise
Scene/background: alpine lake surrounded by pine trees, light morning fog
Style/medium: photorealistic nature photography
Composition/framing: wide panoramic, lake centered, mountains in background
Lighting/mood: golden hour, warm and serene
Aspect ratio: 16:9 landscape
Avoid: people, boats, watermarks, oversaturation
Product shot
Primary request: a ceramic coffee mug on a wooden table
Scene/background: warm kitchen interior, soft bokeh background
Subject: minimalist white ceramic mug, steam rising
Style/medium: clean product photography
Lighting/mood: soft diffused window light
Aspect ratio: 1:1 square
Avoid: text, logos, harsh shadows, clutter

Prompting best practices

  • Describe scene → subject → style → composition → lighting.
  • Mention the intended use (hero image, social post, product shot) to calibrate detail level.
  • Use "Avoid:" to eliminate common defects (watermarks, blur, stock-photo clichés).
  • For modifications, list invariants explicitly ("change only the background; keep the mug unchanged").
  • Start with photon-flash-1 for quick iteration; switch to photon-1 for final quality.
  • If the result isn't satisfactory, make one targeted change per iteration.

Models reference

Model Speed Quality Best for
photon-1 Slower Higher Final assets, complex scenes
photon-flash-1 Fast Good Rapid iteration, drafts

Dependencies

The script uses only the Python standard library. No additional packages are required.

1---
2name: "luma-imagegen"
3description: "Use when the user asks to generate images via the Luma AI API (Dream Machine / Photon); collects a prompt and options interactively, then calls the API using the bundled script. Requires LUMA_API_KEY — will prompt the user if missing."
4author: lumalabs
5---
6 
7# Luma Image Generation Skill
8 
9Generates images using the Luma AI Photon model (Dream Machine API). Handles API key detection, interactive prompt collection, parameter selection, async polling, and final image download — all via the bundled `scripts/luma_imagegen.py` CLI.
10 
11## When to use
12- Generate a new image from a text description using Luma AI (Photon / Photon Flash)
13- Use a reference image to guide style, structure, or character consistency
14- Modify or stylize an existing image using Luma's `modify_image_ref`
15 
16## Workflow
17 
181. **Check API key** — detect `LUMA_API_KEY` in environment. If missing, guide the user (see below).
192. **Collect inputs** — ask the user for: prompt, aspect ratio, model choice, and any optional reference images.
203. **Build the structured prompt** — augment the user's description into a labeled spec (see prompt template below).
214. **Run the bundled CLI** — execute `scripts/luma_imagegen.py` with the collected parameters.
225. **Poll until complete** — the script handles async polling automatically; wait for `state: completed`.
236. **Display result** — show the final image URL and download the image to `output/luma/`.
247. **Iterate** — if the result doesn't match expectations, adjust the prompt and re-run.
25 
26## API key detection & setup
27 
28Before any API call, check for the key:
29 
30```bash
31python3 ${CLAUDE_SKILL_DIR}/scripts/luma_imagegen.py --check-key
32```
33 
34If `LUMA_API_KEY` is missing:
351. Tell the user the key is not set.
362. Direct them to generate one: https://lumalabs.ai/dream-machine/api/keys
373. Ask them to add it to their `.env` file or export it in their shell:
38 ```bash
39 export LUMA_API_KEY=your_key_here
40 ```
414. **Never ask the user to paste the key in chat.** Ask them to set it locally and confirm when ready.
425. Once confirmed, retry the `--check-key` command to verify.
43 
44## Interactive questions to ask the user
45 
46Ask these questions before running the generation:
47 
481. **Prompt** *(required)*: "What image do you want to generate? Describe the scene, subject, style, and any important details."
492. **Aspect ratio** *(optional, default `16:9`)*: "What aspect ratio? Options: `1:1`, `3:4`, `4:3`, `9:16`, `16:9` (default), `9:21`, `21:9`"
503. **Model** *(optional, default `photon-1`)*: "Use `photon-1` (higher quality) or `photon-flash-1` (faster and cheaper)?"
514. **Reference image** *(optional)*: "Do you have a reference image URL for style or structure guidance?"
52 
53Only ask what's needed — skip questions the user has already answered in their message.
54 
55## Running the CLI
56 
57```bash
58python3 ${CLAUDE_SKILL_DIR}/scripts/luma_imagegen.py \
59 --prompt "YOUR AUGMENTED PROMPT" \
60 --aspect-ratio 16:9 \
61 --model photon-1 \
62 [--image-ref "https://example.com/ref.jpg" --image-ref-weight 0.85] \
63 [--out output/luma/]
64```
65 
66All flags:
67| Flag | Default | Description |
68|------|---------|-------------|
69| `--prompt` | *(required)* | Text description of the image |
70| `--aspect-ratio` | `16:9` | `1:1`, `3:4`, `4:3`, `9:16`, `16:9`, `9:21`, `21:9` |
71| `--model` | `photon-1` | `photon-1` or `photon-flash-1` |
72| `--image-ref` | — | Public URL for style/structure reference |
73| `--image-ref-weight` | `0.85` | Weight of reference image (0.0–1.0) |
74| `--modify-ref` | — | Base image URL to modify |
75| `--modify-ref-weight` | `0.5` | Weight for modification fidelity |
76| `--out` | `output/luma/` | Output directory for downloaded images |
77| `--poll-interval` | `3` | Seconds between polling requests |
78| `--check-key` | — | Verify LUMA_API_KEY is set and exit |
79 
80## Output conventions
81- Save final images to `output/luma/` with descriptive filenames (e.g., `photon1_hero_16x9.png`). The output directory is relative to the current working directory when the script is invoked.
82- Log the generation ID for reference (useful to retrieve the image later).
83- If the generation fails, show the `failure_reason` from the API response.
84 
85## Prompt augmentation
86 
87Reformat the user's description into a structured spec. Only make implied details explicit — do not invent new requirements.
88 
89Template (include only relevant lines):
90```
91Primary request: <user's main prompt>
92Scene/background: <environment or setting>
93Subject: <main subject>
94Style/medium: <photo/illustration/3D/cinematic/etc>
95Composition/framing: <wide/close-up/overhead; subject placement>
96Lighting/mood: <lighting type and emotional tone>
97Color palette: <dominant colors or palette notes>
98Aspect ratio: <e.g., 16:9 landscape>
99Avoid: <elements to exclude>
100```
101 
102Augmentation rules:
103- Keep it concise — add only what the user implied or provided.
104- Always include "Avoid:" to prevent common quality issues (watermarks, logos, blur).
105- For modification requests, explicitly list what should change and what must stay the same.
106 
107## Example augmented prompts
108 
109### Landscape hero image
110```
111Primary request: a misty mountain lake at sunrise
112Scene/background: alpine lake surrounded by pine trees, light morning fog
113Style/medium: photorealistic nature photography
114Composition/framing: wide panoramic, lake centered, mountains in background
115Lighting/mood: golden hour, warm and serene
116Aspect ratio: 16:9 landscape
117Avoid: people, boats, watermarks, oversaturation
118```
119 
120### Product shot
121```
122Primary request: a ceramic coffee mug on a wooden table
123Scene/background: warm kitchen interior, soft bokeh background
124Subject: minimalist white ceramic mug, steam rising
125Style/medium: clean product photography
126Lighting/mood: soft diffused window light
127Aspect ratio: 1:1 square
128Avoid: text, logos, harsh shadows, clutter
129```
130 
131## Prompting best practices
132- Describe scene → subject → style → composition → lighting.
133- Mention the intended use (hero image, social post, product shot) to calibrate detail level.
134- Use "Avoid:" to eliminate common defects (watermarks, blur, stock-photo clichés).
135- For modifications, list invariants explicitly ("change only the background; keep the mug unchanged").
136- Start with `photon-flash-1` for quick iteration; switch to `photon-1` for final quality.
137- If the result isn't satisfactory, make one targeted change per iteration.
138 
139## Models reference
140| Model | Speed | Quality | Best for |
141|-------|-------|---------|----------|
142| `photon-1` | Slower | Higher | Final assets, complex scenes |
143| `photon-flash-1` | Fast | Good | Rapid iteration, drafts |
144 
145## Dependencies
146The script uses only the Python standard library. No additional packages are required.
147 
View all files on GitHub →

Details

License
MIT
Stars on the repo
★ 32,299
Checked
Source
davila7/claude-code-templates ↗
Creator
davila7 · 212 listings
View creator

Similar skills

See all →
SkillAPI Interface Designaddyosmani/agent-skills · by addyosmaniGuides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend.★ 98.7k GitHub starsAgentVersion-Specific Docs Lookupupstash/context7 · by upstashPulls up-to-date, version-specific library docs and code examples into the prompt so the AI stops inventing old APIs.★ 62.3k GitHub starsSkillAdaptyv Bio Foundry APIK-Dense-AI/scientific-agent-skills · by K-Dense-AIHow to use the Adaptyv Bio Foundry API and Python SDK for protein experiment design, submission, and results retrieval. Use this skill whenever the user mentions Adaptyv, Foundry API, protein binding assays, protein screening experiments, BLI/SPR assays, thermostability assays, or wants to submit protein sequences for experimental characterization. Also trigger when code imports `adaptyv`, `adaptyv_sdk`, or `FoundryClient`, or references `foundry-api-public.adaptyvbio.com`.★ 46k GitHub starsSkill.NET Backend Developerwshobson/agents · by wshobsonMaster C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuration, caching, and testing with xUnit. Use when developing .NET backends, reviewing C# code, or designing API architectures.★ 39.9k GitHub starsSkillGemini Agent API Guidegoogle/skills · by googleGuides the usage of Gemini Interactions API on Gemini Enterprise Agent Platform. Use when the user wants to use the stateful, server-managed Interactions API for multi-turn conversations, background execution, streaming, structured output, and function calling on the Agent Platform.★ 20.9k GitHub starsSkillGemini Notebook Automationteng-lin/notebooklm-py · by teng-linInstall, authenticate, troubleshoot, and operate Gemini Notebook through the notebooklm-py CLI or typed async Python API. Use for notebook and source management, grounded chat and research, and artifact generation or download when the user mentions Gemini Notebook, notebooklm-py, the notebooklm CLI, or its Python API. Do not use for the generic Gemini API or unrelated content creation.★ 19.6k GitHub stars

More from davila7

Skill2D Game Developmentdavila7/claude-code-templates · by davila72D game development principles. Sprites, tilemaps, physics, camera.★ 32.3k GitHub starsSkill3D Game Development Principlesdavila7/claude-code-templates · by davila73D game development principles. Rendering, shaders, physics, cameras.★ 32.3k GitHub starsSkill3D Web Experience Builderdavila7/claude-code-templates · by davila7Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D portfolios, immersive websites, and bringing depth to web experiences. Use when: 3D website, three.js, WebGL, react three fiber, 3D experience.★ 32.3k GitHub starsSkillSplit Test Setupdavila7/claude-code-templates · by davila7When the user wants to plan, design, or implement an A/B test or experiment. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," or "hypothesis." For tracking implementation, see analytics-tracking.★ 32.3k GitHub starsAgentResearch Literature Synthesizerdavila7/claude-code-templates · by davila7Academic research synthesis specialist. Use PROACTIVELY for comprehensive research on academic topics, literature reviews, technical investigations, and well-cited analysis combining multiple sources. <example>Context: A podcast episode needs a segment grounded in peer-reviewed evidence with formal citations. user: "Research the current state of transformer efficiency techniques for the episode, with proper academic citations." assistant: "I'll use the academic-research-synthesizer agent to search arXiv and Semantic Scholar, extract full-text findings via WebFetch, and produce a cited literature synthesis with confidence levels." <commentary>Use academic-research-synthesizer (not comprehensive-researcher) when the episode segment needs peer-reviewed sourcing, formal citation format, and explicit confidence tagging rather than general-purpose multi-source coverage.</commentary></example> <example>Context: The episode-orchestrator has routed a "literature review" request for a technical deep-dive segment. user: "Summarize the research landscape on federated learning privacy guarantees." assistant: "I'll invoke academic-research-synthesizer to systematically search academic sources, note peer-review status per source, and synthesize consensus vs. open debates."</example>★ 32.3k GitHub starsAgentAcademic Research Specialistdavila7/claude-code-templates · by davila7Academic research specialist for scholarly sources, peer-reviewed papers, and academic literature. Use PROACTIVELY for research paper analysis, literature reviews, citation tracking, and academic methodology evaluation. <example>Context: The research-orchestrator has kicked off Phase 4 parallel research on 'efficacy of intermittent fasting' and needs peer-reviewed evidence. user: "Find the academic evidence on intermittent fasting outcomes." assistant: "I'll use the academic-researcher agent to search Semantic Scholar, PubMed, and OpenAlex for peer-reviewed studies and write structured findings to academic-research.md." <commentary>The request is specifically for scholarly/peer-reviewed evidence rather than general web coverage or code, so academic-researcher (not web-researcher or technical-researcher) is the right specialist.</commentary></example> <example>Context: The user wants a literature review comparing methodologies across studies on a topic. user: "Can you review the literature on transformer model interpretability and identify research gaps?" assistant: "Let me invoke the academic-researcher agent to pull foundational and recent papers, extract methodologies, and surface open research gaps." <commentary>Literature review, methodology extraction, and research-gap identification are core academic-researcher capabilities, distinct from technical-researcher's focus on code repositories and implementations.</commentary></example>★ 32.3k GitHub stars