Files
baoyu-skills/skills/baoyu-image-gen/references/codex-oauth-vs-openai-api-key.md
T
Jim Liu 宝玉 c3cbce9ce3 feat\!: rename baoyu-imagine→baoyu-image-gen, baoyu-image-cards→baoyu-xhs-images (v2.0.0)
BREAKING CHANGE: removed `baoyu-imagine` and `baoyu-image-cards`. All
functionality now lives under `baoyu-image-gen` and `baoyu-xhs-images`
respectively. Cross-skill `## Image Generation Tools` examples updated
across baoyu-article-illustrator, baoyu-comic, baoyu-cover-image,
baoyu-infographic, and baoyu-slide-deck.

Migration: existing `~/.baoyu-skills/baoyu-imagine/EXTEND.md` configs are
auto-renamed to `…/baoyu-image-gen/EXTEND.md` on first run via the
legacy-path resolver in `scripts/main.ts`.
2026-05-24 18:35:05 -05:00

1.9 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 imagegen skill/tool is available, use it directly.
  • If running outside Codex but the codex CLI is installed and logged in, use the repo-level scripts/codex-imagegen.sh wrapper when the calling skill supports it. The wrapper invokes codex exec and the Codex image_gen tool; no OPENAI_API_KEY is required.
  • If running inside Hermes and a native image_generate tool is available, use that as a runtime-native fallback. Be explicit about whether reference images are passed directly or only reconstructed from extracted traits.
  • If the user wants baoyu-image-gen itself to support Codex OAuth, add a distinct provider such as openai-codex rather than modifying the existing openai provider.

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.