{"record":{"id":"b1ff0211f34e94c1","repo":"Fosowl/agenticSeek","slug":"google-gemini-is-not-available-for-local-use-chan","errorCode":null,"errorMessage":"Google Gemini is not available for local use. Change config.ini","messagePattern":"Google Gemini is not available for local use\\. Change config\\.ini","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"sources/llm_provider.py","lineNumber":289,"sourceCode":"                messages=messages,\n                system=system_message\n            )\n            if response is None:\n                raise Exception(\"Anthropic response is empty.\")\n            thought = response.content[0].text\n            if verbose:\n                print(thought)\n            return thought\n        except Exception as e:\n            raise Exception(f\"Anthropic API error: {str(e)}\") from e\n\n    def google_fn(self, history, verbose=False):\n        \"\"\"\n        Use google gemini to generate text.\n        \"\"\"\n        base_url = self.server_ip\n        if self.is_local:\n            raise Exception(\"Google Gemini is not available for local use. Change config.ini\")\n\n        client = OpenAI(api_key=self.api_key, base_url=\"https://generativelanguage.googleapis.com/v1beta/openai/\")\n        try:\n            response = client.chat.completions.create(\n                model=self.model,\n                messages=history,\n            )\n            if response is None:\n                raise Exception(\"Google 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\"GOOGLE API error: {str(e)}\") from e\n\n    def together_fn(self, history, verbose=False):\n        \"\"\"","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/Fosowl/agenticSeek/blob/ae57a2357745a9706cb12d0fd76d954c84d166fa/sources/llm_provider.py#L271-L307","documentation":"google_fn() refuses to call the Google Gemini API when the provider was configured with a local/self-hosted server (is_local=True). Google's Gemini API is a hosted-only service, so the library deliberately blocks the call because a local server cannot serve the Gemini OpenAI-compatible endpoint. The message tells the user to fix config.ini.","triggerScenarios":"Calling google_fn() (directly or via a dispatch by model/provider name) while self.is_local is True — i.e. config.ini specified a local server_ip/local provider for the Google provider.","commonSituations":"User set the wrong provider section in config.ini (local LLM server like Ollama but provider google), copied a local config from another project, or is_local detection picked up server_ip=localhost/127.0.0.1 for the google entry.","solutions":["Edit config.ini to use the hosted Google provider: remove the local server_ip (e.g. localhost/127.0.0.1) from the google section so is_local is False","Set a valid Google API key (self.api_key) in the google provider section","Switch the provider/model in config.ini to a locally-hosted one (e.g. ollama) if you intended to run locally"],"exampleFix":"// before (config.ini)\n[google]\nserver_ip = http://localhost:11434\n// after\n[google]\napi_key = YOUR_GOOGLE_API_KEY","handlingStrategy":"validation","validationCode":"if provider == \"google\" and is_local:\n    raise RuntimeError(\"Google Gemini requires the hosted API; remove server_ip/local settings from config.ini\")","typeGuard":null,"tryCatchPattern":"try:\n    thought = provider.google_fn(history)\nexcept Exception as e:\n    logger.error(\"Gemini unavailable locally: %s\", e)\n    thought = fallback_provider_fn(history)","preventionTips":["Keep local and hosted provider sections separate in config.ini","Validate config at startup: hosted providers must not have a local server_ip","Use distinct config files per environment (local vs cloud)"],"tags":["configuration","gemini","local-server"],"backgroundTag":"provider-not-available-locally","analyzedSha":"ae57a2357745a9706cb12d0fd76d954c84d166fa","analyzedAt":"2026-08-30T02:49:05.834Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}