Repository navigation
feat: add groq to native OpenAI-compatible provider routing - #8801
Felix Shi (shi-felix) wants to merge 5 commits into
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
Strix Security ReviewWarning This pull request has 120 commits after the last Strix review ( ✅ No open security findings. PR summary: This PR adds `groq` as a native OpenAI-compatible provider so `LLM(model="groq/<model-id>")` routes through `OpenAICompatibleCompletion` with `GROQ_API_KEY` / `GROQ_BASE_URL` instead of falling back to LiteLLM, plus documentation and tests. Review summaryReviewed the full diff: the groq ProviderConfig in Review 1 on this PR · Reviewed by Strix |
Summary
groqnow routes through the nativeOpenAICompatibleCompletioninstead of falling back to LiteLLM, soLLM(model="groq/<model-id>")works without the LiteLLM extra.Fixes #8009.
Changes
lib/crewai/src/crewai/llms/providers/openai_compatible/completion.py: add thegroqProviderConfig(https://api.groq.com/openai/v1,GROQ_API_KEY, optionalGROQ_BASE_URL) and list it in the class docstring.lib/crewai/src/crewai/llm.py: addgroqtoSUPPORTED_NATIVE_PROVIDERS,PROVIDER_ALIASES, the native-provider set in_get_native_provider, and_matches_provider_pattern. Groq model ids pass through unchanged, so an id that carries its own slash such asopenai/gpt-oss-120bkeeps both segments.lib/crewai/tests/llms/openai_compatible/test_openai_compatible.py: coverage for the registry entry, the missing-key error (and that an OpenAI key is not reused for Groq), prefixed and explicit-provider routing,GROQ_BASE_URL, explicit-config precedence, slash-carrying model ids, and the resolved client params.docs/edge/{en,ar,ko,pt-BR}/concepts/llms.mdx: a Groq accordion, including the request fields Groq documents as unsupported.is_litellm=Truestill forces the LiteLLM path, and the other native providers are untouched.Testing
Python 3.13.14 on Windows. No provider credentials and no paid API calls were used — the tests only assert on construction, routing and client parameters.
AI assistance
Written with AI assistance (WorkBuddy) and reviewed before submission.
Note
Medium Risk
Changes core LLM routing and API-key selection for Groq; behavior is aligned with other OpenAI-compatible natives and is covered by tests, but misconfiguration could still break existing Groq setups until env vars are set correctly.
Overview
Groq is now a first-class native provider:
LLM(model="groq/…")(orprovider="groq") buildsOpenAICompatibleCompletionagainsthttps://api.groq.com/openai/v1usingGROQ_API_KEYand optionalGROQ_BASE_URL, without requiringcrewai[litellm].Routing updates in
llm.pyregistergroqalongside other OpenAI-compatible natives, accept any model id after the prefix (including ids with an extra slash, e.g.groq/openai/gpt-oss-120b), and keep Groq from reusingOPENAI_API_KEY.completion.pyadds the GroqProviderConfigentry.Tests cover registry defaults, missing-key errors, prefixed and explicit routing, env overrides, and client params. Docs in en/ar/ko/pt-BR add a native Groq accordion (env, example, compatibility caveats); note that older Groq sections still describe LiteLLM in the same pages, so reviewers may want to consolidate.
Reviewed by Cursor Bugbot for commit 24c6792. Bugbot is set up for automated code reviews on this repo. Configure here.