Bind dedupe LLM credentials to the model instead of extra_args - #1100
Open
AmIrRX0 wants to merge 1 commit into
Open
Bind dedupe LLM credentials to the model instead of extra_args#1100AmIrRX0 wants to merge 1 commit into
AmIrRX0 wants to merge 1 commit into
Conversation
A dedicated dedupe model (STRIX_DEDUPE_MODEL) carried its own
DEDUPE_LLM_API_KEY / DEDUPE_LLM_API_BASE through
ModelSettings.extra_args. LitellmModel already passes api_key= to
litellm.acompletion() explicitly and then splats extra_args into the
same call, so the key arrived twice and every dedupe request died
before it was sent:
TypeError: litellm.main.acompletion() got multiple values for
keyword argument 'api_key'
The OpenAI route was broken the same way: chat.completions.create()
has no api_key parameter at all.
Credentials now ride on the model rather than on the request.
StrixProvider takes optional api_key/api_base, forwarding them to
MultiProvider for the OpenAI route and binding them onto the
LitellmModel for the LiteLLM route, which is what those constructor
arguments are for. dedupe_model_provider() builds that provider, so a
dedicated dedupe model keeps its endpoint and key separate from the
main model's process-wide config exactly as before.
Fixes usestrix#1095
Contributor
Greptile SummaryThe PR moves dedicated dedupe credentials from per-request
Confidence Score: 5/5The PR appears safe to merge, with dedicated dedupe credentials consistently scoped to the selected provider and no concrete regression identified. Both warm-up and runtime deduplication now use the same credential-aware provider path, while the tests cover credential binding, endpoint isolation, fallback to global configuration, and the original duplicate-key failure. Important Files Changed
Reviews (1): Last reviewed commit: "Bind dedupe LLM credentials to the model..." | Re-trigger Greptile |
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.
Fixes #1095
Root cause
Not the module-level
litellm.api_keyglobal the issue suspected — those globalsare fine, litellm falls back to them cleanly.
A dedicated dedupe model (
STRIX_DEDUPE_MODEL) carried its ownDEDUPE_LLM_API_KEY/DEDUPE_LLM_API_BASEthroughModelSettings.extra_args(
_dedupe_extra_args).LitellmModel._fetch_responsepassesapi_key=self.api_keyexplicitly and splatsextra_argsinto the samelitellm.acompletion()call, so the key arrived twice:The OpenAI route was broken the same way —
chat.completions.create()has noapi_keyparameter at all, so a dedupe model on that route failed with anunexpected-keyword error.
Reproducing
Before: warm-up dies at the dedupe model with
TypeError: litellm.main.acompletion() got multiple values for keyword argument 'api_key'.After: the dedupe model connects, with its own key and endpoint still isolated
from the main model's.
Fix
Credentials ride on the model rather than on the request:
StrixProvidertakes optionalapi_key/api_base. They go toMultiProviderfor the OpenAI route and are bound onto the
LitellmModelfor the LiteLLMroute — which is what
LitellmModel(model, base_url, api_key)exists for._dedupe_extra_args→dedupe_model_provider(), used by bothcheck_duplicateand the warm-up path in
warm_up_llm.Behaviour is unchanged: a dedicated dedupe model still keeps its endpoint and key
isolated from the main model's process-wide config, and
base_urloverridesapi_baseinsidelitellm.completion()exactly as the oldextra_args["api_base"]did.Tests
LitellmModeltolitellm.acompletion— it fails with the reportedTypeErrorbefore this change.never present in
extra_args.ruff check,ruff format --check,mypy strix/andbandit -r strix/ -c pyproject.tomlclean on the changed files.