Skip to content

Remove user-provided LLM API key (BYOK) feature - #123

Merged
alpha5611331 merged 2 commits into
mainfrom
remove/byok-llm
Sep 4, 2026
Merged

Remove user-provided LLM API key (BYOK) feature#123
alpha5611331 merged 2 commits into
mainfrom
remove/byok-llm

Conversation

@alpha5611331

Copy link
Copy Markdown
Member

Why

Removing the "bring your own LLM API key" feature entirely, per request. The app now always uses the platform's own default LLM configuration - which is already what happened whenever a user had never turned BYOK on, since llmConf: null was the common case.

Not merging - for manual review. Companion backend removal: PowerInterviewAI/backend#61.

What changed

  • llm-group.tsx (deleted, 356 lines) - the entire BYOK UI: a toggle, provider select, API-key password field, model picker populated from /api/llm/models, and debounced /api/llm/validate calls on every keystroke. Removed from the control bar (control-panel/index.tsx).
  • main/ipc/llm.ts (deleted) - the llm:list-models/llm:validate IPC handlers, pure passthroughs to the backend. Deregistered in main/index.ts; bridge removed from preload.cts and electron-api.d.ts.
  • main/api/llm.ts - removed validate()/listModels(); kept generateLiveSuggestions/uploadImage/generateActionSuggestionStream/generateSummary, which aren't BYOK-specific.
  • Types - removed LLMConfig, LLMModelInfo, LLMConfigValidationResult, LLMProvider from both renderer/types/llm.ts and main/types/llm.ts. SuggestionMode (professional-mode wording, unrelated to BYOK) stays in both.
  • Config/RuntimeConfig - removed llmConf. The three generation services (suggestion-live.service.ts, suggestion-action.service.ts, tools.service.ts) stop sending a config field at all on every live-suggestion/action-suggestion/summarize request, matching the backend no longer accepting one.
  • Display remnants - titlebar.tsx and pages/main/index.tsx showed config?.llmConf?.model ?? appState.providedLLMModel; now just appState.providedLLMModel (the backend-reported default model name - unaffected, unrelated to BYOK).

Security cleanup

llmConf could hold a real provider API key in plaintext inside the local electron-store config file. Deleting the field from the TypeScript type does not erase it from an existing install's disk - every read/write in config.store.ts spreads the raw stored object through, so a stale key would otherwise survive silently forever. Added a one-time scrub in config.store.ts (same pattern the store already uses for other retired keys like interviewConf) that deletes a leftover llmConf key from disk on first load after upgrade.

Test plan

  • pnpm lint clean (full project)
  • tsc -b clean (renderer) and tsc -p tsconfig.electron.json clean (main process)
  • pnpm run build and pnpm run electron:build-main both succeed
  • pnpm run test:main - all main-process tests pass
  • Repo-wide grep confirms no remaining references to any removed symbol
  • Manual: confirm the control bar no longer shows an LLM/API-key button, a live/action-suggestion/summarize request still works normally, and an existing install with a stale runtime.llmConf on disk has it removed after one launch

Deletes the "use my own API key" control-bar dialog and its entire
supporting path, so the app always uses the platform's own default
LLM (already what happened whenever a user had never turned BYOK on):

- llm-group.tsx (the dialog itself - provider select, API key input,
  model picker, debounced validate-as-you-type) and its control-bar
  entry
- main/ipc/llm.ts (llm:list-models / llm:validate handlers) and their
  preload/electron-api.d.ts bridge
- LLMApi.validate()/listModels() (main/api/llm.ts) - the rest of the
  class (generate/upload endpoints) stays, those aren't BYOK-specific
- LLMConfig/LLMModelInfo/LLMConfigValidationResult/LLMProvider from
  both renderer and main type files; SuggestionMode (unrelated to
  BYOK) stays
- llmConf from Config/RuntimeConfig, and the `config` field the three
  generation services (live/action suggestion, summarize) sent on
  every request - the backend no longer accepts it at all

Security cleanup: `llmConf` could hold a real provider API key in
plaintext in the local electron-store file. Removing it from the
type doesn't erase it from an existing install's disk - config.store.ts
now actively scrubs a leftover `llmConf` key on first load after
upgrade, the same way the app already handles other retired store
keys.

Companion backend PR removes the corresponding /llm/validate and
/llm/models endpoints and the request-schema field.
@gitar-bot

gitar-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

Gitar is working

Gitar

- Update the audio/language group comment (control-panel/index.tsx)
  and the matching line in CLAUDE.md - both still said "unlike Model"
  about a control this PR deleted.
- Add test coverage for the llmConf disk scrub in
  config-store.test.mjs: seeds a leftover llmConf with a fake API
  key the way a pre-upgrade install would have it, then asserts the
  scrub actually removes it - both from the in-memory store and from
  the written-back file - rather than only asserting the type no
  longer declares the field.
@alpha5611331
alpha5611331 merged commit c43c174 into main Sep 4, 2026
1 check passed
@alpha5611331
alpha5611331 deleted the remove/byok-llm branch September 4, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant