openclaw - 💡(How to fix) Fix [Bug]: OpenRouter provider uses wrong base URL, causing all model calls to fail silently [2 comments, 2 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#68643Fetched 2026-04-19 15:09:08
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
commented ×2labeled ×2closed ×1

On first gateway start, OpenClaw generates ~/.openclaw/agents/main/agent/models.json with an incorrect base URL for the openrouter and arcee providers:

"baseUrl": "https://openrouter.ai/v1"

The correct OpenRouter API base URL is:

"baseUrl": "https://openrouter.ai/api/v1"

https://openrouter.ai/v1 returns the OpenRouter website HTML (200 OK), not the API. The HTTP call succeeds from a networking standpoint, so no error is raised, but the response contains no model output.

Error Message

https://openrouter.ai/v1 returns the OpenRouter website HTML (200 OK), not the API. The HTTP call succeeds from a networking standpoint, so no error is raised, but the response contains no model output. incomplete turn detected: stopReason=stop payloads=0 — surfacing error to user

Root Cause

models.json is written by the gateway on first start. The generated file contains:

{
  "providers": {
    "openrouter": {
      "baseUrl": "https://openrouter.ai/v1",   // ← wrong
      ...
    },
    "arcee": {
      "baseUrl": "https://openrouter.ai/v1",   // ← wrong
      ...
    }
  }
}

A GET/POST to https://openrouter.ai/v1/chat/completions returns a Next.js HTML page. The OpenAI-compatible completions endpoint is at https://openrouter.ai/api/v1/chat/completions.

Fix Action

Fix

In the code that generates models.json, change the OpenRouter base URL from:

https://openrouter.ai/v1

to:

https://openrouter.ai/api/v1

Workaround

Manually edit ~/.openclaw/agents/main/agent/models.json and replace both occurrences of https://openrouter.ai/v1 with https://openrouter.ai/api/v1, then restart the gateway:

sed -i 's|https://openrouter.ai/v1|https://openrouter.ai/api/v1|g' \
  ~/.openclaw/agents/main/agent/models.json
systemctl --user restart openclaw-gateway

Note: This file is regenerated on gateway start, so the workaround may need to be reapplied after an OpenClaw upgrade.

Code Example

"baseUrl": "https://openrouter.ai/v1"

---

"baseUrl": "https://openrouter.ai/api/v1"

---

incomplete turn detected: stopReason=stop payloads=0 — surfacing error to user

---

{
  "role": "assistant",
  "content": [],
  "usage": { "input": 0, "output": 0, "totalTokens": 0 },
  "stopReason": "stop"
}

---

{
  "providers": {
    "openrouter": {
      "baseUrl": "https://openrouter.ai/v1",   // ← wrong
      ...
    },
    "arcee": {
      "baseUrl": "https://openrouter.ai/v1",   // ← wrong
      ...
    }
  }
}

---

https://openrouter.ai/v1

---

https://openrouter.ai/api/v1

---

sed -i 's|https://openrouter.ai/v1|https://openrouter.ai/api/v1|g' \
  ~/.openclaw/agents/main/agent/models.json
systemctl --user restart openclaw-gateway

---
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Version: 2026.4.15 (041266a) Platform: Linux 6.14.8-2-pve (x64) · Node.js 22.22.2 Provider: OpenRouter

Summary

On first gateway start, OpenClaw generates ~/.openclaw/agents/main/agent/models.json with an incorrect base URL for the openrouter and arcee providers:

"baseUrl": "https://openrouter.ai/v1"

The correct OpenRouter API base URL is:

"baseUrl": "https://openrouter.ai/api/v1"

https://openrouter.ai/v1 returns the OpenRouter website HTML (200 OK), not the API. The HTTP call succeeds from a networking standpoint, so no error is raised, but the response contains no model output.

Symptoms

Every message via any channel (Telegram, etc.) returns:

⚠️ Agent couldn't generate a response. Please try again.

Gateway logs show:

incomplete turn detected: stopReason=stop payloads=0 — surfacing error to user

Session files record the assistant message with empty content and zero tokens:

{
  "role": "assistant",
  "content": [],
  "usage": { "input": 0, "output": 0, "totalTokens": 0 },
  "stopReason": "stop"
}

This affects all models on the OpenRouter provider regardless of model tier (free or paid), thinking mode, or tools configuration. The issue persists across a full uninstall/reinstall because models.json is regenerated with the wrong URL on every fresh gateway start.

Root Cause

models.json is written by the gateway on first start. The generated file contains:

{
  "providers": {
    "openrouter": {
      "baseUrl": "https://openrouter.ai/v1",   // ← wrong
      ...
    },
    "arcee": {
      "baseUrl": "https://openrouter.ai/v1",   // ← wrong
      ...
    }
  }
}

A GET/POST to https://openrouter.ai/v1/chat/completions returns a Next.js HTML page. The OpenAI-compatible completions endpoint is at https://openrouter.ai/api/v1/chat/completions.

Fix

In the code that generates models.json, change the OpenRouter base URL from:

https://openrouter.ai/v1

to:

https://openrouter.ai/api/v1

Workaround

Manually edit ~/.openclaw/agents/main/agent/models.json and replace both occurrences of https://openrouter.ai/v1 with https://openrouter.ai/api/v1, then restart the gateway:

sed -i 's|https://openrouter.ai/v1|https://openrouter.ai/api/v1|g' \
  ~/.openclaw/agents/main/agent/models.json
systemctl --user restart openclaw-gateway

Note: This file is regenerated on gateway start, so the workaround may need to be reapplied after an OpenClaw upgrade.

Steps to reproduce

  1. Fresh install: npm install -g openclaw
  2. Configure OpenRouter provider with a valid API key
  3. Start the gateway: systemctl --user start openclaw-gateway
  4. Send any message via a configured channel
  5. Observe: "⚠️ Agent couldn't generate a response" on every message
  6. Check ~/.openclaw/agents/main/agent/models.jsonbaseUrl is https://openrouter.ai/v1
  7. Verify: curl https://openrouter.ai/v1/chat/completions returns HTML, not JSON

Expected behavior

Model reply expected.

Actual behavior

"⚠️ Agent couldn't generate a response" on every message

OpenClaw version

026.4.15 (041266a)

Operating system

Ubuntu 24 Node.js 22.22.2

Install method

npm

Model

openrouter/free

Provider / routing chain

openrouter

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

Update the OpenRouter base URL in models.json to https://openrouter.ai/api/v1 to fix the incorrect API endpoint issue.

Guidance

  • Verify that the models.json file is being generated with the incorrect base URL https://openrouter.ai/v1 by checking the file contents after a fresh gateway start.
  • Manually edit ~/.openclaw/agents/main/agent/models.json to replace the incorrect base URL with https://openrouter.ai/api/v1 as a temporary workaround.
  • Restart the gateway after applying the workaround to ensure the changes take effect.
  • Note that this workaround may need to be reapplied after an OpenClaw upgrade, as the models.json file is regenerated on gateway start.

Example

sed -i 's|https://openrouter.ai/v1|https://openrouter.ai/api/v1|g' \
  ~/.openclaw/agents/main/agent/models.json
systemctl --user restart openclaw-gateway

Notes

The permanent fix involves updating the code that generates models.json to use the correct OpenRouter base URL. However, this may require a new version of OpenClaw to be released.

Recommendation

Apply the workaround by manually editing models.json and restarting the gateway, as this is the most straightforward way to resolve the issue in the short term.

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

Model reply expected.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING