fix(ai): support xhigh for opus 4.6 by model id closes #2040

This commit is contained in:
Mario Zechner
2026-03-14 04:54:39 +01:00
parent a80bbc2227
commit 62064b2b64
2 changed files with 5 additions and 5 deletions

View File

@@ -50,15 +50,15 @@ export function calculateCost<TApi extends Api>(model: Model<TApi>, usage: Usage
*
* Supported today:
* - GPT-5.2 / GPT-5.3 / GPT-5.4 model families
* - Anthropic Messages API Opus 4.6 models (xhigh maps to adaptive effort "max")
* - Opus 4.6 models (xhigh maps to adaptive effort "max" on Anthropic-compatible providers)
*/
export function supportsXhigh<TApi extends Api>(model: Model<TApi>): boolean {
if (model.id.includes("gpt-5.2") || model.id.includes("gpt-5.3") || model.id.includes("gpt-5.4")) {
return true;
}
if (model.api === "anthropic-messages") {
return model.id.includes("opus-4-6") || model.id.includes("opus-4.6");
if (model.id.includes("opus-4-6") || model.id.includes("opus-4.6")) {
return true;
}
return false;

View File

@@ -20,9 +20,9 @@ describe("supportsXhigh", () => {
expect(supportsXhigh(model!)).toBe(true);
});
it("returns false for OpenRouter Opus 4.6 (openai-completions API)", () => {
it("returns true 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);
expect(supportsXhigh(model!)).toBe(true);
});
});