---
name: gen-img-gpt
description: Generate images through the local OpenAI-compatible image API using model cx/gpt-5.5-image. Use when the user asks to create, generate, render, or test images with GPT image generation, especially via the local endpoint /v1/images/generations on 192.168.40.11:20128.
---

# Gen Img GPT

Use this skill to generate images with the local OpenAI-compatible image endpoint and model:

```text
cx/gpt-5.5-image
```

## Required environment

Set the API key before running scripts:

```bash
export GEN_IMG_API_KEY='YOUR_KEY'
```

Optional endpoint override:

```bash
export GEN_IMG_BASE_URL='http://192.168.40.11:20128'
```

Default endpoint:

```text
http://192.168.40.11:20128/v1/images/generations
```

## Generate image

Use the bundled script:

```bash
scripts/gen_img_gpt.py \
  --prompt 'A cute cat wearing a hat' \
  --output cat.png
```

Useful options:

```bash
--size auto
--quality auto
--background auto
--image-detail high
--output-format png
--n 1
```

## Notes

- Do not hard-code API keys in shared files.
- If the API returns server-sent events or streaming chunks, the script attempts to extract image URLs or base64 image payloads.
- If the API returns a URL, the script downloads it to `--output` when provided.
- If the API returns base64, the script decodes it to `--output`.

See `references/api.md` for raw curl and response handling notes.
