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

@smoose/pi-image-gen

v0.1.3

Published

Pi image generation tool backed by local CLI providers: Codex or Agy.

Readme

pi-image-gen

Pi extension that registers image_gen and delegates image generation to a local CLI provider: codex or agy.

codex uses codex exec with a JSON output schema and validates images under ~/.codex/generated_images/<session-id>/.

agy uses agy --print with prompt-constrained JSON output, --dangerously-skip-permissions, and validates the returned image path.

Installation

pi install npm:@smoose/pi-image-gen

Requirements

  • For codex: codex must be on PATH, logged in, and able to use its built-in image generation capability.
  • For agy: agy must be on PATH and logged in.

Tool parameters

  • prompt: image prompt.
  • images: optional local image paths.
  • provider: optional auto, codex, or agy. Defaults to PI_IMAGE_GEN_PROVIDER or codex.
  • model: optional provider-specific model. For agy, this overrides PI_AGY_IMAGE_GEN_MODEL.

Configuration

The default provider is resolved with this precedence (first match wins):

  1. The provider argument passed to an individual image_gen call.
  2. ~/.pi/agent/image-gen.json (written by /image-provider), e.g. {"provider":"codex"}.
  3. The PI_IMAGE_GEN_PROVIDER environment variable.
  4. The built-in default codex.
PI_IMAGE_GEN_PROVIDER=codex|agy|auto
PI_CODEX_IMAGE_GEN_TIMEOUT_MS=900000
PI_AGY_IMAGE_GEN_TIMEOUT_MS=900000
PI_IMAGE_GEN_MAX_CONCURRENCY=5
PI_AGY_IMAGE_GEN_MODEL="Gemini 3.5 Flash (High)"

If PI_AGY_IMAGE_GEN_MODEL is not set and no model parameter is passed, image_gen does not pass --model to agy.

auto selects an installed provider before execution, preferring codex over agy; it does not fallback after a provider failure.

Multiple image_gen tool calls can run in parallel. PI_IMAGE_GEN_MAX_CONCURRENCY limits concurrent provider processes and defaults to 5.

Commands

Use /image-provider to switch the default provider. The choice is persisted to ~/.pi/agent/image-gen.json, so it applies to every Pi session on this machine. The footer status shows the active selection.

/image-provider codex
/image-provider agy
/image-provider auto

Without an argument, Pi opens a provider picker.

Timeout

Both providers default to 15 minutes. For agy, the timeout is applied both to Pi's outer process guard and to agy --print-timeout.

Failure behavior

When image generation fails, the tool returns the failure reason and terminates the turn. It does not ask Pi to try Python, SVG, Image API scripts, or another provider unless the user explicitly asks for a fallback.

Returned image paths are validated for existence, readability, non-empty content, supported image type, fresh mtime, and not being one of the input images. Codex results are additionally restricted to the current Codex session directory.