luma-imagegen
它能做什么
这个技能让你的 AI 智能体使用 Luma AI 的 Photon 模型制作图片。适合想要 Luma 图像风格,或想用参考图片引导新图片的人。
适用场景
- ✓当你想根据文字描述用 Luma AI 制作图片时。
- ✓当你有一张参考图片,并希望新图片遵循其风格或人物形象时。
- ✓当你想用 Luma 修改或重新设计现有图片的风格时。
技能链接
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/creative-design/luma-imagegen/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请用 Luma 制作一张方形构图的奇幻城市海报。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会询问你的提示词、图片的形状和模型。然后把请求发送给 Luma,等待图片生成完成,并将其保存到你项目中的一个文件夹。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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
- Check API key — detect
LUMA_API_KEYin environment. If missing, guide the user (see below). - Collect inputs — ask the user for: prompt, aspect ratio, model choice, and any optional reference images.
- Build the structured prompt — augment the user's description into a labeled spec (see prompt template below).
- Run the bundled CLI — execute
scripts/luma_imagegen.pywith the collected parameters. - Poll until complete — the script handles async polling automatically; wait for
state: completed. - Display result — show the final image URL and download the image to
output/luma/. - 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:
- Tell the user the key is not set.
- Direct them to generate one: https://lumalabs.ai/dream-machine/api/keys
- Ask them to add it to their
.envfile or export it in their shell:export LUMA_API_KEY=your_key_here - Never ask the user to paste the key in chat. Ask them to set it locally and confirm when ready.
- Once confirmed, retry the
--check-keycommand to verify.
Interactive questions to ask the user
Ask these questions before running the generation:
- Prompt (required): "What image do you want to generate? Describe the scene, subject, style, and any important details."
- 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" - Model (optional, default
photon-1): "Usephoton-1(higher quality) orphoton-flash-1(faster and cheaper)?" - 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_reasonfrom 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 con
常见问题
开始之前我需要什么?
你需要在环境变量中设置 Luma API 密钥。如果缺少,智能体会请你添加。
如果我不满意结果,可以重试吗?
可以。智能体可以调整提示词并重新运行。
图片保存在哪里?
图片会下载到你项目中的 luma 输出文件夹。
详情
作者的原始描述
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.
热度
- GitHub 星标
- 33k
- 排名
- #8694
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
owasp-security
33k教你的智能体掌握面向网页应用、API、移动端、容器和 AI 智能体的 OWASP 安全指南,以便发现常见弱点并提出修复建议。
agent-management
33k让你的智能体使用 AI Maestro 命令行工具创建、列出、休眠、唤醒、重命名和删除 AI 智能体,管理每个智能体的生命周期。
agent-messaging
33k让你的智能体使用智能体消息协议,在 AI 智能体之间发送、接收和回复带签名的消息,大部分在你自己的电脑上完成。
docs-search
33k让你的智能体搜索自动生成的代码文档,查找函数签名、类定义和注释,从而在修改代码之前核对真实的 API。