Expose Codex CLI's built-in image_gen tool through baoyu-image-gen's
standard CLI + batch flow as a dedicated provider. The provider spawns
the bundled scripts/codex-imagegen/main.ts (synced from
packages/baoyu-codex-imagegen/src/) so the skill remains self-contained
and inherits retry, cache, file-lock, and JSONL logging. No
OPENAI_API_KEY required — uses the user's Codex subscription.
New env vars: BAOYU_CODEX_IMAGEGEN_{BIN,CACHE_DIR,TIMEOUT_MS,RETRIES,LOG_FILE}.
Hyphenated provider names now resolve under-scored env vars (e.g.,
BAOYU_IMAGE_GEN_CODEX_CLI_CONCURRENCY). codex-cli is never auto-selected
— pin via --provider or default_provider in EXTEND.md.
2.1 KiB
Codex OAuth vs OpenAI API key for baoyu-image-gen
baoyu-image-gen --provider openai uses the standard OpenAI Images API and requires OPENAI_API_KEY. It calls OpenAI-compatible image endpoints such as /images/generations and /images/edits.
Codex / ChatGPT login is different. Codex image generation is driven by Codex OAuth and the Codex runtime's image_gen capability, not by the public OpenAI Images API key path. A Codex OAuth token is not a drop-in replacement for OPENAI_API_KEY, and setting OPENAI_BASE_URL to a Codex backend will not make baoyu-image-gen's existing openai provider work because the auth, route, and payload shape differ.
What to use instead
- If running inside Codex and the native
imagegenskill/tool is available, use it directly. - If running outside Codex but the
codexCLI is installed and logged in, callbaoyu-image-gen --provider codex-cli(preferred). It spawns the bundledscripts/codex-imagegen/main.tsand surfaces its retry/cache/log machinery through baoyu-image-gen's standard CLI + batch flow. Standalone callers outside this skill can run the same code atpackages/baoyu-codex-imagegen/src/main.ts. Both invokecodex execand the Codeximage_gentool; noOPENAI_API_KEYis required. - If running inside Hermes and a native
image_generatetool is available, use that as a runtime-native fallback. Be explicit about whether reference images are passed directly or only reconstructed from extracted traits. baoyu-image-genalready exposes a distinctcodex-cliprovider (wraps the bundledscripts/codex-imagegen/); do not modify the existingopenaiprovider to add Codex OAuth.
Reference-image prompting note
When using actual reference images for identity preservation, avoid long generic descriptions of the subject. Long descriptions can cause the model to synthesize a new similar-looking person/object. Prefer direct wording:
Use the person/object in the reference image(s) as the same identity. Do not redesign it or create a similar-looking new subject. Only change scene, clothing, pose, lighting, rendering style, and composition.