Agent skill

PiDeck Image Generation Connector

by ayuayue in ayuayue/PiDeck

Calls an OpenAI-compatible image generation API using PiDeck's separate image-provider config, then saves the result as a local file.

MITAuto-check passedMedia & Creative

SKILL.md written in Chinese; this summary is our English description.

Install PiDeck Image Generation Connector

skills CLI
$ npx skills add ayuayue/PiDeck --skill image-gen -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ayuayue/PiDeck image-gen --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ayuayue/PiDeck.git skills-src && mkdir -p .claude/skills && cp -r skills-src/resources/skills/image-gen .claude/skills/image-gen && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
image-gen
GitHub stars
1k
Token cost
~1.3k tokens
SKILL.md length
283 words
Files
1
Skills in repo
4
Repo updated
First seen
Licence
MIT

At a glance

Calls an OpenAI-compatible image generation API using PiDeck's separate image-provider config, then saves the result as a local file.

  • Works in 2 steps: 读 PiDeck 生图配置(如果用户在用 PiDeck) → 读不到配置 / 用户不在 PiDeck 里:询问用户三样东西——
  • Generating an image, poster, or avatar from a text prompt
  • SKILL.md covers 这是什么, 第一步:确定模型与凭据, 第二步:确定是否有参考图 and 第三步:拼端点 URL, plus 4 more sections
  • Calls curl; reaches api.openai.com and ark.cn-beijing.volces.com

What it does

This skill reads credentials and the model choice from PiDeck's own image-generation config, kept deliberately separate from the chat model configuration, falling back to the last-used provider and model or asking the user directly when that file can't be found. If the user wants image-to-reference editing, it asks for the reference image path and checks the provider actually supports it before sending one.

It builds the generation endpoint URL from the base URL by rule rather than guessing, appending the generations path or swapping in an edits path for reference-image requests, and sends the request in whichever of three OpenAI-compatible dialects the provider needs, always keeping the API key in the request header and never in logs, filenames, or echoed text.

When your agent uses it

  • Generating an image, poster, or avatar from a text prompt
  • Editing an existing image using a reference-image-capable provider
  • Switching between different OpenAI-compatible image providers

Example prompts

  • “Generate a logo for my coffee shop.”
  • “Make a poster based on this reference photo.”
  • “Switch my image generation to a different provider.”

Requirements

  • baseUrl, apiKey, and model id for an OpenAI-compatible image API

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. 读 PiDeck 生图配置(如果用户在用 PiDeck)
  2. 读不到配置 / 用户不在 PiDeck 里:询问用户三样东西——

What it can do on your machine

Read from SKILL.md and the folder at commit 3b93468. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • curl

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • api.openai.com
    • ark.cn-beijing.volces.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

PiDeck Image Generation Connector loads about 1.3k tokens when it runs. Until then it costs about 32 tokens; SKILL.md has 283 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~32
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ayuayue/PiDeck at commit 3b93468, republished under its MIT licence (© ayuayue). 283 words, ~1,307 tokens.

