Skip to content

Discover Codex models from latest stable release and account catalog - #127

Open
EmBista wants to merge 2 commits into
RayBytes:mainfrom
EmBista:auto-codex-model-catalog
Open

EmBista wants to merge 2 commits into
RayBytes:mainfrom
EmBista:auto-codex-model-catalog

Conversation

@EmBista

@EmBista EmBista commented Sep 23, 2026 •

Copy link
Copy Markdown

Summary

  • Resolve the Codex catalogue client version from the latest stable openai/codex GitHub release when refreshing the account model catalogue.
  • Keep CHATGPT_LOCAL_MODELS_CLIENT_VERSION as an optional stable-release-only override; prerelease values are rejected. If GitHub is unavailable, use the last successful stable version or the bundled verified 0.156.0 fallback.
  • Make both OpenAI and Ollama model listings depend on the discovered account catalogue. Return 503 before discovery succeeds instead of advertising the static registry. Use catalogue metadata for priority support; legacy aliases remain for request compatibility.

This is an alternative to #126 and addresses #125 without adding GPT-6 IDs to static lists. Future visible model IDs require no ChatMock registry change. The existing cache is marked stale when its client version differs from the effective version, so the first refresh replaces it.

Verification

  • python -m unittest discover -s tests -q — 24 tests passed.
  • The tests cover stable release selection, prerelease rejection, GitHub failure, old-cache refresh, priority metadata, and a made-up future model ID through both listing endpoints.
  • A read-only live catalogue check against the current account with stable 0.156.0 returned the GPT-6 models. No live model turn was run.

How to try locally

  1. Sign in to ChatMock and start the server with model sync enabled.
  2. Request GET /v1/models and GET /api/tags; both should list only models visible in the signed-in account catalogue.
  3. Optionally set CHATGPT_LOCAL_MODELS_CLIENT_VERSION=0.156.0, restart, and check the list again. Remove the override to resume automatic stable-release selection.
  4. With no account catalogue or cache, both listing endpoints should return 503.

The release check runs on the existing catalogue refresh interval (one hour by default), not on every request. Existing model aliases and the request default are retained for compatibility but are no longer used to advertise availability.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant