Install
$ agentstack add skill-syh1906-openai-compatible-imagegen-openai-compatible-imagegen ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
OpenAI-Compatible Image Generation
Use this skill to call the bundled image generation script. Do not rewrite the API client inline.
Workflow
- Run
infofirst to inspect the local configuration. Ifauth.jsonis missing, runinit. - Choose the mode:
generate: text-to-imageedit: image editing, inpainting, or reference-image generationbatch: JSONL batch generation with limited concurrencyinfo: configuration summary
- Resolve parameters in this order:
- explicit user request
- per-row batch parameters
- agent judgment from the prompt
auth.jsondefaults
- Choose quality deliberately:
- use
lowormediumfor drafts and broad exploration - use
highfor final assets, UI, posters, covers, dense text, or user requests for finished detail - use
autoonly when leaving the decision to the backend is acceptable
- Before execution, decide output path, image count, aspect/size, resolution, quality, transparency intent, and reference images.
- Call
scripts/imagegen.py. - Report output image paths, manifest path, success count, failure count, and short failure summaries.
Never read, print, quote, or summarize the secret value in auth.json.
For explicit post-processing, delivery-size normalization, image inspection, or grid splitting, read references/postprocess.md first. Do not load it for ordinary image generation.
Local Auth
The private config file is always auth.json in this skill directory. It is local-only and must not be committed.
Initialize it:
$SkillDir = "$env:USERPROFILE/.codex/skills/openai-compatible-imagegen"
python "$SkillDir/scripts/imagegen.py" init
Initialize non-secret fields:
$SkillDir = "$env:USERPROFILE/.codex/skills/openai-compatible-imagegen"
python "$SkillDir/scripts/imagegen.py" init `
--base-url "https://example.com/v1" `
--model "gpt-image-2" `
--api-key-env "OPENAI_API_KEY"
API key options:
- Put the key directly in
auth.jsonasapi_key. - Put an environment variable name in
api_key_env, then set that environment variable.
If both are present, the script uses api_key. If api_key is still the template placeholder, the script reads api_key_env.
Config fields:
base_url: OpenAI-compatible API base URL, usually ending in/v1.api_key: API key stored directly in localauth.json.api_key_env: optional environment variable name for the API key.model: default image model, for examplegpt-image-2.capabilities.transparent_background: whether the backend supportsbackground=transparent.defaults: weak defaults used only when parameters are missing.postprocess.enabled: optional post-processing opt-in. Missing meansfalseand preserves legacy behavior.
Commands
All commands can be run from any working directory.
Configuration summary:
$SkillDir = "$env:USERPROFILE/.codex/skills/openai-compatible-imagegen"
python "$SkillDir/scripts/imagegen.py" info
Text-to-image:
$SkillDir = "$env:USERPROFILE/.codex/skills/openai-compatible-imagegen"
python "$SkillDir/scripts/imagegen.py" generate `
-p "Warcraft 3 style frost skill icon, single rune, centered, no text" `
-f "outputs/frost-rune.png" `
--aspect 1:1 `
--resolution 1K `
--quality high
Reference-image edit:
$SkillDir = "$env:USERPROFILE/.codex/skills/openai-compatible-imagegen"
python "$SkillDir/scripts/imagegen.py" edit `
-p "Convert this to a dark magic UI style" `
-i "input.png" `
-f "outputs/dark-ui.png"
Batch generation:
$SkillDir = "$env:USERPROFILE/.codex/skills/openai-compatible-imagegen"
python "$SkillDir/scripts/imagegen.py" batch `
--input "prompts.jsonl" `
--out "outputs/imagegen" `
--concurrency 3
Transparent-background asset intent:
$SkillDir = "$env:USERPROFILE/.codex/skills/openai-compatible-imagegen"
python "$SkillDir/scripts/imagegen.py" generate `
-p "Centered fire orb game item asset, no text" `
-f "outputs/fire-orb.png" `
--asset `
--transparent
Parameters
Core parameters:
-p, --prompt: required forgenerateandedit.-f, --file: output file. If omitted, the script writes to the current directory.-i, --image: reference image. Repeat for multiple images. Uses the edit endpoint.-m, --mask: mask image for edit mode.--size: examples include1024x1024,1536x1024,1024x1536,2048x2048,3840x2160.--aspect:1:1,16:9,4:3,3:4, or9:16. Use this when the user describes shape but not exact pixels.--resolution:1K,2K, or4K. Used with--aspectto choose a concrete supported size.--quality:low,medium,high, orauto.--n: number of images returned by one request.--format:png,jpeg, orwebp.--background:auto,opaque, ortransparent. The script sendstransparentonly when the config declares backend support.--transparent: transparent-background asset intent shortcut. Forces PNG and injects transparent-background constraints into the prompt. If supported, also sendsbackground=transparent.--asset: asset shortcut. Prefers PNG and is suitable for icons, game items, textures, and sprites.--concurrency: limited batch concurrency.
Read references/parameters.md for detailed behavior.
Batch Format
batch input is JSONL, one task per line. See examples/batch.example.jsonl.
Common fields:
idmodepromptfilesizeaspectresolutionqualitynformatbackgroundtransparentassetimagesmaskmodeltimeout
Batch mode uses limited concurrency. Concurrency priority:
command --concurrency > auth.json defaults.concurrency > 3
Do not add model switching, endpoint switching, background removal, retries with altered parameters, or any other fallback strategy unless the user explicitly asks for it.
Post-processing is also opt-in. Unless auth.json postprocess.enabled=true or the user explicitly requests normalization, resizing, cropping, image inspection, or grid splitting, keep the legacy generate/edit/batch behavior.
Transparent Assets
When the user asks for assets, icons, items, textures, sprites, transparent background, or transparent PNG, prefer --asset. Add --transparent when the user explicitly wants a transparent background.
Transparency has two layers:
- prompt layer: always available; asks the model for an isolated subject and alpha-friendly edges
- API parameter layer: only sent when
capabilities.transparent_background=true
When background=transparent or --transparent conflicts with the selected model and resolution, the script stops before sending the request. Ask the user to choose whether to switch to a transparent-capable model or keep the current model with background=auto.
Do not promise a real alpha channel unless the backend actually returns one. Do not add local background-removal post-processing unless the user explicitly asks for that implementation.
Output
The script saves images and writes manifest.json in batch mode.
Report only:
- output image paths
- manifest path
- success and failure counts
- short failure summaries
Do not show API keys, full request headers, or config content that contains secrets.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: Syh1906
- Source: Syh1906/openai-compatible-imagegen
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.