openclaw - ✅(Solved) Fix [Bug]: OpenRouter model redirects not handled properly in OpenClaw model resolution [1 pull requests]

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…

When using OpenRouter model aliases (e.g., openrouter/deepseek/deepseek-v3.2), OpenClaw fails to handle the HTTP redirects properly, resulting in model resolution failures.

Error Message

In Logs, "[agent/embedded] incomplete turn detected: runId=<ID> stopReason=stop payloads=0 — surfacing error to user"

Root Cause

When using OpenRouter model aliases (e.g., openrouter/deepseek/deepseek-v3.2), OpenClaw fails to handle the HTTP redirects properly, resulting in model resolution failures.

Fix Action

Fixed

PR fix notes

PR #69522: fix: resolve openrouter model alias redirects in provider response

Description (problem / solution / changelog)

Summary

  • keep OpenRouter assistant stream messages pinned to the configured model alias instead of the provider-returned redirected id
  • normalize done/error stream events and final stream results so downstream payload assembly does not lose the resolved model
  • add regression coverage for redirected OpenRouter aliases on success and error paths

Testing

  • pnpm test -- --run extensions/openrouter/stream.test.ts src/agents/pi-embedded-runner/proxy-stream-wrappers.test.ts

Closes #69507

Changed files

  • extensions/openrouter/stream.test.ts (added, +119/-0)
  • extensions/openrouter/stream.ts (modified, +36/-7)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When using OpenRouter model aliases (e.g., openrouter/deepseek/deepseek-v3.2), OpenClaw fails to handle the HTTP redirects properly, resulting in model resolution failures.

Steps to reproduce

  1. Specify OpenRouter Model, e.g. openrouter/deepseek/deepseek-v3.2 or openrouter/anthropic/claude-sonnet-4.5
  2. OpenRouter returns a redirect to: deepseek/deepseek-v3.2-20251201 or anthropic/claude-4.5-sonnet-20250929
  3. No response is returned

Expected behavior

OpenClaw should follow HTTP redirects from OpenRouter transparently, allowing users to use convenient model aliases.

Actual behavior

In Chat, no response is seen. In messaging app, "⚠️ Agent couldn't generate a response. Please try again." In Logs, "[agent/embedded] incomplete turn detected: runId=<ID> stopReason=stop payloads=0 — surfacing error to user"

OpenClaw version

2026.4.15

Operating system

Ubuntu 24.04

Install method

No response

Model

openrouter/deepseek/deepseek-v3.2

Provider / routing chain

openclaw -> openrouter

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

Run curl -s -X POST "https://openrouter.ai/api/v1/chat/completions" -H "Au: Bearer <OpenRouter API Key>" -H "Content-Type: application/json" -d "{\"model\": \"deepseek/deepseek-v3.2\", \"messages\": [{\"role\": \"user\", \"content\": \"Hi\"}]}"

Reponse will show {"id":"<redacted>","object":"chat.completion","created":1776731492,"model":"deepseek/deepseek-v3.2-20251201"

This seems to be related to #69350 #69069 #69350 #68076 #69068 #68261 #69097

extent analysis

TL;DR

OpenClaw needs to be updated to properly handle HTTP redirects from OpenRouter when using model aliases.

Guidance

  • Verify that the issue is indeed related to HTTP redirects by checking the OpenRouter response for a redirect status code (e.g., 301 or 302) using the provided curl command.
  • Investigate the OpenClaw code to see if it has a mechanism for following HTTP redirects and if it can be updated to handle redirects from OpenRouter.
  • Check the related issues (#69350, #69069, etc.) to see if they provide any insight into the problem or potential solutions.
  • Consider updating the OpenClaw version to a newer release, if available, to see if the issue has been fixed.

Example

No code snippet is provided as the issue does not contain enough information to create a specific example.

Notes

The issue seems to be related to several other issues, which may indicate a larger problem with OpenClaw's handling of HTTP redirects or OpenRouter's redirect behavior.

Recommendation

Apply workaround: Update OpenClaw to properly handle HTTP redirects from OpenRouter or use the full model name (e.g., deepseek/deepseek-v3.2-20251201) instead of the alias. This is because the issue seems to be related to OpenClaw's handling of redirects, and using the full model name may bypass the redirect issue.

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 should follow HTTP redirects from OpenRouter transparently, allowing users to use convenient model aliases.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING