44 lines
2.7 KiB
Markdown
44 lines
2.7 KiB
Markdown
---
|
|
name: pinai-imagegen
|
|
description: Generate a local PNG through the built-in PinAI Images API. Use when the user asks to create or edit raster images with PinAI, needs a local PNG, or explicitly invokes $pinai-imagegen.
|
|
---
|
|
|
|
# PinAI Image Generator
|
|
|
|
Generate one local PNG through PinAI. The API URL is built in as `https://api.pinaic.com/v1`; customers only configure `PINAI_API_KEY`. The default model is `gpt-image-2`. Keep credentials only in environment variables: never request, print, save, commit, or put an API key in a command, prompt, or output file.
|
|
|
|
## 客户交付:客户只需双击一次
|
|
|
|
1. 把整个 `pinai-imagegen` 文件夹压缩成 ZIP,发给客户;ZIP 中已包含 `设置 PinAI Key.cmd`。
|
|
2. 客户双击 `设置 PinAI Key.cmd`,在弹窗中粘贴自己的 Key,点击“保存 Key”。Key 以圆点隐藏,并保存到当前 Windows 用户环境变量;不需要打开 PowerShell 或填写 URL。
|
|
3. 客户完全退出并重新打开 Codex。
|
|
|
|
不要把真实 Key 写进 ZIP、技能文件或 Codex 聊天。
|
|
|
|
然后让客户把 ZIP 和以下整段文字一起发给 Codex:
|
|
|
|
```text
|
|
请把附件中的 pinai-imagegen 安装为我的本地 Codex skill。此电脑已经配置好 PINAI_API_KEY;不要向我索取、显示、输出或保存该 Key。以后当我说“生图”、"生成图片",或显式调用 $pinai-imagegen 时,请使用这个技能通过 PinAI 生成 PNG,并返回图片文件路径、生成耗时、实际尺寸和文件大小。现在请确认技能已可用。
|
|
```
|
|
|
|
安装后,客户只需直接对 Codex 说,例如:
|
|
|
|
```text
|
|
用 PinAI 生图:一只戴宇航服的橘猫,电影海报风格。
|
|
```
|
|
|
|
或:
|
|
|
|
```text
|
|
$pinai-imagegen 生成一张赛博朋克风格的上海夜景,竖版海报构图。
|
|
```
|
|
|
|
## Workflow
|
|
|
|
1. Confirm the subject, visual style, size or aspect request, and output path. Do not ask customers for an API URL.
|
|
2. Invoke `scripts/generate_image.py` with a descriptive prompt and a new `.png` output path.
|
|
3. Return the saved path and the CLI's request, download, save, and total elapsed times; actual dimensions; requested size and quality; lossless PNG properties; and file size. Do not perform a post-generation visual inspection unless the user explicitly requests review or revision.
|
|
4. Report provider errors without exposing credentials. If the endpoint rejects the model or payload, ask for the provider's documented model name or schema.
|
|
|
|
The client accepts `data[0].b64_json` and `data[0].url` responses. It only downloads returned images through HTTPS, does not send the API key while downloading them, and writes the final PNG atomically. Metadata is read from the PNG header only, with no visual review step.
|