npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-imagegen

v0.1.3

Published

Pi package for OpenAI/Codex image generation with a local browser studio.

Readme

pi-imagegen

npm version license

A Pi package for generating images with your existing OpenAI/Codex subscription session.

pi-imagegen adds an agent-callable imagegen tool, a /img command namespace, and a local browser studio for visual image workflows.

What it does

  • Generates images through Pi's existing openai-codex OAuth login.
  • Uses the Codex Responses backend with native gpt-image-2 image generation.
  • Saves images and sidecar metadata locally.
  • Supports batches, style presets, reference images, and sketch references.
  • Provides a browser-based studio for browsing, comparing, rerunning, varying, and referencing images.

Install

Install the published npm package:

pi install npm:pi-imagegen

npm package: https://www.npmjs.com/package/pi-imagegen

For local development:

git clone https://github.com/Jon-Vii/pi-imagegen.git
cd pi-imagegen
pi install .

Then reload Pi:

/reload

You also need to be logged into Pi's OpenAI/Codex provider:

/login

Select the ChatGPT/Codex option that provides the openai-codex provider.

Commands

/img studio
/img gen [--thinking off|minimal|low|medium|high] [--style name] <prompt>
/img batch <count> [--thinking off|minimal|low|medium|high] [--style name] <prompt>
/img styles
/img list [count]
/img open [latest|number|path]
/img reveal [latest|number|path]
/img path [latest|number|path]
/img info [latest|number|path]

Examples:

/img gen tiny blue ceramic fish on white background
/img gen --thinking off --style poster a cinematic expedition poster for a lava cavern
/img batch 4 --style wallpaper a quiet mountain observatory at sunrise
/img studio

Studio

Run:

/img studio

The studio opens a local browser UI served from 127.0.0.1.

It supports:

  • image history wall
  • grouped batch/contact-sheet view
  • modal preview with rerun/vary/reference actions
  • prompt composer with style, aspect, quality, thinking, and count controls
  • real image references sent as input_image content
  • sketch references via a simple drawing canvas

A typical loop:

Draw or pick reference → Generate 4 → inspect → Vary or Rerun → keep exploring

Agent tool

The package also registers a model-facing tool:

imagegen

It can generate an image and return both a saved file and an inline image attachment. It supports options such as:

  • prompt
  • size
  • quality
  • background
  • outputFormat
  • thinking
  • referencePaths
  • outputPath

How it works

This package does not use the public OpenAI image API or a separate API key.

It uses Pi's existing openai-codex OAuth token and calls:

https://chatgpt.com/backend-api/codex/responses

with the native Responses image generation tool:

{
  "type": "image_generation",
  "model": "gpt-image-2"
}

Generated image results are received from streamed SSE events and saved locally.

Files and metadata

By default, generated images are saved under:

~/.pi/agent/generated-images/

Each image gets a JSON sidecar with prompt, model, path, format, reference, batch, and generation metadata.

Batches are saved under:

~/.pi/agent/generated-images/batches/

Sketch references are saved under:

~/.pi/agent/generated-images/sketches/

Notes

This package relies on Pi internals and the Codex Responses backend. It is intended for personal/local Pi workflows and may need updates if the upstream backend changes.

License

MIT