Fix GitLab Duo thinking metadata

closes #5201
This commit is contained in:
Mario Zechner
2026-05-30 01:08:18 +02:00
Unverified
parent 9c4a3f3518
commit 0ffa590a33
2 changed files with 54 additions and 2 deletions
+1
View File
@@ -9,6 +9,7 @@
### Fixed
- Fixed the GitLab Duo custom provider example to use adaptive thinking for Claude models, expose xhigh thinking, and include newer verified model IDs ([#5201](https://github.com/earendil-works/pi/issues/5201)).
- Fixed Bun release archive creation to install and copy the matching `@mariozechner/clipboard` base package and native sidecars ([#5184](https://github.com/earendil-works/pi/issues/5184)).
## [0.77.0] - 2026-05-28
@@ -20,6 +20,7 @@ import {
type SimpleStreamOptions,
streamSimpleAnthropic,
streamSimpleOpenAIResponses,
type ThinkingLevelMap,
} from "@earendil-works/pi-ai";
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
@@ -49,6 +50,7 @@ interface GitLabModel {
backend: Backend;
baseUrl: string;
reasoning: boolean;
thinkingLevelMap?: ThinkingLevelMap;
input: ("text" | "image")[];
cost: { input: number; output: number; cacheRead: number; cacheWrite: number };
contextWindow: number;
@@ -57,12 +59,37 @@ interface GitLabModel {
export const MODELS: GitLabModel[] = [
// Anthropic
{
id: "claude-opus-4-8",
name: "Claude Opus 4.8",
backend: "anthropic",
baseUrl: ANTHROPIC_PROXY_URL,
reasoning: true,
thinkingLevelMap: { xhigh: "max" },
input: ["text", "image"],
cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 },
contextWindow: 1000000,
maxTokens: 128000,
},
{
id: "claude-sonnet-4-6",
name: "Claude Sonnet 4.6",
backend: "anthropic",
baseUrl: ANTHROPIC_PROXY_URL,
reasoning: true,
thinkingLevelMap: { xhigh: "max" },
input: ["text", "image"],
cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
contextWindow: 1000000,
maxTokens: 64000,
},
{
id: "claude-opus-4-5-20251101",
name: "Claude Opus 4.5",
backend: "anthropic",
baseUrl: ANTHROPIC_PROXY_URL,
reasoning: true,
thinkingLevelMap: { xhigh: "max" },
input: ["text", "image"],
cost: { input: 15, output: 75, cacheRead: 1.5, cacheWrite: 18.75 },
contextWindow: 200000,
@@ -74,6 +101,7 @@ export const MODELS: GitLabModel[] = [
backend: "anthropic",
baseUrl: ANTHROPIC_PROXY_URL,
reasoning: true,
thinkingLevelMap: { xhigh: "max" },
input: ["text", "image"],
cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
contextWindow: 200000,
@@ -85,12 +113,24 @@ export const MODELS: GitLabModel[] = [
backend: "anthropic",
baseUrl: ANTHROPIC_PROXY_URL,
reasoning: true,
thinkingLevelMap: { xhigh: "max" },
input: ["text", "image"],
cost: { input: 1, output: 5, cacheRead: 0.1, cacheWrite: 1.25 },
contextWindow: 200000,
maxTokens: 8192,
},
// OpenAI (all use Responses API)
{
id: "gpt-5.5-2026-04-23",
name: "GPT-5.5",
backend: "openai",
baseUrl: OPENAI_PROXY_URL,
reasoning: true,
input: ["text", "image"],
cost: { input: 5, output: 30, cacheRead: 0.5, cacheWrite: 0 },
contextWindow: 272000,
maxTokens: 128000,
},
{
id: "gpt-5.1-2025-11-13",
name: "GPT-5.1",
@@ -285,7 +325,17 @@ export function streamGitLabDuo(
const innerStream =
cfg.backend === "anthropic"
? streamSimpleAnthropic(modelWithBaseUrl as Model<"anthropic-messages">, context, streamOptions)
? streamSimpleAnthropic(
{
...(modelWithBaseUrl as Model<"anthropic-messages">),
compat: {
...(modelWithBaseUrl as Model<"anthropic-messages">).compat,
forceAdaptiveThinking: true,
},
},
context,
streamOptions,
)
: streamSimpleOpenAIResponses(modelWithBaseUrl as Model<"openai-responses">, context, streamOptions);
for await (const event of innerStream) stream.push(event);
@@ -329,10 +379,11 @@ export default function (pi: ExtensionAPI) {
baseUrl: AI_GATEWAY_URL,
apiKey: "$GITLAB_TOKEN",
api: "gitlab-duo-api",
models: MODELS.map(({ id, name, reasoning, input, cost, contextWindow, maxTokens }) => ({
models: MODELS.map(({ id, name, reasoning, thinkingLevelMap, input, cost, contextWindow, maxTokens }) => ({
id,
name,
reasoning,
thinkingLevelMap,
input,
cost,
contextWindow,