sub2api 4K Image Generator TS
Use this skill when the user wants TypeScript/Node image generation through sub2api rather than Codex's built-in image tool.
Workflow
- Work from the skill root that contains this
SKILL.md. - Ensure
.envor the process environment provides:
SUB2API_BASE_URL=https://your-sub2api.example.com
SUB2API_API_KEY=sk-...
- Prefer the compiled JS entrypoint for normal use:
node .\dist\openai_4k_image_generator.js `
"剑仙,云海,发光长剑,无文字无水印" `
--size 3840x2160 `
--quality high `
--output-dir output
- For development, run the TypeScript source:
npx tsx .\scripts\openai_4k_image_generator.ts "test prompt" --dry-run
- If Node/TypeScript is inconvenient, use the bundled Python request script:
python .\openai_4k_image_request.py "test prompt" --dry-run
Install python-dotenv first if Python reports that dotenv is missing.
- Report final image paths, partial image paths, and any Cloudflare/SSE diagnostic in plain language. Never print full API keys.
Notes
- Replace
SUB2API_BASE_URLwith the user's own deployed sub2api domain. - Treat 4K as explicit pixel sizes:
3840x2160or2160x3840. - Streaming is enabled by default to avoid Cloudflare 524 during slow 4K generation.
*-partial-XX.pngfiles are diagnostics only; final images are saved as<prefix>-XX.png.openai_4k_image_request.pyis a standalone Python fallback that supports/v1/images/generations,/v1/responses,--input-image, streaming SSE, and--dry-run.- Run
npm testafter editing the skill. - The bundled
dist/directory is enough for normal use; usescripts/only for development or debugging.