diff --git a/plugins/pipes/github-copilot-sdk/github_copilot_sdk.py b/plugins/pipes/github-copilot-sdk/github_copilot_sdk.py index 37a1c91..62ecd96 100644 --- a/plugins/pipes/github-copilot-sdk/github_copilot_sdk.py +++ b/plugins/pipes/github-copilot-sdk/github_copilot_sdk.py @@ -8133,7 +8133,15 @@ async def _fetch_byok_models( ) or self.valves.BYOK_BEARER_TOKEN effective_models = (uv.BYOK_MODELS if uv else "") or self.valves.BYOK_MODELS - if effective_base_url: + # If user explicitly configured BYOK_MODELS, use them directly (skip API fetch) + if effective_models.strip(): + model_list = [ + m.strip() for m in effective_models.split(",") if m.strip() + ] + await self._emit_debug_log( + f"BYOK: Using user-configured BYOK_MODELS ({len(model_list)} models)." + ) + elif effective_base_url: try: base_url = effective_base_url.rstrip("/") url = f"{base_url}/models" @@ -8188,16 +8196,6 @@ async def _fetch_byok_models( except Exception as e: await self._emit_debug_log(f"BYOK: Setup error: {e}") - # Fallback to configured list or defaults - if not model_list: - if effective_models.strip(): - model_list = [ - m.strip() for m in effective_models.split(",") if m.strip() - ] - await self._emit_debug_log( - f"BYOK: Using user-configured BYOK_MODELS ({len(model_list)} models)." - ) - # Infer per-model provider from ID string (BYOK endpoints can return multi-provider lists) byok_models = [ {