Port pattern from zed-industries/zed#62729: request ungated Codex model catalog (clean-room)
The ChatGPT Codex models endpoint interprets client_version as a Codex CLI compatibility version and filters out any model whose minimal_client_version is newer than the value sent. Hermes hardcoded client_version=1.0.0 at both catalog request sites, so model visibility was accidentally coupled to a version scheme Hermes doesn't follow — future models gated behind a higher minimal version would silently vanish from the account catalog. The backend accepts the exact sentinel 0.0.0 as an ungated request returning the complete account catalog (verified live: 0.0.0 and current versions return identical model sets today, while omitting the parameter is HTTP 400 and out-of-sequence values like 0.0.1 return no models). Both request sites (hermes_cli/codex_models.py and the context-length probe in agent/model_metadata.py) now share one CODEX_UNGATED_CLIENT_VERSION constant. Clean-room port of the observed behavior in zed-industries/zed#62729; no GPL code translated.
This commit is contained in:
@@ -155,10 +155,8 @@ def _fetch_models_from_api(access_token: str) -> List[str]:
|
||||
acct_id = _extract_chatgpt_account_id(access_token)
|
||||
if acct_id:
|
||||
headers["ChatGPT-Account-Id"] = acct_id
|
||||
resp = httpx.get(
|
||||
"https://chatgpt.com/backend-api/codex/models?client_version=1.0.0",
|
||||
headers=headers,
|
||||
timeout=10)
|
||||
from agent.model_metadata import CODEX_MODELS_CATALOG_URL
|
||||
resp = httpx.get(CODEX_MODELS_CATALOG_URL, headers=headers, timeout=10)
|
||||
if resp.status_code != 200:
|
||||
return []
|
||||
data = resp.json()
|
||||
|
||||
Reference in New Issue
Block a user