--- name: gpt-image-2-apimart description: Generate or inspect project image assets through this repository's APIMart OpenAI-compatible 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 APIMART_BASE_URL / APIMART_API_KEY image-generation configuration without exposing secrets. --- # gpt-image-2 APIMart Use this skill for project-local image asset generation that must match the repository's `server-rs` APIMart `gpt-image-2` path. ## 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: ```powershell 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: ```powershell 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 `APIMART_API_KEY`. Report only whether configuration exists. ## Request Contract The repository image path uses: ```text POST {APIMART_BASE_URL}/images/generations Authorization: Bearer {APIMART_API_KEY} Content-Type: application/json ``` Default body: ```json { "model": "gpt-image-2", "prompt": "", "n": 1, "size": "1:1" } ``` For a reference image, add: ```json { "image_urls": ["data:image/png;base64,..."] } ``` Poll async responses with: ```text GET {APIMART_BASE_URL}/tasks/{task_id} ``` Accept image output from `data[].url`, `data[].b64_json`, direct nested `url` fields, or async task results. ## Environment Load environment values from process env first, then `.env.secrets.local`, `.env.local`, and `.env.example`. Required for live generation: - `APIMART_BASE_URL` - `APIMART_API_KEY` Optional: - `APIMART_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.