用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Ember452/StarRing-main --skill image-gen命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | image-gen |
| description | 在 Agent 沙盒中生成图片并保存到 outputs。当用户要求生成图片、海报、插画、文生图,或指定 Qwen-Image、其它兼容图片生成接口时使用此技能。 |
当用户要求生成图片、海报、插画、文生图,或明确提到 Qwen-Image 时,使用此技能组织图片生成流程。
默认使用 SiliconFlow 的 Qwen-Image 接口:
POST https://api.siliconflow.cn/v1/images/generationsQwen/Qwen-Imagenegative_prompt: ""num_inference_steps: 20guidance_scale: 7.5调用外部接口时,必须在 Agent 沙盒执行环境中读取 SILICONFLOW_API_KEY。不要依赖后端进程环境变量。
prompt,并按需传入 negative_prompt、num_inference_steps、guidance_scale。images[0].url。Authorization: Bearer $SILICONFLOW_API_KEY 下载该图片地址;如果接口直接返回 base64,则直接解码保存。/home/gem/user-data/outputs/ 下,例如 /home/gem/user-data/outputs/generated-image.png。present_artifacts,传入保存后的 outputs 虚拟路径,让前端展示图片产物。可根据用户需求调整 prompt 和输出文件名:
import os
import requests
from pathlib import Path
api_key = os.environ["SILICONFLOW_API_KEY"]
prompt = "根据用户需求整理后的图片提示词"
response = requests.post(
"https://api.siliconflow.cn/v1/images/generations",
headers={"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"},
json={
"model": "Qwen/Qwen-Image",
"prompt": prompt,
"negative_prompt": "",
"num_inference_steps": 20,
"guidance_scale": 7.5,
},
timeout=120,
)
response.raise_for_status()
image_url = response.json()["images"][0]["url"]
image_response = requests.get(
image_url,
headers={"Authorization": f"Bearer {api_key}"},
timeout=120,
)
image_response.raise_for_status()
output_path = Path("/home/gem/user-data/outputs/generated-image.png")
output_path.parent.mkdir(parents=True, exist_ok=True)
output_path.write_bytes(image_response.content)
print(output_path.as_posix())
如果用户指定其它图片生成模型或兼容接口,可以按该接口的协议先生成图片。只要最终拿到图片 bytes 或 base64,就保存到 /home/gem/user-data/outputs/,再调用 present_artifacts 展示。
SILICONFLOW_API_KEY 缺失,应明确提示用户需要在 Agent 沙盒环境变量中配置。present_artifacts,否则前端不会自动展示生成图片。