{"record":{"id":"005334db1c263946","repo":"BerriAI/litellm","slug":"model-is-required","errorCode":null,"errorMessage":"model is required","messagePattern":"model is required","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/completion_extras/litellm_responses_transformation/handler.py","lineNumber":110,"sourceCode":"        response_obj: Final = getattr(completed, \"response\", None) if completed else None\n        if response_obj is None:\n            raise ValueError(\"Stream ended without a completed response\")\n\n        hidden_params: Final = getattr(stream_iter, \"_hidden_params\", None)\n        response: Final = self._coerce_response_object(response_obj, hidden_params)\n        if not isinstance(response, ResponsesAPIResponse):\n            raise ValueError(\"Stream completed response is invalid\")\n        return response\n\n    def validate_input_kwargs(self, kwargs: dict) -> ResponsesToCompletionBridgeHandlerInputKwargs:\n        from litellm import LiteLLMLoggingObj\n        from litellm.types.utils import ModelResponse\n\n        typed_kwargs: Final[dict[str, object]] = kwargs\n\n        model: Final = typed_kwargs.get(\"model\")\n        if model is None or not isinstance(model, str):\n            raise ValueError(\"model is required\")\n\n        custom_llm_provider: Final = typed_kwargs.get(\"custom_llm_provider\")\n        if custom_llm_provider is None or not isinstance(custom_llm_provider, str):\n            raise ValueError(\"custom_llm_provider is required\")\n\n        messages: Final = typed_kwargs.get(\"messages\")\n        if messages is None or not isinstance(messages, list):\n            raise ValueError(\"messages is required\")\n\n        optional_params: Final = typed_kwargs.get(\"optional_params\")\n        if optional_params is None or not isinstance(optional_params, dict):\n            raise ValueError(\"optional_params is required\")\n\n        litellm_params: Final = typed_kwargs.get(\"litellm_params\")\n        if litellm_params is None or not isinstance(litellm_params, dict):\n            raise ValueError(\"litellm_params is required\")\n\n        headers: Final = typed_kwargs.get(\"headers\")","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/completion_extras/litellm_responses_transformation/handler.py#L92-L128","documentation":"validate_input_kwargs on ResponsesToCompletionBridgeHandler raises this when the kwargs dict is missing 'model' or it is not a str. These kwargs are normally assembled internally by litellm's completion pipeline; a user only sees this error when invoking the bridge handler directly (it is an internal API) or when a fork/older pipeline fails to thread the model through.","triggerScenarios":"Instantiating ResponsesToCompletionBridgeHandler and calling its async_completion or validate_input_kwargs with a hand-built kwargs dict that omits 'model' or sets it to a non-string (e.g. None, int).","commonSituations":"Custom integrations or tests that call the bridge handler directly instead of litellm.completion; copy-pasted kwargs from an older litellm version whose pipeline keys changed.","solutions":["Call litellm.completion()/acompletion() instead of the bridge handler directly — it constructs all required kwargs for you","If calling directly, include model as a non-empty string in the kwargs dict","Check the ResponsesToCompletionBridgeHandlerInputKwargs TypedDict (handler.py:16) for the full required key set"],"exampleFix":"# before\nhandler = ResponsesToCompletionBridgeHandler()\nresult = await handler.acompletion({\"messages\": msgs, ...})  # no model\n\n# after\nresult = await litellm.acompletion(model=\"openai/gpt-4o\", messages=msgs)","handlingStrategy":"validation","validationCode":"def has_model_kwarg(kwargs: dict) -> bool:\n    return isinstance(kwargs.get(\"model\"), str) and bool(kwargs[\"model\"])","typeGuard":"def is_valid_bridge_kwargs(kwargs: dict) -> bool:\n    return isinstance(kwargs.get(\"model\"), str)","tryCatchPattern":null,"preventionTips":["Prefer litellm.completion over the internal bridge handler","Type your kwargs against ResponsesToCompletionBridgeHandlerInputKwargs","Validate required keys before direct invocation"],"tags":["validation","bridge","internal-api","kwargs"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}