Files
Genarrative/.codex/skills/gpt-image-2-apimart/SKILL.md
2026-05-09 18:24:08 +08:00

3.0 KiB

name, description
name description
gpt-image-2-apimart Generate or inspect project image assets through this repository's VectorEngine gpt-image-2 workflow. Use when Codex needs to create puzzle template sample images, reproduce the server-rs gpt-image-2 request body, dry-run image prompts, batch-generate local project thumbnails, or debug VECTOR_ENGINE_BASE_URL / VECTOR_ENGINE_API_KEY image-generation configuration without exposing secrets. The directory name is historical.

gpt-image-2 VectorEngine

Use this skill for project-local image asset generation that must match the repository's server-rs VectorEngine gpt-image-2-all path. The folder still contains apimart in its name for compatibility with existing local plugin references.

Workflow

  1. Read the local task and decide whether the image is project-bound.

  2. Prefer scripts/generate-template-samples.mjs for puzzle template thumbnails or small batches.

  3. Run dry-run first:

    node .codex/skills/gpt-image-2-apimart/scripts/generate-template-samples.mjs --dry-run
    
  4. If dry-run looks correct and the user asked for real assets, run live generation with a small limit:

    node .codex/skills/gpt-image-2-apimart/scripts/generate-template-samples.mjs --live --limit 6
    
  5. Save final project assets under public/ or another explicitly requested workspace path.

  6. Never print VECTOR_ENGINE_API_KEY. Report only whether configuration exists.

Request Contract

The repository image path uses:

POST {VECTOR_ENGINE_BASE_URL}/v1/images/generations
Authorization: Bearer {VECTOR_ENGINE_API_KEY}
Content-Type: application/json

Default body:

{
  "model": "gpt-image-2-all",
  "prompt": "<prompt>",
  "n": 1,
  "size": "1024x1024"
}

For a reference image, add:

{
  "image": ["data:image/png;base64,..."]
}

Accept image output from data[].url, data[].b64_json, or direct nested url fields. VectorEngine GPT-image-2-all currently returns synchronously; do not poll APIMart task endpoints.

Environment

Load environment values from process env first, then .env.secrets.local, .env.local, and .env.example.

Required for live generation:

  • VECTOR_ENGINE_BASE_URL
  • VECTOR_ENGINE_API_KEY

Optional:

  • VECTOR_ENGINE_IMAGE_REQUEST_TIMEOUT_MS

If the key or base URL is missing, stop after dry-run or explain the missing configuration. Do not ask the user to paste the key in chat.

Prompt Rules

  • Use Chinese prompts when generating project puzzle templates.
  • Keep template samples square, clear, image-only, and suitable for puzzle thumbnails.
  • Avoid text, watermark, UI chrome, buttons, borders, and tutorial overlays.
  • Include local negative constraints in the prompt instead of relying on provider-specific negative prompt fields.

Resources

  • scripts/generate-template-samples.mjs: dry-run or live-generate puzzle template sample thumbnails.
  • assets/puzzle-template-prompts.json: default prompt list consumed by the script.