fix(ai): support xhigh for opus 4.6 by model id closes #2040
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user