Remove user-provided LLM API key (BYOK) feature - #123
Merged
Conversation
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.
- 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.
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.
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: nullwas 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/validatecalls on every keystroke. Removed from the control bar (control-panel/index.tsx).main/ipc/llm.ts(deleted) - thellm:list-models/llm:validateIPC handlers, pure passthroughs to the backend. Deregistered inmain/index.ts; bridge removed frompreload.ctsandelectron-api.d.ts.main/api/llm.ts- removedvalidate()/listModels(); keptgenerateLiveSuggestions/uploadImage/generateActionSuggestionStream/generateSummary, which aren't BYOK-specific.LLMConfig,LLMModelInfo,LLMConfigValidationResult,LLMProviderfrom bothrenderer/types/llm.tsandmain/types/llm.ts.SuggestionMode(professional-mode wording, unrelated to BYOK) stays in both.Config/RuntimeConfig- removedllmConf. The three generation services (suggestion-live.service.ts,suggestion-action.service.ts,tools.service.ts) stop sending aconfigfield at all on every live-suggestion/action-suggestion/summarize request, matching the backend no longer accepting one.titlebar.tsxandpages/main/index.tsxshowedconfig?.llmConf?.model ?? appState.providedLLMModel; now justappState.providedLLMModel(the backend-reported default model name - unaffected, unrelated to BYOK).Security cleanup
llmConfcould hold a real provider API key in plaintext inside the localelectron-storeconfig file. Deleting the field from the TypeScript type does not erase it from an existing install's disk - every read/write inconfig.store.tsspreads the raw stored object through, so a stale key would otherwise survive silently forever. Added a one-time scrub inconfig.store.ts(same pattern the store already uses for other retired keys likeinterviewConf) that deletes a leftoverllmConfkey from disk on first load after upgrade.Test plan
pnpm lintclean (full project)tsc -bclean (renderer) andtsc -p tsconfig.electron.jsonclean (main process)pnpm run buildandpnpm run electron:build-mainboth succeedpnpm run test:main- all main-process tests passruntime.llmConfon disk has it removed after one launch