Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ uv tool upgrade gpt-image-cli

</details>

Reads `OPENAI_API_KEY` from process env, then `.env`, then `~/.env` without overriding an already-set env var.
Reads `OPENAI_API_KEY` from process env, then `.env`, then `~/.env` without overriding an already-set env var. The optional Atlas Cloud text-to-image path reads `ATLASCLOUD_API_KEY` or `ATLAS_CLOUD_API_KEY`.

> **Agent + API-key note.** Codex also has its own built-in image-generation skill, but that path is black-box and cannot be edited here; Codex users can switch to it if they prefer. Thanks to the related issue discussion for the simple safety tip: if you do not want an agent to accidentally use your OpenAI API key, run `unset OPENAI_API_KEY` before invoking the local CLI/skill.

Expand All @@ -219,6 +219,16 @@ gpt-image -p "a photorealistic convenience store at 10pm" --size 1k --quality hi

Under the hood: `POST /v1/images/generations` with `model=gpt-image-2`.

### Atlas Cloud text → image

```bash
export ATLASCLOUD_API_KEY="your-atlascloud-api-key"
gpt-image --provider atlascloud -p "a photorealistic convenience store at 10pm" \
--size 1k --quality high -f store.png
```

Under the hood: `POST /api/v1/model/generateImage` with `model=openai/gpt-image-2/text-to-image`, followed by prediction polling. The Atlas Cloud provider currently covers text-to-image generation only; reference edits and inpainting still use the OpenAI provider.

### Text + reference image → image (edit)

```bash
Expand All @@ -245,6 +255,8 @@ Under the hood: `POST /v1/images/edits` (multipart form), the official endpoint
| Flag | Values | Default | Applies to | Notes |
|---|---|---|---|---|
| `-p, --prompt` | str | — required | both | Full prompt text. |
| `--provider` | `openai` · `atlascloud` | `openai` | generation | `atlascloud` uses Atlas Cloud's async text-to-image API and reads `ATLASCLOUD_API_KEY`. |
| `--model` | str | `gpt-image-2` | both | With `--provider atlascloud`, the default maps to `openai/gpt-image-2/text-to-image`. |
| `-f, --file` | path | `./fig/YYYY-MM-DD-HH-MM-SS-<slug>.png` | both | Explicit output path. |
| `-i, --image` | path (repeatable) | — | edits | Presence routes through `/v1/images/edits`. |
| `-m, --mask` | path (PNG, alpha) | — | edits | Opaque = preserved, transparent = regenerated. Requires `-i`. |
Expand Down
14 changes: 13 additions & 1 deletion README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ uv tool upgrade gpt-image-cli

</details>

按 process env、`.env`、`~/.env` 的顺序读取 `OPENAI_API_KEY`,且不会覆盖已经设置好的环境变量。
按 process env、`.env`、`~/.env` 的顺序读取 `OPENAI_API_KEY`,且不会覆盖已经设置好的环境变量。可选的 Atlas Cloud 文生图路径会读取 `ATLASCLOUD_API_KEY` 或 `ATLAS_CLOUD_API_KEY`。

> **Agent 与 API Key 提醒。** 我们发现 Codex 其实自带生成 Image 的 skill,但它是黑盒的,无法在这里修改;Codex 用户如果更想走内置能力,可以自行切换。也感谢相关 issue 里提到的方法:如果你不想让 agent accidentally 调用你的 OpenAI API Key,直接在调用本地 CLI/Skill 前运行 `unset OPENAI_API_KEY` 即可。

Expand All @@ -219,6 +219,16 @@ gpt-image -p "晚上10点的逼真便利店" --size 1k --quality high -f store.p

底层实现:`POST /v1/images/generations`,使用 `model=gpt-image-2`。

### Atlas Cloud 文本 → 图片

```bash
export ATLASCLOUD_API_KEY="your-atlascloud-api-key"
gpt-image --provider atlascloud -p "晚上10点的逼真便利店" \
--size 1k --quality high -f store.png
```

底层实现:`POST /api/v1/model/generateImage`,使用 `model=openai/gpt-image-2/text-to-image`,随后轮询 prediction 结果。Atlas Cloud provider 目前只覆盖文本生成图片;参考图编辑和 inpainting 仍走 OpenAI provider。

### 文字 + 参考图像 → 图像(编辑)

```bash
Expand All @@ -245,6 +255,8 @@ gpt-image -p "将天空替换为极光" \
| 标志 | 取值 | 默认值 | 适用范围 | 备注 |
|---|---|---|---|---|
| `-p, --prompt` | 字符串 | — 必需 | 两者 | 完整的提示文本。 |
| `--provider` | `openai` · `atlascloud` | `openai` | 生成 | `atlascloud` 使用 Atlas Cloud 异步文生图 API,并读取 `ATLASCLOUD_API_KEY`。 |
| `--model` | 字符串 | `gpt-image-2` | 两者 | 使用 `--provider atlascloud` 时,默认映射为 `openai/gpt-image-2/text-to-image`。 |
| `-f, --file` | 路径 | `./fig/YYYY-MM-DD-HH-MM-SS-<slug>.png` | 两者 | 明确输出路径。 |
| `-i, --image` | 路径(可重复) | — | 编辑 | 存在时走 `/v1/images/edits` 路由。 |
| `-m, --mask` | 路径(PNG,带alpha通道) | — | 编辑 | 不透明 = 保留,透明 = 重新生成。需要 `-i`。 |
Expand Down
9 changes: 6 additions & 3 deletions skills/gpt-image/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: gpt-image
description: "Use this skill whenever a user asks to generate, create, draw, render, or edit images with GPT Image 2 / gpt-image-2, text-to-image, reference-image editing, inpainting, posters, typography, Chinese text, UI mockups, diagrams, or gallery prompts. Analyze the user's prompt, search the bundled Reference Gallery/craft files for matching design patterns, confer on direction when useful, then call the packaged `gpt-image` CLI or bundled `scripts/generate.py`. Do not write new image-generation code unless explicitly asked to modify this repo."
compatibility: "Requires Python 3.11+ and either `gpt-image`, `uv`, or `uvx`. CLI/API calls read `OPENAI_API_KEY` and may incur OpenAI API charges."
compatibility: "Requires Python 3.11+ and either `gpt-image`, `uv`, or `uvx`. CLI/API calls read `OPENAI_API_KEY` for OpenAI or `ATLASCLOUD_API_KEY` / `ATLAS_CLOUD_API_KEY` for Atlas Cloud text-to-image, and may incur API charges."
metadata: {"openclaw":{"requires":{"anyBins":["gpt-image","uv","uvx"]},"primaryEnv":"OPENAI_API_KEY","homepage":"https://github.com/wuyoscar/gpt_image_2_skill"}}
---

Expand Down Expand Up @@ -41,7 +41,8 @@ uvx --from git+https://github.com/wuyoscar/gpt_image_2_skill gpt-image -p "PROMP

## Key and cost rules

- CLI reads `OPENAI_API_KEY` from process env, then `.env`, then `~/.env` without overriding existing env; successful API calls may bill the user’s OpenAI account.
- CLI reads `OPENAI_API_KEY` from process env, then `.env`, then `~/.env` without overriding existing env; successful API calls may bill the user's OpenAI account.
- Optional `--provider atlascloud` reads `ATLASCLOUD_API_KEY` or `ATLAS_CLOUD_API_KEY` and uses Atlas Cloud's async text-to-image API.
- If host/runtime has native platform-managed image generation and the user wants that path, use the host tool instead of this CLI.
- If `OPENAI_API_KEY` is unset, report missing key or use host-native generation when requested; do not write secrets.
- If user wants to avoid local-key use, respect `unset OPENAI_API_KEY`; if a key exists in `.env`/`~/.env`, tell them to remove/rename it for the session rather than working around it.
Expand All @@ -52,10 +53,11 @@ uvx --from git+https://github.com/wuyoscar/gpt_image_2_skill gpt-image -p "PROMP
| Flag | Values | Use |
|---|---|---|
| `-p, --prompt` | string | Required prompt/edit instruction |
| `--provider` | `openai`, `atlascloud` | Provider; `atlascloud` currently supports text-to-image generation |
| `-f, --file` | path | Output path; auto-named if omitted |
| `-i, --image` | repeatable path | Use edits endpoint; supports multiple references |
| `-m, --mask` | PNG path | Inpaint with alpha mask; requires `-i` |
| `--model` | default `gpt-image-2` | Image model |
| `--model` | default `gpt-image-2` | Image model; with `--provider atlascloud`, the default maps to `openai/gpt-image-2/text-to-image` |
| `--size` | `1k`, `2k`, `4k`, `portrait`, `landscape`, `square`, `wide`, `tall`, or literal | Canvas size |
| `--quality` | `low`, `medium`, `high`, `auto` | Cost/quality dial |
| `-n, --n` | integer | Number of images |
Expand Down Expand Up @@ -83,6 +85,7 @@ Size policy:
| Mode | Trigger | Endpoint |
|---|---|---|
| Text-to-image | no `-i` | `/v1/images/generations` |
| Atlas Cloud text-to-image | `--provider atlascloud`, no `-i` | `/api/v1/model/generateImage` + prediction polling |
| Reference edit | one or more `-i` | `/v1/images/edits` |
| Inpaint | `-i` + `-m` | `/v1/images/edits` with mask |

Expand Down
2 changes: 1 addition & 1 deletion skills/gpt-image/agents/openai.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface:
display_name: "GPT Image"
short_description: "Generate/edit GPT Image 2 visuals through the packaged CLI"
short_description: "Generate/edit GPT Image 2 visuals through the packaged CLI, with optional Atlas Cloud text-to-image"
default_prompt: "Use $gpt-image to analyze my image request, search the Reference Gallery/craft files, confer on the best direction if needed, then call the packaged gpt-image CLI. Do not write a new image-generation script unless asked to modify this repo."
Loading