openclaw - 💡(How to fix) Fix [Bug]: OpenAI-compatible chat completions drops response_format

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…

POST /v1/chat/completions on the OpenAI-compatible Gateway accepts response_format, but the parameter is not forwarded into the agent runtime stream parameters, so upstream OpenAI-compatible providers do not receive the client's structured-output preference.

Root Cause

POST /v1/chat/completions on the OpenAI-compatible Gateway accepts response_format, but the parameter is not forwarded into the agent runtime stream parameters, so upstream OpenAI-compatible providers do not receive the client's structured-output preference.

Fix Action

Fix / Workaround

OpenClaw version

2026.5.14 build 4337a32 while validating the fix; affected behavior was present before the patch on current branch comparison.

Logs, screenshots, and evidence

The fix branch adds focused regression coverage showing response_format is forwarded from the gateway into streamParams, then into OpenAI Chat Completions response_format and Responses text.format transport params. It also validates unsupported gateway values before dispatch.

RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

POST /v1/chat/completions on the OpenAI-compatible Gateway accepts response_format, but the parameter is not forwarded into the agent runtime stream parameters, so upstream OpenAI-compatible providers do not receive the client's structured-output preference.

Steps to reproduce

  1. Start an OpenClaw gateway with gateway.http.endpoints.chatCompletions.enabled enabled.
  2. Send a local POST /v1/chat/completions request with response_format: { "type": "json_object" } and a prompt that asks for JSON output.
  3. Inspect the agent command/runtime stream parameters or the outbound provider request.

Expected behavior

The gateway should preserve the client-supplied response_format and pass it through to the upstream provider request. Chat Completions backends should receive response_format, and Responses backends selected by the runtime should receive the equivalent text.format shape.

Actual behavior

The gateway previously parsed the request but did not include response_format in streamParams, so the structured-output preference was silently dropped before the upstream provider call.

OpenClaw version

2026.5.14 build 4337a32 while validating the fix; affected behavior was present before the patch on current branch comparison.

Operating system

macOS local development environment.

Install method

Source checkout / pnpm openclaw local gateway.

Model

deepseek/deepseek-v4-flash for the live gateway proof; transport builders also cover OpenAI Chat Completions and OpenAI Responses model APIs.

Provider / routing chain

OpenClaw OpenAI-compatible Gateway /v1/chat/completions -> OpenClaw agent runtime -> configured provider transport.

Additional provider/model setup details

The live proof used a local managed gateway with a temporary config enabling the OpenAI-compatible Chat Completions endpoint. Provider credentials were read from local OpenClaw auth storage and were not printed.

Logs, screenshots, and evidence

The fix branch adds focused regression coverage showing response_format is forwarded from the gateway into streamParams, then into OpenAI Chat Completions response_format and Responses text.format transport params. It also validates unsupported gateway values before dispatch.

Impact and severity

Affected: OpenAI-compatible Gateway clients relying on structured outputs through /v1/chat/completions. Severity: Medium; requests still complete, but structured-output preferences are silently ignored, which can break downstream JSON parsing and schema-dependent workflows. Frequency: Always for affected requests before the fix. Consequence: Clients cannot rely on OpenAI-compatible response_format behavior through the gateway.

Additional information

This is related in shape to the earlier gateway parameter plumbing fixes for temperature / top_p and token limits, but no directly matching issue was found for response_format forwarding.

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 gateway should preserve the client-supplied response_format and pass it through to the upstream provider request. Chat Completions backends should receive response_format, and Responses backends selected by the runtime should receive the equivalent text.format shape.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: OpenAI-compatible chat completions drops response_format