Skip to content

fix(provider): preserve GPT-5.6 max reasoning effort in local provider config #37032

Description

@LYY

Description

OpenCode supports GPT-5.6 models with reasoning.effort: "max", but the current fix appears to work only for model metadata loaded from models.dev.

When the same model is defined manually in opencode.json, OpenCode exposes a max variant but does not bind it to reasoningEffort: "max". Selecting max then sends medium instead.

Environment

Configuration

{
  "provider": {
    "openai-b1": {
      "id": "openai-b1",
      "npm": "@ai-sdk/openai",
      "options": {
        "baseURL": "https://example.invalid/v1",
        "apiKey": "REDACTED"
      },
      "models": {
        "gpt-5.6-luna": {
          "id": "gpt-5.6-luna",
          "reasoning": true,
          "reasoning_options": [
            {
              "type": "effort",
              "values": ["none", "low", "medium", "high", "xhigh", "max"]
            }
          ],
          "variants": {
            "low": {},
            "medium": {},
            "high": {},
            "xhigh": {},
            "max": {}
          }
        }
      }
    }
  }
}

Steps To Reproduce

  1. Configure a GPT-5.6 model manually in opencode.json.
  2. Add max to reasoning_options.
  3. Add an empty max entry under variants.
  4. Select the max reasoning variant.
  5. Inspect the outgoing request or the upstream provider request log.

Expected Behavior

The outgoing OpenAI Responses request should contain:

{
  "reasoning": {
    "effort": "max"
  }
}

Actual Behavior

The max variant appears in the local configuration, but an empty variant does not generate the corresponding reasoning option. The request is sent with medium instead. high and xhigh work correctly.

An explicit variant configuration does work as a workaround:

"max": {
  "reasoningEffort": "max"
}

Suspected Cause

PR #36543 adds reasoning_options handling for models loaded from models.dev: fromModelsDevModel() copies the field and reasoningVariants() derives variants from it.

However, the local opencode.json provider model path rebuilds parsedModel without copying model.reasoning_options. It then falls back to ProviderTransform.variants(parsedModel), whose GPT-5.6 fallback does not include max.

The relevant path appears to be packages/opencode/src/provider/provider.ts around lines 1417-1505. The local variants merge preserves max: {}, but does not attach { reasoningEffort: "max" }.

Related Issues And PR

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions