{"record":{"id":"8e6498ef0b8fd6e2","repo":"BerriAI/litellm","slug":"tweaks-cannot-be-set-via-request-parameters-they","errorCode":null,"errorMessage":"tweaks cannot be set via request parameters; they would override the operator-configured LangFlow flow components","messagePattern":"tweaks cannot be set via request parameters; they would override the operator-configured LangFlow flow components","errorType":"validation","errorClass":"LangFlowError","httpStatus":400,"severity":"error","filePath":"litellm/llms/langflow/chat/transformation.py","lineNumber":130,"sourceCode":"                    content = convert_content_list_to_str(msg)\n                if not isinstance(content, str):\n                    content = str(content)\n                return content\n\n        # Fallback: use last message regardless of role\n        if messages:\n            content = messages[-1].get(\"content\", \"\")\n            if isinstance(content, list):\n                content = convert_content_list_to_str(messages[-1])\n            if not isinstance(content, str):\n                content = str(content)\n            return content\n\n        return \"\"\n\n    def _reject_caller_tweaks(self, params: dict) -> None:\n        if params.get(\"tweaks\") is not None:\n            raise LangFlowError(\n                status_code=400,\n                message=(\n                    \"tweaks cannot be set via request parameters; they would \"\n                    \"override the operator-configured LangFlow flow components\"\n                ),\n            )\n\n    def transform_request(\n        self,\n        model: str,\n        messages: list[AllMessageValues],\n        optional_params: dict,\n        litellm_params: dict,\n        headers: dict,\n    ) -> dict:\n        \"\"\"\n        Transform the request to LangFlow format.\n","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/langflow/chat/transformation.py#L112-L148","documentation":"LangFlow 'tweaks' override component settings of a flow at run time. LiteLLM rejects caller-supplied tweaks (LangFlowError 400) because they would bypass the operator's curated flow configuration — the deployment is meant to expose flows as fixed models. Tweaks must be configured on the LangFlow side, not per request.","triggerScenarios":"Passing tweaks=... or extra_body={'tweaks': {...}} to a langflow/* model; porting a script that called LangFlow's REST API directly with a tweaks payload; a generic kwargs-forwarding client injecting tweaks.","commonSituations":"Trying to tweak model temperature or component params per-request through tweaks instead of configuring the flow in LangFlow; migrating raw LangFlow API code to LiteLLM without removing tweaks.","solutions":["Remove tweaks from the request; configure the desired component settings inside the LangFlow flow itself","If different tweak sets are needed, create separate LangFlow flows and expose them as separate langflow/{flow_id} models","Check extra_body/default_params in router configs for a leftover tweaks key"],"exampleFix":"# before\nlitellm.completion(\n    model=\"langflow/my-flow\", messages=msgs,\n    extra_body={\"tweaks\": {\"OpenAI-abc\": {\"model_name\": \"gpt-4o\"}}},\n)\n\n# after\n# adjust the component in the LangFlow editor, then just:\nlitellm.completion(model=\"langflow/my-flow\", messages=msgs)","handlingStrategy":"validation","validationCode":"def strip_forbidden_langflow_params(extra_body: dict) -> dict:\n    return {k: v for k, v in (extra_body or {}).items() if k not in (\"tweaks\", \"flow_id\")}","typeGuard":null,"tryCatchPattern":"try:\n    litellm.completion(model=\"langflow/x\", messages=msgs, extra_body=user_extra)\nexcept LangFlowError as e:\n    if e.status_code == 400 and \"tweaks\" in str(e):\n        user_extra.pop(\"tweaks\", None)  # degrade gracefully: run operator defaults\n        litellm.completion(model=\"langflow/x\", messages=msgs, extra_body=user_extra)","preventionTips":["Treat langflow/* models as sealed: expose only messages/temperature-level knobs, never forward raw LangFlow body params","When porting direct LangFlow API code, delete tweaks payloads instead of translating them","Need variant settings? Deploy one flow per configuration and map each to its own model name"],"tags":["langflow","validation","security","config"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}