fix(ai): enable xhigh for anthropic opus 4.6

This commit is contained in:
Mario Zechner 2026-02-05 22:57:43 +01:00
parent 9494fa8d3f
commit ee53b53689
4 changed files with 43 additions and 2 deletions

View file

@ -2,6 +2,10 @@
## [Unreleased]
### Fixed
- Fixed `supportsXhigh()` to treat Anthropic Messages Opus 4.6 models as xhigh-capable so `streamSimple` can map `xhigh` to adaptive effort `max`
## [0.52.4] - 2026-02-05
## [0.52.3] - 2026-02-05

View file

@ -47,10 +47,21 @@ export function calculateCost<TApi extends Api>(model: Model<TApi>, usage: Usage
/**
* Check if a model supports xhigh thinking level.
* Currently only certain OpenAI Codex models support this.
*
* Supported today:
* - GPT-5.2 / GPT-5.3 model families
* - Anthropic Messages API Opus 4.6 models (xhigh maps to adaptive effort "max")
*/
export function supportsXhigh<TApi extends Api>(model: Model<TApi>): boolean {
return model.id.includes("gpt-5.2") || model.id.includes("gpt-5.3");
if (model.id.includes("gpt-5.2") || model.id.includes("gpt-5.3")) {
return true;
}
if (model.api === "anthropic-messages") {
return model.id.includes("opus-4-6") || model.id.includes("opus-4.6");
}
return false;
}
/**

View file

@ -0,0 +1,22 @@
import { describe, expect, it } from "vitest";
import { getModel, supportsXhigh } from "../src/models.js";
describe("supportsXhigh", () => {
it("returns true for Anthropic Opus 4.6 on anthropic-messages API", () => {
const model = getModel("anthropic", "claude-opus-4-6");
expect(model).toBeDefined();
expect(supportsXhigh(model!)).toBe(true);
});
it("returns false for non-Opus Anthropic models", () => {
const model = getModel("anthropic", "claude-sonnet-4-5");
expect(model).toBeDefined();
expect(supportsXhigh(model!)).toBe(false);
});
it("returns false for OpenRouter Opus 4.6 (openai-completions API)", () => {
const model = getModel("openrouter", "anthropic/claude-opus-4.6");
expect(model).toBeDefined();
expect(supportsXhigh(model!)).toBe(false);
});
});

View file

@ -2,6 +2,10 @@
## [Unreleased]
### Fixed
- Fixed thinking level capability detection so Anthropic Opus 4.6 models expose `xhigh` in selectors and cycling
## [0.52.4] - 2026-02-05
### Fixed