diff --git a/packages/ai/CHANGELOG.md b/packages/ai/CHANGELOG.md index 1330e4e2..64bace68 100644 --- a/packages/ai/CHANGELOG.md +++ b/packages/ai/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixed +- Fixed DeepSeek V4 Flash `xhigh` thinking support so requests preserve `xhigh` and map it to DeepSeek's `max` reasoning effort ([#3944](https://github.com/badlogic/pi-mono/issues/3944)). - Fixed Anthropic streams that end before `message_stop` to be treated as errors instead of successful partial responses ([#3936](https://github.com/badlogic/pi-mono/issues/3936)). - Fixed generated OpenAI-compatible DeepSeek V4 models to carry the provider-specific reasoning effort mapping outside the direct DeepSeek provider ([#3940](https://github.com/badlogic/pi-mono/issues/3940)). - Fixed DeepSeek V4 Flash and V4 Pro pricing metadata to match current official rates ([#3910](https://github.com/badlogic/pi-mono/issues/3910)). diff --git a/packages/ai/src/models.ts b/packages/ai/src/models.ts index ee095205..47fdc3c5 100644 --- a/packages/ai/src/models.ts +++ b/packages/ai/src/models.ts @@ -50,7 +50,7 @@ export function calculateCost(model: Model, usage: Usage * * Supported today: * - GPT-5.2 / GPT-5.3 / GPT-5.4 / GPT-5.5 model families - * - DeepSeek V4 Pro + * - DeepSeek V4 Pro and Flash * - Opus 4.6+ models (xhigh maps to adaptive effort "max" on Anthropic-compatible providers) */ export function supportsXhigh(model: Model): boolean { @@ -59,7 +59,8 @@ export function supportsXhigh(model: Model): boolean { model.id.includes("gpt-5.3") || model.id.includes("gpt-5.4") || model.id.includes("gpt-5.5") || - model.id.includes("deepseek-v4-pro") + model.id.includes("deepseek-v4-pro") || + model.id.includes("deepseek-v4-flash") ) { return true; } diff --git a/packages/ai/test/supports-xhigh.test.ts b/packages/ai/test/supports-xhigh.test.ts index eb5eeba8..8474d7ef 100644 --- a/packages/ai/test/supports-xhigh.test.ts +++ b/packages/ai/test/supports-xhigh.test.ts @@ -26,6 +26,24 @@ describe("supportsXhigh", () => { expect(supportsXhigh(model!)).toBe(true); }); + it("returns true for DeepSeek V4 Flash on the DeepSeek provider", () => { + const model = getModel("deepseek", "deepseek-v4-flash"); + expect(model).toBeDefined(); + expect(supportsXhigh(model!)).toBe(true); + }); + + it("returns true for DeepSeek V4 Flash on opencode-go", () => { + const model = getModel("opencode-go", "deepseek-v4-flash"); + expect(model).toBeDefined(); + expect(supportsXhigh(model!)).toBe(true); + }); + + it("returns true for DeepSeek V4 Flash on OpenRouter", () => { + const model = getModel("openrouter", "deepseek/deepseek-v4-flash"); + expect(model).toBeDefined(); + expect(supportsXhigh(model!)).toBe(true); + }); + it("returns true for OpenRouter Opus 4.6 (openai-completions API)", () => { const model = getModel("openrouter", "anthropic/claude-opus-4.6"); expect(model).toBeDefined();