Bug
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.
Bug
When using GPT-5.5 through the Responses API (via
@iam-brain/opencode-codex-authplugin or native OpenAI provider), OpenCode sendsmax_output_tokens: 32000in the request body. The OpenAI Responses API for GPT-5.5 rejects this parameter with aBad Requesterror:Root Cause
From the logs, the request to
https://api.openai.com/v1/responsesincludes:GPT-5.5 (and other reasoning models on the Responses API) do not accept
max_output_tokens. They usereasoningEffortandtextVerbosityinstead. OpenCode is automatically injecting this from the model's known output limit.Environment
openai/gpt-5.5@iam-brain/opencode-codex-auth@1.7.1Workarounds Tried
@iam-brain/opencode-codex-authto v1.7.1 — still failssanitizeInputs: truein codex-config.jsonc — still failsreasoningEffort,textVerbosity,reasoningSummary) in opencode.json — still failsExpected Behavior
OpenCode should NOT send
max_output_tokensfor 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:
max_output_tokensfrom the request bodyreasoningEffortandtextVerbosityinstead (already configurable via model options)Alternatively, allow users to configure
limit.outputor a flag to disable sendingmax_output_tokensfor specific models.