Skip to content

[Bug]: Web gateway: OpenRouter model picker sends wrong model ref (missing openrouter/ prefix) → model not allowed #49379

@careycao

Description

@careycao

Bug type

Behavior bug (incorrect output/state without crash)

Summary

环境

  • OpenClaw 版本:(例如 2026.3.13,或 openclaw --version
  • 使用 Web 网关 / Control UI 选择模型

现象

在模型下拉里选择带「· openrouter」的项(例如 anthropic/claude-opus-4.6 · openrouter)后,设置失败:
GatewayRequestError: model not allowed: anthropic/claude-opus-4.6

预期

从 OpenRouter 列表选择的模型应提交为 openrouter/anthropic/claude-opus-4.6(与 agents.defaults.models 白名单一致),或网关应把「OpenRouter 分区」的选项统一解析为 openrouter/<id>

实际

似乎只提交了 anthropic/claude-opus-4.6,被解析成 Anthropic 官方 provider,导致不在白名单内。

复现

  1. agents.defaults.models 中仅允许 openrouter/anthropic/claude-opus-4.6 等带 openrouter/ 前缀的键
  2. Web 网关下拉里点选 anthropic/claude-opus-4.6 · openrouter
  3. 报错 model not allowed

备注

命令行 /model openrouter/anthropic/claude-opus-4.6 可正常工作。

Image

Steps to reproduce

正确的完整模型标识:openrouter/anthropic/claude-opus-4.6(provider = openrouter)
❌ UI 实际发送的:anthropic/claude-opus-4.6(provider = anthropic)
OpenClaw 的规则是第一个 / 左边是 provider,所以 anthropic/claude-opus-4.6 会被解析为 provider=anthropic,model=claude-opus-4.6。如果你没有单独配置 anthropic 这个 provider(只配了 openrouter),那自然就报 "model not allowed"。

这是个 Web UI 的 bug——它在展示 OpenRouter 下的模型列表时,点选后没有把 openrouter/ 前缀拼回去就发给了后端。

Expected behavior

预期

从 OpenRouter 列表选择的模型应提交为 openrouter/anthropic/claude-opus-4.6(与 agents.defaults.models 白名单一致),或网关应把「OpenRouter 分区」的选项统一解析为 openrouter/<id>

Actual behavior

实际

似乎只提交了 anthropic/claude-opus-4.6,被解析成 Anthropic 官方 provider,导致不在白名单内。

OpenClaw version

2026.3.13

Operating system

macOS 26.3.1

Install method

No response

Model

minimax

Provider / routing chain

openclaw -> http-proxy -> openrouter

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug:behaviorIncorrect behavior without a crash

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions