BerriAI/litellm · error · LangFlowError

tweaks cannot be set via request parameters; they would over

Error message

tweaks cannot be set via request parameters; they would override the operator-configured LangFlow flow components

What it means

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.

Source

Thrown at litellm/llms/langflow/chat/transformation.py:130

                    content = convert_content_list_to_str(msg)
                if not isinstance(content, str):
                    content = str(content)
                return content

        # Fallback: use last message regardless of role
        if messages:
            content = messages[-1].get("content", "")
            if isinstance(content, list):
                content = convert_content_list_to_str(messages[-1])
            if not isinstance(content, str):
                content = str(content)
            return content

        return ""

    def _reject_caller_tweaks(self, params: dict) -> None:
        if params.get("tweaks") is not None:
            raise LangFlowError(
                status_code=400,
                message=(
                    "tweaks cannot be set via request parameters; they would "
                    "override the operator-configured LangFlow flow components"
                ),
            )

    def transform_request(
        self,
        model: str,
        messages: list[AllMessageValues],
        optional_params: dict,
        litellm_params: dict,
        headers: dict,
    ) -> dict:
        """
        Transform the request to LangFlow format.

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Remove tweaks from the request; configure the desired component settings inside the LangFlow flow itself
  2. If different tweak sets are needed, create separate LangFlow flows and expose them as separate langflow/{flow_id} models
  3. Check extra_body/default_params in router configs for a leftover tweaks key

Example fix

# before
litellm.completion(
    model="langflow/my-flow", messages=msgs,
    extra_body={"tweaks": {"OpenAI-abc": {"model_name": "gpt-4o"}}},
)

# after
# adjust the component in the LangFlow editor, then just:
litellm.completion(model="langflow/my-flow", messages=msgs)
Defensive patterns

Strategy: validation

Validate before calling

def strip_forbidden_langflow_params(extra_body: dict) -> dict:
    return {k: v for k, v in (extra_body or {}).items() if k not in ("tweaks", "flow_id")}

Try / catch

try:
    litellm.completion(model="langflow/x", messages=msgs, extra_body=user_extra)
except LangFlowError as e:
    if e.status_code == 400 and "tweaks" in str(e):
        user_extra.pop("tweaks", None)  # degrade gracefully: run operator defaults
        litellm.completion(model="langflow/x", messages=msgs, extra_body=user_extra)

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/8e6498ef0b8fd6e2. Report an issue: GitHub.