openclaw - 💡(How to fix) Fix Custom providers cannot use Responses API reasoning params (multiple hardcoded guards) [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#63294Fetched 2026-04-09 07:55:40
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

When using a custom provider with api: "openai-responses", reasoning parameters (params.thinking: "high") are silently ignored. The request reaches the provider but with reasoning: { effort: "none" } instead of { effort: "high" }.

This affects any custom provider (e.g. load balancers like litellm, one-api, or similar proxies) that needs Responses API + reasoning support.

Root Cause

Root Cause (3 layers)

Fix Action

Workaround

Patch 3 files in the dist bundle (lost on upgrade):

  1. anthropic-vertex-stream-*.js: Comment out getApiProvider(api) guard + add options.reasoning fallback
  2. provider-attribution-*.js: Add custom provider name to supportsOpenAIReasoningCompatPayload
  3. pi-embedded-*.js: Add streamOpts.reasoning fallback in WebSocket path

Code Example

function ensureCustomApiRegistered(api, streamFn) {
  if (getApiProvider(api)) return false; // ← blocks custom providers for built-in APIs
  registerApiProvider({ api, stream: ..., streamSimple: ... }, ...);
  return true;
}

---

provider === "openai" || provider === "openai-codex" || provider === "azure-openai" || provider === "azure-openai-responses"

---

// pi-agent-core/dist/agent.js
reasoning: this._state.thinkingLevel === "off" ? undefined : this._state.thinkingLevel,

---

if (options?.reasoningEffort || options?.reasoningSummary) { ... }

---

const reasoningEffort = supportsXhigh(model) ? options?.reasoning : clampReasoning(options?.reasoning);
RAW_BUFFERClick to expand / collapse

Summary

When using a custom provider with api: "openai-responses", reasoning parameters (params.thinking: "high") are silently ignored. The request reaches the provider but with reasoning: { effort: "none" } instead of { effort: "high" }.

This affects any custom provider (e.g. load balancers like litellm, one-api, or similar proxies) that needs Responses API + reasoning support.

Root Cause (3 layers)

1. ensureCustomApiRegistered guard blocks custom provider streamFn registration

In the bundled dist (anthropic-vertex-stream-*.js), ensureCustomApiRegistered() calls getApiProvider(api) first — if the API name (e.g. openai-responses) is a built-in, it returns false immediately without registering the custom provider's streamFn.

function ensureCustomApiRegistered(api, streamFn) {
  if (getApiProvider(api)) return false; // ← blocks custom providers for built-in APIs
  registerApiProvider({ api, stream: ..., streamSimple: ... }, ...);
  return true;
}

2. supportsOpenAIReasoningCompatPayload hardcodes provider names

In provider-attribution-*.js, reasoning payload compatibility is gated by:

provider === "openai" || provider === "openai-codex" || provider === "azure-openai" || provider === "azure-openai-responses"

Custom providers are excluded even when they proxy to OpenAI-compatible endpoints.

3. Field name mismatch: options.reasoning vs options.reasoningEffort

pi-agent-core's Agent.createLoopConfig() maps thinkingLevel to options.reasoning:

// pi-agent-core/dist/agent.js
reasoning: this._state.thinkingLevel === "off" ? undefined : this._state.thinkingLevel,

But the embedded buildOpenAIResponsesParams() only checks options.reasoningEffort:

if (options?.reasoningEffort || options?.reasoningSummary) { ... }

The native provider in pi-ai (openai-responses.js) does the mapping correctly:

const reasoningEffort = supportsXhigh(model) ? options?.reasoning : clampReasoning(options?.reasoning);

But the embedded version in the dist bundle skips this conversion, so options.reasoning: "high" is never picked up.

Additional requirement

The model definition must have reasoning: true — otherwise if (model.reasoning) skips the entire reasoning block regardless of params.

Steps to Reproduce

  1. Configure a custom provider with api: "openai-responses"
  2. Set agents.defaults.models["custom/model"].params.thinking: "high"
  3. Set reasoning: true in the model definition
  4. Send a message — observe that the proxied request has reasoning: { effort: "none" } or no reasoning field

Expected Behavior

Custom providers using openai-responses should be able to use reasoning params the same way built-in OpenAI providers do.

Workaround

Patch 3 files in the dist bundle (lost on upgrade):

  1. anthropic-vertex-stream-*.js: Comment out getApiProvider(api) guard + add options.reasoning fallback
  2. provider-attribution-*.js: Add custom provider name to supportsOpenAIReasoningCompatPayload
  3. pi-embedded-*.js: Add streamOpts.reasoning fallback in WebSocket path

Related

  • #43018 (custom providers + openai-responses transport bug — covers the WebSocket routing issue but not the reasoning params issue)

Environment

  • OpenClaw version: 2026.4.5
  • Provider: custom (OpenAI-compatible proxy)
  • API: openai-responses

extent analysis

TL;DR

To fix the issue with custom providers ignoring reasoning parameters when using the openai-responses API, modify the anthropic-vertex-stream-*.js, provider-attribution-*.js, and pi-embedded-*.js files in the dist bundle to properly handle custom providers and reasoning parameters.

Guidance

  1. Modify anthropic-vertex-stream-*.js: Comment out the getApiProvider(api) guard to allow custom provider registration and add a fallback for options.reasoning to ensure it is properly handled.
  2. Update provider-attribution-*.js: Add the custom provider name to the supportsOpenAIReasoningCompatPayload check to include custom providers in reasoning payload compatibility.
  3. Adjust pi-embedded-*.js: Implement a fallback for streamOpts.reasoning in the WebSocket path to correctly handle reasoning parameters for custom providers.
  4. Verify model definition: Ensure the model definition has reasoning: true to enable reasoning parameters.
  5. Test with custom provider: After applying the modifications, test the custom provider with api: "openai-responses" and verify that reasoning parameters are correctly applied.

Example

No specific code example is provided due to the complexity and specificity of the modifications required across multiple files.

Notes

  • These modifications are specific to the described issue and may not be applicable to other scenarios.
  • The changes are made to the dist bundle, which may be overwritten during upgrades, so it's essential to document these modifications for future reference.
  • Ensure that the custom provider is correctly configured and that the model definition supports reasoning parameters.

Recommendation

Apply the workaround by modifying the specified files in the dist bundle, as this directly addresses the issue with custom providers and reasoning parameters. This approach allows for the use of reasoning parameters with custom providers using the openai-responses API until a more permanent solution is available.

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