Skip to content

fix(desktop): onboarding can configure a local/custom endpoint without an API key - #38572

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-7c7bbc02
Jun 4, 2026
Merged

fix(desktop): onboarding can configure a local/custom endpoint without an API key#38572
teknium1 merged 2 commits into
mainfrom
hermes/hermes-7c7bbc02

Conversation

@teknium1

@teknium1 teknium1 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Desktop onboarding's "Local / custom endpoint" option now actually works, including the common no-API-key case (vLLM, llama.cpp, Ollama). No onboarding UI changes — the existing single URL field is reused.

Root cause: the local option only wrote the OPENAI_BASE_URL env var, but runtime resolution deliberately ignores it — model.base_url in config.yaml is the single source of truth. And /api/model/set actively cleared base_url, so the GUI had no way to persist it. Resolution fell through to the default provider and reported "No usable credentials found for custom".

Changes

  • hermes_cli/web_server.py: POST /api/model/set accepts an optional base_url and persists model.base_url for provider=custom (clears it for hosted providers, unchanged). POST /api/providers/validate returns the model ids advertised at /v1/models (tolerant _parse_model_ids for OpenAI/vLLM/llama.cpp shapes) so the GUI auto-picks a default.
  • apps/desktop/src/store/onboarding.ts: local option routes through saveOnboardingLocalEndpoint — probe endpoint, auto-discover model, persist provider=custom + base_url + model, verify runtime. Avoids completeWithModelConfirm, which would re-assign the model without a base_url and wipe it.
  • Types + tests (backend _parse_model_ids / base_url persistence; frontend onboarding store).

Validation

Before After
provider=custom + base_url, no key resolves to openrouter.ai, no key → "No usable credentials found for custom" resolves to the local endpoint, api_key=no-key-required, api_mode=chat_completions
Backend tests (set_model / parse_model_ids) 6/6 pass

E2E verified with a fake no-key OpenAI-compatible endpoint in an isolated HERMES_HOME with all credential env vars unset. Negative control (no base_url) reproduces the exact pre-PR error.

Salvage of #38265 by @xxxigm — both commits cherry-picked onto current main with authorship preserved. Closes #38265.

Infographic

technical-schematic

xxxigm added 2 commits June 3, 2026 17:03
The runtime resolver reads model.base_url from config and ignores the
OPENAI_BASE_URL env var, so a self-hosted endpoint could not be configured
from the GUI. Two changes enable it:

- POST /api/model/set accepts an optional base_url and persists it as
  model.base_url when provider=custom (still clearing stale base_url for
  hosted providers).
- POST /api/providers/validate now returns the model ids a custom endpoint
  advertises at /v1/models, so the GUI can auto-pick a default without
  asking the user to type a model name.

Refs desktop onboarding "Local / custom endpoint" bug.
…I changes

Onboarding's "Local / custom endpoint" only wrote the OPENAI_BASE_URL env
var, which runtime resolution ignores — so a self-hosted endpoint was never
wired in and setup failed with "No usable credentials found for custom" even
though local servers need no key.

Route the local option through saveOnboardingLocalEndpoint: probe the
endpoint, auto-discover a model from /v1/models, persist provider=custom +
base_url + model via /api/model/set, then verify the runtime directly
(not via completeWithModelConfirm, which would re-assign the model without
base_url and wipe it). No onboarding form/UI changes — the existing single
URL field is enough.
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-7c7bbc02 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9750 on HEAD, 9748 on base (🆕 +2)

🆕 New issues (1):

Rule Count
unresolved-attribute 1
First entries
tests/hermes_cli/test_web_server.py:1128: [unresolved-attribute] unresolved-attribute: Attribute `get` is not defined on `None` in union `Any | None`

✅ Fixed issues: none

Unchanged: 5050 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles labels Jun 4, 2026
@teknium1
teknium1 merged commit 5a22cd4 into main Jun 4, 2026
23 checks passed
@teknium1
teknium1 deleted the hermes/hermes-7c7bbc02 branch June 4, 2026 00:48
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 P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants