{"record":{"id":"c00460209e779a41","repo":"Fosowl/agenticSeek","slug":"deepseek-api-is-not-available-for-local-use-cha","errorCode":null,"errorMessage":"Deepseek (API) is not available for local use. Change config.ini","messagePattern":"Deepseek \\(API\\) is not available for local use\\. Change config\\.ini","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"sources/llm_provider.py","lineNumber":335,"sourceCode":"                model=self.model,\n                messages=history,\n            )\n            if response is None:\n                raise Exception(\"Together AI response is empty.\")\n            thought = response.choices[0].message.content\n            if verbose:\n                print(thought)\n            return thought\n        except Exception as e:\n            raise Exception(f\"Together AI API error: {str(e)}\") from e\n\n    def deepseek_fn(self, history, verbose=False):\n        \"\"\"\n        Use deepseek api to generate text.\n        \"\"\"\n        client = OpenAI(api_key=self.api_key, base_url=\"https://api.deepseek.com\")\n        if self.is_local:\n            raise Exception(\"Deepseek (API) is not available for local use. Change config.ini\")\n        try:\n            response = client.chat.completions.create(\n                model=self.model,\n                messages=history,\n                stream=False\n            )\n            thought = response.choices[0].message.content\n            if verbose:\n                print(thought)\n            return thought\n        except Exception as e:\n            raise Exception(f\"Deepseek API error: {str(e)}\") from e\n\n    def lm_studio_fn(self, history, verbose=False):\n        \"\"\"\n        Use local lm-studio server to generate text.\n        \"\"\"\n        if self.in_docker:","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/Fosowl/agenticSeek/blob/ae57a2357745a9706cb12d0fd76d954c84d166fa/sources/llm_provider.py#L317-L353","documentation":"deepseek_fn refuses to run when self.is_local is true, because the Deepseek cloud API endpoint (api.deepseek.com) cannot be used as a local/offline model. The library throws this immediately, before any HTTP call, to force the user to correct their config.ini provider/model selection.","triggerScenarios":"config.ini selects the deepseek (API) provider while is_local is enabled (local mode), so deepseek_fn raises before creating the chat completion.","commonSituations":"User switched to a local setup but left provider=deepseek in config.ini; developer running offline tests with an API-provider config; mixing 'local' and hosted provider flags.","solutions":["Edit config.ini: either disable local mode or switch provider/model to a locally-run option (e.g. LM Studio / Ollama style provider)","If you intend to use Deepseek's cloud, set is_local/local mode to false and provide a valid api_key","Ensure the model string corresponds to the chosen provider (deepseek-chat / deepseek-reasoner for the API)","Re-run after config change; this error is raised pre-flight, so no API call was consumed"],"exampleFix":"// before (config.ini)\n[LLM]\nprovider = deepseek\nlocal = true\n// after\n[LLM]\nprovider = deepseek\nlocal = false\napi_key = sk-...","handlingStrategy":"validation","validationCode":"def validate_deepseek_config(provider):\n    if provider.is_local:\n        raise ValueError(\"Deepseek (API) cannot run locally — switch provider in config.ini to a local server\")\n    assert provider.api_key, \"Deepseek API key missing\"","typeGuard":"def supports_local_mode(provider) -> bool:\n    return not getattr(provider, \"is_local\", False) or provider.__class__.__name__.lower().startswith(\"lmstudio\")","tryCatchPattern":"try:\n    thought = provider.deepseek_fn(history)\nexcept Exception as e:\n    if \"not available for local use\" in str(e):\n        thought = provider.lm_studio_fn(history)  # fall back to local provider\n    else:\n        raise","preventionTips":["Keep config.ini provider and local flag consistent — never pair deepseek with local=true","Add a config sanity check at app startup","Document which providers work in local vs cloud mode for your team"],"tags":["configuration","deepseek","local-mode","validation"],"backgroundTag":"invalid-provider-config","analyzedSha":"ae57a2357745a9706cb12d0fd76d954c84d166fa","analyzedAt":"2026-08-30T02:49:05.834Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}