{"record":{"id":"21cf308681f6e0a1","repo":"Fosowl/agenticSeek","slug":"openrouter-is-not-available-for-local-use-change","errorCode":null,"errorMessage":"OpenRouter is not available for local use. Change config.ini","messagePattern":"OpenRouter is not available for local use\\. Change config\\.ini","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"sources/llm_provider.py","lineNumber":426,"sourceCode":"            raise Exception(\"LM Studio request timed out - check if server is responsive\")\n        except requests.exceptions.ConnectionError:\n            raise Exception(f\"Cannot connect to LM Studio at {route_start} - check if server is running\")\n        except requests.exceptions.RequestException as e:\n            raise Exception(f\"HTTP request failed: {str(e)}\") from e\n        except Exception as e:\n            if \"LM Studio\" in str(e):\n                raise  # Re-raise our custom exceptions\n            raise Exception(f\"Unexpected error: {str(e)}\") from e\n\n    def openrouter_fn(self, history, verbose=False):\n        \"\"\"\n        Use OpenRouter API to generate text.\n        \"\"\"\n        client = OpenAI(api_key=self.api_key, base_url=\"https://openrouter.ai/api/v1\")\n        if self.is_local:\n            # This case should ideally not be reached if unsafe_providers is set correctly\n            # and is_local is False in config for openrouter\n            raise Exception(\"OpenRouter 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            )\n            if response is None:\n                raise Exception(\"OpenRouter 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\"OpenRouter API error: {str(e)}\") from e\n\n    def minimax_fn(self, history, verbose=False):\n        \"\"\"\n        Use MiniMax API to generate text via OpenAI-compatible interface.\n","sourceCodeStart":408,"sourceCodeEnd":444,"githubUrl":"https://github.com/Fosowl/agenticSeek/blob/ae57a2357745a9706cb12d0fd76d954c84d166fa/sources/llm_provider.py#L408-L444","documentation":"openrouter_fn refuses to run when the provider instance is configured as local (self.is_local is True). OpenRouter is a cloud relay API and cannot be reached through a local-only configuration, so the function raises immediately before making any network call.","triggerScenarios":"Calling openrouter_fn (directly or through the provider dispatch) while config.ini sets is_local=True (or an equivalent local flag) for the openrouter provider.","commonSituations":"User copied a local provider's config block for openrouter; user switched config.ini to 'local mode' globally without realizing openrouter is cloud-only; misreading of the unsafe_providers/is_local semantics described in the comment.","solutions":["Set is_local=False for the openrouter provider in config.ini","Ensure the provider name in config.ini matches a valid cloud provider entry so is_local is not defaulted to True","If you need offline/local inference, switch the provider to LM Studio, Ollama, or another local-capable backend instead of openrouter"],"exampleFix":"// before (config.ini)\n[openrouter]\nis_local = True\n// after\n[openrouter]\nis_local = False","handlingStrategy":"validation","validationCode":"cfg = config['openrouter']\nif cfg.get('is_local', False):\n    raise SystemExit(\"openrouter cannot run locally; set is_local = False in config.ini or pick a local provider\")","typeGuard":null,"tryCatchPattern":"try:\n    out = provider.openrouter_fn(history)\nexcept Exception as e:\n    if 'not available for local use' in str(e):\n        log.error(\"Fix config.ini: openrouter requires is_local = False\")\n    raise","preventionTips":["Audit config.ini so cloud providers never have is_local = True","Validate provider config at startup, before any generation call","Keep provider blocks copied from documented templates","For offline work choose an explicitly local provider (lmstudio/ollama)"],"tags":["configuration","openrouter","cloud-only"],"backgroundTag":"provider-not-available-locally","analyzedSha":"ae57a2357745a9706cb12d0fd76d954c84d166fa","analyzedAt":"2026-08-30T02:49:05.834Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}