关于 image-generation
image-generation 是一项通过文本提示生成图像的技能,由 each::sense 根据请求选择模型。它支持参考图像,并通过兼容 OpenAI 的 API 提供流式或完整响应。
主要功能
- 01自动选择模型
- 02文本生成图像
- 03参考图像引导
- 04流式或完整响应
- 05批量提示词工作流
适用场景
- 01创作写实或插画场景
- 02生成产品图和概念艺术
- 03制作含文字的海报
- 04批量比较不同视觉风格
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ awesome-genmedia/ skills --skill image-generation安装后在 Claude Code 中输入/image-generation确认已加载。
详细介绍
图像生成
使用 each::sense 根据文本描述生成图像。each::sense 是一款智能 AI Agent,可自动为你的请求选择最佳模型。
快速开始
需要 each::labs API 密钥。请前往 eachlabs.ai 获取。
使用 curl
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": "A lone astronaut standing on a red desert planet, looking up at a sky filled with three massive moons, cinematic lighting, photorealistic, wide shot"}],
"stream": false
}'
使用 Python(OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="YOUR_EACHLABS_API_KEY",
base_url="https://eachsense-agent.core.eachlabs.run/v1"
)
response = client.chat.completions.create(
model="eachsense/beta",
messages=[{"role": "user", "content": "A lone astronaut standing on a red desert planet, looking up at a sky filled with three massive moons, cinematic lighting, photorealistic, wide shot"}]
)
print(response.choices[0].message.content)
使用参考图像
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Generate an image in the same style as this reference, but change the setting to a futuristic Tokyo street at night"},
{"type": "image_url", "image_url": {"url": "https://example.com/reference-style.jpg"}}
]
}
],
"stream": false
}'
图像会使用 OpenAI 多模态内容格式嵌入消息中发送。每个请求最多可包含 4 张图像。
流式传输
设置 "stream": true 以获取实时 SSE 响应,或设置 "stream": false" 以在单个响应中获取完整结果。流式传输适合在 UI 中显示进度;非流式传输则更适用于脚本和自动化。
可用模型
| 模型 | 优势 | 最适合 |
|---|---|---|
| flux-2-max | 最高品质,细节出众 | 主视觉图、可直接印刷的视觉作品、作品集创作 |
| flux-2-pro | 速度快且品质均衡 | 快速迭代、生产工作流 |
| flux-kontext-pro | 图像中的文字渲染准确 | 海报、标牌、带有清晰可读文字的徽标 |
| nano-banana-pro | 生成速度最快 | 原型设计、批量生成、实时预览 |
| gemini-imagen-4 | 出色的照片级真实感 | 产品摄影、生活方式照片、真实场景 |
| seedream-v4-5 | 艺术化和风格化的输出 | 插画、奇幻艺术、绘画风格 |
| kling-text-to-image | 适用于多种风格 | 通用图像生成、混合媒介 |
each::sense 会根据你的提示词自动选择最优模型。除非你想覆盖自动选择结果,否则无需指定模型。
提示词工程指南
提示词结构
[subject] + [action/pose] + [environment] + [style] + [lighting] + [camera/composition]
风格关键词
| 风格 | 关键词 |
|---|---|
| 照片级真实感 | photorealistic, ultra-realistic, DSLR photo, 8K, raw photo, unedited |
| 插画 | digital illustration, vector art, hand-drawn, watercolor, ink drawing |
| 电影感 | cinematic, film still, movie scene, dramatic lighting, anamorphic lens |
| 动漫 | anime style, manga, cel shading, Studio Ghibli, Makoto Shinkai |
| 3D 渲染 | 3D render, octane render, unreal engine, isometric, blender render |
| 油画 | oil painting, impasto, classical art, Renaissance, Baroque |
| 像素艺术 | pixel art, 16-bit, retro game, 8-bit, sprite art |
| 极简主义 | minimalist, flat design, simple, clean lines, geometric |
宽高比
在提示词中指定宽高比,以控制图像尺寸:
"... landscape format, 16:9 aspect ratio"
"... square format, 1:1"
"... portrait format, 9:16, vertical"
"... ultrawide, 21:9 cinematic"
提升品质的关键词
masterpiece, highly detailed, sharp focus, professional,
studio quality, award-winning, 8K resolution, HDR
负向提示
描述你不希望出现的内容,以改善生成结果:
"... avoid blurry, no watermarks, no text overlays, avoid distorted faces"
示例
照片级真实感风景
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": "A misty fjord in Norway at sunrise, mirror-like water reflecting snow-capped mountains, a small red fishing cabin on the shore, photorealistic, 8K, golden hour lighting, shot on Hasselblad"}],
"stream": false
}'
数字插画
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": "A cozy bookstore interior with a cat sleeping on a stack of old books, warm lamp light, plants hanging from the ceiling, digital illustration, Studio Ghibli style, soft colors, whimsical atmosphere"}],
"stream": false
}'
产品摄影
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": "A sleek wireless earbud case on a marble surface, soft studio lighting, product photography, shallow depth of field, clean minimalist background, commercial quality, 1:1 square format"}],
"stream": false
}'
概念艺术
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": "A floating cyberpunk city above the clouds, neon lights reflecting off chrome towers, flying vehicles streaming between buildings, concept art, matte painting, epic scale, dramatic perspective, 16:9 cinematic"}],
"stream": false
}'
图像中的文字(海报)
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": "A vintage concert poster for a band called SOLAR DRIFT, playing at The Echo Lounge, June 15th. Retro psychedelic style with swirling colors, 60s typography, orange and purple palette, portrait format"}],
"stream": false
}'
批量生成工作流
# Generate multiple style variations of the same subject
PROMPTS=(
"A medieval castle on a cliff at sunset, oil painting style"
"A medieval castle on a cliff at sunset, photorealistic, drone shot"
"A medieval castle on a cliff at sunset, anime style, Makoto Shinkai"
"A medieval castle on a cliff at sunset, pixel art, 16-bit"
)
for PROMPT in "${PROMPTS[@]}"; do
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d "{
\"messages\": [{\"role\": \"user\", \"content\": \"$PROMPT\"}],
\"stream\": false
}"
echo "---"
done
常见问题
- 提示词过于模糊会产生泛泛的结果。请具体描述主体、风格和氛围。
- 单个提示词中包含过多主体会造成混淆。每张图像聚焦于一个主要主体。
- 文字渲染在大多数模型中都不太可靠。对于文字较多的图像,请使用 flux-kontext-pro。
- 手和手指可能会变形。如果手是焦点,请仔细裁剪或设置手部姿势。
- 相互矛盾的风格(例如“照片级真实感水彩”)会让模型困惑。请选择一种风格。
- 提示词内容过多(超过 50 个词)通常会降低品质。建议将描述控制在 15–40 个重点词语。
相关技能
Documentation
评论
支持 Markdown