feat(desktop): support API modes for custom endpoints - #82148
Draft
JackLee992 wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
providers.<id>.transportfield while preserving existing hand-written values for older clientsmodel.api_modeon Save/Use, clear it when Auto is selected, and remove it when the active endpoint is deleted/modelsfor Chat Completions, a disclosed one-token/responsesrequest for Responses, and a disclosed one-token/v1/messagesrequest with Anthropic headers for Anthropic MessagesRelated Issue
Follow-up to #13415 and the Desktop custom-endpoint work in #67759. No dedicated open issue found.
Type of Change
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.tsandapps/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.How to Test
/v1), choose Anthropic Messages, enter a model and key, then click Test.providers.<id>.transport: anthropic_messagesplusmodel.api_mode: anthropic_messagesinconfig.yaml.POST /v1/messagesrather than/chat/completions.Automated verification performed:
scripts/run_tests.sh tests/hermes_cli/test_web_server.py -q— 149 passednpm run test:ui— 406 files / 3621 tests passednpm run check:lint— passed (no errors)npm run build— passedpython scripts/check-windows-footguns.py hermes_cli/web_models.py hermes_cli/web_server.py— passedChecklist
Code
Documentation & Housekeeping
cli-config.yaml.exampleN/A —transportalready exists; this exposes it in DesktopCONTRIBUTING.md/AGENTS.mdN/A — no workflow or architecture changeScreenshots / Logs
No screenshot attached; the new selector is covered by a Desktop behavior test and the production Desktop build succeeds.