Skip to content

The agent that grows with you

refactor(aux): _try_openrouter/_try_anthropic annotate the callable key they already accept

kshitijk4poor62f7e04f843a
diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.py
index 5d4c5505026..ccf72855ba4 100644
--- a/agent/auxiliary_client.py
+++ b/agent/auxiliary_client.py
@@ -2213,7 +2213,7 @@ def _warn_paid_lane_once(model: str) -> None:
)
-def _try_openrouter(explicit_api_key: str = None, model: str = None) -> Tuple[Optional[OpenAI], Optional[str]]:
+def _try_openrouter(explicit_api_key: Optional[Union[str, Callable[[], str]]] = None, model: str = None) -> Tuple[Optional[OpenAI], Optional[str]]:
free_only, cfg_model = _aux_openrouter_settings()
or_model = model or cfg_model
if free_only and not _is_free_model(or_model):
@@ -2910,7 +2910,7 @@ def _try_azure_foundry(
return client, final_model
-def _try_anthropic(explicit_api_key: str = None) -> Tuple[Optional[Any], Optional[str]]:
+def _try_anthropic(explicit_api_key: Optional[Union[str, Callable[[], str]]] = None) -> Tuple[Optional[Any], Optional[str]]:
try:
from agent.anthropic_adapter import build_anthropic_client
from agent.anthropic_credentials import resolve_anthropic_token