Fosowl/agenticSeek · error · Exception

OpenRouter is not available for local use. Change config.ini

Error message

OpenRouter is not available for local use. Change config.ini

What it means

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.

Source

Thrown at sources/llm_provider.py:426

            raise Exception("LM Studio request timed out - check if server is responsive")
        except requests.exceptions.ConnectionError:
            raise Exception(f"Cannot connect to LM Studio at {route_start} - check if server is running")
        except requests.exceptions.RequestException as e:
            raise Exception(f"HTTP request failed: {str(e)}") from e
        except Exception as e:
            if "LM Studio" in str(e):
                raise  # Re-raise our custom exceptions
            raise Exception(f"Unexpected error: {str(e)}") from e

    def openrouter_fn(self, history, verbose=False):
        """
        Use OpenRouter API to generate text.
        """
        client = OpenAI(api_key=self.api_key, base_url="https://openrouter.ai/api/v1")
        if self.is_local:
            # This case should ideally not be reached if unsafe_providers is set correctly
            # and is_local is False in config for openrouter
            raise Exception("OpenRouter is not available for local use. Change config.ini")
        try:
            response = client.chat.completions.create(
                model=self.model,
                messages=history,
            )
            if response is None:
                raise Exception("OpenRouter response is empty.")
            thought = response.choices[0].message.content
            if verbose:
                print(thought)
            return thought
        except Exception as e:
            raise Exception(f"OpenRouter API error: {str(e)}") from e

    def minimax_fn(self, history, verbose=False):
        """
        Use MiniMax API to generate text via OpenAI-compatible interface.

View on GitHub (pinned to ae57a23577)

Solutions

  1. Set is_local=False for the openrouter provider in config.ini
  2. Ensure the provider name in config.ini matches a valid cloud provider entry so is_local is not defaulted to True
  3. If you need offline/local inference, switch the provider to LM Studio, Ollama, or another local-capable backend instead of openrouter

Example fix

// before (config.ini)
[openrouter]
is_local = True
// after
[openrouter]
is_local = False
Defensive patterns

Strategy: validation

Validate before calling

cfg = config['openrouter']
if cfg.get('is_local', False):
    raise SystemExit("openrouter cannot run locally; set is_local = False in config.ini or pick a local provider")

Try / catch

try:
    out = provider.openrouter_fn(history)
except Exception as e:
    if 'not available for local use' in str(e):
        log.error("Fix config.ini: openrouter requires is_local = False")
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Fosowl/agenticSeek@ae57a23577 (2026-08-30). Data as JSON: /api/errors/21cf308681f6e0a1. Report an issue: GitHub.