From 708afb994410f140c811e3421817c33dd80dbd95 Mon Sep 17 00:00:00 2001 From: Fabio RItzel Borges <38725315+fworks-tech@users.noreply.github.com> Date: Mon, 5 Oct 2026 22:11:29 -0300 Subject: [PATCH] feat(ai): switch chat model to qwen3.8-flash --- src/app/api/chat/route.ts | 2 +- src/lib/abuse/__tests__/cost.test.ts | 4 ++-- src/lib/abuse/cost.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/api/chat/route.ts b/src/app/api/chat/route.ts index 0332d1b..bb8abb0 100644 --- a/src/app/api/chat/route.ts +++ b/src/app/api/chat/route.ts @@ -47,7 +47,7 @@ const zen = (sessionId: string) => }, }); -const MODEL_ID = 'deepseek-v4-flash'; +const MODEL_ID = 'qwen3.8-flash'; const model = (sessionId: string) => zen(sessionId).chatModel(MODEL_ID); diff --git a/src/lib/abuse/__tests__/cost.test.ts b/src/lib/abuse/__tests__/cost.test.ts index a7c9a85..b429cb9 100644 --- a/src/lib/abuse/__tests__/cost.test.ts +++ b/src/lib/abuse/__tests__/cost.test.ts @@ -11,8 +11,8 @@ describe('estimateTokens', () => { describe('calculateCost', () => { it('scales tokens to USD', () => { - expect(calculateCost(1_000_000)).toBeCloseTo(0.28); - expect(calculateCost(500_000)).toBeCloseTo(0.14); + expect(calculateCost(1_000_000)).toBeCloseTo(0.47); + expect(calculateCost(500_000)).toBeCloseTo(0.235); }); }); diff --git a/src/lib/abuse/cost.ts b/src/lib/abuse/cost.ts index 6ab1540..39af44e 100644 --- a/src/lib/abuse/cost.ts +++ b/src/lib/abuse/cost.ts @@ -8,7 +8,7 @@ export const MAX_TOKENS_PER_REQUEST = 4000; const MAX_COST_PER_HOUR_USD = 0.5; // ~$0.50/hour budget -const TOKEN_COST_PER_1M = 0.28; // deepseek-v4-flash on OpenCode Zen (output upper bound) +const TOKEN_COST_PER_1M = 0.47; // qwen3.8-flash on OpenCode Zen (output upper bound) const USAGE_WINDOW_MS = 60 * 60 * 1000; // 1 hour const CLEANUP_INTERVAL_MS = 300_000; // 5 min