agentleFS
boltguoboltguo/skills/openai-image-gen/SKILL.md

openai-image-gen

Skill0 starsChanged 30 days agoMITView on GitHub

Generate and edit images through the OpenAI Images API using the global OPENAI_API_KEY. Use for OpenAI API 生图、改图, flare/sunburst model controls, consistent character views, or continuing an established OpenAI API image workflow. Does not select Gemini or replace an explicitly requested built-in image tool.

  • Reads credentials

22 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use sonos, healthcheck and 3 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • emanueleieloSkill

    sonos

    Control Sonos speakers: discover, play/pause, volume, grouping, favorites, and queue management via sonos CLI.

    Also in 3 projects that use this

  • TermiX-officialSkill

    healthcheck

    Host security hardening and risk-tolerance configuration for OpenClaw deployments. Use when a user asks for security audits, firewall/SSH/update hardening, risk posture, exposure review, OpenClaw cron scheduling for periodic checks, or version status checks on a machine running OpenClaw (laptop, workstation, Pi, VPS).

    Also in 11 projects that use this

  • GoogleSkill

    gh-issues

    Fetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]

    Also in 9 projects that use this

  • TermiX-officialSkill

    xurl

    A CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.

    Also in 8 projects that use this

  • emanueleieloSkill

    whatsapp

    Send and read WhatsApp messages via the wacli CLI. Search chats, view history, send text and files to contacts or groups.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 18 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use the bundled script for the user's OpenAI API image workflow.

    line 8
  2. Very specific:

    Use Python 3.9+ with openai installed.

    line 12
  3. Very specific:

    Read OPENAI_API_KEY from the process environment only.

    line 40
  4. Distinctive:

    Use an available configured key before asking the user to change setup.

    line 48

“Common” is measured: kept by at least 6 in 10 of the 18 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

OpenAI Image Generation

Use the bundled script for the user's OpenAI API image workflow. It reads the global OPENAI_API_KEY, generates PNGs, and saves the exact prompt and request metadata alongside each image.

Run

Use Python 3.9+ with openai installed. If needed, create an isolated virtual environment and install scripts/requirements.txt; do not copy an existing virtual environment into the skill.

python <skill-path>/scripts/generate_image.py "图片描述"
python <skill-path>/scripts/generate_image.py --prompt-file /absolute/path/prompt.txt --size 1024x1024
python <skill-path>/scripts/generate_image.py "保持人物和服饰,转为严格侧面" --image /absolute/path/front.png --model sunburst

Defaults: flare → gpt-image-2.6-flare, 1536×864 (16:9), medium quality, one PNG. sunburst resolves to gpt-image-2.6-sunburst. These aliases have no date suffix. An explicit complete model ID is passed through unchanged, including gpt-image-2.5-flare or gpt-image-2.5-sunburst when requested; do not silently upgrade a named model.

ParameterBehavior
--modelflare (default), sunburst, or an exact model ID
--sizeExact WIDTHxHEIGHT, or auto; default 1536x864
--qualitylow, medium (default), high, xhigh, max, auto
--complexityOptional low, medium, high for GPT Image 2.6; separate from rendering quality
-i, --imageOne or more local reference paths; repeatable, up to 16 total
--no-referenceExplicit text-only generation; cannot be combined with --image
--prompt-fileRead the exact UTF-8 prompt from a file instead of the positional prompt
--output-dirDestination for this run; default ./openai-images/<timestamp>-<topic>/
--timeoutPer-request timeout in seconds; default 180
--max-retriesSDK retries; default 1, allowed 0–2; no additional retry loop
--dry-runValidate and print a request summary without a key, API call, or output files

An output directory contains image.png, prompt.md, request.json, and result.json. Standard output is one JSON result with absolute paths. Progress goes to standard error. Existing output files are preserved; choose a new directory for another attempt. result.json reports the actual pixel dimensions and whether they match the request.

Credentials

Read OPENAI_API_KEY from the process environment only. The script has no key argument, .env loader, or credential file. Do not print environment contents, put a key in the prompt/command, or copy credentials into this repository.

On this user's macOS setup, the global key may only be loaded by interactive zsh. If the current process cannot see it, use the existing shell configuration without exposing its contents:

zsh -ic 'exec "$@"' openai-image-gen /absolute/path/to/python /absolute/path/to/skill/scripts/generate_image.py --prompt-file /absolute/path/prompt.txt --size 1024x1024

Use an available configured key before asking the user to change setup. Report missing configuration without requesting the secret in chat. A restricted key needs the Images endpoint permission; a Models-list permission is unnecessary for generation. Do not require a models-list probe before every run.

Workflow

  1. Resolve the subject, exact visible text, requested aspect ratio/resolution, and whether reference images are allowed. Preserve explicit user choices. Use the common sizes below when mapping natural-language requests.
  2. Write a complete prompt. Keep constraints specific to this image. For clean artwork, distinguish smooth skin/fabric/shadow surfaces from intentional effects: use layered flowing light, water, volumetric dust and localized directional sparks rather than blanket grain or uniform particle scatter. Preserve rich effects when the user only wants cleaner surface textures. Do not impose this look when the user requests grain or textured painting.
  3. Choose the operation deliberately: no --image means images.generate(), while passing --image means images.edit(). When the user says “不要参考图 / 从头生成”, pass --no-reference; do not upload earlier outputs. For edits, state what may change and what must remain fixed. Read references/multiview.md only for character turnaround/modeling views.
  4. Run once with the selected model. The CLI makes at most the configured retries. If it still fails, report the sanitized error and completed outputs. Do not stack repeated retries, regenerate successful views, or change model/provider silently. A timeout may have reached the server; check for saved output before another attempt.
  5. Inspect the actual saved image, including requested text, hands/feet, angle and visual consistency. Check actual dimensions in result.json. Correct a demonstrated issue within the user's scope, with a focused prompt. Retain prior versions. The script never resizes an image to conceal a size mismatch.
  6. Show the result inline with an absolute image path and link the output folder or image. Report the API model and whether it was generated from text or edited with references. Provide the saved prompt. For a set, deliver all separate PNGs with clear view names; a contact sheet and ZIP are useful companions.

Common sizes

The pixel dimensions are authoritative; map the user's ratio and resolution together.

RequestSize
Default 16:91536x864
1K, 1:11024x1024
2K, 16:9 / 9:162048x1152 / 1152x2048
2K, 3:4 / 4:31536x2048 / 2048x1536
2K, 1:12048x2048
4K, 16:9 / 9:163840x2160 / 2160x3840

The CLI validates the documented raster range used here: edges divisible by 16, longest edge at most 3840, ratio at most 3:1, and 655,360–8,294,400 total pixels. Do not silently substitute an invalid size. Other models may have different limits; verify official documentation before broadening the supported range.

Official OpenAI documentation

Defaults were checked on 2026-11-12. Preserve the user's explicit model, and consult these official sources when availability or parameters need verification:

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.