feat(config): accept GROQ_API_KEY for Groq-hosted models#657
Open
DanielNg0729 wants to merge 2 commits into
Open
feat(config): accept GROQ_API_KEY for Groq-hosted models#657DanielNg0729 wants to merge 2 commits into
DanielNg0729 wants to merge 2 commits into
Conversation
Add GROQ_API_KEY as an accepted alias for the LLM key alongside LLM_API_KEY / OPENAI_API_KEY, so STRIX_LLM="groq/<model>" works with a provider-native key. Groq models already route through LiteLLM (which mirrors the configured key to GROQ_API_KEY), so this wires up the alias plus docs and tests. Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
Contributor
Greptile SummaryThis PR adds first-class Groq key support for LLM configuration. The main changes are:
Confidence Score: 4/5The changed config path can pick the wrong provider credential.
strix/config/settings.py Important Files Changed
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
strix/config/settings.py:26
**OpenAI Key Overrides Groq**
When `STRIX_LLM` is `groq/...` and the environment contains both an existing `OPENAI_API_KEY` and the new `GROQ_API_KEY`, this alias order selects the OpenAI key for `settings.llm.api_key`. That generic key is then passed into the model defaults, so Groq requests can authenticate with the wrong provider credential and fail even though the Groq key is set.
### Issue 2 of 2
strix/config/settings.py:26
**Groq Key Becomes Generic**
When only `GROQ_API_KEY` is set and the configured model is not Groq, this alias still populates the generic LLM key. The later provider-env mirroring path can then copy the Groq credential into the missing key for the selected provider, such as `OPENAI_API_KEY`, causing non-Groq runs to authenticate with a Groq token instead of reporting that the provider key is missing.
Reviews (1): Last reviewed commit: "feat(config): accept GROQ_API_KEY for Gr..." | Re-trigger Greptile |
Folding GROQ_API_KEY into the generic api_key AliasChoices let the wrong provider credential be selected: with both OPENAI_API_KEY and GROQ_API_KEY set the OpenAI key won by alias order, and a Groq-only key would be mirrored into OPENAI_API_KEY on non-Groq runs. Give Groq a dedicated groq_api_key field (like perplexity_api_key) that is only ever exported as GROQ_API_KEY, so it never contaminates the generic key or another provider's env. LiteLLM reads GROQ_API_KEY natively; the export also lets persisted config reach the provider. Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
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
Adds first-class support for running Strix on Groq.
GROQ_API_KEYis now accepted as the LLM key alongsideLLM_API_KEY/OPENAI_API_KEY, so users can point Strix at Groq's fast inference with theirprovider-native key and a
groq/<model>model string.Resolved #656
Why
Groq offers fast, low-cost inference for open models (Llama 3.x, etc.), but there was no documented, first-class way to use it. Strix only looked for
LLM_API_KEY/OPENAI_API_KEY, so a user with aGROQ_API_KEYhad to fall back toundocumented workarounds (custom
LLM_API_BASE,openai/model names). This makes Groq work the same way OpenAI already does.How
Groq models already route correctly through the existing stack —
StrixProviderforwards non-OpenAI prefixes to LiteLLM, and_mirror_api_key_to_provider_envcopies the configured key intoGROQ_API_KEY(verified:litellm.validate_environment("groq/llama-3.3-70b-versatile")reportsGROQ_API_KEYas the required key). The only missing piece was accepting the provider-native key, so this change is intentionally minimal:strix/config/settings.py— addGROQ_API_KEYto theapi_keyAliasChoices. It's listed afterLLM_API_KEY/OPENAI_API_KEY, sothose keep precedence when multiple are set.
tests/test_config_loader.py— two tests (alias populates the LLM key;LLM_API_KEYwins overGROQ_API_KEY) plusGROQ_API_KEYadded to theenv-reset list.
README.md— document the Groq config in the Configuration section.Before / After
Before — no supported path; had to improvise: