openclaw - 💡(How to fix) Fix [Bug]: OpenClaw does not switch provider when changing model in UI, causing requests to be routed to the default provider [6 comments, 4 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#50966Fetched 2026-04-08 01:06:11
View on GitHub
Comments
6
Participants
4
Timeline
12
Reactions
0
Author
Timeline (top)
commented ×6labeled ×2closed ×1cross-referenced ×1

When multiple model providers (e.g., Azure OpenAI and Zhipu) are configured in OpenClaw, switching to a model from a non-default provider in the UI does not correctly update the routing. The request is still sent to the default provider, resulting in a "model not allowed" error.

Error Message

When multiple model providers (e.g., Azure OpenAI and Zhipu) are configured in OpenClaw, switching to a model from a non-default provider in the UI does not correctly update the routing. The request is still sent to the default provider, resulting in a "model not allowed" error. Error message:

Root Cause

When multiple model providers (e.g., Azure OpenAI and Zhipu) are configured in OpenClaw, switching to a model from a non-default provider in the UI does not correctly update the routing. The request is still sent to the default provider, resulting in a "model not allowed" error.

Code Example

screenshot
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Summary

When multiple model providers (e.g., Azure OpenAI and Zhipu) are configured in OpenClaw, switching to a model from a non-default provider in the UI does not correctly update the routing. The request is still sent to the default provider, resulting in a "model not allowed" error.

Steps to reproduce

1.Configure multiple providers in openclaw.json:

2.Azure OpenAI (set as default)

Zhipu (with model glm-4.7)

Set the default model to Azure:

"model": { "primary": "custom-xxx/gpt-5.2" }

3.Start OpenClaw and open the UI

4.Switch the model in the UI to: glm-4.7 · zhipu

5.Send any request

Expected behavior

The request should be routed to the selected provider: zhipu/glm-4.7

Actual behavior

The request is routed to the default provider instead: custom-xxx/glm-4.7

Error message: Failed to set model: GatewayRequestError: model not allowed: custom-xxx/glm-4.7

OpenClaw version

2026.3.13

Operating system

Ubuntu 24.04

Install method

Local deployment

Model

gpt-5.2 gpt-5.2-codex glm-4.7

Provider / routing chain

Default Provider: Azure OpenAI (openai-responses) Secondary Provider: Zhipu (openai-completions / chat-completions)

Additional provider/model setup details

"models": { "providers": { "custom-testmfoundry-resource-openai-azure-com": { "baseUrl": "https://testmfoundry-resource.openai.azure.com/openai/v1", "apiKey": "", "api": "openai-responses", "headers": { "api-key": "" }, "authHeader": false, "models": [ { "id": "gpt-5.2", "name": "GPT-5.2 (Azure)", "reasoning": false, "input": [ "text", "image" ], "cost": { "input": 1.75, "output": 14, "cacheRead": 0.18, "cacheWrite": 1.75 }, "contextWindow": 272000, "maxTokens": 16384, "compat": { "supportsStore": false } }, { "id": "gpt-5.2-codex", "name": "GPT-5.2-Codex (Azure)", "reasoning": true, "input": [ "text", "image" ], "cost": { "input": 1.75, "output": 14, "cacheRead": 0.18, "cacheWrite": 1.75 }, "contextWindow": 400000, "maxTokens": 16384, "compat": { "supportsStore": false } } ] }, "zhipu": { "baseUrl": "https://open.bigmodel.cn/api/paas/v4", "apiKey": "", "api": "openai-completions", "models": [ { "id": "glm-4.7", "name": "GLM-4.7 (Zhipu)", "api": "openai-completions", "reasoning": true, "input": [ "text", "image" ], "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 200000, "maxTokens": 8192 } ] } } }, "agents": { "defaults": { "model": { "primary": "custom-testmfoundry-resource-openai-azure-com/gpt-5.2" }, "models": { "custom-testmfoundry-resource-openai-azure-com/gpt-5.2": {}, "custom-testmfoundry-resource-openai-azure-com/gpt-5.2-codex": {}, "zhipu/glm-4.7": {} }, "workspace": "/root/.openclaw/workspace", "compaction": { "mode": "safeguard" }, "maxConcurrent": 4, "subagents": { "maxConcurrent": 8 } }, "list": [ { "id": "main", "subagents": { "allowAgents": [] }, "tools": { "profile": "full" } } ] },

Logs, screenshots, and evidence

screenshot

Impact and severity

This issue prevents correct usage of multiple providers through the UI. All requests continue to be routed to the default provider regardless of user selection.

It affects scenarios such as:

Multi-model comparison

Cost optimization strategies

Fallback and routing logic This is a functional issue impacting core multi-provider capability.

<img width="2374" height="430" alt="Image" src="https://github.com/user-attachments/assets/904a90ee-ae77-4917-9270-28ef87a6fc80" />

Additional information

No response

extent analysis

Fix Plan

To resolve the issue of requests being routed to the default provider instead of the selected provider, we need to update the routing logic in OpenClaw.

Here are the steps to fix the issue:

  • Update the openclaw.json configuration file to include the correct routing information for each provider.
  • Modify the UI code to update the routing configuration when a user selects a different provider.
  • Implement a check in the routing logic to ensure that requests are sent to the correct provider based on the user's selection.

Example code changes:

// Update openclaw.json to include routing information for each provider
"models": {
  "providers": {
    "custom-testmfoundry-resource-openai-azure-com": {
      // ...
    },
    "zhipu": {
      // ...
      "routing": {
        "api": "openai-completions",
        "baseUrl": "https://open.bigmodel.cn/api/paas/v4"
      }
    }
  }
}
// Update UI code to update routing configuration when a provider is selected
function updateProvider(providerId) {
  // Get the selected provider's routing information
  const provider = getProvider(providerId);
  const routing = provider.routing;
  
  // Update the routing configuration
  updateRoutingConfig(routing);
}

// Implement a check in the routing logic to ensure correct provider is used
function routeRequest(request) {
  // Get the user's selected provider
  const selectedProvider = getSelectedProvider();
  
  // Check if the request should be sent to the default provider or the selected provider
  if (selectedProvider !== getDefaultProvider()) {
    // Send the request to the selected provider
    sendRequestToProvider(request, selectedProvider);
  } else {
    // Send the request to the default provider
    sendRequestToDefaultProvider(request);
  }
}

Verification

To verify that the fix worked, follow these steps:

  • Configure multiple providers in openclaw.json.
  • Start OpenClaw and open the UI.
  • Switch to a model from a non-default provider.
  • Send a request and check that it is routed to the correct provider.
  • Verify that the request is successful and the expected output is received.

Extra Tips

  • Make sure to update the openclaw.json file correctly and restart OpenClaw after making changes.
  • Test the fix with different providers and models to ensure that it works correctly in all scenarios.
  • Consider adding additional logging or debugging statements to help diagnose any issues that may arise.

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

The request should be routed to the selected provider: zhipu/glm-4.7

Still need to ship something?

×6

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

Back to top recommendations

TRENDING