seedream 5.0 lite
基于火山方舟 seedream 5.0 lite 模型的 AI 图片生成器,支持文生图、图生图、组图生成与提示词优化。输入关键词即可生成高分辨率图片,使用 seedream 图片生成、AI 绘图、文生图、图生图时调用此 Skill。
Install
npx skills add https://github.com/redfox-data/redfox-community/tree/main/skills/seedream-5-lite
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install redfox-data-redfox-community@llmmart
git clone https://github.com/redfox-data/redfox-community.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole redfox-data/redfox-community collection as a plugin from our marketplace. Git is the plain clone.
README
seedream 5.0 lite / seedream 5.0 lite
简介
基于火山方舟 seedream 5.0 lite 模型的 AI 图片生成器,支持文生图、图生图、组图生成与提示词优化。一行命令即可出图。
核心价值
- 文生图:输入中文或英文描述,生成高清图片
- 图生图:上传参考图 + 提示词,进行风格转换与编辑
- 组图生成:自动生成多张关联图片,最多 15 张
- 高分辨率:支持 2K、3K、4K 或自定义像素尺寸
适用对象
- 🎨 设计师 — 快速生成高质量配图、封面图、产品展示图
- 📱 自媒体运营 — 批量生成风格统一的视觉素材
- 🛍️ 电商卖家 — 零摄影成本,快速产出商品场景图
功能特性
核心功能
- 文生图:输入提示词,seedream 5.0 lite 自动生成高清图片
- 图生图:上传参考图,基于原图进行编辑和风格转换
- 组图生成:
auto模式自动生成多张关联图片 - 提示词优化:内置 standard(高质量)和 fast(快速)两种模式
- 高分辨率:支持 2K/3K/4K 或自定义像素尺寸
- 任务管理:支持提交任务获取 taskId,随时查询进度
密钥获取与安全说明
- 本技能需要使用环境变量:
REDFOX_API_KEY。 REDFOX_API_KEY由 红狐 hub (https://redfox.hk)提供。- 请前往 红狐 hub 注册账号,获取
REDFOX_API_KEY。 - 配置设备环境变量
REDFOX_API_KEY后使用本技能。 - 在提供密钥前,请先确认密钥来源、可用范围、有效期及是否支持重置/撤销。
- 禁止在代码、提示词、日志或输出文件中硬编码/明文暴露密钥。
使用指南
直接用自然语言描述你想要的图片即可。
常用说法速查
| 意图 | 示例话术 | 效果 |
|---|---|---|
| 文生图 | 「生成一杯拿铁咖啡在木质桌面上的图片」 | 提交任务,生成高清图片 |
| 图生图 | 「把这张照片换成油画风格 [图片]」 | 上传参考图,进行风格转换 |
| 组图生成 | 「生成一组极简风办公桌面静物图」 | 批量生成风格一致的组图 |
| 高分辨率 | 「生成 4K 超高清的雪山日出图」 | 输出超高分辨率图片 |
使用场景
| 场景 | 角色 | 示例问法 | 收益 |
|---|---|---|---|
| 社交媒体配图 | 小红书博主 | 「生成 ins 风咖啡照片做封面」 | 快速产出高质量配图 |
| 电商产品展示 | 电商运营 | 「给白色耳机生成产品场景图」 | 零摄影成本,快速出图 |
| 创意灵感验证 | 设计师 | 「生成赛博朋克未来城市概念图」 | 想法到视觉稿只需一行命令 |
| 组图内容运营 | 内容运营 | 「生成一组早餐摄影用于文章配图」 | 批量产出风格统一的视觉素材 |
Skill manifest
seedream 5.0 lite
简介
基于火山方舟 seedream 5.0 lite 模型的 AI 图片生成工具。通过 redfox.hk 平台封装了复杂的 ARK API 鉴权流程,一行命令即可生成高质量图片。
为什么用这个 Skill?
- 对开发者:无需去火山方舟申请白名单、配置 AK/SK、对接 ARK 鉴权,一行命令搞定
- 对创作者:不用买会员、不用绑卡订阅,按次消费,用完即走
适用对象
设计师、社交媒体创作者、内容运营人员、AI 爱好者,以及任何需要快速将创意转化为图片的用户。
功能特性
核心功能
- 文生图:输入一句中文或英文描述,seedream 5.0 lite 自动生成高清图片
- 图生图:上传参考图 + 提示词,基于原图进行编辑和风格转换
- 组图生成:支持
auto模式自动生成多张关联图片(最多 15 张) - 提示词优化:内置
standard(高质量)和fast(快速)两种优化模式 - 高分辨率输出:支持
2K/3K/4K或自定义像素尺寸,默认2048x2048 - 任务管理:支持提交任务后获取 taskId,可随时查询任务进度和结果
- 自动轮询:脚本自动轮询任务状态(排队中/生成中/已完成),无需手动等待
技术亮点
- 底层模型:
doubao-seedream-5-0-260128 - 输出格式:PNG、JPEG
- 水印控制:可选择是否添加 "AI生成" 水印
- 图片 URL 自动转存 OSS,长期有效
- HTTPS 安全传输:全链路 SSL 验证
参数速查
| 参数 | 说明 | 默认值 |
|---|---|---|
prompt |
图片生成提示词(必填,中英文均可) | — |
--image |
参考图路径或 URL(启用图生图模式) | — |
--size |
图片尺寸:2K/3K/4K 或具体像素如 2048x2048 |
2048x2048 |
--format |
输出格式:png / jpeg |
jpeg |
--watermark |
添加 "AI生成" 水印 | 默认不添加 |
--sequential |
组图模式:auto / disabled |
disabled |
--max-images |
组图最多生成数量(1-15) | 4 |
--optimize |
提示词优化:standard / fast |
— |
-o, --output-dir |
输出目录 | ~/Downloads/QoderImages |
--prefix |
文件名前缀 | image |
--no-download |
仅提交不等待 | — |
--task-id |
查询已有任务 | — |
使用场景
场景一:社交媒体内容创作
角色:小红书博主 / 自媒体运营
需求:快速生成高质量配图、封面图、产品展示图
使用方式:
python3 "$SKILL_PATH/assets/seedream.py" "一杯拿铁咖啡放在木质桌面上,柔和的自然光,ins风" --size 2048x2048
预期收益:从找图/拍图到出图只需几秒,支持批量组图生成
场景二:电商产品展示
角色:电商运营 / 独立站卖家
需求:为商品生成统一风格的产品场景图
使用方式:
python3 "$SKILL_PATH/assets/seedream.py" "白色无线耳机悬浮在浅灰色背景上,专业产品摄影,柔和阴影" --format png --size 3K
预期收益:零摄影成本,快速产出高质量商品图
场景三:设计灵感快速验证
角色:UI 设计师 / 插画师
需求:将脑中的画面用自然语言快速变成可视化图片,验证创意方向
使用方式:
python3 "$SKILL_PATH/assets/seedream.py" "赛博朋克风格的未来城市,霓虹灯倒映在雨后的街道上,电影级构图" --size 4K
预期收益:降低创意门槛,想法到视觉稿只需一行命令
场景四:组图内容运营
角色:内容运营 / 市场人员
需求:一次性生成多张风格统一的配图,用于文章/推文/活动页
使用方式:
python3 "$SKILL_PATH/assets/seedream.py" "一组清新风格的早餐摄影,包含面包、水果、咖啡" --sequential auto --max-images 6
预期收益:批量生成风格一致的视觉素材,提升内容产出效率
场景五:图生图风格迁移
角色:摄影师 / 艺术创作者
需求:基于现有图片进行风格转换或元素修改
使用方式:
python3 "$SKILL_PATH/assets/seedream.py" "将画面转换成宫崎骏动画风格,色彩明亮温暖" --image ~/Pictures/photo.jpg
预期收益:无需掌握复杂修图软件,自然语言即可驱动风格转换
依赖安装
| 依赖 | 安装命令 |
|---|---|
requests |
pip3 install requests |
首次使用
配置 API Key 后即可使用:
# 设置环境变量
export REDFOX_API_KEY=ak_你的密钥
# 运行
python3 "$SKILL_PATH/assets/seedream.py" "一只橘色的猫咪坐在窗台上看着窗外的夕阳"
前往 redfox.hk 注册获取 API Key。
后续使用
前往 redfox.hk 注册账号获取自己的 API Token,三种配置方式任选其一:
| 配置方式 | 说明 | 命令 |
|---|---|---|
| 环境变量(推荐) | 设置一次,全局生效 | export REDFOX_API_KEY=ak_你的密钥 |
| 命令行参数 | 临时使用,单次生效 | python3 "$SKILL_PATH/assets/seedream.py" "prompt" --api-key ak_你的密钥 |
| 配置文件 | 持久化存储,跨会话保留 | mkdir -p ~/.qoder/apis && echo '{"api_key":"ak_你的密钥"}' > ~/.qoder/apis/redfox.json |
使用指南
基础使用
1. 输入提示词生成图片
python3 "$SKILL_PATH/assets/seedream.py" "一只橘猫在窗台上打哈欠,阳光温暖地照在它的毛上"
脚本会自动提交任务、轮询等待(约 10-60 秒),完成后下载到 ~/Downloads/QoderImages/。
3. 查看结果
生成成功后会显示图片信息和文件路径:
[✓] Model: doubao-seedream-5-0-260128, Size: 2048x2048
[✓] Generated images: 1, Tokens: 1024
[→] Downloading 1/1: image.jpeg
[████████████████████] 100%
✓ Done!
/Users/you/Downloads/QoderImages/image.jpeg (312.5 KB)
高级使用
高分辨率输出
# 4K 超高清
python3 "$SKILL_PATH/assets/seedream.py" "雪山日出,金色阳光洒在雪顶" --size 4K
# 指定具体像素
python3 "$SKILL_PATH/assets/seedream.py" "城市夜景" --size 2048x1152
组图生成(批量出图)
# 自动生成最多 6 张关联图片
python3 "$SKILL_PATH/assets/seedream.py" "一组极简风办公桌面静物" --sequential auto --max-images 6
图生图编辑
# 基于参考图修改
python3 "$SKILL_PATH/assets/seedream.py" "把背景换成海边日落" --image ~/Pictures/portrait.jpg
# 使用网络图片作为参考
python3 "$SKILL_PATH/assets/seedream.py" "转换成油画风格" --image "https://example.com/photo.jpg"
提示词优化
# 标准模式(质量更高,耗时较长)
python3 "$SKILL_PATH/assets/seedream.py" "未来太空站内部" --optimize standard
# 快速模式(快速出图,质量一般)
python3 "$SKILL_PATH/assets/seedream.py" "快速草图概念" --optimize fast
任务管理
# 仅提交任务,返回 taskId 后立即退出
python3 "$SKILL_PATH/assets/seedream.py" "复杂场景" --no-download
# 稍后用 taskId 查询结果
python3 "$SKILL_PATH/assets/seedream.py" "ignored" --task-id ark_abc123def456
命令速查
| 命令 | 功能 |
|---|---|
python3 seedream.py "提示词" |
基础文生图 |
--size 4K |
4K 高分辨率 |
--format png |
PNG 格式输出 |
--sequential auto --max-images 6 |
组图模式生成 6 张 |
--image ~/pic.jpg |
图生图模式 |
--optimize standard |
提示词标准优化 |
--watermark |
添加水印 |
--no-download |
仅提交任务 |
--task-id <id> |
查询已有任务 |
--api-key <key> |
指定 API Key |
-o ~/Desktop |
指定输出目录 |
项目架构
目录结构
seedream-5-lite/
├── SKILL.md # Skill 定义与文档
└── assets/ # 工具脚本
└── seedream.py # 图片生成主程序
技术栈
| 组件 | 技术 |
|---|---|
| 运行环境 | Python 3.6+ |
| HTTP 库 | requests |
| API 平台 | redfox.hk |
| 底层模型 | 火山方舟 seedream 5.0 lite (doubao-seedream-5-0-260128) |
| 输出格式 | PNG、JPEG |
核心模块
| 模块 | 职责 |
|---|---|
get_api_key() |
三级优先级获取 API Key:CLI > 环境变量 > 配置文件 |
upload_image() |
将本地参考图上传至 OSS,获取可访问的 URL |
submit_task() |
构建请求体,提交 ARK 图片生成任务 |
poll_result() |
轮询任务状态(queued/running/succeeded/failed),最多 6 分钟 |
download_images() |
流式下载生成图片,带进度条显示 |
main() |
CLI 入口:参数解析、API Key 校验、双分支(提交/查询)流程 |
数据流转
用户输入提示词 → submit_task() → redfox.hk API → 火山方舟 seedream 5.0 lite
↓
用户获得图片 ← download_images() ← poll_result() ← 任务完成回调
常见问答
安装相关问题
Q1:本 Skill 的特点是什么?
A:命令行直接调用 seedream 5.0 lite 模型,支持文生图、图生图、组图生成、提示词优化与高分辨率输出。
Q2:如何获取 API Key?
A:前往 redfox.hk 注册获取自己的 API Token。
Q3:配置文件放在哪里?
A:放在 ~/.qoder/apis/redfox.json,内容格式为:{"api_key": "ak_你的密钥"}。
Q4:如何验证 API Key 是否配置成功?
A:运行 python3 seedream.py "测试" --no-download,如果能返回 taskId 则配置成功。
使用相关问题
Q5:生成一张图片需要多久?
A:通常 10-60 秒,复杂场景或高分辨率可能更久。脚本会自动轮询等待,最多等待 6 分钟。
Q6:支持上传自己的参考图吗?
A:支持。通过 --image 参数传入本地图片路径(如 --image ~/Pictures/photo.jpg),脚本会自动上传至 OSS 后提交图生图任务。也支持直接传入网络图片 URL。
Q7:支持哪些提示词语言?
A:中英文均可,API 内部会自动处理。
Q8:输出文件保存在哪里?
A:默认保存到 ~/Downloads/QoderImages/image.jpeg,可通过 -o 参数指定目录。
Q9:组图模式和单张模式有什么区别?
A:--sequential disabled(默认)只生成单张图片;--sequential auto 会根据提示词自动判断并生成多张关联图片,最多 --max-images 张。
故障排除
Q10:任务超时了怎么办?
A:脚本最多等待 6 分钟。超时后会打印 taskId,你可以稍后通过 --task-id 参数重新查询并下载结果。
Q11:提示"API request failed"?
A:检查网络连接是否正常,确认 redfox.hk 服务可访问。如果持续失败,可能是 API Key 已过期或余额不足。
Q12:图片下载失败?
A:确认输出目录有写入权限,磁盘空间充足。如果 OSS 链接过期,可以用 --task-id 重新查询获取新的下载链接。
获取帮助
如有其他问题,可前往 redfox.hk 查看平台文档或联系客服。
Files (redfox-community)
-
assets
-
seedream.py 16.3 KB
#!/usr/bin/env python3 """ Qoder seedream 5.0 lite Image Generator 基于火山方舟 seedream 5.0 lite 模型的图片生成工具 Usage: python3 seedream.py "提示词" [options] python3 seedream.py "修改提示词" --image ~/path/to/ref.png python3 seedream.py "ignored" --task-id ark_xxx """ import argparse import json import os import sys import time from pathlib import Path import requests SUBMIT_URL = "https://redfox.hk/story/api/parseWork/imageGen/arkSubmit" RESULT_URL = "https://redfox.hk/story/api/parseWork/imageGen/arkResult" UPLOAD_URL = "https://redfox.hk/story/api/parseWork/imageGen/uploadImage" CONFIG_DIR = Path.home() / ".qoder" / "apis" CONFIG_FILE = CONFIG_DIR / "redfox.json" ENV_KEY = "REDFOX_API_KEY" SOURCE = "seedream 5.0 lite-GitHub" DEFAULT_MODEL = "doubao-seedream-5-0-260128" POLL_INTERVAL = 3 # seconds MAX_POLL_ATTEMPTS = 120 # max ~6 minutes GREEN = "\033[92m" YELLOW = "\033[93m" RED = "\033[91m" CYAN = "\033[96m" BOLD = "\033[1m" RESET = "\033[0m" def info(msg): print(f"{GREEN}[✓]{RESET} {msg}") def warn(msg): print(f"{YELLOW}[!]{RESET} {msg}") def error(msg): print(f"{RED}[✗]{RESET} {msg}") def step(msg): print(f"{CYAN}[→]{RESET} {msg}") def get_api_key(cli_key=None): """Get API key: CLI arg > env var > config file.""" if cli_key: return cli_key env_key = os.environ.get(ENV_KEY) if env_key: return env_key if CONFIG_FILE.exists(): try: data = json.loads(CONFIG_FILE.read_text()) key = data.get("api_key") if key: return key except (json.JSONDecodeError, OSError): pass return None def upload_image(api_key, image_path): """Upload a local image file to OSS, return the image URL.""" image_path = os.path.expanduser(image_path) if not os.path.isfile(image_path): error(f"Image file not found: {image_path}") return None ext = os.path.splitext(image_path)[1].lower() fmt_map = {".png": "png", ".jpg": "jpeg", ".jpeg": "jpeg", ".webp": "webp"} fmt = fmt_map.get(ext, "png") step(f"Uploading image: {image_path}") try: with open(image_path, "rb") as f: files = {"file": (os.path.basename(image_path), f)} data = {"format": fmt} headers = {"X-API-KEY": api_key} resp = requests.post(UPLOAD_URL, files=files, data=data, headers=headers, timeout=60, verify=True) result = resp.json() except requests.exceptions.RequestException as e: error(f"Upload request failed: {e}") return None except json.JSONDecodeError: error(f"Upload returned invalid JSON: {resp.text[:200]}") return None code = result.get("code") if not str(code).startswith("2"): error(f"Upload failed (code {code}): {result.get('msg', '')}") return None data = result.get("data", {}) image_url = data.get("imageUrl") if not image_url: error("Upload succeeded but no imageUrl returned") return None info(f"Upload complete") return image_url def confirm_retry(): """询问用户是否需要重试。""" while True: answer = input(f"{YELLOW}[?]{RESET} 是否重试?(y/n): ").strip().lower() if answer in ('y', 'yes'): return True if answer in ('n', 'no'): return False def submit_task(session, prompt, params): """Submit image generation task, return taskId.""" payload = { "model": DEFAULT_MODEL, "prompt": prompt, "source": SOURCE, } # Add optional params if params.get("size"): payload["size"] = params["size"] if params.get("image"): payload["image"] = params["image"] if params.get("outputFormat"): payload["outputFormat"] = params["outputFormat"] if params.get("responseFormat"): payload["responseFormat"] = params["responseFormat"] if params.get("watermark") is not None: payload["watermark"] = params["watermark"] if params.get("sequentialImageGeneration"): payload["sequentialImageGeneration"] = params["sequentialImageGeneration"] if params.get("sequentialImageGenerationOptions"): payload["sequentialImageGenerationOptions"] = params["sequentialImageGenerationOptions"] if params.get("optimizePromptOptions"): payload["optimizePromptOptions"] = params["optimizePromptOptions"] try: resp = session.post(SUBMIT_URL, json=payload, timeout=30) result = resp.json() except requests.exceptions.RequestException as e: error(f"API request failed: {e}") return None except json.JSONDecodeError: error(f"API returned invalid JSON: {resp.text[:200]}") return None code = result.get("code") msg = result.get("msg", "") if not str(code).startswith("2"): error(f"Submit failed (code {code}): {msg}") return None data = result.get("data") if not data or not data.get("taskId"): error("API did not return taskId") return None return data["taskId"] def poll_result(session, task_id): """Poll for task result until succeeded/failed/timeout.""" consecutive_errors = 0 for attempt in range(1, MAX_POLL_ATTEMPTS + 1): try: resp = session.post(RESULT_URL, json={"taskId": task_id}, timeout=15) result = resp.json() except requests.exceptions.RequestException as e: consecutive_errors += 1 warn(f"Poll request failed (attempt {attempt}): {e}") if consecutive_errors >= 5: error("Too many consecutive network errors, giving up") return None time.sleep(POLL_INTERVAL) continue except json.JSONDecodeError: consecutive_errors += 1 warn(f"Invalid JSON response (attempt {attempt})") if consecutive_errors >= 5: error("Too many consecutive decode errors, giving up") return None time.sleep(POLL_INTERVAL) continue consecutive_errors = 0 code = result.get("code") if not str(code).startswith("2"): error(f"Query failed (code {code}): {result.get('msg', '')}") return None data = result.get("data", {}) status = data.get("status") if status == "succeeded": return data elif status == "failed": reason = data.get("failReason", "unknown") error(f"Generation failed: {reason}") return None else: elapsed = attempt * POLL_INTERVAL status_cn = {"queued": "排队中", "running": "生成中"}.get(status, status) print(f"\r {CYAN}⏳ Generating... ({elapsed}s) [{status_cn}]{RESET}", end="", flush=True) time.sleep(POLL_INTERVAL) print() error(f"Timeout: task did not complete within {MAX_POLL_ATTEMPTS * POLL_INTERVAL}s") print(f" You can query later with: --task-id {task_id}") return None def download_images(session, image_urls, output_dir, prefix="image"): """Download generated images to output directory.""" downloaded = [] total = len(image_urls) for i, url in enumerate(image_urls, 1): ext = ".jpeg" url_path = url.split("?")[0] for fmt in [".png", ".jpg", ".jpeg", ".webp"]: if url_path.lower().endswith(fmt): ext = fmt break filename = f"{prefix}_{i}{ext}" if total > 1 else f"{prefix}{ext}" filepath = os.path.join(output_dir, filename) step(f"Downloading {i}/{total}: {filename}") try: resp = session.get(url, stream=True, timeout=120) resp.raise_for_status() total_size = int(resp.headers.get("content-length", 0)) dl = 0 with open(filepath, "wb") as f: for chunk in resp.iter_content(chunk_size=8192): if chunk: f.write(chunk) dl += len(chunk) if total_size > 0: pct = int(dl * 100 / total_size) bar = "█" * (pct // 5) + "░" * (20 - pct // 5) print(f"\r {bar} {pct}%", end="", flush=True) print() downloaded.append(filepath) except requests.exceptions.RequestException as e: error(f"Download failed: {e}") return downloaded def main(): parser = argparse.ArgumentParser( description="AI 图片生成器 - 基于 seedream 5.0 lite 模型", formatter_class=argparse.RawDescriptionHelpFormatter, epilog=""" Examples: # 文生图 python3 seedream.py "一只橘色的猫咪坐在窗台上看着窗外的夕阳" # 指定尺寸和格式 python3 seedream.py "赛博朋克城市夜景" --size 2048x2048 --format png # 组图模式(自动生成多张) python3 seedream.py "一组美食摄影" --sequential auto --max-images 4 # 图生图 python3 seedream.py "把猫咪改成白色,背景换成星空" --image ~/Pictures/cat.png # 仅提交任务 python3 seedream.py "complex scene" --no-download # 查询已有任务 python3 seedream.py "ignored" --task-id ark_abc123def456 """, ) parser.add_argument("prompt", help="图片生成提示词(中英文均可)") parser.add_argument("--image", help="参考图片路径或 URL(启用图生图模式)") parser.add_argument("--size", default="2048x2048", help="图片尺寸 (默认 2048x2048, 支持 2K/3K/4K 或具体像素如 1024x1024)") parser.add_argument("--format", default="jpeg", choices=["png", "jpeg"], help="输出格式 (默认 jpeg)") parser.add_argument("--watermark", action="store_true", help="添加水印 (默认不添加)") parser.add_argument("--sequential", choices=["auto", "disabled"], default="disabled", help="组图模式: auto=自动判断/disabled=单张 (默认 disabled)") parser.add_argument("--max-images", type=int, default=4, help="组图最多生成数量 1-15 (默认 4, 仅 sequential=auto 时生效)") parser.add_argument("--optimize", choices=["standard", "fast"], help="提示词优化模式: standard=高质量/fast=快速") parser.add_argument("--no-download", action="store_true", help="仅提交任务并返回 taskId,不等待结果") parser.add_argument("--task-id", help="直接查询已有任务的结果 (跳过提交)") parser.add_argument("--api-key", help="API Key (前往 https://redfox.hk/settings/api-keys?source=github 注册获取)") parser.add_argument("-o", "--output-dir", help="输出目录 (默认 ~/Downloads/QoderImages)") parser.add_argument("--prefix", default="image", help="下载文件名前缀 (默认 image)") args = parser.parse_args() # ── Banner ── banner = f"""{CYAN}{BOLD} ╔══════════════════════════════════════════╗ ║ Qoder Image Generator (API) ║ ║ AI 图片生成工具 · seedream 5.0 lite ║ ╚══════════════════════════════════════════╝{RESET} """ print(banner) # ── API Key ── api_key = get_api_key(cli_key=args.api_key) if not api_key: error("未找到 API Key,请设置环境变量 REDFOX_API_KEY 或使用 --api-key 参数") print(f" 获取 Key: https://redfox.hk/settings/api-keys?source=github") sys.exit(1) # ── Session ── session = requests.Session() session.verify = True session.headers.update({ "Content-Type": "application/json", "X-API-KEY": api_key, }) # ── Mode: Query existing task ── if args.task_id: step(f"Querying task: {args.task_id}") result = poll_result(session, args.task_id) if not result: sys.exit(1) print() image_urls = result.get("imageUrls", []) model = result.get("model", "?") size = result.get("size", "?") usage = result.get("usage", {}) info(f"Model: {model}, Size: {size}") if usage: info(f"Generated images: {usage.get('generatedImages', '?')}, Tokens: {usage.get('totalTokens', '?')}") if image_urls: output_dir = os.path.expanduser(args.output_dir) if args.output_dir else str(Path.home() / "Downloads" / "QoderImages") os.makedirs(output_dir, exist_ok=True) downloaded = download_images(session, image_urls, output_dir, args.prefix) if downloaded: print(f"\n{GREEN}{BOLD}✓ Done!{RESET}") for f in downloaded: size_kb = os.path.getsize(f) / 1024 print(f" {f} ({size_kb:.1f} KB)") else: print(f"\n{RED}{BOLD}✗ Download failed{RESET}") sys.exit(1) else: warn("Task succeeded but no imageUrls returned") sys.exit(0) # ── Mode: Submit new task ── prompt = args.prompt.strip() if not prompt: error("提示词不能为空") sys.exit(1) # Validate max-images if args.max_images < 1 or args.max_images > 15: error(f"max-images 取值范围: 1-15,当前值: {args.max_images}") sys.exit(1) # Handle image parameter image_value = None if args.image: if args.image.startswith(("http://", "https://")): image_value = args.image step(f"Using image URL: {image_value}") else: image_url = upload_image(api_key, args.image) if not image_url: sys.exit(1) image_value = image_url # Display mode and settings if image_value: step(f"Mode: 图生图 (image-to-image)") else: step(f"Mode: 文生图 (text-to-image)") step(f"Prompt: {prompt[:100]}{'...' if len(prompt) > 100 else ''}") step(f"Settings: size={args.size}, format={args.format}, sequential={args.sequential}, watermark={'on' if args.watermark else 'off'}") # Build params params = { "size": args.size, "outputFormat": args.format, "responseFormat": "url", "watermark": args.watermark, } if image_value: params["image"] = image_value if args.sequential == "auto": params["sequentialImageGeneration"] = "auto" params["sequentialImageGenerationOptions"] = {"maxImages": args.max_images} if args.optimize: params["optimizePromptOptions"] = {"mode": args.optimize} # Submit while True: step("Submitting image generation task...") task_id = submit_task(session, prompt, params) if task_id: break if not confirm_retry(): sys.exit(1) info(f"Task submitted: {task_id}") if args.no_download: print(f"\n{GREEN}{BOLD}✓ Task submitted successfully{RESET}") print(f" taskId: {task_id}") print(f" 查询命令: python3 seedream.py \"ignored\" --task-id {task_id}") sys.exit(0) # Poll step("Waiting for image generation...") result = poll_result(session, task_id) if not result: sys.exit(1) print() image_urls = result.get("imageUrls", []) model = result.get("model", "?") size = result.get("size", "?") usage = result.get("usage", {}) info(f"Model: {model}, Size: {size}") if usage: info(f"Generated images: {usage.get('generatedImages', '?')}, Tokens: {usage.get('totalTokens', '?')}") if image_urls: output_dir = os.path.expanduser(args.output_dir) if args.output_dir else str(Path.home() / "Downloads" / "QoderImages") os.makedirs(output_dir, exist_ok=True) downloaded = download_images(session, image_urls, output_dir, args.prefix) if downloaded: print(f"\n{GREEN}{BOLD}✓ Done!{RESET}") for f in downloaded: size_kb = os.path.getsize(f) / 1024 print(f" {f} ({size_kb:.1f} KB)") sys.exit(0) else: print(f"\n{RED}{BOLD}✗ Download failed{RESET}") sys.exit(1) else: error("Task succeeded but no imageUrls returned") sys.exit(1) if __name__ == "__main__": main()
-
-
README.en.md 3.3 KB
# seedream 5.0 lite / seedream 5.0 lite --- ## Overview An AI image generator based on the Volcano Engine seedream 5.0 lite model, supporting text-to-image, image-to-image, multi-image generation, and prompt optimization. Generate high-quality images with a single command. **Core Value** - **Text-to-Image**: Generate high-resolution images from Chinese or English descriptions - **Image-to-Image**: Upload a reference image with a prompt for style transfer and editing - **Multi-Image Generation**: Automatically generate multiple related images, up to 15 - **High Resolution**: Supports 2K, 3K, 4K, or custom pixel dimensions **Who It's For** - 🎨 **Designers** — Quickly generate high-quality illustrations, covers, and product photos - 📱 **Social Media Creators** — Batch-generate visually consistent assets - 🛍️ **E-commerce Sellers** — Produce product scene photos with zero photography cost --- ## Features ### Core Features - **Text-to-Image**: Enter a prompt and seedream 5.0 lite generates a high-resolution image - **Image-to-Image**: Upload a reference image for style transfer and editing - **Multi-Image Generation**: `auto` mode generates multiple related images automatically - **Prompt Optimization**: Built-in standard (high quality) and fast modes - **High Resolution**: Supports 2K/3K/4K or custom pixel dimensions - **Task Management**: Submit tasks and get a taskId to track progress anytime --- ## API Key Acquisition & Security - This skill requires the environment variable: `REDFOX_API_KEY`. - `REDFOX_API_KEY` is provided by [RedFoxHub](https://redfox.hk/settings/api-keys?source=github) (`https://redfox.hk`). - Please visit [RedFoxHub](https://redfox.hk?source=github) to register and obtain your `REDFOX_API_KEY`. - Configure the environment variable `REDFOX_API_KEY` on your device before using this skill. - Before providing your key, verify its source, available scope, validity period, and whether it supports reset/revocation. - Do not hardcode or expose the key in plaintext within code, prompts, logs, or output files. --- ## Usage Guide Simply describe the image you want in natural language. ### Quick Reference | Intent | Example | Result | |--------|---------|--------| | Text-to-Image | "Generate a latte on a wooden table" | Submits task and generates a high-res image | | Image-to-Image | "Turn this photo into oil painting style [image]" | Uploads reference for style transfer | | Multi-Image | "Generate a set of minimalist desk photos" | Batch-generates visually consistent images | | High Resolution | "Generate a 4K ultra HD sunrise over snow mountains" | Outputs ultra-high resolution image | --- ## Use Cases | Scenario | Role | Example Prompt | Benefit | |----------|------|---------------|---------| | Social media visuals | Xiaohongshu blogger | "Generate an Instagram-style coffee photo for my cover" | Quick high-quality illustrations | | E-commerce product display | E-commerce operator | "Generate product scene photos for white earphones" | Zero photography cost, instant results | | Creative inspiration | Designer | "Generate a cyberpunk futuristic city concept" | From idea to visual in one command | | Multi-image content | Content marketer | "Generate a set of breakfast photos for article banners" | Batch visually consistent assets | -
README.md 2.9 KB
# seedream 5.0 lite / seedream 5.0 lite --- ## 简介 基于火山方舟 seedream 5.0 lite 模型的 AI 图片生成器,支持文生图、图生图、组图生成与提示词优化。一行命令即可出图。 **核心价值** - **文生图**:输入中文或英文描述,生成高清图片 - **图生图**:上传参考图 + 提示词,进行风格转换与编辑 - **组图生成**:自动生成多张关联图片,最多 15 张 - **高分辨率**:支持 2K、3K、4K 或自定义像素尺寸 **适用对象** - 🎨 **设计师** — 快速生成高质量配图、封面图、产品展示图 - 📱 **自媒体运营** — 批量生成风格统一的视觉素材 - 🛍️ **电商卖家** — 零摄影成本,快速产出商品场景图 --- ## 功能特性 ### 核心功能 - **文生图**:输入提示词,seedream 5.0 lite 自动生成高清图片 - **图生图**:上传参考图,基于原图进行编辑和风格转换 - **组图生成**:`auto` 模式自动生成多张关联图片 - **提示词优化**:内置 standard(高质量)和 fast(快速)两种模式 - **高分辨率**:支持 2K/3K/4K 或自定义像素尺寸 - **任务管理**:支持提交任务获取 taskId,随时查询进度 --- ## 密钥获取与安全说明 - 本技能需要使用环境变量:`REDFOX_API_KEY`。 - `REDFOX_API_KEY` 由 [红狐 hub](https://redfox.hk/settings/api-keys?source=github) (`https://redfox.hk`)提供。 - 请前往 [红狐 hub](https://redfox.hk?source=github) 注册账号,获取 `REDFOX_API_KEY`。 - 配置设备环境变量 `REDFOX_API_KEY` 后使用本技能。 - 在提供密钥前,请先确认密钥来源、可用范围、有效期及是否支持重置/撤销。 - 禁止在代码、提示词、日志或输出文件中硬编码/明文暴露密钥。 --- ## 使用指南 直接用自然语言描述你想要的图片即可。 ### 常用说法速查 | 意图 | 示例话术 | 效果 | |------|---------|------| | 文生图 | 「生成一杯拿铁咖啡在木质桌面上的图片」 | 提交任务,生成高清图片 | | 图生图 | 「把这张照片换成油画风格 [图片]」 | 上传参考图,进行风格转换 | | 组图生成 | 「生成一组极简风办公桌面静物图」 | 批量生成风格一致的组图 | | 高分辨率 | 「生成 4K 超高清的雪山日出图」 | 输出超高分辨率图片 | --- ## 使用场景 | 场景 | 角色 | 示例问法 | 收益 | |------|------|---------|------| | 社交媒体配图 | 小红书博主 | 「生成 ins 风咖啡照片做封面」 | 快速产出高质量配图 | | 电商产品展示 | 电商运营 | 「给白色耳机生成产品场景图」 | 零摄影成本,快速出图 | | 创意灵感验证 | 设计师 | 「生成赛博朋克未来城市概念图」 | 想法到视觉稿只需一行命令 | | 组图内容运营 | 内容运营 | 「生成一组早餐摄影用于文章配图」 | 批量产出风格统一的视觉素材 | -
SKILL.md 11.7 KB
--- name: seedream 5.0 lite description: 基于火山方舟 seedream 5.0 lite 模型的 AI 图片生成器,支持文生图、图生图、组图生成与提示词优化。输入关键词即可生成高分辨率图片,使用 seedream 图片生成、AI 绘图、文生图、图生图时调用此 Skill。 --- # seedream 5.0 lite ## 简介 基于火山方舟 **seedream 5.0 lite** 模型的 AI 图片生成工具。通过 redfox.hk 平台封装了复杂的 ARK API 鉴权流程,**一行命令即可生成高质量图片**。 ### 为什么用这个 Skill? - **对开发者**:无需去火山方舟申请白名单、配置 AK/SK、对接 ARK 鉴权,一行命令搞定 - **对创作者**:不用买会员、不用绑卡订阅,按次消费,用完即走 ### 适用对象 设计师、社交媒体创作者、内容运营人员、AI 爱好者,以及任何需要快速将创意转化为图片的用户。 --- ## 功能特性 ### 核心功能 - **文生图**:输入一句中文或英文描述,seedream 5.0 lite 自动生成高清图片 - **图生图**:上传参考图 + 提示词,基于原图进行编辑和风格转换 - **组图生成**:支持 `auto` 模式自动生成多张关联图片(最多 15 张) - **提示词优化**:内置 `standard`(高质量)和 `fast`(快速)两种优化模式 - **高分辨率输出**:支持 `2K`/`3K`/`4K` 或自定义像素尺寸,默认 `2048x2048` - **任务管理**:支持提交任务后获取 taskId,可随时查询任务进度和结果 - **自动轮询**:脚本自动轮询任务状态(排队中/生成中/已完成),无需手动等待 ### 技术亮点 - 底层模型:`doubao-seedream-5-0-260128` - 输出格式:PNG、JPEG - 水印控制:可选择是否添加 "AI生成" 水印 - 图片 URL 自动转存 OSS,长期有效 - HTTPS 安全传输:全链路 SSL 验证 ### 参数速查 | 参数 | 说明 | 默认值 | |------|------|--------| | `prompt` | 图片生成提示词(必填,中英文均可) | — | | `--image` | 参考图路径或 URL(启用图生图模式) | — | | `--size` | 图片尺寸:`2K`/`3K`/`4K` 或具体像素如 `2048x2048` | `2048x2048` | | `--format` | 输出格式:`png` / `jpeg` | `jpeg` | | `--watermark` | 添加 "AI生成" 水印 | 默认不添加 | | `--sequential` | 组图模式:`auto` / `disabled` | `disabled` | | `--max-images` | 组图最多生成数量(1-15) | `4` | | `--optimize` | 提示词优化:`standard` / `fast` | — | | `-o, --output-dir` | 输出目录 | `~/Downloads/QoderImages` | | `--prefix` | 文件名前缀 | `image` | | `--no-download` | 仅提交不等待 | — | | `--task-id` | 查询已有任务 | — | --- ## 使用场景 ### 场景一:社交媒体内容创作 **角色**:小红书博主 / 自媒体运营 **需求**:快速生成高质量配图、封面图、产品展示图 **使用方式**: ```bash python3 "$SKILL_PATH/assets/seedream.py" "一杯拿铁咖啡放在木质桌面上,柔和的自然光,ins风" --size 2048x2048 ``` **预期收益**:从找图/拍图到出图只需几秒,支持批量组图生成 --- ### 场景二:电商产品展示 **角色**:电商运营 / 独立站卖家 **需求**:为商品生成统一风格的产品场景图 **使用方式**: ```bash python3 "$SKILL_PATH/assets/seedream.py" "白色无线耳机悬浮在浅灰色背景上,专业产品摄影,柔和阴影" --format png --size 3K ``` **预期收益**:零摄影成本,快速产出高质量商品图 --- ### 场景三:设计灵感快速验证 **角色**:UI 设计师 / 插画师 **需求**:将脑中的画面用自然语言快速变成可视化图片,验证创意方向 **使用方式**: ```bash python3 "$SKILL_PATH/assets/seedream.py" "赛博朋克风格的未来城市,霓虹灯倒映在雨后的街道上,电影级构图" --size 4K ``` **预期收益**:降低创意门槛,想法到视觉稿只需一行命令 --- ### 场景四:组图内容运营 **角色**:内容运营 / 市场人员 **需求**:一次性生成多张风格统一的配图,用于文章/推文/活动页 **使用方式**: ```bash python3 "$SKILL_PATH/assets/seedream.py" "一组清新风格的早餐摄影,包含面包、水果、咖啡" --sequential auto --max-images 6 ``` **预期收益**:批量生成风格一致的视觉素材,提升内容产出效率 --- ### 场景五:图生图风格迁移 **角色**:摄影师 / 艺术创作者 **需求**:基于现有图片进行风格转换或元素修改 **使用方式**: ```bash python3 "$SKILL_PATH/assets/seedream.py" "将画面转换成宫崎骏动画风格,色彩明亮温暖" --image ~/Pictures/photo.jpg ``` **预期收益**:无需掌握复杂修图软件,自然语言即可驱动风格转换 --- ### 依赖安装 | 依赖 | 安装命令 | |------|----------| | `requests` | `pip3 install requests` | --- ## 首次使用 配置 API Key 后即可使用: ```bash # 设置环境变量 export REDFOX_API_KEY=ak_你的密钥 # 运行 python3 "$SKILL_PATH/assets/seedream.py" "一只橘色的猫咪坐在窗台上看着窗外的夕阳" ``` > 前往 [redfox.hk](https://redfox.hk/settings/api-keys?source=github) 注册获取 API Key。 --- ## 后续使用 前往 [redfox.hk](https://redfox.hk/settings/api-keys?source=github) 注册账号获取自己的 API Token,三种配置方式任选其一: | 配置方式 | 说明 | 命令 | |----------|------|------| | **环境变量**(推荐) | 设置一次,全局生效 | `export REDFOX_API_KEY=ak_你的密钥` | | **命令行参数** | 临时使用,单次生效 | `python3 "$SKILL_PATH/assets/seedream.py" "prompt" --api-key ak_你的密钥` | | **配置文件** | 持久化存储,跨会话保留 | `mkdir -p ~/.qoder/apis && echo '{"api_key":"ak_你的密钥"}' > ~/.qoder/apis/redfox.json` | --- ## 使用指南 ### 基础使用 #### 1. 输入提示词生成图片 ```bash python3 "$SKILL_PATH/assets/seedream.py" "一只橘猫在窗台上打哈欠,阳光温暖地照在它的毛上" ``` 脚本会自动提交任务、轮询等待(约 10-60 秒),完成后下载到 `~/Downloads/QoderImages/`。 #### 3. 查看结果 生成成功后会显示图片信息和文件路径: ``` [✓] Model: doubao-seedream-5-0-260128, Size: 2048x2048 [✓] Generated images: 1, Tokens: 1024 [→] Downloading 1/1: image.jpeg [████████████████████] 100% ✓ Done! /Users/you/Downloads/QoderImages/image.jpeg (312.5 KB) ``` ### 高级使用 #### 高分辨率输出 ```bash # 4K 超高清 python3 "$SKILL_PATH/assets/seedream.py" "雪山日出,金色阳光洒在雪顶" --size 4K # 指定具体像素 python3 "$SKILL_PATH/assets/seedream.py" "城市夜景" --size 2048x1152 ``` #### 组图生成(批量出图) ```bash # 自动生成最多 6 张关联图片 python3 "$SKILL_PATH/assets/seedream.py" "一组极简风办公桌面静物" --sequential auto --max-images 6 ``` #### 图生图编辑 ```bash # 基于参考图修改 python3 "$SKILL_PATH/assets/seedream.py" "把背景换成海边日落" --image ~/Pictures/portrait.jpg # 使用网络图片作为参考 python3 "$SKILL_PATH/assets/seedream.py" "转换成油画风格" --image "https://example.com/photo.jpg" ``` #### 提示词优化 ```bash # 标准模式(质量更高,耗时较长) python3 "$SKILL_PATH/assets/seedream.py" "未来太空站内部" --optimize standard # 快速模式(快速出图,质量一般) python3 "$SKILL_PATH/assets/seedream.py" "快速草图概念" --optimize fast ``` #### 任务管理 ```bash # 仅提交任务,返回 taskId 后立即退出 python3 "$SKILL_PATH/assets/seedream.py" "复杂场景" --no-download # 稍后用 taskId 查询结果 python3 "$SKILL_PATH/assets/seedream.py" "ignored" --task-id ark_abc123def456 ``` ### 命令速查 | 命令 | 功能 | |------|------| | `python3 seedream.py "提示词"` | 基础文生图 | | `--size 4K` | 4K 高分辨率 | | `--format png` | PNG 格式输出 | | `--sequential auto --max-images 6` | 组图模式生成 6 张 | | `--image ~/pic.jpg` | 图生图模式 | | `--optimize standard` | 提示词标准优化 | | `--watermark` | 添加水印 | | `--no-download` | 仅提交任务 | | `--task-id <id>` | 查询已有任务 | | `--api-key <key>` | 指定 API Key | | `-o ~/Desktop` | 指定输出目录 | --- ## 项目架构 ### 目录结构 ``` seedream-5-lite/ ├── SKILL.md # Skill 定义与文档 └── assets/ # 工具脚本 └── seedream.py # 图片生成主程序 ``` ### 技术栈 | 组件 | 技术 | |------|------| | 运行环境 | Python 3.6+ | | HTTP 库 | requests | | API 平台 | redfox.hk | | 底层模型 | 火山方舟 seedream 5.0 lite (`doubao-seedream-5-0-260128`) | | 输出格式 | PNG、JPEG | ### 核心模块 | 模块 | 职责 | |------|------| | `get_api_key()` | 三级优先级获取 API Key:CLI > 环境变量 > 配置文件 | | `upload_image()` | 将本地参考图上传至 OSS,获取可访问的 URL | | `submit_task()` | 构建请求体,提交 ARK 图片生成任务 | | `poll_result()` | 轮询任务状态(queued/running/succeeded/failed),最多 6 分钟 | | `download_images()` | 流式下载生成图片,带进度条显示 | | `main()` | CLI 入口:参数解析、API Key 校验、双分支(提交/查询)流程 | ### 数据流转 ``` 用户输入提示词 → submit_task() → redfox.hk API → 火山方舟 seedream 5.0 lite ↓ 用户获得图片 ← download_images() ← poll_result() ← 任务完成回调 ``` --- ## 常见问答 ### 安装相关问题 **Q1:本 Skill 的特点是什么?** A:命令行直接调用 seedream 5.0 lite 模型,支持文生图、图生图、组图生成、提示词优化与高分辨率输出。 **Q2:如何获取 API Key?** A:前往 [redfox.hk](https://redfox.hk/settings/api-keys?source=github) 注册获取自己的 API Token。 **Q3:配置文件放在哪里?** A:放在 `~/.qoder/apis/redfox.json`,内容格式为:`{"api_key": "ak_你的密钥"}`。 **Q4:如何验证 API Key 是否配置成功?** A:运行 `python3 seedream.py "测试" --no-download`,如果能返回 taskId 则配置成功。 --- ### 使用相关问题 **Q5:生成一张图片需要多久?** A:通常 10-60 秒,复杂场景或高分辨率可能更久。脚本会自动轮询等待,最多等待 6 分钟。 **Q6:支持上传自己的参考图吗?** A:支持。通过 `--image` 参数传入本地图片路径(如 `--image ~/Pictures/photo.jpg`),脚本会自动上传至 OSS 后提交图生图任务。也支持直接传入网络图片 URL。 **Q7:支持哪些提示词语言?** A:中英文均可,API 内部会自动处理。 **Q8:输出文件保存在哪里?** A:默认保存到 `~/Downloads/QoderImages/image.jpeg`,可通过 `-o` 参数指定目录。 **Q9:组图模式和单张模式有什么区别?** A:`--sequential disabled`(默认)只生成单张图片;`--sequential auto` 会根据提示词自动判断并生成多张关联图片,最多 `--max-images` 张。 --- ### 故障排除 **Q10:任务超时了怎么办?** A:脚本最多等待 6 分钟。超时后会打印 taskId,你可以稍后通过 `--task-id` 参数重新查询并下载结果。 **Q11:提示"API request failed"?** A:检查网络连接是否正常,确认 redfox.hk 服务可访问。如果持续失败,可能是 API Key 已过期或余额不足。 **Q12:图片下载失败?** A:确认输出目录有写入权限,磁盘空间充足。如果 OSS 链接过期,可以用 `--task-id` 重新查询获取新的下载链接。 --- ### 获取帮助 如有其他问题,可前往 [redfox.hk](https://redfox.hk/settings/api-keys?source=github) 查看平台文档或联系客服。
Comments (0)
Sign in to join the conversation.
Reviews (0)
No reviews yet.
No comments yet.