diff --git a/pipeline_llm/gateway.py b/pipeline_llm/gateway.py index b0114d5..12c2afb 100644 --- a/pipeline_llm/gateway.py +++ b/pipeline_llm/gateway.py @@ -295,8 +295,14 @@ async def _pick_candidate(sor, model: dict, pref: str): matched = {i for i, e in tagged if (e.get('protocol') or '').strip() == mproto} untagged = {i for i, e in enumerate(endpoints) if not (e.get('protocol') or '').strip()} - usable = matched | untagged - if not matched: + # 有协议匹配端点 → 只选匹配的(同账号多端点余额同分,按序会选到 + # 第一个即 compatible-mode → 404,必须排除不匹配项而非并集); + # 无匹配但有未标注(历史)端点 → 兜底用未标注;全无 → 报错 + if matched: + usable = matched + elif untagged: + usable = untagged + else: return False, ('供应商端点均为其他协议(模型模板协议 %s,端点协议 %s)——' '原生异步(openai_compat 之外)与兼容模式端点 base_url 不同,' '混用必 404。请在供应商端点目录添加协议 %s 的端点'