
Security News
arXiv Is Rate Limiting Authors Following a Flood of AI Slop Submissions
arXiv now limits authors to two submissions a month as AI slop overwhelms moderators, delays good papers, and sparks debate over applying the limit to everyone.
@leing2021/pi-image-gen
Advanced tools
Pi Extension — generate images via gpt-image-2, with runtime config override for API key, base URL, model, and output directory.
A Pi Coding Agent extension that adds image generation via gpt-image-2 (or any OpenAI-compatible endpoint).
Speak naturally — "draw a cat" — and the LLM calls generate_image automatically. Or use /image <prompt> directly.
You: draw a watercolor cat sitting on a desk
Pi: 🎨 Generating image...
✅ Image generated!
📁 File: /your/project/generated-images/generated_image_1700000000000.png
📏 Size: 1024x1024 🎨 Quality: medium 🔧 Model: gpt-image-2
💾 245.3 KB
# Option 1: Copy to project extensions (auto-loaded)
mkdir -p .pi/extensions
curl -o .pi/extensions/image-gen.ts https://unpkg.com/@leing2021/pi-image-gen/image-gen.ts
# Option 2: Global extensions
mkdir -p ~/.pi/agent/extensions
curl -o ~/.pi/agent/extensions/image-gen.ts https://unpkg.com/@leing2021/pi-image-gen/image-gen.ts
# Option 3: Quick test (no install)
pi -e ./image-gen.ts
On first launch the extension checks for an API key and guides you if missing.
Three levels of configuration, highest priority first:
| Priority | Source | Use case |
|---|---|---|
| 1 | Tool params / command flags | Per-request override |
| 2 | Environment variables | Global defaults |
| 3 | Built-in defaults | Zero config for OpenAI users |
| Variable | Default | Description |
|---|---|---|
GPT_IMAGE_API_KEY | — | API key (preferred) |
OPENAI_API_KEY | — | Fallback key |
GPT_IMAGE_BASE_URL | https://api.openai.com/v1 | API endpoint |
GPT_IMAGE_MODEL | gpt-image-2 | Model ID |
GPT_IMAGE_OUTPUT_DIR | generated-images | Output directory (relative to cwd) |
export GPT_IMAGE_API_KEY="sk-..."
export GPT_IMAGE_BASE_URL="https://your-relay.example.com/v1"
export GPT_IMAGE_MODEL="your-model-id"
pi
Override any setting for a single call — no need to change env vars.
/image command flags:
/image a watercolor cat
/image --model your-model-id --base-url https://your-relay.example.com/v1 a cat
/image --output-dir ./my-artwork a sunset over the ocean
generate_image tool params (the LLM passes these automatically):
| Param | Type | Description |
|---|---|---|
prompt | string | Required. Image description. |
size | string | 1024x1024 · 1536x1024 · 1024x1536 |
quality | string | low · medium · high |
filename | string | Output filename (auto-sanitized) |
model | string | Model ID override |
apiKey | string | API key override |
baseUrl | string | API endpoint override |
outputDir | string | Output directory override |
Images are saved to generated-images/ relative to the project root:
your-project/
└── generated-images/
├── generated_image_1700000000000.png
└── my-cat.png
Pi's read tool can display the generated image:
read("generated-images/my-cat.png")
../, null bytes, and shell metacharacters are stripped.ctx.cwd.| Error | Cause | Fix |
|---|---|---|
Missing API key | No key configured | export GPT_IMAGE_API_KEY="sk-..." or pass --api-key |
HTTP 401 | Invalid or expired key | Check key and account balance |
HTTP 400 | Invalid parameters | Check prompt for content policy violations |
No image data returned | Empty API response | Retry or verify endpoint |
| Tool not appearing | Wrong file path | Must be in .pi/extensions/*.ts |
npm test # 35 tests, zero npm test dependencies (uses node:test)
npm run typecheck
pi-image-gen/
├── image-gen.ts # Extension (pure functions + factory)
├── image-gen.test.ts # Tests (35 tests)
├── package.json
├── tsconfig.json
└── LICENSE # MIT
MIT
FAQs
Pi Extension — generate images via gpt-image-2, with runtime config override for API key, base URL, model, and output directory.
The npm package @leing2021/pi-image-gen receives a total of 2 weekly downloads. As such, @leing2021/pi-image-gen popularity was classified as not popular.
We found that @leing2021/pi-image-gen demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
arXiv now limits authors to two submissions a month as AI slop overwhelms moderators, delays good papers, and sparks debate over applying the limit to everyone.

Research
/Security News
A new GhostAction wave hits hundreds of GitHub repos, expanding CI/CD secret theft to cloud and AI credentials in source code and git history.

Research
/Security News
Tensorlake npm SDK version 0.5.144 was compromised in a ChainDrop / Shai-Hulud attack, delivering credential-stealing malware.