Lab entry

ChatGPT Image CLI

A macOS Swift CLI that opens ChatGPT in Safari, uses the signed-in subscription already in that browser session, and saves generated images locally.

Tool, Safari automation, image generation April 15, 2026 Live tool

Overview

This is a real tool built for wezen.tech. It exists because the workflow I use here could write and automate code well, but it could not generate images directly from the same ChatGPT subscription already signed into Safari.

Idea or goal. I wanted a direct way to generate site art and other small image assets without bouncing between separate accounts, separate tools, or a manual browser-only loop every time I needed one more variation.

Format. macOS Swift CLI

Focus. Tool, Safari automation, image generation

Why it belongs here. The result is a narrow installer-backed utility that turns an existing ChatGPT Safari session into a practical local image-generation workflow for this site.

Install

Install it with the website-hosted script below. The installer downloads the source bundle from wezen.tech, builds the Swift package locally, and places chatgpt-image in your user bin directory.

curl -fsSL https://wezen.tech/downloads/chatgpt-image-installer.sh | bash
  • macOS only. The tool depends on Safari and AppleScript automation.
  • Before first use, enable Safari > Settings > Developer > Allow JavaScript from Apple Events.
  • Use --reference-image /path/to/current-image.png when you want ChatGPT to create a variation from an existing image.

Interesting problems

  • Driving a modern web app from Swift while still using the real Safari session that already holds the authenticated ChatGPT account.
  • Picking the generated image reliably when the conversation may also contain uploaded reference images and overlay variants.
  • Cleaning up after each run so the tool does not leave a trail of throwaway chats in the sidebar.

Choices that shaped it

  • Kept the CLI in Swift to match the repo rule that tools should be written in Swift when possible.
  • Used Safari plus AppleScript instead of a separate browser profile so the tool could reuse the same signed-in ChatGPT subscription already active on the machine.
  • Archived the temporary conversation after a successful save and added reference-image support so the tool stays useful beyond one-off prompts.