Skip to content

feat(setup): Z.AI endpoint picker for Global/China/Coding Plan selection - #52364

Merged
kshitijk4poor merged 4 commits into
NousResearch:mainfrom
kshitijk4poor:feat/zai-endpoint-picker
Jun 25, 2026
Merged

feat(setup): Z.AI endpoint picker for Global/China/Coding Plan selection#52364
kshitijk4poor merged 4 commits into
NousResearch:mainfrom
kshitijk4poor:feat/zai-endpoint-picker

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Summary

Z.AI setup now presents a curses-based endpoint picker instead of a plain text input, letting users explicitly choose between Global, China, Coding Plan Global, Coding Plan China, or a custom proxy URL.

Changes

  • hermes_cli/model_setup_flows.py: Add _select_zai_endpoint() helper that presents a _prompt_provider_choice picker sourced from ZAI_ENDPOINTS in auth.py (stays in sync with the probe list). Wire it into _model_flow_api_key_provider for provider_id == "zai"; other API-key providers keep the text input.
  • tests/hermes_cli/test_model_provider_persistence.py: Migrate TestBaseUrlValidation from zai to minimax (zai no longer uses input() for base URL). Add TestZaiEndpointPicker covering each endpoint selection, custom proxy (valid + invalid), cancel, default selection, and custom-URL default behavior.

Validation

Before After
Z.AI base URL selection Plain text input() prompt Curses picker with 4 official endpoints + custom
Tests 12 passed (TestBaseUrlValidation with zai) 20 passed (TestBaseUrlValidation with minimax + TestZaiEndpointPicker)

3 commits:

  1. feat(setup): add _select_zai_endpoint helper for Z.AI endpoint picker
  2. feat(setup): wire Z.AI endpoint picker into _model_flow_api_key_provider
  3. test(setup): add ZAI endpoint picker tests, move base-URL tests to MiniMax

Presents a curses-based picker (via _prompt_provider_choice) offering the
four official Z.AI endpoints — Global, China, Coding Plan Global, Coding
Plan China — plus a custom-proxy option. Sourced from ZAI_ENDPOINTS in
auth.py so it stays in sync with the probe list.

Not yet wired into the setup flow; that comes in the next commit.
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.
…niMax

Z.AI now uses a curses picker instead of plain text input for base URL,
so the existing TestBaseUrlValidation tests (which used zai as their test
subject) are migrated to MiniMax, which still uses the text input path.

Add TestZaiEndpointPicker covering:
- Selecting each official endpoint (Global, China, Coding Plan Global,
  Coding Plan China) saves the correct base URL to config
- Custom proxy URL entry (valid + invalid rejection)
- Cancel keeps the existing base URL
- Current endpoint is the default choice in the picker
- Non-standard URL defaults to the Custom proxy option
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard provider/zai ZAI provider area/config Config system, migrations, profiles labels Jun 25, 2026
- Remove dead `chosen_base or effective_base` fallback; _select_zai_endpoint
  always returns a non-empty base URL (returns current_base on cancel).
- Add .rstrip("/") to official-endpoint return for symmetry with custom-proxy
  path (both now return normalized URLs).
- Replace magic index 4 with len(ZAI_ENDPOINTS) in custom-proxy tests so they
  don't break if a 5th endpoint is added to ZAI_ENDPOINTS.
@kshitijk4poor
kshitijk4poor merged commit d6cf383 into NousResearch:main Jun 25, 2026
27 checks passed
@kshitijk4poor
kshitijk4poor deleted the feat/zai-endpoint-picker branch August 5, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have provider/zai ZAI provider type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants