Skip to content

[Improvement]: custom-provider-gitlab-duo — fix adaptive thinking for Claude models #5201

@jetnet

Description

@jetnet

Before you start: I've read CONTRIBUTING.md.

What do you want to change?

Three things in the custom-provider-gitlab-duo example extension:

1. forceAdaptiveThinking missing. GitLab's proxy rejects thinking.type: "enabled" on claude-opus-4-6 and newer — error: "thinking.type 'enabled' is not supported". Fix: spread compat: { forceAdaptiveThinking: true } onto the model in streamGitLabDuo when cfg.backend === "anthropic".

2. xhigh level never appears. pi gates xhigh on model.thinkingLevelMap?.xhigh being defined. Without it, Shift+Tab stops at high. Fix: add thinkingLevelMap: { xhigh: "max" } to Claude models with reasoning: true. GitLab's proxy accepts "max" as the top effort value.

3. Model list is stale. Tested against the live GitLab proxy — current upstream models still work, but newer ones are available and the GPT short-form IDs (gpt-5.5, gpt-5.4) return 400; only dated/specific IDs are accepted:

Model Verified ID
Claude Opus (latest) claude-opus-4-8
Claude Sonnet (latest) claude-sonnet-4-6
GPT-5.5 gpt-5.5-2026-04-23
GPT-5 Mini gpt-5-mini-2025-08-07 (already upstream)

gpt-5.5 (short form) → 400. gpt-5.5-2026-04-23 → works.

Why?

Issues 1 and 2 fail silently — basic usage looks fine, thinking just doesn't work. claude-opus-4-6 is in the official GitLab supported list and anyone adding it hits both. Issue 3 saves the next person from debugging 400s with no body.

How?

// streamGitLabDuo — spread forceAdaptiveThinking for Anthropic models
const modelWithBaseUrl = {
  ...model,
  baseUrl: cfg.baseUrl,
  ...(cfg.backend === "anthropic"
    ? { compat: { ...(model as any).compat, forceAdaptiveThinking: true } }
    : {}),
};

In MODELS, on Claude entries with reasoning: true:

thinkingLevelMap: { xhigh: "max" },

Happy to send a PR if approved with lgtm.

Metadata

Metadata

Assignees

Labels

inprogressIssue is being worked on

Type

No type
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