From f3372d3407dfa37f6ca525d03e1dcd7da4ef2742 Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Thu, 25 Jun 2026 11:27:02 +0530 Subject: [PATCH] feat(setup): wire Z.AI endpoint picker into _model_flow_api_key_provider When provider_id == 'zai', replace the plain text Base URL input with _select_zai_endpoint, which presents a curses picker offering Global, China, Coding Plan Global, Coding Plan China, and custom proxy options. Other API-key providers (MiniMax, DeepSeek, etc.) keep the text input. --- hermes_cli/model_setup_flows.py | 36 +++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/hermes_cli/model_setup_flows.py b/hermes_cli/model_setup_flows.py index 81875d7c0cf..be9ecd612ff 100644 --- a/hermes_cli/model_setup_flows.py +++ b/hermes_cli/model_setup_flows.py @@ -2392,19 +2392,29 @@ def _model_flow_api_key_provider(config, provider_id, current_model=""): pass effective_base = current_base or pconfig.inference_base_url - try: - override = input(f"Base URL [{effective_base}]: ").strip() - except (KeyboardInterrupt, EOFError): - print() - override = "" - if override and base_url_env: - if not override.startswith(("http://", "https://")): - print( - " Invalid URL — must start with http:// or https://. Keeping current value." - ) - else: - save_env_value(base_url_env, override) - effective_base = override + if provider_id == "zai": + # Z.AI has four official endpoints (Global, China, Coding Plan + # Global, Coding Plan China) with separate billing paths. Present + # a picker instead of a plain text input so users can explicitly + # choose the endpoint that matches their key type. + chosen_base = _select_zai_endpoint(effective_base) + if chosen_base and chosen_base != effective_base and base_url_env: + save_env_value(base_url_env, chosen_base) + effective_base = chosen_base or effective_base + else: + try: + override = input(f"Base URL [{effective_base}]: ").strip() + except (KeyboardInterrupt, EOFError): + print() + override = "" + if override and base_url_env: + if not override.startswith(("http://", "https://")): + print( + " Invalid URL — must start with http:// or https://. Keeping current value." + ) + else: + save_env_value(base_url_env, override) + effective_base = override # Model selection — resolution order: # 1. models.dev registry (cached, filtered for agentic/tool-capable models)