openclaw - ✅(Solved) Fix [Bug]: OpenRouter provider not routing requests to models [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#67989Fetched 2026-04-18 05:54:30
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×2cross-referenced ×1referenced ×1subscribed ×1

OpenClaw fails to route requests through the OpenRouter provider and returns blank responses in the chat UI.

Root Cause

OpenClaw fails to route requests through the OpenRouter provider and returns blank responses in the chat UI.

Fix Action

Fixed

PR fix notes

PR #68010: fix(providers): defer OpenRouter env var candidates to lazy proxy (#67989)

Description (problem / solution / changelog)

Summary

  • Problem: OpenRouter provider fails to route requests because PROVIDER_ENV_API_KEY_CANDIDATES in model-auth-env-vars.ts was calling resolveProviderEnvApiKeyCandidates() at module import time, triggering loadPluginManifestRegistry() too early.
  • Why it matters: The lazy-loading optimization (PROVIDER_AUTH_ENV_VAR_CANDIDATES proxy) was bypassed, causing manifest discovery to fail during startup.
  • What changed: PROVIDER_ENV_API_KEY_CANDIDATES now delegates to the existing lazy PROVIDER_AUTH_ENV_VAR_CANDIDATES proxy.
  • Regression test: Added test verifying lazy loading behavior.

Change Type

  • Bug fix

Linked Issue

  • Fixes #67989

Security Impact

  • No new permissions or capabilities
  • Does not change auth behavior, only fixes loading order

Testing

  • Added model-auth-env-vars.test.ts for lazy loading verification

Changed files

  • extensions/ollama/index.test.ts (modified, +118/-8)
  • extensions/ollama/src/stream.ts (modified, +11/-3)
  • src/agents/model-auth-env-vars.test.ts (added, +51/-0)
  • src/agents/model-auth-env-vars.ts (modified, +12/-1)

Code Example

"model": {
     "primary": "openrouter/google/gemini-2.5-flash"
   },
   "auth": {
     "profiles": {
       "openrouter:default": {
         "provider": "openrouter",
         "mode": "api_key"
       }
     }
   }

---
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

OpenClaw fails to route requests through the OpenRouter provider and returns blank responses in the chat UI.

Steps to reproduce

  1. Start with OpenClaw 2026.4.14 and use the attached config below.
  2. Configure OpenClaw with OpenRouter as provider:
    "model": {
      "primary": "openrouter/google/gemini-2.5-flash"
    },
    "auth": {
      "profiles": {
        "openrouter:default": {
          "provider": "openrouter",
          "mode": "api_key"
        }
      }
    }
  3. Set OPENROUTER_API_KEY env variable with a valid sk-or-v1-... key
  4. Start gateway and send any message in chat
  5. Observe: assistant row appears with model name but empty response

Expected behavior

OpenClaw routes the request through OpenRouter and returns the model's response in the chat UI.

Actual behavior

  • Chat UI shows blank assistant message (model name visible, no content)
  • No OpenRouter request appears in OpenRouter's activity dashboard
  • openclaw doctor reports no issues
  • openclaw status --all shows gateway healthy and reachable <img width="1920" height="1080" alt="Image" src="https://github.com/user-attachments/assets/eaa2cd4a-b523-499d-8c6e-dfe516d614a7" />

OpenClaw version

2026.4.14

Operating system

macOS and Ubuntu

Install method

npm global

Model

openrouter/google/gemini-2.5-flash

Provider / routing chain

openclaw -> openrouter -> gemini-2.5-flash

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Affected: Openrouter users Severity: High Frequency: always Consequence: No response from LLM

Additional information

No response

extent analysis

TL;DR

Verify the OpenRouter API key configuration and ensure it is correctly set as an environment variable to resolve the blank response issue in OpenClaw.

Guidance

  • Check the OPENROUTER_API_KEY environment variable to ensure it is correctly set with a valid sk-or-v1-... key.
  • Review the OpenClaw configuration file to confirm that the openrouter provider is correctly specified and the api_key mode is enabled.
  • Test the OpenRouter API key by using it in a separate request to verify its validity and ensure it is not expired or revoked.
  • Consider running openclaw with increased logging or debugging to capture more detailed information about the request and response.

Example

No code example is provided as the issue seems to be related to configuration and environment variables rather than code.

Notes

The issue may be related to the configuration of the OpenRouter API key or the OpenClaw setup. Verifying the environment variable and configuration file should help resolve the issue. If the problem persists, further debugging and logging may be necessary.

Recommendation

Apply workaround: Verify and correct the OpenRouter API key configuration to ensure it is correctly set and valid. This is the most likely cause of the issue, and resolving it should allow OpenClaw to route requests through OpenRouter correctly.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

OpenClaw routes the request through OpenRouter and returns the model's response in the chat UI.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING