Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(cli): mark proxy-served stock Codex models as selectable with an API key

mateo-berri15721e52effa
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)