From 15721e52effaa79ad042b23ef91188798a20be43 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Sat, 12 Sep 2026 16:50:50 -0700 Subject: [PATCH] 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. --- litellm/proxy/client/cli/commands/agents.py | 9 ++++++--- tests/test_litellm/proxy/client/cli/test_agents.py | 7 +++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/litellm/proxy/client/cli/commands/agents.py b/litellm/proxy/client/cli/commands/agents.py index 1422514372a..decb520c3a0 100644 --- a/litellm/proxy/client/cli/commands/agents.py +++ b/litellm/proxy/client/cli/commands/agents.py @@ -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. """ diff --git a/tests/test_litellm/proxy/client/cli/test_agents.py b/tests/test_litellm/proxy/client/cli/test_agents.py index cc7c3a14f44..c437f4c12c5 100644 --- a/tests/test_litellm/proxy/client/cli/test_agents.py +++ b/tests/test_litellm/proxy/client/cli/test_agents.py @@ -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)