Skip to content

feat(cli): persist explicit api_mode for manual custom endpoints#13423

Closed
mslovy wants to merge 1 commit into
NousResearch:mainfrom
mslovy:feat/custom-endpoint-api-mode
Closed

feat(cli): persist explicit api_mode for manual custom endpoints#13423
mslovy wants to merge 1 commit into
NousResearch:mainfrom
mslovy:feat/custom-endpoint-api-mode

Conversation

@mslovy

@mslovy mslovy commented Apr 21, 2026

Copy link
Copy Markdown

Summary

Manual custom endpoint setup now supports explicit api_mode selection.

Hermes already supports explicit transport routing such as codex_responses at runtime, but the manual custom endpoint flow did not expose that setting. It always relied on URL-based detection and cleared any explicit api_mode during save.

That made some OpenAI-compatible relays and gateways hard to configure through the CLI. A common example is CCH-style proxies: the base URL does not look like the official OpenAI/Codex endpoint, so Hermes falls back to chat_completions, while some relays only support codex_responses. Refer to Issue: #13415

This change adds an explicit API mode prompt to the manual custom endpoint flow so users can choose the transport they need without depending entirely on URL heuristics.

Changes

  • Added an explicit API mode prompt to the manual custom endpoint flow in hermes_cli/main.py
  • Supported the following choices:
    • auto
    • chat_completions
    • codex_responses
    • anthropic_messages
  • Persisted explicit selections to model.api_mode
  • Persisted the same selection to the saved custom_providers entry for the endpoint
  • Kept auto behavior as “unset”, so existing URL-based detection continues to work as before
  • Cleared stale saved api_mode values when the same endpoint is reconfigured back to auto
  • Kept existing saved-provider behavior unchanged: no new editing UI was added for named saved providers
  • Added regression coverage in tests/cli/test_cli_provider_resolution.py for:
    • explicit codex_responses persistence
    • clearing stale api_mode when switching back to auto
    • updating an existing saved custom endpoint entry

Validation

Ran:

  • scripts/run_tests.sh tests/cli/test_cli_provider_resolution.py tests/hermes_cli/test_custom_provider_model_switch.py tests/hermes_cli/test_runtime_provider_resolution.py tests/hermes_cli/test_update_config_clears_custom_fields.py -q

Result:

  • 98 passed

Manual custom endpoint setup always dropped model.api_mode and never
saved api_mode into custom_providers. That worked for endpoints whose
transport could be inferred from the URL, but broke CCH-style proxies
whose base URLs are OpenAI-compatible while only supporting the
codex_responses transport.

- Adds an explicit api_mode prompt to the manual custom endpoint setup flow.
- Persists explicit modes like codex_responses for CCH-style proxies whose URLs do not auto-detect correctly.
- Keeps auto behavior by not persisting api_mode when the user chooses auto.
- Updates saved custom_providers entries for the same endpoint without adding a new edit UI.
- Adds regression coverage for explicit persistence, auto clearing, and custom provider upda
@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 area/config Config system, migrations, profiles labels Apr 22, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Closing as superseded by #25068.

Triage notes (high confidence):
Merged PR #25068 'feat(custom): prompt and persist explicit api_mode for custom providers' implemented the same feature; main hermes_cli/main.py:3656-3771 already prompts and persists api_mode in the manual custom endpoint flow.

Thanks for the contribution — the underlying problem this PR addresses has been resolved by the linked PR on current main. If you believe this was closed in error, please comment and we'll reopen.

(Bulk-closed during a CLI PR triage sweep.)

@teknium1 teknium1 closed this May 24, 2026
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 type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants