# gen-image · 生图 Skill 通过大模型中转站,直接调用 OpenAI 图片接口生图。文生图 / 图生图 / 局部重绘 / 透明背景,零第三方依赖。 ## 快速开始 ```bash # 1. 配置凭证 cp .env.example .env # 编辑 .env,填入 IMAGE_API_BASE_URL、IMAGE_API_KEY # 2. 文生图 python3 scripts/gen_image.py "a cozy cabin in snowy mountains, golden hour, cinematic" \ --size 1536x1024 --quality high # 3. 图生图 / 编辑 python3 scripts/gen_image.py "把背景换成星空" --edit input.png # 4. 局部重绘(mask 透明处为重绘区域) python3 scripts/gen_image.py "戴上一顶红帽子" --edit input.png --mask mask.png ``` 图片保存到 `output/`,脚本打印完整路径。 ## 配置项(.env) | 变量 | 说明 | |------|------| | `IMAGE_API_BASE_URL` | 中转站基址,如 `https://your-relay.com`(自动补 `/v1/images/...`) | | `IMAGE_API_KEY` | 中转站 API Key | | `IMAGE_MODEL` | 默认模型,默认 `gpt-image-2`,可用 `--model` 覆盖 | ## 参数 `--size` `--n` `--quality` `--background transparent` `--edit`(可多次) `--mask` `--model` `--output` 详见 `python3 scripts/gen_image.py --help` 与 `SKILL.md`。 ## 安全 `.env` 与 `output/` 已在 `.gitignore` 中,不会提交。切勿把 API Key 写进代码或对话。