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

god-tibo-imagen

v0.2.0

Published

Node.js library and CLI for Codex private ChatGPT-authenticated image generation

Readme

god-tibo-imagen

Node.js library and CLI for sending image-generation requests to Codex's private ChatGPT-authenticated backend path.

WARNING: This is not a supported public API integration. It depends on private Codex request behavior that may change without notice.

What it does

  • Reuses local Codex ChatGPT auth from ~/.codex/auth.json
  • Reads ~/.codex/installation_id when available
  • Sends a POST request to https://chatgpt.com/backend-api/codex/responses
  • Requests the built-in image_generation tool with output_format: png
  • Parses streamed SSE output and saves the resulting PNG
  • Supports dry-run and sanitized debug dumps with request/response metadata minimization
  • Also supports a codex exec fallback provider that verifies real PNG output from ~/.codex/generated_images/

Requirements

  • Node.js 20+
  • Existing local Codex ChatGPT login state
  • A Codex/ChatGPT account that is entitled to image generation on the private backend

Installation Guide

Prerequisites

  • Node.js 20+ (for CLI and Node.js library)
  • Python 3.10+ (for Python SDK)
  • Existing local Codex ChatGPT login state (~/.codex/auth.json)
  • A Codex/ChatGPT account entitled to image generation on the private backend

CLI (global)

npm install -g god-tibo-imagen

After installation, the gti command is available globally:

gti --version
gti --help

Node.js Library

npm install god-tibo-imagen
import { createProvider, resolveConfig } from 'god-tibo-imagen';

Python SDK

pip install god-tibo-imagen
from gti import Client

CLI Usage

npm test
npm run check
gti --prompt "flat blue square icon" --output ./out/blue-square.png

Image input

You can provide existing images as additional context alongside your text prompt. Images are embedded as base64 data URLs and sent with the request. Use --image multiple times for multiple images.

# single image
gti --prompt "Make this cat wear a hat" --image ./cat.png --output ./cat-hat.png

# multiple images
gti --prompt "Combine these two styles" --image ./style-a.png --image ./style-b.png --output ./combined.png

Supported formats: png, jpg/jpeg, gif, webp.

Provider modes

# direct private HTTP path
gti --provider private-codex --prompt "flat blue square icon" --output ./out.png

# borrow the Hermes-style codex exec workaround
gti --provider codex-cli --prompt "flat blue square icon" --output ./out.png

# try private HTTP first, then fall back to codex-cli
gti --provider auto --prompt "flat blue square icon" --output ./out.png

Dry run

gti --prompt "flat blue square icon" --dry-run

Live smoke test

npm run smoke:live -- "Generate a tiny flat blue square icon." ./smoke-output.png

Programmatic API (Node.js)

import { createProvider, resolveConfig, loadCodexSession, validateCodexSession } from 'god-tibo-imagen';

const config = resolveConfig({ provider: 'private-codex' });
const provider = createProvider(config);

const result = await provider.generateImage({
  prompt: 'flat blue square icon',
  model: 'gpt-5.4',
  outputPath: './out.png',
  dryRun: false,
  debug: false
});

console.log(result.savedPath);

You can also pass existing images as input:

// single image
const result = await provider.generateImage({
  prompt: 'Make this cat wear a hat',
  model: 'gpt-5.4',
  outputPath: './cat-hat.png',
  images: ['data:image/png;base64,iVBORw0KGgo...']
});

// multiple images
const result = await provider.generateImage({
  prompt: 'Combine these two styles',
  model: 'gpt-5.4',
  outputPath: './combined.png',
  images: [
    'data:image/png;base64,abc...',
    'data:image/png;base64,def...'
  ]
});

Python SDK

from gti import Client

client = Client(provider="private-codex")
result = client.generate_image(
    prompt="flat blue square icon",
    model="gpt-5.4",
    output_path="./out.png"
)
print(result.saved_path)

You can also pass existing images as input:

# single image
result = client.generate_image(
    prompt="Make this cat wear a hat",
    model="gpt-5.4",
    output_path="./cat-hat.png",
    image_paths="./cat.png"
)

# multiple images
result = client.generate_image(
    prompt="Combine these two styles",
    model="gpt-5.4",
    output_path="./combined.png",
    image_paths=["./style-a.png", "./style-b.png"]
)

Quick Start

1. Generate an image via CLI

gti --prompt "flat blue square icon" --output ./out.png

2. Use in a Node.js script

import { createProvider, resolveConfig } from 'god-tibo-imagen';

const config = resolveConfig({ provider: 'private-codex' });
const provider = createProvider(config);

const result = await provider.generateImage({
  prompt: 'flat blue square icon',
  model: 'gpt-5.4',
  outputPath: './out.png',
});

console.log(result.savedPath);

3. Use in a Python script

from gti import Client

client = Client(provider="private-codex")
result = client.generate_image(
    prompt="flat blue square icon",
    model="gpt-5.4",
    output_path="./out.png"
)
print(result.saved_path)

With image inputs:

result = client.generate_image(
    prompt="Make this cat wear a hat",
    model="gpt-5.4",
    output_path="./cat-hat.png",
    image_paths="./cat.png"
)
print(result.saved_path)

Key files

  • src/auth/loadCodexSession.js — reads Codex auth state
  • src/auth/validateSession.js — validates required private-backend fields
  • src/codex/buildResponsesRequest.js — builds the /responses request
  • src/codex/streamResponsesSse.js — parses SSE events
  • src/codex/extractImageGeneration.js — finds image_generation_call
  • src/providers/privateCodexProvider.js — live request/response orchestration
  • src/providers/codexCliProvider.js — Hermes-style codex exec fallback with file verification
  • src/providers/createProvider.js — provider selection and auto fallback
  • src/cli/generate.js — CLI entry point

Notes

  • This MVP supports the file-backed ~/.codex/auth.json path.
  • If your Codex install stores auth only in a keyring and does not materialize auth.json, this MVP will not discover it yet.
  • Debug dumps redact bearer tokens, account/session identifiers, installation IDs, cookies, and image payload base64, and store a minimized response summary instead of the raw response body.
  • The architecture now supports both the direct private HTTP client and a Hermes-style codex exec fallback, while keeping the provider seam open for future app-server integration.