{"record":{"id":"213edf97e86bef65","repo":"Fosowl/agenticSeek","slug":"litellm-is-not-available-for-local-use-change-con","errorCode":null,"errorMessage":"LiteLLM is not available for local use. Change config.ini","messagePattern":"LiteLLM is not available for local use\\. Change config\\.ini","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"sources/llm_provider.py","lineNumber":522,"sourceCode":"            raise NetworkError(\"Network error occurred. Check your internet connection.\") from e\n        except APIError as e:\n            raise APIError(f\"API error occurred: {str(e)}\") from e\n        return None\n\n    def litellm_fn(self, history, verbose=False):\n        \"\"\"\n        Use LiteLLM AI gateway for completion.\n        Routes to 100+ providers (OpenAI, Anthropic, Azure, Bedrock,\n        Vertex AI, Groq, Together, Ollama, etc.) based on model prefix.\n        See https://docs.litellm.ai/docs/providers\n        \"\"\"\n        try:\n            import litellm\n        except ImportError as e:\n            raise ImportError(\"litellm is not installed. Install with: pip install litellm\") from e\n\n        if self.is_local:\n            raise Exception(\"LiteLLM is not available for local use. Change config.ini\")\n\n        api_key = os.getenv(\"LITELLM_API_KEY\", None)\n\n        try:\n            call_kwargs = {\n                \"model\": self.model,\n                \"messages\": history,\n                \"drop_params\": True,\n            }\n            if api_key:\n                call_kwargs[\"api_key\"] = api_key\n            response = litellm.completion(**call_kwargs)\n            if response is None:\n                raise Exception(\"LiteLLM response is empty.\")\n            thought = response.choices[0].message.content\n            if verbose:\n                print(thought)\n            return thought","sourceCodeStart":504,"sourceCodeEnd":540,"githubUrl":"https://github.com/Fosowl/agenticSeek/blob/ae57a2357745a9706cb12d0fd76d954c84d166fa/sources/llm_provider.py#L504-L540","documentation":"litellm_fn explicitly rejects local configurations: if the provider was constructed with is_local=True (a local model chosen in config.ini), it raises a plain Exception saying LiteLLM routing is only for cloud providers. LiteLLM completion here always targets hosted APIs via model prefixes, so local backends are unsupported by design.","triggerScenarios":"Calling LLMProvider.litellm_fn(history) when the provider instance was built from a config.ini entry selecting a local model (is_local=True).","commonSituations":"Developer flips the provider to litellm in config.ini but leaves `local = true` / local model settings; reusing one provider object across local and cloud pipelines; misunderstanding that litellm can proxy Ollama-style local endpoints in this wrapper.","solutions":["Edit config.ini and switch the provider away from local mode (set is_local/local flag off and pick a cloud model)","Use the dedicated local-model code path in LLMProvider instead of litellm_fn","Instantiate a separate LLMProvider configured for a cloud provider when you need LiteLLM routing"],"exampleFix":"// before (config.ini)\n[PROVIDER]\nprovider = litellm\nlocal = true\n// after (config.ini)\n[PROVIDER]\nprovider = litellm\nlocal = false\nmodel = openai/gpt-4o-mini","handlingStrategy":"validation","validationCode":"if provider.is_local:\n    raise SystemExit('litellm_fn requires a cloud provider: set local = false in config.ini')","typeGuard":null,"tryCatchPattern":"try:\n    thought = provider.litellm_fn(history)\nexcept Exception as e:\n    if 'not available for local use' in str(e):\n        logger.error('Fix config.ini: LiteLLM cannot serve local models here')\n    raise","preventionTips":["Check provider.is_local before selecting the litellm backend","Keep config.ini provider/local settings consistent with the code path you call","Document that local models use a separate pipeline in this library","Validate config.ini at startup, before any LLM calls"],"tags":["configuration","unsupported-feature","local-model","litellm"],"backgroundTag":"unsupported-configuration","analyzedSha":"ae57a2357745a9706cb12d0fd76d954c84d166fa","analyzedAt":"2026-08-30T02:49:05.834Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}