mcpField
S
sub2api-4k-image-generator-ts

sub2api-4k-image-generator-ts

github.com/fengyunzaidushiCreative & media1248 installsUpdated 17w ago
Repository

About sub2api-4k-image-generator-ts

A skill for generating 4K images through sub2api with TypeScript/Node, aimed at users who want this workflow instead of Codex’s built-in image tool. It includes a compiled entry point and a Python fallback, with streaming and diagnostic handling.

Key features

  1. 01Generate 4K images via sub2api
  2. 02Run compiled JavaScript or TypeScript source
  3. 03Use a standalone Python fallback
  4. 04Stream generation and save output files
  5. 05Report partial files and diagnostics

Use cases

  1. 01Generate 4K images using a sub2api deployment
  2. 02Test generation with dry-run mode
  3. 03Develop or debug the TypeScript script

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/fengyunzaidushi/sub2api-4k-image-generator-ts --skill sub2api-4k-image-generator-ts

After installing, type/sub2api-4k-image-generator-tsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

.env.example
openai_4k_image_request.py
package-lock.json
package.json
tsconfig.json
agents/
openai.yaml
scripts/
args.ts
cli.ts
env.ts
errors.ts
openai_4k_image_generator.ts
payload.ts
request.ts
save.ts
sse.ts
test.ts
types.ts

Details

From the project README

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

  1. Work from the skill root that contains this SKILL.md.
  2. Ensure .env or the process environment provides:
SUB2API_BASE_URL=https://your-sub2api.example.com
SUB2API_API_KEY=sk-...
  1. Prefer the compiled JS entrypoint for normal use:
node .\dist\openai_4k_image_generator.js `
  "剑仙,云海,发光长剑,无文字无水印" `
  --size 3840x2160 `
  --quality high `
  --output-dir output
  1. For development, run the TypeScript source:
npx tsx .\scripts\openai_4k_image_generator.ts "test prompt" --dry-run
  1. 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.

  1. Report final image paths, partial image paths, and any Cloudflare/SSE diagnostic in plain language. Never print full API keys.

Notes

  • Replace SUB2API_BASE_URL with the user's own deployed sub2api domain.
  • Treat 4K as explicit pixel sizes: 3840x2160 or 2160x3840.
  • Streaming is enabled by default to avoid Cloudflare 524 during slow 4K generation.
  • *-partial-XX.png files are diagnostics only; final images are saved as <prefix>-XX.png.
  • openai_4k_image_request.py is a standalone Python fallback that supports /v1/images/generations, /v1/responses, --input-image, streaming SSE, and --dry-run.
  • Run npm test after editing the skill.
  • The bundled dist/ directory is enough for normal use; use scripts/ only for development or debugging.

Comments

Markdown supported