You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GPT-5.5 on Responses API rejects max_output_tokens: Bad Request error #27547
When using GPT-5.5 through the Responses API (via @iam-brain/opencode-codex-auth plugin or native OpenAI provider), OpenCode sends max_output_tokens: 32000 in the request body. The OpenAI Responses API for GPT-5.5 rejects this parameter with a Bad Request error:
"max_output_tokens" not permitted
Root Cause
From the logs, the request to https://api.openai.com/v1/responses includes:
"max_output_tokens": 32000
GPT-5.5 (and other reasoning models on the Responses API) do not accept max_output_tokens. They use reasoningEffort and textVerbosity instead. OpenCode is automatically injecting this from the model's known output limit.
Environment
OpenCode v1.14.50 (also fails on v1.14.49)
Model: openai/gpt-5.5
Provider: OpenAI (Responses API)
Plugin: @iam-brain/opencode-codex-auth@1.7.1
Workarounds Tried
✅ Upgraded OpenCode to v1.14.50 — still fails
✅ Updated @iam-brain/opencode-codex-auth to v1.7.1 — still fails
✅ Set sanitizeInputs: true in codex-config.jsonc — still fails
✅ Added model options (reasoningEffort, textVerbosity, reasoningSummary) in opencode.json — still fails
✅ Removed plugin (fixes the error but loses OAuth subscription access)
Expected Behavior
OpenCode should NOT send max_output_tokens for reasoning models (GPT-5.x) when using the Responses API. The parameter should be omitted or replaced with the appropriate reasoning model controls (reasoningEffort, textVerbosity).
Suggested Fix
When the provider is OpenAI and the model is a reasoning model (GPT-5.x), OpenCode should:
Omit max_output_tokens from the request body
Use reasoningEffort and textVerbosity instead (already configurable via model options)
Alternatively, allow users to configure limit.output or a flag to disable sending max_output_tokens for specific models.
This issue might be a duplicate of existing issues. Please check:
gpt-5.3-codex-spark fails on official OpenAI path with unsupported reasoning.summary #18791: Same root cause pattern — OpenCode sending unsupported parameters to reasoning models via the Responses API (that issue covers reasoning.summary on gpt-5.3-codex-spark; this one covers max_output_tokens on gpt-5.5, but the underlying fix area in transform.ts / the Responses API adapter is likely the same)
Thanks for the detailed report. I do not think this is actionable in stock OpenCode as written.
What I checked:
Current OpenAI Responses API docs explicitly show gpt-5.5 accepting max_output_tokens.
OpenCode built-in OpenAI/Codex plugin already clears output.maxOutputTokens for provider openai to match Codex CLI behavior, so stock OpenCode should not send max_output_tokens on that path. This is present in v1.14.50 and current dev.
We have a regression assertion for the OpenAI Responses payload that expects max_output_tokens to be absent, and that focused test passes locally.
Given the workaround says removing @iam-brain/opencode-codex-auth fixes it, this looks like the third-party plugin is either reintroducing the cap after OpenCode built-in hook or running a custom request path. If you can reproduce this with stock OpenCode, default plugins enabled, and no third-party Codex auth plugin, please reopen with the raw request body and startup flags/config.
Activity
github-actions commentedon May 14, 2026
This issue might be a duplicate of existing issues. Please check:
reasoning.summaryongpt-5.3-codex-spark; this one coversmax_output_tokensongpt-5.5, but the underlying fix area intransform.ts/ the Responses API adapter is likely the same)nexxeln commentedon May 18, 2026
Thanks for the detailed report. I do not think this is actionable in stock OpenCode as written.
What I checked:
gpt-5.5acceptingmax_output_tokens.output.maxOutputTokensfor provideropenaito match Codex CLI behavior, so stock OpenCode should not sendmax_output_tokenson that path. This is present inv1.14.50and currentdev.max_output_tokensto be absent, and that focused test passes locally.Given the workaround says removing
@iam-brain/opencode-codex-authfixes it, this looks like the third-party plugin is either reintroducing the cap after OpenCode built-in hook or running a custom request path. If you can reproduce this with stock OpenCode, default plugins enabled, and no third-party Codex auth plugin, please reopen with the raw request body and startup flags/config.