Download SKILL.mdSave it as .claude/skills/image-gen/SKILL.md (or your agent's skills folder).
name
image-gen
description
生成图片。当用户想让 AI 生成图片、插画、海报、头像等图像内容时使用。读取生图供应商配置,调用 OpenAI 兼容的图片生成 API(支持 OpenAI、火山方舟、SiliconFlow 三种方言与参考图),把生成的图片保存到项目目录。

图片生成(image-gen)

这是什么

当用户说「帮我画一张图」「生成一张海报」「做一个 logo」等请求时,用本技能 直接调用生图 API 出图。生成的图片保存为本地文件,交给用户在项目里使用。

生图供应商配置与「会话 LLM」完全分离:生图用的是 PiDeck 的 imagegen.json (或用户直接提供的 baseUrl / apiKey / 模型),不碰 AI 对话用的模型配置。

第一步:确定模型与凭据

生图请求最少需要三样:baseUrl + apiKey + 模型 id。按优先级取:

  1. 读 PiDeck 生图配置(如果用户在用 PiDeck):

    平台配置路径
    Windows 安装版%APPDATA%\PiDeck\imagegen.json(即 C:\Users\<用户>\AppData\Roaming\PiDeck\imagegen.json)
    Windows 便携版<exe 同目录>\data\imagegen.json
    macOS~/Library/Application Support/PiDeck/imagegen.json
    Linux~/.config/PiDeck/imagegen.json

    旧版数据目录名为 pi-desktop,新首启已自动改名为 PiDeck;若 PiDeck 下没有该文件,再回退查同名 pi-desktop 路径。

    文件结构:

    jsonc
    {
      "providers": [
        {
          "id": "ig-1",
          "name": "OpenAI 或 Ark",
          "baseUrl": "https://api.openai.com",   // 根地址,端点按规则推导(见下)
          "apiKey": "sk-xxxx",
          "models": ["gpt-image-1"],             // 该供应商可选模型
          "extraParams": { "size": true, "output_format": false, "watermark": true },
          "referenceMode": "none | edits | image-field",   // 参考图 API 形态
          "apiStyle": "openai | siliconflow"                // 字段名/响应方言
        }
      ],
      "activeProviderId": "ig-1",   // 用户上次选中的供应商
      "activeModel": "gpt-image-1"  // 用户上次选中的模型
    }
    • 默认用 activeProviderId + activeModel:用户上次选的,通常是想要的。
    • 模型必须在该供应商的 models[] 里;如果有多个模型,让用户确认用哪个(用户会指定)。
  2. 读不到配置 / 用户不在 PiDeck 里:询问用户三样东西—— baseUrl、apiKey、模型 id。并顺手问是否需要参考图(图生图)。

第二步:确定是否有参考图

用户可能要求「基于这张图改一下」(图生图 / 局部编辑)。有参考图时:

  • 让用户提供图片的文件路径,或直接上传。
  • 把图片转成 base64 / data URI 备用(见下文各形态)。
  • 若供应商 referenceMode 是 none:该供应商不支持图生图,直接告诉用户 「这个供应商没开启参考图能力」,不要硬发图。

参考图约束(与 PiDeck 一致):≤ 4 张,支持 png/jpeg/webp。

第三步:拼端点 URL

baseUrl 是根地址,生图端点按下面规则推导(不要盲猜):

  • 已经以 /images/generations 结尾 → 直接用。
  • 以版本段结尾(/v1、/v1beta、/api、/api/v3 等)→ 直接追加 /images/generations。
    • 例:https://ark.cn-beijing.volces.com/api/v3 → .../api/v3/images/generations
  • 裸根地址 → 补 /v1 再追加。
    • 例:https://api.openai.com → https://api.openai.com/v1/images/generations

参考图走 edits 形态时,把上面结果里的尾段 /images/generations 换成 /images/edits。

第四步:发请求(三种方言)

鉴权一律 Authorization: Bearer <apiKey>。apiKey 只放 header,绝不写进日志、对话回显、生成的文件名或注释里。

方言 A:OpenAI 兼容(apiStyle=openai,默认)

无参考图或 referenceMode=image-field 时用这个:

bash
curl -sS "$EP/generations" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"model":"gpt-image-1","prompt":"<提示词>","n":1,"response_format":"b64_json"}'
  • 可选字段只在用户/配置显式开启时才发(避免未知字段 400):

    • size:官方尺寸,如 "1024x1024"(OpenAI)或 "2K"(方舟);
    • watermark:true/false(方舟支持,OpenAI 官方不支持);
    • output_format:"png" / "jpeg"(文件编码,seedream 5.0 支持)。
  • response_format:"b64_json" 固定要发:图片直接以 base64 返回,不依赖 24h 临时 url。

  • 参考图(image-field):方舟 seedream 风格,图片作为 data URI 数组放进 JSON 体:

    jsonc
    { "model": "...", "prompt": "...", "n": 1, "response_format": "b64_json",
      "image": ["data:image/png;base64,<base64>"] }
  • 响应取图:data[0].b64_json;如果只有 data[0].url,则再 GET 该 url 下载图片字节。

方言 B:edits(referenceMode=edits,OpenAI gpt-image-1 风格图生图)

参考图多张、局部编辑走 multipart 到 /images/edits:

bash
curl -sS "$EP/edits" \
  -H "Authorization: Bearer $KEY" \
  -F "model=gpt-image-1" -F "prompt=<提示词>" -F "n=1" \
  -F "image[]=@ref1.png" -F "image[]=@ref2.png"
  • image[] 可多张;size 同样只在开启时才加 -F "size=..."。
  • 响应与 generations 一致:取 data[0].b64_json 或 data[0].url。
方言 C:SiliconFlow(apiStyle=siliconflow)

