{"record":{"id":"6bac31bb9ca3362f","repo":"BerriAI/litellm","slug":"failed-to-translate-request-to-openai-format","errorCode":null,"errorMessage":"Failed to translate request to OpenAI format","messagePattern":"Failed to translate request to OpenAI format","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/anthropic/experimental_pass_through/adapters/handler.py","lineNumber":493,"sourceCode":"            request_data[\"output_format\"] = output_format\n\n        # Extract output_config from extra_kwargs so the translator can use it\n        # (e.g. output_config.effort for adaptive thinking → reasoning_effort,\n        # output_config.format → response_format for structured outputs).\n        # Use explicit None check rather than `or {}` so an explicit empty dict\n        # caller-passed argument is preserved (matters for tests that drive\n        # the fallback inference path).\n        extra_kwargs = extra_kwargs if extra_kwargs is not None else {}\n        if \"output_config\" in extra_kwargs:\n            request_data[\"output_config\"] = extra_kwargs[\"output_config\"]\n\n        (\n            openai_request,\n            tool_name_mapping,\n        ) = ANTHROPIC_ADAPTER.translate_completion_input_params_with_tool_mapping(request_data)\n\n        if openai_request is None:\n            raise ValueError(\"Failed to translate request to OpenAI format\")\n\n        completion_kwargs: Final[_CompletionKwargs] = {**openai_request}\n\n        if stream:\n            completion_kwargs[\"stream\"] = stream\n            completion_kwargs[\"stream_options\"] = {\n                \"include_usage\": True,\n            }\n\n        # Keys that must NOT be forwarded as raw extras into the OpenAI-format\n        # ``completion_kwargs`` after translation. The translator above has\n        # already consumed the meaningful parts of these inputs (e.g.\n        # ``output_config.format`` → ``response_format``, ``output_config.effort``\n        # → ``reasoning_effort`` for non-Claude targets). Re-adding the raw\n        # Anthropic-shaped key here causes 400 \"Extra inputs are not permitted\"\n        # on non-Anthropic backends (Azure OpenAI, Fireworks, Bedrock Nova,\n        # etc.) and is silently lossy on Anthropic-family targets, which would\n        # see the translated key ``response_format`` AND a duplicate, conflicting","sourceCodeStart":475,"sourceCodeEnd":511,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/anthropic/experimental_pass_through/adapters/handler.py#L475-L511","documentation":"Error \"Failed to translate request to OpenAI format\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/anthropic/experimental_pass_through/adapters/handler.py:493 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the Anthropic request payload for fields that cannot be translated to OpenAI format."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}