new-imagegen
Skill4 starsChanged 7 months agoMITView on GitHub
Default replacement image generation and image editing skill for Codex API-key environments where the built-in imagegen tool is unavailable. Use for any request to create images, generate visual assets, make illustrations, render concepts, create product/mockup images, edit or restyle images, or generate from reference images, unless the user explicitly requires another provider or a repo-native vector/code asset.
- Reads credentials
In this repository5 other files it gives its agents.
- content-to-pdfSkill
- longform-html-infographicSkill
- ppt-designSkill
- technical-book-writerSkill
- xiaohongshu-tuwenSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 5 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill as the default raster image generation tool in Codex API-key login environments where built-in image generation is …
- Very specific: line 14
Use POST https://apiopencc.com/v1/images/generations for normal text-to-image generation.
- Very specific: line 15
Use POST https://apiopencc.com/v1/images/edits when reference images are provided.
- Distinctive: line 23
Use this skill for:
- Very specific: line 30
Do not use it when the user specifically needs editable SVG/vector/code-native graphics, chart rendering, or a screenshot of an existing …
- Distinctive: line 34
Use the bundled script when available:
- Distinctive: line 69
If this skill is copied outside the repository, resolve the script path relative to this skill:
- Distinctive: line 149
Use the bundled script unless there is a reason to write custom integration code.
- Very specific: line 152
If calling manually, extract data[].b64_json from /v1/images/generations or /v1/images/edits, or output[].result from /v1/responses.
- Very specific: line 153
Verify with file output.png or sips -g pixelWidth -g pixelHeight output.png on macOS.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
New Imagegen
Use this skill as the default raster image generation tool in Codex API-key login environments where built-in image generation is unavailable. It supports text-to-image and reference-image-guided generation.
The implementation uses apiopencc's OpenAI-compatible gpt-image-2 route, but users do not need to mention apiopencc when asking for images.
Key facts
- Use
POST https://apiopencc.com/v1/images/generationsfor normal text-to-image generation. - Use
POST https://apiopencc.com/v1/images/editswhen reference images are provided. The bundled script sends references as multipart image files and falls back to/v1/responses, then/v1/images/generationsreference fields if needed. - The request model should be
gpt-image-2unless the user explicitly asks to testgpt-image2. - Text-to-image success returns base64 in
data[].b64_json. - Reference-image success may return base64 in
data[].b64_jsonfor/images/edits, or inoutput[].resultwheretype == "image_generation_call"for/responses. - For reference images, pass local files or remote URLs with
--reference-image. The bundled script handles local multipart uploads, remote URL downloads, and fallback endpoint variants.
When to use
Use this skill for:
- Text-to-image generation.
- Image variation or restyling from one or more reference images.
- Product/mockup/illustration/key visual generation for apps, sites, decks, documents, or assets.
- Generating bitmap textures, sprites, backgrounds, icons, and concept images.
Do not use it when the user specifically needs editable SVG/vector/code-native graphics, chart rendering, or a screenshot of an existing app.
Preferred script
Use the bundled script when available:
export APIOPENCC_API_KEY='...'
python3 scripts/apiopencc_gpt_image_2.py \
"A red cube on a clean white background" \
--output image.png \
--size 1024x1024 \
--quality low \
--format pngReference-image generation:
export APIOPENCC_API_KEY='...'
python3 scripts/apiopencc_gpt_image_2.py \
"Use the reference image composition, but make it a clean studio product render in teal and white." \
--reference-image reference.png \
--output result.png \
--size 1024x1024 \
--quality low \
--format pngReference-image generation defaults to /v1/images/edits. To force another route during debugging:
python3 scripts/apiopencc_gpt_image_2.py \
"Restyle this reference image." \
--reference-image reference.png \
--endpoint responses \
--output result.pngIf this skill is copied outside the repository, resolve the script path relative to this skill:
python3 skills/new-imagegen/scripts/apiopencc_gpt_image_2.py "prompt" -o image.pngRaw API shape
{
"model": "gpt-image-2",
"input": "Generate a product photo of a red cube on a white background.",
"tools": [
{
"type": "image_generation",
"size": "1024x1024",
"quality": "low",
"output_format": "png"
}
]
}Raw API shape with a reference image:
Preferred /v1/images/edits multipart fields:
model=gpt-image-2
prompt=Use this reference image, but turn it into a polished product render.
size=1024x1024
quality=low
response_format=b64_json
image[]=@reference.pngFallback /v1/responses shape:
{
"model": "gpt-image-2",
"input": [
{
"role": "user",
"content": [
{
"type": "input_text",
"text": "Use this reference image, but turn it into a polished product render."
},
{
"type": "input_image",
"image_url": "data:image/png;base64,..."
}
]
}
],
"tools": [
{
"type": "image_generation",
"action": "edit",
"size": "1024x1024",
"quality": "low",
"output_format": "png"
}
]
}Optional image tool fields:
size: for example1024x1024.quality:low,medium,high, orauto.output_format:png,jpeg, orwebp.background:opaque,transparent, orautowhen needed.action:generatefor text-only generation,editwhen using reference images. The script sets this automatically.endpoint: script-only option,auto,images,edits, orresponses. Useautoby default.
Workflow
- Get the key from
APIOPENCC_API_KEY; do not print or commit API keys. - Use the bundled script unless there is a reason to write custom integration code.
- For normal text-to-image, let the script use
/v1/images/generations. - For reference images, pass each image with
--reference-image; the script first uses/v1/images/editsmultipart, then falls back to/v1/responses, then/v1/images/generationsreference fields. - If calling manually, extract
data[].b64_jsonfrom/v1/images/generationsor/v1/images/edits, oroutput[].resultfrom/v1/responses. - Verify with
file output.pngorsips -g pixelWidth -g pixelHeight output.pngon macOS.
Curl fallback
curl https://apiopencc.com/v1/images/generations \
-H "Authorization: Bearer $APIOPENCC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A red cube on a white background",
"size": "1024x1024",
"quality": "low",
"response_format": "b64_json"
}' \
| jq -r '.data[0].b64_json' \
| base64 -d > image.pngDoes 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
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.

