From 1518734e591ee3cee59705ac828b754b5a43046e Mon Sep 17 00:00:00 2001 From: teknium1 Date: Tue, 10 Mar 2026 23:20:46 -0700 Subject: [PATCH] fix: sort Nous Portal model list (opus first, sonnet lower) fetch_nous_models() returned models in whatever order the API gave them, which put sonnet near the top. Add a priority sort so users see the best models first: opus > pro > other > sonnet. --- hermes_cli/auth.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hermes_cli/auth.py b/hermes_cli/auth.py index d89eadc7..c90f7792 100644 --- a/hermes_cli/auth.py +++ b/hermes_cli/auth.py @@ -1103,6 +1103,19 @@ def fetch_nous_models( continue model_ids.append(mid) + # Sort: prefer opus > pro > haiku/flash > sonnet (sonnet is cheap/fast, + # users who want the best model should see opus first). + def _model_priority(mid: str) -> tuple: + low = mid.lower() + if "opus" in low: + return (0, mid) + if "pro" in low and "sonnet" not in low: + return (1, mid) + if "sonnet" in low: + return (3, mid) + return (2, mid) + + model_ids.sort(key=_model_priority) return list(dict.fromkeys(model_ids))