From fb7f5351ab3349830480af9340537affbd0d3b61 Mon Sep 17 00:00:00 2001 From: Alexsander Hamir Date: Thu, 22 Jan 2026 12:14:06 -0800 Subject: [PATCH] Fix duplicate keyword argument error for acompletion parameter - Only add acompletion=True to completion_kwargs if not already in kwargs - Prevents TypeError when functools.partial() receives acompletion twice - Fixes issue affecting multiple model groups (llama-3-70b, gpt-4o, gemini, etc.) - More Pythonic approach that respects explicit values in kwargs --- litellm/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/litellm/main.py b/litellm/main.py index ae27b4145b3..df49a6435ee 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -555,11 +555,15 @@ async def acompletion( "safety_identifier": safety_identifier, "service_tier": service_tier, "extra_headers": extra_headers, - "acompletion": True, # assuming this is a required parameter "thinking": thinking, "web_search_options": web_search_options, "shared_session": shared_session, } + # Only add acompletion if not already in kwargs (avoids duplicate keyword argument error) + # acompletion is an internal flag to distinguish async from sync calls + if "acompletion" not in kwargs: + completion_kwargs["acompletion"] = True + if custom_llm_provider is None: _, custom_llm_provider, _, _ = get_llm_provider( model=model,