litellm - ✅(Solved) Fix [Bug]: litellm.anthropic_interface.messages.acreate() got multiple values for keyword argument 'output_config' [1 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#24856Fetched 2026-04-08 01:59:09
View on GitHub
Comments
2
Participants
3
Timeline
8
Reactions
0
Timeline (top)
labeled ×4commented ×2cross-referenced ×1referenced ×1

Error Message

13:32:20 - LiteLLM:ERROR: handler.py:784 - WebSearchInterception: Follow-up request failed [call_id=ca20f5ed-4764-47a2-b39b-e2d35079c151 model=bedrock/eu.anthropic.claude-opus-4-6-v1 messages=3 searches=1]: litellm.anthropic_interface.messages.acreate() got multiple values for keyword argument 'output_config' Traceback (most recent call last): File "/Users/slaurent/repos/github_public/BerriAI/litellm/litellm/integrations/websearch_interception/handler.py", line 769, in _execute_agentic_loop final_response = await anthropic_messages.acreate( ~~~~~~~~~~~~~~~~~~~~~~~~~~^ max_tokens=max_tokens, ^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... **kwargs_for_followup, ^^^^^^^^^^^^^^^^^^^^^^ ) ^ TypeError: litellm.anthropic_interface.messages.acreate() got multiple values for keyword argument 'output_config' 13:32:20 - LiteLLM:ERROR: llm_http_handler.py:4517 - LiteLLM.AgenticHookError: Exception in agentic completion hooks [call_id=ca20f5ed-4764-47a2-b39b-e2d35079c151 model=eu.anthropic.claude-opus-4-6-v1]: litellm.anthropic_interface.messages.acreate() got multiple values for keyword argument 'output_config' Traceback (most recent call last): File "/Users/slaurent/repos/github_public/BerriAI/litellm/litellm/llms/custom_httpx/llm_http_handler.py", line 4501, in _call_agentic_completion_hooks agentic_response = await callback.async_run_agentic_loop( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<9 lines>... ) ^ File "/Users/slaurent/repos/github_public/BerriAI/litellm/litellm/integrations/websearch_interception/handler.py", line 559, in async_run_agentic_loop return await self._execute_agentic_loop( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<8 lines>... ) ^ File "/Users/slaurent/repos/github_public/BerriAI/litellm/litellm/integrations/websearch_interception/handler.py", line 769, in _execute_agentic_loop final_response = await anthropic_messages.acreate( ~~~~~~~~~~~~~~~~~~~~~~~~~~^ max_tokens=max_tokens, ^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... **kwargs_for_followup, ^^^^^^^^^^^^^^^^^^^^^^ ) ^ TypeError: litellm.anthropic_interface.messages.acreate() got multiple values for keyword argument 'output_config' INFO: 127.0.0.1:50477 - "POST /v1/messages?beta=true HTTP/1.1" 200 OK

Root Cause

The issue seems to be that in litellm/integrations/websearch_interception/handler.py line 769, the call

            final_response = await anthropic_messages.acreate(
                max_tokens=max_tokens,
                messages=follow_up_messages,
                model=full_model_name,
                **optional_params_without_max_tokens,
                **kwargs_for_followup,
            )

fails because both optional_params_without_max_tokens and kwargs_for_followup contain a output_config key

Fix Action

Fixed

PR fix notes

PR #24858: fix(websearch): deduplicate overlapping keys in follow-up kwargs to prevent TypeError

Description (problem / solution / changelog)

Summary

Fixes #24856

When using websearch interception with bedrock + Claude, the follow-up acreate() call crashes with:

TypeError: acreate() got multiple values for keyword argument 'output_config'

Root Cause

_execute_agentic_loop() merges two dicts into the acreate() call:

  • optional_params_without_max_tokens — extracted from anthropic_messages_optional_request_params
  • kwargs_for_followup — built by _prepare_followup_kwargs(kwargs)

Both can contain the same keys (e.g. output_config). When Python unpacks **dict1, **dict2 and both have the same key, it raises TypeError: got multiple values.

Fix

After building kwargs_for_followup, remove any keys that are already present in optional_params_without_max_tokens. The explicit optional params always win since they are the canonical source for Anthropic-specific parameters.

for key in optional_params_without_max_tokens:
    kwargs_for_followup.pop(key, None)

Tests

Added 2 unit tests:

  • test_prepare_followup_kwargs_excludes_internal_keys — verifies internal key filtering
  • test_followup_kwargs_deduplication_against_optional_params — regression test for the exact duplicate key scenario

Changed files

  • litellm/integrations/websearch_interception/handler.py (modified, +7/-0)
  • tests/test_litellm/integrations/websearch_interception/test_websearch_interception_handler.py (modified, +44/-0)

Code Example

final_response = await anthropic_messages.acreate(
                max_tokens=max_tokens,
                messages=follow_up_messages,
                model=full_model_name,
                **optional_params_without_max_tokens,
                **kwargs_for_followup,
            )

---

{
	"model": "claude-opus-4-6",
	"messages": [{
		"role": "user",
		"content": [{
			"type": "text",
			"text": "Perform a web search for the query: Microsoft CEO",
			"cache_control": {
				"type": "ephemeral"
			}
		}]
	}],
	"system": [{
		"type": "text",
		"text": "x-anthropic-billing-header: cc_version=2.1.88.ac3; cc_entrypoint=cli; cch=700fb;"
	}, {
		"type": "text",
		"text": "You are Claude Code, Anthropic's official CLI for Claude.",
		"cache_control": {
			"type": "ephemeral"
		}
	}, {
		"type": "text",
		"text": "You are an assistant for performing a web search tool use",
		"cache_control": {
			"type": "ephemeral"
		}
	}],
	"tools": [{
		"type": "web_search_20250305",
		"name": "web_search",
		"max_uses": 8
	}],
	"metadata": {
		"user_id": "{\"device_id\":\"e904d2bcc55d3407c82c326a6da36d0a843a29b6ad20b1fdbc8bfadc303060f3\",\"account_uuid\":\"\",\"session_id\":\"3ff70fe0-031a-4028-8598-377aa5f78126\"}"
	},
	"max_tokens": 64000,
	"thinking": {
		"type": "adaptive"
	},
	"output_config": {
		"effort": "medium"
	},
	"stream": true
}

---

13:32:20 - LiteLLM:ERROR: handler.py:784 - WebSearchInterception: Follow-up request failed [call_id=ca20f5ed-4764-47a2-b39b-e2d35079c151 model=bedrock/eu.anthropic.claude-opus-4-6-v1 messages=3 searches=1]: litellm.anthropic_interface.messages.acreate() got multiple values for keyword argument 'output_config'
Traceback (most recent call last):
  File "/Users/slaurent/repos/github_public/BerriAI/litellm/litellm/integrations/websearch_interception/handler.py", line 769, in _execute_agentic_loop
    final_response = await anthropic_messages.acreate(
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~^
        max_tokens=max_tokens,
        ^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        **kwargs_for_followup,
        ^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
TypeError: litellm.anthropic_interface.messages.acreate() got multiple values for keyword argument 'output_config'
13:32:20 - LiteLLM:ERROR: llm_http_handler.py:4517 - LiteLLM.AgenticHookError: Exception in agentic completion hooks [call_id=ca20f5ed-4764-47a2-b39b-e2d35079c151 model=eu.anthropic.claude-opus-4-6-v1]: litellm.anthropic_interface.messages.acreate() got multiple values for keyword argument 'output_config'
Traceback (most recent call last):
  File "/Users/slaurent/repos/github_public/BerriAI/litellm/litellm/llms/custom_httpx/llm_http_handler.py", line 4501, in _call_agentic_completion_hooks
    agentic_response = await callback.async_run_agentic_loop(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<9 lines>...
    )
    ^
  File "/Users/slaurent/repos/github_public/BerriAI/litellm/litellm/integrations/websearch_interception/handler.py", line 559, in async_run_agentic_loop
    return await self._execute_agentic_loop(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<8 lines>...
    )
    ^
  File "/Users/slaurent/repos/github_public/BerriAI/litellm/litellm/integrations/websearch_interception/handler.py", line 769, in _execute_agentic_loop
    final_response = await anthropic_messages.acreate(
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~^
        max_tokens=max_tokens,
        ^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        **kwargs_for_followup,
        ^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
TypeError: litellm.anthropic_interface.messages.acreate() got multiple values for keyword argument 'output_config'
INFO:     127.0.0.1:50477 - "POST /v1/messages?beta=true HTTP/1.1" 200 OK
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

Using Claude Code with LiteLLM 1.82.6.rc.2 with bedrock + websearch_interception with perplexity

  • claude code prompts litellm with a web_search_20250305 tool
  • litellm queries bedrock (with opus 4.6) OK, with tool litellm_web_search
  • bedrock responds with stop_reason=tool_use
  • litellm queries perplexity OK
  • litellm prepares a new request for bedrock and fails: see log output field

The issue seems to be that in litellm/integrations/websearch_interception/handler.py line 769, the call

            final_response = await anthropic_messages.acreate(
                max_tokens=max_tokens,
                messages=follow_up_messages,
                model=full_model_name,
                **optional_params_without_max_tokens,
                **kwargs_for_followup,
            )

fails because both optional_params_without_max_tokens and kwargs_for_followup contain a output_config key

Steps to Reproduce

  1. configure litellm proxy with bedrock / opus4-6 + websearch interception + perplexity
  2. call /v1/messages?beta=true on litellm with this payload:
{
	"model": "claude-opus-4-6",
	"messages": [{
		"role": "user",
		"content": [{
			"type": "text",
			"text": "Perform a web search for the query: Microsoft CEO",
			"cache_control": {
				"type": "ephemeral"
			}
		}]
	}],
	"system": [{
		"type": "text",
		"text": "x-anthropic-billing-header: cc_version=2.1.88.ac3; cc_entrypoint=cli; cch=700fb;"
	}, {
		"type": "text",
		"text": "You are Claude Code, Anthropic's official CLI for Claude.",
		"cache_control": {
			"type": "ephemeral"
		}
	}, {
		"type": "text",
		"text": "You are an assistant for performing a web search tool use",
		"cache_control": {
			"type": "ephemeral"
		}
	}],
	"tools": [{
		"type": "web_search_20250305",
		"name": "web_search",
		"max_uses": 8
	}],
	"metadata": {
		"user_id": "{\"device_id\":\"e904d2bcc55d3407c82c326a6da36d0a843a29b6ad20b1fdbc8bfadc303060f3\",\"account_uuid\":\"\",\"session_id\":\"3ff70fe0-031a-4028-8598-377aa5f78126\"}"
	},
	"max_tokens": 64000,
	"thinking": {
		"type": "adaptive"
	},
	"output_config": {
		"effort": "medium"
	},
	"stream": true
}
  1. Check litellm logs

Relevant log output

13:32:20 - LiteLLM:ERROR: handler.py:784 - WebSearchInterception: Follow-up request failed [call_id=ca20f5ed-4764-47a2-b39b-e2d35079c151 model=bedrock/eu.anthropic.claude-opus-4-6-v1 messages=3 searches=1]: litellm.anthropic_interface.messages.acreate() got multiple values for keyword argument 'output_config'
Traceback (most recent call last):
  File "/Users/slaurent/repos/github_public/BerriAI/litellm/litellm/integrations/websearch_interception/handler.py", line 769, in _execute_agentic_loop
    final_response = await anthropic_messages.acreate(
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~^
        max_tokens=max_tokens,
        ^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        **kwargs_for_followup,
        ^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
TypeError: litellm.anthropic_interface.messages.acreate() got multiple values for keyword argument 'output_config'
13:32:20 - LiteLLM:ERROR: llm_http_handler.py:4517 - LiteLLM.AgenticHookError: Exception in agentic completion hooks [call_id=ca20f5ed-4764-47a2-b39b-e2d35079c151 model=eu.anthropic.claude-opus-4-6-v1]: litellm.anthropic_interface.messages.acreate() got multiple values for keyword argument 'output_config'
Traceback (most recent call last):
  File "/Users/slaurent/repos/github_public/BerriAI/litellm/litellm/llms/custom_httpx/llm_http_handler.py", line 4501, in _call_agentic_completion_hooks
    agentic_response = await callback.async_run_agentic_loop(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<9 lines>...
    )
    ^
  File "/Users/slaurent/repos/github_public/BerriAI/litellm/litellm/integrations/websearch_interception/handler.py", line 559, in async_run_agentic_loop
    return await self._execute_agentic_loop(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<8 lines>...
    )
    ^
  File "/Users/slaurent/repos/github_public/BerriAI/litellm/litellm/integrations/websearch_interception/handler.py", line 769, in _execute_agentic_loop
    final_response = await anthropic_messages.acreate(
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~^
        max_tokens=max_tokens,
        ^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        **kwargs_for_followup,
        ^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
TypeError: litellm.anthropic_interface.messages.acreate() got multiple values for keyword argument 'output_config'
INFO:     127.0.0.1:50477 - "POST /v1/messages?beta=true HTTP/1.1" 200 OK

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

v1.82.6.rc.2

Twitter / LinkedIn details

No response

extent analysis

TL;DR

The issue can be resolved by removing the duplicate output_config key from the optional_params_without_max_tokens or kwargs_for_followup dictionary in the handler.py file.

Guidance

  • Identify the source of the duplicate output_config key in the optional_params_without_max_tokens and kwargs_for_followup dictionaries.
  • Remove or modify one of the output_config keys to avoid the duplication error.
  • Verify that the acreate function is called with a single output_config key.
  • Test the updated code to ensure that the error is resolved and the acreate function is executed successfully.

Example

# Remove the output_config key from one of the dictionaries
del optional_params_without_max_tokens['output_config']

# or
del kwargs_for_followup['output_config']

final_response = await anthropic_messages.acreate(
    max_tokens=max_tokens,
    messages=follow_up_messages,
    model=full_model_name,
    **optional_params_without_max_tokens,
    **kwargs_for_followup,
)

Notes

The issue is specific to the handler.py file in the websearch_interception integration, and the solution involves modifying the code to avoid the duplicate output_config key.

Recommendation

Apply a workaround by removing the duplicate output_config key from the optional_params_without_max_tokens or kwargs_for_followup dictionary. This will resolve the error and allow the acreate function to execute successfully.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - ✅(Solved) Fix [Bug]: litellm.anthropic_interface.messages.acreate() got multiple values for keyword argument 'output_config' [1 pull requests, 2 comments, 3 participants]