openclaw - 💡(How to fix) Fix [Feature]: supportsAdaptiveThinking should respect custom provider model capabilities [1 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#72890Fetched 2026-04-28 06:30:48
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

supportsAdaptiveThinking() in @mariozechner/pi-ai/dist/providers/anthropic.js uses a hardcoded model ID allowlist (opus-4-6, opus-4.6, opus-4-7, sonnet-4-6, etc.). Custom providers that proxy Anthropic models under different model IDs (e.g., corporate gateways, load balancers, or API aggregators) cannot benefit from adaptive thinking — even though the underlying model supports it.

This causes:

  1. First request sent with thinking.type: "adaptive" + output_config.effort → proxy forwards to real Claude model → works
  2. But OpenClaw never sends adaptive thinking params because supportsAdaptiveThinking("custom-model-id") returns false
  3. Agent falls back to thinking: "off", degrading response quality

Root Cause

This causes:

  1. First request sent with thinking.type: "adaptive" + output_config.effort → proxy forwards to real Claude model → works
  2. But OpenClaw never sends adaptive thinking params because supportsAdaptiveThinking("custom-model-id") returns false
  3. Agent falls back to thinking: "off", degrading response quality

Fix Action

Workaround

We patch supportsAdaptiveThinking() directly to add our custom model ID prefix:

function supportsAdaptiveThinking(modelId) {
    if (modelId.startsWith("zyb-")) return true;  // custom proxy model
    return (modelId.includes("opus-4-6") || ...);
}

This works but requires re-patching on every OpenClaw upgrade.

Code Example

{
  "models": {
    "providers": {
      "my-proxy": {
        "baseUrl": "https://proxy.example.com/anthropic",
        "api": "anthropic-messages",
        "models": [
          {
            "id": "my-claude-proxy",
            "name": "my-claude-proxy",
            "capabilities": {
              "adaptiveThinking": true
            }
          }
        ]
      }
    }
  }
}

---

function supportsAdaptiveThinking(modelId) {
    if (modelId.startsWith("zyb-")) return true;  // custom proxy model
    return (modelId.includes("opus-4-6") || ...);
}
RAW_BUFFERClick to expand / collapse

Feature type

Enhancement to adaptive thinking model detection.

Summary

supportsAdaptiveThinking() in @mariozechner/pi-ai/dist/providers/anthropic.js uses a hardcoded model ID allowlist (opus-4-6, opus-4.6, opus-4-7, sonnet-4-6, etc.). Custom providers that proxy Anthropic models under different model IDs (e.g., corporate gateways, load balancers, or API aggregators) cannot benefit from adaptive thinking — even though the underlying model supports it.

This causes:

  1. First request sent with thinking.type: "adaptive" + output_config.effort → proxy forwards to real Claude model → works
  2. But OpenClaw never sends adaptive thinking params because supportsAdaptiveThinking("custom-model-id") returns false
  3. Agent falls back to thinking: "off", degrading response quality

Proposed Solution

Allow custom providers to declare adaptive thinking support via config, e.g.:

{
  "models": {
    "providers": {
      "my-proxy": {
        "baseUrl": "https://proxy.example.com/anthropic",
        "api": "anthropic-messages",
        "models": [
          {
            "id": "my-claude-proxy",
            "name": "my-claude-proxy",
            "capabilities": {
              "adaptiveThinking": true
            }
          }
        ]
      }
    }
  }
}

Then supportsAdaptiveThinking() checks:

  1. Config-declared capability (if present) — takes precedence
  2. Hardcoded model ID list (existing behavior as fallback)

This is the same pattern used for other model capabilities like reasoning, contextWindow, and maxTokens — they can all be overridden in the provider config.

Workaround

We patch supportsAdaptiveThinking() directly to add our custom model ID prefix:

function supportsAdaptiveThinking(modelId) {
    if (modelId.startsWith("zyb-")) return true;  // custom proxy model
    return (modelId.includes("opus-4-6") || ...);
}

This works but requires re-patching on every OpenClaw upgrade.

Environment

  • OpenClaw: 2026.4.25 (aa36ee6)
  • Provider: custom anthropic-messages via corporate proxy (model ID: zyb-high, backed by Claude Opus)
  • OS: macOS (Darwin 25.4.0)

extent analysis

TL;DR

The most likely fix is to modify the supportsAdaptiveThinking() function to check for config-declared capabilities, allowing custom providers to declare adaptive thinking support.

Guidance

  • Modify the supportsAdaptiveThinking() function to prioritize config-declared capabilities over the hardcoded model ID list.
  • Update the provider configuration to include the adaptiveThinking capability for the custom model ID.
  • Test the updated configuration to ensure adaptive thinking is enabled for the custom model ID.
  • Consider using the proposed solution pattern to override other model capabilities, such as reasoning, contextWindow, and maxTokens.

Example

{
  "models": {
    "providers": {
      "my-proxy": {
        "baseUrl": "https://proxy.example.com/anthropic",
        "api": "anthropic-messages",
        "models": [
          {
            "id": "zyb-high",
            "name": "zyb-high",
            "capabilities": {
              "adaptiveThinking": true
            }
          }
        ]
      }
    }
  }
}

Notes

The proposed solution requires updating the supportsAdaptiveThinking() function and the provider configuration. The workaround provided in the issue body can be used as a temporary solution, but it requires re-patching on every OpenClaw upgrade.

Recommendation

Apply the proposed solution by modifying the supportsAdaptiveThinking() function and updating the provider configuration, as it provides a more robust and maintainable solution.

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