字段名与响应结构都不同:

bash
curl -sS "$EP/generations" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"model":"<模型>","prompt":"<提示词>"}'
  • 尺寸字段是 image_size(不是 size),且仍只在开启 size 时发; 如 "image_size":"1024x1024"。
  • 参考图是单个 string(不认数组),取第一张拼 data URI: "image":"data:image/png;base64,<base64>"。
  • 无 watermark / output_format / response_format 概念,一律不发。
  • 响应取图:images[0].url(无 b64_json、无 data 数组)→ GET 下载该 url 得到图片字节。
下载 url 型图片

若响应只给了 url:curl -sS "<url>" -o out.bin,把返回字节当图片内容保存 (url 一般与 baseUrl 同源,直接取即可)。

第五步:保存结果到项目目录

  1. 把图片字节/解码后的 base64 写进当前项目目录:

    • 默认放 assets/ 或 images/;没有就建,或按用户指定路径。
    • 文件名用简短语义名(英文、连字符),如 hero-banner.png、app-icon.png; 重复则不覆盖,加 -2 后缀。
  2. 图片格式(png / jpeg)以返回内容为准;base64 解码示例:

    bash
    # 假设 base64 已存在变量 B64 里(去掉可能的 data:...;base64, 前缀)
    printf '%s' "$B64" | base64 -d > assets/hero-banner.png
  3. 完成后告诉用户文件保存路径,并把图片信息(尺寸、格式、路径)简述一句。

安全边界(必须遵守)

  • apiKey 绝不回显:不写进对话、日志、脚本注释、文件名;打码再展示。
  • 提示词是用户内容,原样传递;模型/供应商 id 按白名单取。
  • 发请求用参数数组 / 双引号包裹,不要 shell 拼插不可信内容。
  • 失败时把服务端返回的错误正文给用户看(脱敏),帮助判断是 key 错、baseUrl 错还是额度/审核拒绝。

常见失败与排查

现象原因处理
401 / 403apiKey 错或没权限让用户核对 key
404 / 405baseUrl 拼错端点按第三步规则重算 URL
400 unknown field发了厂商不支持的字段(size/watermark/output_format)去掉未开启的可选字段重试
返回空、没有图片方言不匹配(如把 SiliconFlow 当 OpenAI 读)按第四步对应方言解析响应
网络不通需要代理国内访问 OpenAI 官方可提示用代理(本地端口 7890)

© ayuayue, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in resources/skills/image-gen of ayuayue/PiDeck.

Open the folder on GitHubat commit 3b93468

Compare with similar skills

PiDeck Image Generation Connector next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

PiDeck Image Generation Connector compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
PiDeck Image Generation Connector this skillayuayue/PiDeck1k—~1.3kAutomated safety check: PassMIT
AI Image Generation and Editingzhayujie/CowAgent47k—~1.3kAutomated safety check: PassMIT
GPT Image Generation CLIwuyoscar/GPT-Image2-Skill5.7k—~2.5kAutomated safety check: NotesMIT
Imagegentheowenyoung/home1154 repos~4.8kAutomated safety check: PassApache-2.0
Openai Image Gentrpc-group/trpc-agent-go1.9k12 repos~843Automated safety check: PassApache-2.0
Image Generationonyx-dot-app/onyx32k1 repos~1.7kAutomated safety check: PassCustom licence

Similar skills

  • Generates or edits images from text prompts through a Python script that picks an image backend based on which API keys are configured.

    47k GitHub stars~1.3k tokensUpdated today
    Media & CreativeAuto-check passed
  • GPT Image Generation CLI

    wuyoscar/GPT-Image2-Skill

    Generates and edits images with GPT Image 2 or 2.5 through a packaged CLI and a prompt gallery, after settling which model fits the request.

    5.7k GitHub stars~2.5k tokensUpdated 9 days ago
    Media & CreativeAuto-check: notes
  • Imagegen

    theowenyoung/home

    Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts.

    115 GitHub starsUsed in 4 repos~4.8k tokens
    Media & CreativeAuto-check passed
  • Openai Image Gen

    trpc-group/trpc-agent-go

    Batch-generate images via OpenAI Images API. An agent skill from trpc-group/trpc-agent-go.

    1.9k GitHub starsUsed in 12 repos~843 tokens
    Media & CreativeAuto-check passed
  • Image Generation

    onyx-dot-app/onyx

    Generate or edit raster images (photos, illustrations, textures, sprites, mockups, logos, infographics) using the workspace's configured image-generation provider via onyx-cli image.

    32k GitHub starsUsed in 1 repo~1.7k tokens
    Media & CreativeAuto-check passed
  • BlockRun Image Generation

    BlockRunAI/ClawRouter

    Generates or edits images through ClawRouter's local image API, with a choice of models and sizes and payment handled automatically through x402.

    6.6k GitHub stars~2.1k tokensUpdated 4 days ago
    Media & CreativeAuto-check passed

More from ayuayue/PiDeck

  • MCP Setup

    ayuayue/PiDeck

    帮用户接入/配置 MCP(Model Context Protocol)服务。当用户说「帮我接 MCP」「连上某个服务的 MCP」「配置 Model Context Protocol」「加个工具服务器」「为什么 MCP 连不上」等时使用。按服务官方文档把配置写进 pi 的 mcp.json,并用 pi mcp list 验证连接,全程不破坏用户已有配置。

    1k GitHub stars~650 tokensUpdated today
    Auto-check passed
  • Helps show a model provider's usage, balance or quota in PiDeck: checks built-in support, points to the dialog templates, or writes a custom probe entry.

    1k GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • Diagnoses problems in the PiDeck desktop app from a redacted environment report, matching health checks to known failure patterns with fix steps.

    1k GitHub stars~566 tokensUpdated today
    Auto-check passed

Works with

Questions about PiDeck Image Generation Connector

What does PiDeck Image Generation Connector do?

Calls an OpenAI-compatible image generation API using PiDeck's separate image-provider config, then saves the result as a local file. This skill reads credentials and the model choice from PiDeck's own image-generation config, kept deliberately separate from the chat model configuration, falling back to the last-used provider and model or asking the user directly when that file can't be found. If the user wants image-to-reference editing, it asks for the reference image path and checks the provider actually supports it before sending one.

When should I use PiDeck Image Generation Connector?

PiDeck Image Generation Connector fits situations like: generating an image, poster, or avatar from a text prompt; editing an existing image using a reference-image-capable provider; switching between different OpenAI-compatible image providers.

How do I install PiDeck Image Generation Connector in Claude Code?

Run `npx skills add ayuayue/PiDeck --skill image-gen -a claude-code`. Or copy the skill folder (resources/skills/image-gen in ayuayue/PiDeck) into .claude/skills/image-gen in your project. Claude Code loads it when a task matches its description.

How do I install PiDeck Image Generation Connector in Codex?

Run `npx skills add ayuayue/PiDeck --skill image-gen -a codex`. Or copy the skill folder (resources/skills/image-gen in ayuayue/PiDeck) into .agents/skills/image-gen in your project. Codex loads it when a task matches its description.

Can I use PiDeck Image Generation Connector in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ayuayue/PiDeck --skill image-gen -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/image-gen, .gemini/skills/image-gen, .github/skills/image-gen and .opencode/skills/image-gen in your project.

What does PiDeck Image Generation Connector need to run?

Going by SKILL.md and its folder, PiDeck Image Generation Connector needs the command-line tools its instructions call (curl). Our summary lists: baseUrl, apiKey, and model id for an OpenAI-compatible image API.

Does PiDeck Image Generation Connector access the network?

SKILL.md names 2 domains. In commands or code: api.openai.com and ark.cn-beijing.volces.com; the agent is likely to contact these when it follows the instructions. This is read from the text; nothing was executed.

Is PiDeck Image Generation Connector safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does PiDeck Image Generation Connector use?

PiDeck Image Generation Connector is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does PiDeck Image Generation Connector use?

About 1.3k tokens (SKILL.md is roughly 5.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to PiDeck Image Generation Connector?

Skills that share tags, products or a category with PiDeck Image Generation Connector: AI Image Generation and Editing (zhayujie/CowAgent, 47k stars), GPT Image Generation CLI (wuyoscar/GPT-Image2-Skill, 5.7k stars), Imagegen (theowenyoung/home, 115 stars) and Openai Image Gen (trpc-group/trpc-agent-go, 1.9k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains PiDeck Image Generation Connector?

ayuayue (a GitHub user) maintains it in ayuayue/PiDeck, which has 1,034 GitHub stars. The repository holds 4 skills in this directory. The repository was last updated on October 9, 2026.

Source: ayuayue/PiDeck on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.