Files
codex-market-app/gen-image/README.md
T
backup-bot 2dc15d99ad feat: 新增 gen-image 生图技能
通过大模型中转站调用 OpenAI 图片接口生图(文生图/图生图/局部重绘/透明背景),零第三方依赖。
含可安装 zip 与可浏览源码。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 17:53:43 +08:00

41 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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 写进代码或对话。