feat: add OpenRouter as alternative LLM provider - #7
Merged
Conversation
OpenRouter ist OpenAI-kompatibel: konfigurierbare base_url + Modell werden in den bestehenden openai-Client gereicht. Neue, nicht-geheime Config-Felder llm_provider/llm_base_url/llm_model mit Validierung (Provider-Whitelist, http(s)://-Pflicht fuer base_url, Modell-Fallback). Anbieter-Dropdown sowie base_url-/Modell-Felder im KI-Tab mit Auto-Prefill fuer OpenRouter. Beide LLMService-Konstruktionsorte (Init + Settings-Save) ueber _build_llm_service() zusammengefuehrt, damit base_url/model nicht auseinanderlaufen. Secret-Modell unveraendert: nur Env-Var-Name in config.json, Key aus secrets.env. Hotkey/Auto-Paste/Whisper unangetastet.
Codex-Finalreview-Finding: llm_provider wurde gespeichert, aber base_url bedingungslos verwendet. Bei manuell editierter config.json (Provider "openai" + gesetzte base_url) waere OpenRouter trotz OpenAI-Auswahl genutzt worden. _build_llm_service() ignoriert jetzt eine gespeicherte base_url, wenn der Provider "openai" ist -> OpenAI-Standardendpunkt. OpenRouter/eigener Endpunkt nutzen base_url nur bei expliziter Auswahl. Regressionstest ergaenzt.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec724c9efa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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 changed?
Optionaler LLM-Provider neben OpenAI:
LLMServicenimmt jetztbase_url+modelentgegen;gpt-4o-miniist nur noch Default.llm_provider,llm_base_url(http(s)://-Pflicht, sonst leer),llm_model(Fallbackgpt-4o-mini) mit Validierung.BlitztextApp._build_llm_service()→ keine Drift mehr.openaiwird eine evtl. gespeichertebase_urlignoriert (OpenAI-Standardendpunkt). OpenRouter wird nur bei expliziter Auswahl genutzt..venv/zu.gitignoreergänzt.Why?
Ermöglicht das Routen der Umschreib-Workflows über OpenRouter (oder jeden anderen OpenAI-kompatiblen Endpunkt), ohne den Default zu ändern. OpenAI bleibt Standardpfad, OpenRouter ist rein optional. Kein Cloud-TTS in diesem PR.
How did you test it?
QT_QPA_PLATFORM=offscreen WHISPER_GUI_TESTS=1 python -m pytest -q→ 203 passed.sys.modulesinjiziert → Tests laufen ohne echtes Paket), Settings-Persistenz + Provider-Prefill, Regressionstests für_build_llm_service(inkl. Provider-autoritativ beiopenai).config.jsonenthält keinen Key.AI assistance
Ja — umgesetzt mit Claude Code (TDD), read-only gegengeprüft von Codex (GPT-5.4) sowie den code-reviewer- und security-reviewer-Agents (ein Codex-Finding zur Provider-Autorität wurde behoben).
Checklist
pytest tests/(offscreen) — 203 passed.base_urlauf http(s):// validiert.