Skip to content

feat(desktop): support API modes for custom endpoints - #82148

Draft
JackLee992 wants to merge 1 commit into
NousResearch:mainfrom
JackLee992:fix/desktop-custom-endpoint-api-mode
Draft

feat(desktop): support API modes for custom endpoints#82148
JackLee992 wants to merge 1 commit into
NousResearch:mainfrom
JackLee992:fix/desktop-custom-endpoint-api-mode

Conversation

@JackLee992

Copy link
Copy Markdown

What does this PR do?

Desktop custom endpoints currently assume an OpenAI-compatible API surface: the form cannot choose a wire protocol, saves do not mirror a protocol to the active model, and the Test action only calls /models. An Anthropic-compatible relay can therefore validate or save misleadingly while real chat falls back to /chat/completions.

This adds the Desktop counterpart to the custom-provider API mode support already available in the CLI:

  • expose Auto-detect, Chat Completions, Responses / Codex, and Anthropic Messages in Custom Endpoints
  • persist the selection to the v12 providers.<id>.transport field while preserving existing hand-written values for older clients
  • mirror the resolved mode to model.api_mode on Save/Use, clear it when Auto is selected, and remove it when the active endpoint is deleted
  • make Test protocol-aware: /models for Chat Completions, a disclosed one-token /responses request for Responses, and a disclosed one-token /v1/messages request with Anthropic headers for Anthropic Messages
  • localize the new UI copy in English, Simplified Chinese, Traditional Chinese, Japanese, and Arabic

Related Issue

Follow-up to #13415 and the Desktop custom-endpoint work in #67759. No dedicated open issue found.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • apps/desktop/src/app/settings/custom-endpoints-settings.tsx: add the API Mode selector and mode-specific guidance.
  • apps/desktop/src/types/hermes.ts and apps/desktop/src/i18n/*: extend the API contract and localized copy.
  • hermes_cli/web_models.py: validate supported Desktop API mode values.
  • hermes_cli/web_server.py: round-trip/persist transport, synchronize active model state, and probe the selected protocol.
  • Python and Vitest regression tests cover save, Auto clearing, older-client preservation, activation/deletion, runtime resolution, and Anthropic request shape.

How to Test

  1. Open Settings → Providers → Custom Endpoints.
  2. Add an Anthropic-compatible endpoint using the API root (without a trailing /v1), choose Anthropic Messages, enter a model and key, then click Test.
  3. Save with Use for new chats enabled and verify providers.<id>.transport: anthropic_messages plus model.api_mode: anthropic_messages in config.yaml.
  4. Start a chat and verify the provider receives POST /v1/messages rather than /chat/completions.

Automated verification performed:

  • scripts/run_tests.sh tests/hermes_cli/test_web_server.py -q — 149 passed
  • npm run test:ui — 406 files / 3621 tests passed
  • npm run check:lint — passed (no errors)
  • npm run build — passed
  • python scripts/check-windows-footguns.py hermes_cli/web_models.py hermes_cli/web_server.py — passed

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this feature
  • I've run the entire Python test suite (targeted Web API suite passed: 149 tests)
  • I've added tests for my changes
  • I've tested on macOS 26.4 arm64

Documentation & Housekeeping

  • Documentation N/A — the new field has localized inline guidance and uses an existing config capability
  • cli-config.yaml.example N/A — transport already exists; this exposes it in Desktop
  • CONTRIBUTING.md / AGENTS.md N/A — no workflow or architecture change
  • Cross-platform impact considered; changed production Python files pass the Windows footgun checker
  • Tool descriptions/schemas N/A — no agent tool changed

Screenshots / Logs

No screenshot attached; the new selector is covered by a Desktop behavior test and the production Desktop build succeeds.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Aug 9, 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 comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants