openclaw - ✅(Solved) Fix Bug: webchat model dropdown sends model name without provider prefix, causing 'model not allowed' error [1 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#48878Fetched 2026-04-08 00:51:31
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Participants
Timeline (top)
commented ×1subscribed ×1

Error Message

Failed to set model: GatewayRequestError: model not allowed: modelstudio/claude-sonnet-4-6

Fix Action

Workaround

Using the /model 4sapi/claude-sonnet-4-6 command works correctly.

PR fix notes

Fix: Webchat UI Model Dropdown Sends Bare Model ID Without Provider Prefix

Problem

When switching models via the webchat UI dropdown, the request sends only the bare model name (e.g. claude-sonnet-4-6) instead of the full provider/model key (e.g. 4sapi/claude-sonnet-4-6). The gateway then prepends the current session's provider instead of the model's actual provider, producing an invalid key that is rejected by the allowlist.

Failed to set model: GatewayRequestError: model not allowed: modelstudio/claude-sonnet-4-6

The /model TUI command works correctly because it accepts the full provider/model string directly.


Workaround

Use the /model command in the TUI with the full provider-qualified model ID:

/model 4sapi/claude-sonnet-4-6

Manual Patch (Advanced)

Locate the webchat UI dist file:

find ~/.npm -name "index-*.js" | grep webchat
# or
find /usr/local/lib -name "*.js" | grep openclaw | grep webchat

Patch: Fix dropdown option value to include provider prefix

- value={model.id}
+ value={`${model.provider}/${model.id}`}

Or if the model object does not carry a provider field at the option level, ensure the provider is passed down as a prop:

- {models.map(model => (
-   <option key={model.id} value={model.id}>
-     {model.id} · {model.provider}
-   </option>
- ))}
+ {models.map(model => (
+   <option key={`${model.provider}/${model.id}`} value={`${model.provider}/${model.id}`}>
+     {model.id} · {model.provider}
+   </option>
+ ))}

Config Reference

Ensure models are defined with explicit provider keys in ~/.openclaw/openclaw.json:

{
  "providers": {
    "4sapi": {
      "models": [
        "claude-sonnet-4-6",
        "claude-opus-4-6"
      ]
    }
  }
}

The gateway allowlist must contain the fully-qualified key:

{
  "tools": {
    "profile": {
      "allowlist": [
        "4sapi/claude-sonnet-4-6",
        "4sapi/claude-opus-4-6"
      ]
    }
  }
}

Verification

After applying the patch:

  1. Open webchat UI
  2. Navigate to any agent session
  3. Use the model dropdown to select claude-sonnet-4-6 under 4sapi
  4. Confirm no error banner appears
  5. Confirm the next message is processed using 4sapi/claude-sonnet-4-6
# Confirm via gateway log
openclaw gateway logs --tail 20 | grep "model"
# Expected: model set to 4sapi/claude-sonnet-4-6

Environment

FieldValue
OpenClaw version2026.3.13
OSmacOS 26.3.1 (arm64)
Affected UIWebchat model dropdown
Working workaround/model 4sapi/claude-sonnet-4-6 in TUI
Failure patternGateway prepends wrong provider to bare model ID

Upstream Fix Required

This is the same root cause as the Control UI model picker bug — the dropdown option value must always use the fully-qualified provider/model key, not the bare model.id.

Recommended fix across all UI surfaces:

  1. Webchat <select> option value: ${provider}/${model.id} instead of model.id
  2. Control UI K_(): same fix (ref: existing patch)
  3. Any sessions.patch call site: validate that the model key contains a / before sending — if not, reject client-side with a clear error rather than letting the gateway infer the wrong provider

Suggested validation:

function patchSessionModel(modelKey: string) {
  if (!modelKey.includes("/")) {
    throw new Error(`Invalid model key "${modelKey}": must be in provider/model format`)
  }
  return sessions.patch({ model: modelKey })
}

Code Example

Failed to set model: GatewayRequestError: model not allowed: modelstudio/claude-sonnet-4-6
RAW_BUFFERClick to expand / collapse

Bug Description

When switching models via the webchat UI dropdown menu, the request sends only the model name (e.g. claude-sonnet-4-6) without the provider prefix (e.g. 4sapi/claude-sonnet-4-6), causing the following error:

Failed to set model: GatewayRequestError: model not allowed: modelstudio/claude-sonnet-4-6

Steps to Reproduce

  1. Configure a model under a custom provider (e.g. 4sapi/claude-sonnet-4-6)
  2. Open webchat UI and go to another agent's session
  3. Use the model dropdown to select the model
  4. Error is thrown

Expected Behavior

The dropdown should send the full provider/model identifier (e.g. 4sapi/claude-sonnet-4-6).

Workaround

Using the /model 4sapi/claude-sonnet-4-6 command works correctly.

Environment

  • OpenClaw version: 2026.3.13
  • OS: macOS 26.3.1 (arm64)

extent analysis

Fix Plan

To fix the issue, we need to modify the code to include the provider prefix when sending the model name via the webchat UI dropdown menu.

  • Update the model selection dropdown to include the provider prefix in the model identifier.
  • Modify the API request to send the full provider/model identifier.

Example code snippet:

# Assuming 'model_name' is the selected model and 'provider' is the provider prefix
full_model_identifier = f"{provider}/{model_name}"
# Send the full_model_identifier in the API request
api_request(data={"model": full_model_identifier})

Verification

To verify the fix, follow these steps:

  • Configure a model under a custom provider (e.g. 4sapi/claude-sonnet-4-6)
  • Open webchat UI and go to another agent's session
  • Use the model dropdown to select the model
  • Check if the error is resolved and the model is selected correctly

Extra Tips

  • Ensure that the provider prefix is correctly retrieved and included in the model identifier.
  • Test the fix with different providers and models to ensure it works as expected.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING