mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-16 23:41:43 +00:00
fix(cli): mark proxy-served stock Codex models as selectable with an API key
Codex hides catalog entries whose supported_in_api is false when it runs with an API key, so a stock entry the proxy serves now carries supported_in_api true alongside its list visibility.
This commit is contained in:
parent
5b9153f5ea
commit
15721e52ef
2 changed files with 13 additions and 3 deletions
|
|
@ -447,6 +447,7 @@ class _StockCodexModel(BaseModel):
|
|||
slug: str
|
||||
priority: int
|
||||
visibility: str
|
||||
supported_in_api: bool = True
|
||||
upgrade: _StockCodexUpgrade | None = None
|
||||
|
||||
|
||||
|
|
@ -474,7 +475,9 @@ def _codex_catalog_entry(
|
|||
base_instructions=instructions,
|
||||
)
|
||||
upgrade: Final = stock.upgrade if stock.upgrade is not None and stock.upgrade.model in served else None
|
||||
return stock.model_copy(update={"priority": priority, "visibility": "list", "upgrade": upgrade})
|
||||
return stock.model_copy(
|
||||
update={"priority": priority, "visibility": "list", "supported_in_api": True, "upgrade": upgrade}
|
||||
)
|
||||
|
||||
|
||||
def codex_model_catalog(
|
||||
|
|
@ -486,8 +489,8 @@ def codex_model_catalog(
|
|||
Passing a catalog replaces Codex's built-in one, so a proxy model the
|
||||
installed Codex knows keeps that Codex's own entry and the proxy only
|
||||
decides its place in the picker: the listing orders it, lists it even when
|
||||
Codex hides it, and keeps Codex's upgrade nudge only when the model it
|
||||
points at is served too. A model Codex does not know gets the fallback
|
||||
Codex hides it or keeps it off the API, and keeps Codex's upgrade nudge only
|
||||
when the model it points at is served too. A model Codex does not know gets the fallback
|
||||
entry, with the same base instructions Codex itself uses so the agent never
|
||||
runs without a system prompt.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -527,6 +527,13 @@ class TestCodexModelSync:
|
|||
assert entry["upgrade"] is None
|
||||
assert entry["supported_reasoning_levels"] == _STOCK_REASONING_LEVELS
|
||||
|
||||
def test_api_disabled_stock_model_is_selectable_when_the_proxy_serves_it(self, tmp_path):
|
||||
self._sync(self._listing(self._row("codex-auto-review")), tmp_path)
|
||||
entry = self._entries(tmp_path)["codex-auto-review"]
|
||||
assert entry["supported_in_api"] is True
|
||||
assert entry["visibility"] == "list"
|
||||
assert entry["base_instructions"] == _STOCK_MODELS["codex-auto-review"]["base_instructions"]
|
||||
|
||||
def test_stock_upgrade_nudge_survives_when_its_target_is_listed(self, tmp_path):
|
||||
self._sync(self._listing(self._row("gpt-5.4"), self._row("gpt-5.6-terra")), tmp_path)
|
||||
entries = self._entries(tmp_path)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue