Skip to content

Built-in image generation returns 404 Unknown endpoint #83

Closed

Description

@Yeondaeno

Summary

The built-in image generation tool fails before producing an image. Every observed attempt returned an immediate 404 Not Found response identifying POST /v1/images/generations as an unknown endpoint.

Environment

  • Product surface: Codex Desktop on Windows
  • Codex CLI: codex-cli 0.144.1
  • OS: Microsoft Windows 10.0.26100.8655
  • LazyCodex: auto-updated from v4.13.0 to v4.16.2 during the session
  • LazyCodex bootstrap: running in the background; a fresh-session confirmation is still required after bootstrap completes
  • Workspace: C:\개인 홈페이지
  • Image path requested: built-in image_gen tool
  • API fallback: not used
  • OPENAI_API_KEY: not configured

Minimal Reproduction

  1. Open Codex Desktop on Windows.

  2. Start a task in any local workspace.

  3. Ask Codex to generate an image using the built-in image generation feature, explicitly without the API/CLI fallback. For example:

    Generate a dark Gothic editorial hero graphic with indigo and gold inks,
    halftone texture, no text, and no watermark. Use the built-in image
    generation tool only.
    
  4. Allow Codex to invoke the built-in image_gen.imagegen tool with the prompt.

  5. Observe that the tool fails immediately instead of returning an image.

  6. Repeat with a materially different prompt. The same endpoint error is returned.

Exact Observed Error

image generation failed: http 404 Not Found: Some("{\"error\":{\"message\":\"Unknown endpoint: POST /v1/images/generations\",\"type\":\"not_found\",\"code\":\"not_found\"}}")

Expected Behavior

The built-in image generation tool should accept the prompt and return a generated image without requiring a locally configured OPENAI_API_KEY.

Actual Behavior

  • The request fails in less than one second.
  • No image or project asset is created.
  • The error is independent of the requested composition or palette across the observed attempts.
  • The CLI/API fallback is not invoked.

Runtime Evidence

  • The identical 404 Unknown endpoint response was observed on repeated built-in image-generation calls.
  • The response names the rejected route as POST /v1/images/generations.
  • The failure occurs before any image result, output path, or asset metadata is returned.
  • A local API key check returned OPENAI_API_KEY=missing, confirming that the paid CLI fallback was not involved.

Hypotheses

  1. Stale or incompatible endpoint routing: the built-in tool is sending requests to /v1/images/generations, but the active image backend no longer exposes that route.
    • Distinguishing evidence: capture the tool gateway base URL and final outbound request path.
  2. Capability/backend mismatch: the Codex surface exposes image_gen, while the connected backend does not have the corresponding image-generation endpoint enabled.
    • Distinguishing evidence: compare capability discovery/feature flags with the backend route table for the same session.
  3. Gateway or proxy misconfiguration: an intermediate service receives the image request but forwards it to a service that does not implement image generation.
    • Distinguishing evidence: correlate the request ID across Codex tool logs, gateway logs, and the image service logs.

These are hypotheses only. The current runtime evidence confirms the failing route and response, but does not identify which layer selected or rejected the endpoint.

Ownership Status

Repository ownership is not yet confirmed.

  • Route to openai/codex if the failure reproduces in a clean Codex session without LazyCodex.
  • Route to code-yeongyu/lazycodex if a clean upstream session works and the failure appears only with the LazyCodex integration active.

Maintainer Verification

  1. Reproduce in a fresh Codex session after the current LazyCodex bootstrap completes.
  2. Run the same prompt in a clean upstream Codex environment without LazyCodex.
  3. Record the resolved tool gateway URL and outbound HTTP path.
  4. Confirm whether the supported endpoint is /v1/images/generations or a different internal route.
  5. Verify that a successful call returns image metadata and a usable asset.
  6. Regression-test a second unrelated prompt to confirm that prompt content does not affect routing.

Notes

  • No external GitHub issue was filed as part of preparing this reproduction.
  • No paid API/CLI request was made.
  • Re-test after restarting the Codex session because LazyCodex v4.16.2 was applied during the current session and its background bootstrap has not yet been validated in a fresh session.

This issue or PR was generated by LazyCodex.
Tag: lazycodex-generated


한국어

내장 이미지 생성 기능에서 404 Unknown endpoint 발생

요약

내장 이미지 생성 도구가 이미지를 만들기 전에 실패합니다. 확인된 모든 시도에서 POST /v1/images/generations가 존재하지 않는 엔드포인트라는 404 Not Found 응답이 즉시 반환되었습니다.

환경

  • 제품 환경: Windows용 Codex Desktop
  • Codex CLI: codex-cli 0.144.1
  • 운영체제: Microsoft Windows 10.0.26100.8655
  • LazyCodex: 세션 도중 v4.13.0에서 v4.16.2로 자동 업데이트됨
  • LazyCodex 부트스트랩: 백그라운드에서 진행 중이며, 완료 후 새 세션에서 재확인 필요
  • 작업 폴더: C:\개인 홈페이지
  • 요청한 이미지 생성 경로: 내장 image_gen 도구
  • API 대체 경로: 사용하지 않음
  • OPENAI_API_KEY: 설정되지 않음

최소 재현 절차

  1. Windows에서 Codex Desktop을 실행합니다.

  2. 임의의 로컬 작업 폴더에서 새 작업을 시작합니다.

  3. API 또는 CLI 대체 경로를 사용하지 말고, 내장 이미지 생성 기능으로 이미지를 만들어 달라고 요청합니다. 예시:

    인디고와 골드 잉크, 하프톤 질감을 사용한 다크 고딕 에디토리얼
    히어로 그래픽을 만들어줘. 텍스트와 워터마크는 넣지 말고,
    내장 이미지 생성 기능만 사용해줘.
    
  4. Codex가 해당 프롬프트로 내장 image_gen.imagegen 도구를 실행하도록 합니다.

  5. 이미지가 반환되지 않고 도구가 즉시 실패하는 것을 확인합니다.

  6. 내용이 크게 다른 프롬프트로 다시 실행합니다. 동일한 엔드포인트 오류가 반환됩니다.

실제 오류 메시지

image generation failed: http 404 Not Found: Some("{\"error\":{\"message\":\"Unknown endpoint: POST /v1/images/generations\",\"type\":\"not_found\",\"code\":\"not_found\"}}")

기대 동작

내장 이미지 생성 도구가 프롬프트를 처리하고, 로컬 OPENAI_API_KEY 설정을 요구하지 않은 채 생성된 이미지를 반환해야 합니다.

실제 동작

  • 요청이 1초 이내에 실패합니다.
  • 이미지 또는 프로젝트 에셋이 생성되지 않습니다.
  • 확인된 시도에서는 구성이나 색상 팔레트 등 프롬프트 내용과 관계없이 동일한 오류가 발생했습니다.
  • CLI/API 대체 경로는 실행되지 않았습니다.

런타임 증거

  • 여러 차례의 내장 이미지 생성 호출에서 동일한 404 Unknown endpoint 응답이 확인되었습니다.
  • 응답에는 거부된 경로가 POST /v1/images/generations로 명시되어 있습니다.
  • 이미지 결과, 출력 경로 또는 에셋 메타데이터가 반환되기 전에 실패합니다.
  • 로컬 API 키 확인 결과는 OPENAI_API_KEY=missing이었으므로, 유료 CLI 대체 경로는 관련되지 않았습니다.

원인 가설

  1. 오래되었거나 호환되지 않는 엔드포인트 라우팅: 내장 도구가 /v1/images/generations로 요청을 보내지만, 현재 이미지 백엔드에는 해당 경로가 존재하지 않을 수 있습니다.
    • 판별에 필요한 증거: 도구 게이트웨이의 기본 URL과 최종 전송 경로를 기록합니다.
  2. 기능 노출과 백엔드 활성화 상태 불일치: Codex 화면에는 image_gen 도구가 노출되지만, 연결된 백엔드에는 이미지 생성 엔드포인트가 활성화되지 않았을 수 있습니다.
    • 판별에 필요한 증거: 동일 세션의 기능 플래그 또는 capability 정보와 백엔드 라우팅 테이블을 비교합니다.
  3. 게이트웨이 또는 프록시 설정 오류: 중간 서비스가 이미지 요청을 받았지만, 이미지 생성을 지원하지 않는 서비스로 전달했을 수 있습니다.
    • 판별에 필요한 증거: 요청 ID를 기준으로 Codex 도구 로그, 게이트웨이 로그, 이미지 서비스 로그를 연결해 확인합니다.

위 내용은 원인 가설입니다. 현재 런타임 증거로 실패한 경로와 응답은 확인했지만, 어느 계층에서 해당 엔드포인트를 선택하거나 거부했는지는 확인되지 않았습니다.

저장소 소유권 판단

현재 단계에서는 문제를 등록할 저장소가 확정되지 않았습니다.

  • LazyCodex를 사용하지 않은 순정 Codex 세션에서도 재현되면 openai/codex로 분류합니다.
  • 순정 Codex에서는 정상 동작하고 LazyCodex 통합 환경에서만 실패하면 code-yeongyu/lazycodex로 분류합니다.

유지보수자 확인 절차

  1. 현재 LazyCodex 부트스트랩이 끝난 후 새 Codex 세션에서 다시 재현합니다.
  2. LazyCodex가 없는 순정 Codex 환경에서 동일한 프롬프트를 실행합니다.
  3. 실제로 해석된 도구 게이트웨이 URL과 외부 전송 HTTP 경로를 기록합니다.
  4. 지원되는 경로가 /v1/images/generations인지 다른 내부 경로인지 확인합니다.
  5. 정상 호출에서 이미지 메타데이터와 사용 가능한 이미지 에셋이 반환되는지 확인합니다.
  6. 내용이 다른 두 번째 프롬프트를 실행해 프롬프트와 라우팅이 무관한지 회귀 검증합니다.

참고 사항

  • 이 재현 문서를 작성하면서 외부 GitHub 이슈는 등록하지 않았습니다.
  • 유료 API 또는 CLI 요청은 실행하지 않았습니다.
  • 현재 세션 도중 LazyCodex v4.16.2가 적용되었으므로, Codex를 재시작한 새 세션에서 최종 재확인이 필요합니다.

이 이슈 또는 PR은 LazyCodex를 통해 생성되었습니다.
태그: lazycodex-generated

Activity

  1. lidge-jun commented on Jul 10, 2026

    @lidge-jun
    Owner

    Confirmed as an opencodex routing bug. Codex's built-in image_gen client posts to /v1/images/generations, while opencodex was sending that path to its generic /v1/* 404 guard.

    The fix adds exact forwarding routes for POST /v1/images/generations and POST /v1/images/edits, reusing Codex forward authentication/account affinity without requiring OPENAI_API_KEY. It also keeps the existing data-plane auth/origin gates, bounded opaque-body relay, cancellation propagation, safe response-header relay, pool health tracking, and a single upstream attempt for paid image requests.

    Verification completed:

    • focused Images regression/safety suite: 10 passed
    • full repository suite: 1,942 passed
    • typecheck and privacy scan passed
    • real HTTP wire QA confirmed generation/edit routing and a parseable 413 at the 256 MiB body ceiling

    The maintainer fix is implemented and verified and will be included in the next release. Existing released installations remain affected until they update.

  2. Ingwannu commented on Jul 10, 2026

    @Ingwannu
    Owner

    Thank you for the excellent report — the reproduction steps, the exact error body, and the hypotheses made this very quick to confirm. 🙏

    Confirmed: this was opencodex's bug (not upstream Codex, and not LazyCodex). Your hypothesis #1 was exactly right — here is the full chain:

    1. opencodex points Codex's built-in openai provider at the local proxy via openai_base_url in ~/.codex/config.toml.
    2. Codex's built-in image_gen tool runs client-side: it POSTs {base_url}/images/generations directly (with the same ChatGPT bearer auth it uses for chat) — so the request lands on the proxy, not on OpenAI.
    3. The proxy had no route for /v1/images/*, so the request fell through to the JSON-404 guard → Unknown endpoint: POST /v1/images/generations.
    4. Why it started happening now: codex 0.144.0 enabled image_generation by default (previously an off-by-default experiment), so ChatGPT-signed-in users began hitting the tool organically.

    Fix — merged in #87: the proxy now serves POST /v1/images/generations and POST /v1/images/edits by relaying the request to the ChatGPT backend with your existing ChatGPT login (no OPENAI_API_KEY needed — exactly your expected behavior). If no ChatGPT auth is available it falls back to a configured OpenAI API-key provider, and if neither exists it returns a clear, actionable error instead of the confusing 404.

    The fix is on dev now and will ship in the next release — after updating, please restart the proxy (ocx restart) and try the same prompt again. If you want to opt out of the tool entirely instead, codex features disable image_generation turns it off on the Codex side.

    Thanks again for the well-structured report!


    리포트 정말 감사합니다 — 재현 절차, 정확한 에러 본문, 원인 가설까지 잘 정리해주셔서 확인이 매우 빨랐습니다. 🙏

    opencodex의 버그가 맞습니다 (upstream Codex도, LazyCodex도 아닙니다). 가설 1번이 정확했습니다:

    1. opencodex는 ~/.codex/config.toml의 openai_base_url로 Codex 내장 openai 프로바이더를 로컬 프록시로 향하게 합니다.
    2. 내장 image_gen 도구는 클라이언트 측에서 직접 {base_url}/images/generations로 POST합니다(채팅과 동일한 ChatGPT 인증 사용) — 그래서 요청이 OpenAI가 아니라 프록시로 왔습니다.
    3. 프록시에 /v1/images/* 라우트가 없어서 404 가드에 걸렸습니다.
    4. 지금 시점에 발생한 이유: codex 0.144.0부터 image_generation 기능이 기본 활성화되어, ChatGPT 로그인 사용자들이 자연스럽게 이 도구를 쓰기 시작했기 때문입니다.

    수정 — #87에 반영: 이제 프록시가 POST /v1/images/generations / /v1/images/edits를 받아 기존 ChatGPT 로그인 인증 그대로 ChatGPT 백엔드에 중계합니다(OPENAI_API_KEY 불필요 — 기대하신 동작 그대로입니다). ChatGPT 인증이 없으면 설정된 OpenAI API 키 프로바이더로 폴백하고, 둘 다 없으면 모호한 404 대신 명확한 안내 오류를 반환합니다.

    수정은 dev 브랜치에 머지되었고 다음 릴리스에 포함됩니다. 업데이트 후 프록시를 재시작(ocx restart)하고 동일한 프롬프트로 다시 시도해보세요. 도구 자체를 끄고 싶으시면 codex features disable image_generation으로 Codex 쪽에서 비활성화할 수 있습니다.

    다시 한번 좋은 리포트 감사합니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions