{"record":{"id":"28738b5c3bd60539","repo":"BerriAI/litellm","slug":"promptinjectiondetection-invalid-llm-api-name-ll","errorCode":null,"errorMessage":"PromptInjectionDetection: Invalid LLM API Name. LLM API Name must be a 'model_name' in 'model_list'.","messagePattern":"PromptInjectionDetection: Invalid LLM API Name\\. LLM API Name must be a 'model_name' in 'model_list'\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/proxy/hooks/prompt_injection_detection.py","lineNumber":93,"sourceCode":"            print(print_statement)  # noqa: T201\n\n    def update_environment(self, router: Router | None = None):\n        self.llm_router = router\n\n        if self.prompt_injection_params is not None and self.prompt_injection_params.llm_api_check is True:\n            if self.llm_router is None:\n                raise Exception(\n                    \"PromptInjectionDetection: Model List not set. Required for Prompt Injection detection.\"\n                )\n\n            self.print_verbose(\n                f\"model_names: {self.llm_router.model_names}; self.prompt_injection_params.llm_api_name: {self.prompt_injection_params.llm_api_name}\"\n            )\n            if (\n                self.prompt_injection_params.llm_api_name is None\n                or self.prompt_injection_params.llm_api_name not in self.llm_router.model_names\n            ):\n                raise Exception(\n                    \"PromptInjectionDetection: Invalid LLM API Name. LLM API Name must be a 'model_name' in 'model_list'.\"\n                )\n\n    def generate_injection_keywords(self) -> list[str]:\n        combinations: Final = []\n        for verb in self.verbs:\n            for adj in self.adjectives:\n                for prep in self.prepositions:\n                    phrase = \" \".join(filter(None, [verb, adj, prep])).strip()\n                    if len(phrase.split()) > 2:  # additional check to ensure more than 2 words\n                        combinations.append(phrase.lower())\n        return combinations\n\n    def check_user_input_similarity(\n        self,\n        user_input: str,\n        similarity_threshold: float = DEFAULT_PROMPT_INJECTION_SIMILARITY_THRESHOLD,\n    ) -> bool:","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/hooks/prompt_injection_detection.py#L75-L111","documentation":"Error \"PromptInjectionDetection: Invalid LLM API Name. LLM API Name must be a 'model_name' in 'model_list'.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/hooks/prompt_injection_detection.py:93 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set llm_api_name to a model_name that exists in the proxy model_list.","Check for typos in the configured LLM API name."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}