diff --git a/web/src/features/pricing/components/free-models-banner.tsx b/web/src/features/pricing/components/free-models-banner.tsx new file mode 100644 index 0000000..dbadaf8 --- /dev/null +++ b/web/src/features/pricing/components/free-models-banner.tsx @@ -0,0 +1,97 @@ +/* +Copyright (C) 2023-2026 QuantumNous + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . + +For commercial licensing, please contact support@quantumnous.com +*/ +import { Sparkles } from 'lucide-react' +import { useTranslation } from 'react-i18next' + +import { Button } from '@/components/ui/button' +import { cn } from '@/lib/utils' + +import { isFreeModel } from '../lib/model-helpers' +import type { PricingModel } from '../types' + +export interface FreeModelsBannerProps { + models: PricingModel[] + onShowFree: () => void + className?: string +} + +export function FreeModelsBanner(props: FreeModelsBannerProps) { + const { t } = useTranslation() + const freeModels = props.models.filter((model) => isFreeModel(model)) + if (freeModels.length === 0) return null + + const names = freeModels + .slice(0, 6) + .map((model) => model.model_name) + .join(', ') + const suffix = freeModels.length > 6 ? ` +${freeModels.length - 6}` : '' + + return ( +
+
+
+
+ +
+

+ + {t("Today's Free Models")} + + + {freeModels.length} + +

+

+ {names} + {suffix} +

+
+
+ +
+
+ ) +} diff --git a/web/src/features/pricing/components/index.ts b/web/src/features/pricing/components/index.ts index 2acb49c..80fbe9f 100644 --- a/web/src/features/pricing/components/index.ts +++ b/web/src/features/pricing/components/index.ts @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ export { PricingSidebar } from './pricing-sidebar' export { PricingToolbar } from './pricing-toolbar' +export { FreeModelsBanner } from './free-models-banner' export { ModelCard } from './model-card' export { ModelCardGrid } from './model-card-grid' export { LoadingSkeleton } from './loading-skeleton' diff --git a/web/src/features/pricing/components/model-billing-mode-badge.tsx b/web/src/features/pricing/components/model-billing-mode-badge.tsx index ce78431..5e71a78 100644 --- a/web/src/features/pricing/components/model-billing-mode-badge.tsx +++ b/web/src/features/pricing/components/model-billing-mode-badge.tsx @@ -40,6 +40,8 @@ export function ModelBillingModeBadge(props: ModelBillingModeBadgeProps) { if (isDynamicPricingModel(props.model)) { variant = 'warning' + } else if (labelKey === 'Free models') { + variant = 'success' } else if (labelKey === 'Token-based') { variant = 'info' } diff --git a/web/src/features/pricing/components/pricing-sidebar.tsx b/web/src/features/pricing/components/pricing-sidebar.tsx index 238b681..7ca47ae 100644 --- a/web/src/features/pricing/components/pricing-sidebar.tsx +++ b/web/src/features/pricing/components/pricing-sidebar.tsx @@ -38,6 +38,7 @@ import { getQuotaTypeLabels, } from '../constants' import { hasTaskUsageSchema } from '../lib/dynamic-price' +import { isFreeModel } from '../lib/model-helpers' import { parseTags } from '../lib/filters' import type { PricingModel, PricingVendor } from '../types' @@ -218,6 +219,11 @@ export function PricingSidebar(props: PricingSidebarProps) { label: quotaTypeLabels[QUOTA_TYPES.TASK], count: countBy(props.models, (model) => hasTaskUsageSchema(model)), }, + { + value: QUOTA_TYPES.FREE, + label: quotaTypeLabels[QUOTA_TYPES.FREE], + count: countBy(props.models, (model) => isFreeModel(model)), + }, ] const tagOptions: FilterOption[] = [ diff --git a/web/src/features/pricing/constants.ts b/web/src/features/pricing/constants.ts index ca64779..1790209 100644 --- a/web/src/features/pricing/constants.ts +++ b/web/src/features/pricing/constants.ts @@ -50,6 +50,7 @@ export const QUOTA_TYPES = { TOKEN: 'token', REQUEST: 'request', TASK: 'task', + FREE: 'free', } as const export type QuotaTypeOption = (typeof QUOTA_TYPES)[keyof typeof QUOTA_TYPES] @@ -63,6 +64,7 @@ export function getQuotaTypeLabels( [QUOTA_TYPES.TOKEN]: t('Token-based'), [QUOTA_TYPES.REQUEST]: t('Per Request'), [QUOTA_TYPES.TASK]: t('Task billing'), + [QUOTA_TYPES.FREE]: t('Free models'), } } diff --git a/web/src/features/pricing/index.tsx b/web/src/features/pricing/index.tsx index f34d68d..fc199fa 100644 --- a/web/src/features/pricing/index.tsx +++ b/web/src/features/pricing/index.tsx @@ -31,8 +31,9 @@ import { PricingToolbar, ModelCardGrid, ModelDetailsDrawer, + FreeModelsBanner, } from './components' -import { EXCLUDED_GROUPS, VIEW_MODES } from './constants' +import { EXCLUDED_GROUPS, QUOTA_TYPES, VIEW_MODES } from './constants' import { useFilters } from './hooks/use-filters' import { usePricingData } from './hooks/use-pricing-data' @@ -202,6 +203,12 @@ export function Pricing() { /> + setQuotaTypeFilter(QUOTA_TYPES.FREE)} + className='mb-4' + /> +
isFreeModel(m)) + } // Task-usage models form their own bucket, disjoint from token/request. if (quotaType === QUOTA_TYPES.TASK) { return models.filter((m) => hasTaskUsageSchema(m)) diff --git a/web/src/features/pricing/lib/model-helpers.ts b/web/src/features/pricing/lib/model-helpers.ts index 746da8b..10b31ce 100644 --- a/web/src/features/pricing/lib/model-helpers.ts +++ b/web/src/features/pricing/lib/model-helpers.ts @@ -107,3 +107,21 @@ export function replaceModelInPath(path: string, modelName: string): string { export function isTokenBasedModel(model: PricingModel): boolean { return model.quota_type === QUOTA_TYPE_VALUES.TOKEN } + +/** + * Check if a model is free of charge (0 price with standard billing). + * Covers both token-based models with zero ratios and per-request models + * with a zero fixed price. Dynamic/task-billing models are excluded because + * their cost cannot be derived from the static price fields. + */ +export function isFreeModel(model: PricingModel): boolean { + // Inline task/dynamic checks to avoid an import cycle with dynamic-price.ts. + const isTaskBilling = Object.keys(model.billing_usage_schema ?? {}).length > 0 + const isDynamic = + model.billing_mode === 'tiered_expr' && Boolean(model.billing_expr) + if (isTaskBilling || isDynamic) return false + if (model.quota_type === QUOTA_TYPE_VALUES.TOKEN) { + return (model.model_ratio ?? 0) === 0 + } + return (model.model_price ?? 0) === 0 +} diff --git a/web/src/i18n/locales/en.json b/web/src/i18n/locales/en.json index b289eb7..9c63625 100644 --- a/web/src/i18n/locales/en.json +++ b/web/src/i18n/locales/en.json @@ -6144,7 +6144,11 @@ "Zero retention": "Zero retention", "Zhipu": "Zhipu", "Zhipu V4": "Zhipu V4", - "Zoom": "Zoom" + "Zoom": "Zoom", + "Free models": "Free models", + "Today's Free Models": "Today's Free Models", + "{{count}} free models available": "{{count}} free models available", + "View all free models": "View all free models" }, "Recharge bonus: pay {{pay}} get {{credit}} — the more you top up, the more you get.": "Recharge bonus: pay ¥{{pay}}, get ¥{{credit}} credited — the more you top up, the more you get.", "Credited amount": "Credited amount", diff --git a/web/src/i18n/locales/fr.json b/web/src/i18n/locales/fr.json index 8799f87..10563e5 100644 --- a/web/src/i18n/locales/fr.json +++ b/web/src/i18n/locales/fr.json @@ -6144,7 +6144,11 @@ "Zero retention": "Aucune rétention", "Zhipu": "Zhipu", "Zhipu V4": "Zhipu V4", - "Zoom": "Zoom" + "Zoom": "Zoom", + "Free models": "Modèles gratuits", + "Today's Free Models": "Modèles gratuits du jour", + "{{count}} free models available": "{{count}} modèles gratuits disponibles", + "View all free models": "Voir tous les modèles gratuits" }, "Recharge bonus: pay {{pay}} get {{credit}} — the more you top up, the more you get.": "Bonus de recharge : payez ¥{{pay}} et recevez ¥{{credit}} — plus vous rechargez, plus vous gagnez.", "Credited amount": "Montant crédité", diff --git a/web/src/i18n/locales/ja.json b/web/src/i18n/locales/ja.json index 7f1ca4a..077cb8b 100644 --- a/web/src/i18n/locales/ja.json +++ b/web/src/i18n/locales/ja.json @@ -6144,7 +6144,11 @@ "Zero retention": "データ保持なし", "Zhipu": "Zhipu", "Zhipu V4": "Zhipu V 4", - "Zoom": "ズーム" + "Zoom": "ズーム", + "Free models": "無料モデル", + "Today's Free Models": "本日の無料モデル", + "{{count}} free models available": "無料モデル: {{count}}", + "View all free models": "すべての無料モデルを見る" }, "Recharge bonus: pay {{pay}} get {{credit}} — the more you top up, the more you get.": "チャージ特典:{{pay}}元の支払いで{{credit}}元が付与されます。金額が多いほどお得です。", "Credited amount": "付与額", diff --git a/web/src/i18n/locales/ru.json b/web/src/i18n/locales/ru.json index 7e70293..a806b51 100644 --- a/web/src/i18n/locales/ru.json +++ b/web/src/i18n/locales/ru.json @@ -6144,7 +6144,11 @@ "Zero retention": "Без хранения данных", "Zhipu": "Zhipu", "Zhipu V4": "Zhipu V4", - "Zoom": "Zoom" + "Zoom": "Zoom", + "Free models": "Бесплатные модели", + "Today's Free Models": "Бесплатные модели сегодня", + "{{count}} free models available": "Доступно бесплатных моделей: {{count}}", + "View all free models": "Все бесплатные модели" }, "Recharge bonus: pay {{pay}} get {{credit}} — the more you top up, the more you get.": "Бонус за пополнение: платите ¥{{pay}} — получаете ¥{{credit}}. Чем больше пополнение, тем больше бонус.", "Credited amount": "Начислено", diff --git a/web/src/i18n/locales/vi.json b/web/src/i18n/locales/vi.json index b92930c..06fe359 100644 --- a/web/src/i18n/locales/vi.json +++ b/web/src/i18n/locales/vi.json @@ -6144,7 +6144,11 @@ "Zero retention": "Không lưu dữ liệu", "Zhipu": "Zhipu", "Zhipu V4": "Zhipu V4", - "Zoom": "Zoom" + "Zoom": "Zoom", + "Free models": "Mô hình miễn phí", + "Today's Free Models": "Mô hình miễn phí hôm nay", + "{{count}} free models available": "{{count}} mô hình miễn phí", + "View all free models": "Xem tất cả mô hình miễn phí" }, "Recharge bonus: pay {{pay}} get {{credit}} — the more you top up, the more you get.": "Ưu đãi nạp tiền: nạp {{pay}} nhận {{credit}} — nạp càng nhiều nhận càng nhiều.", "Credited amount": "Số tiền nhận được", diff --git a/web/src/i18n/locales/zh-TW.json b/web/src/i18n/locales/zh-TW.json index ad35cfa..fce076a 100644 --- a/web/src/i18n/locales/zh-TW.json +++ b/web/src/i18n/locales/zh-TW.json @@ -6144,7 +6144,11 @@ "Zero retention": "零數據保留", "Zhipu": "智譜", "Zhipu V4": "智譜 V4", - "Zoom": "縮放" + "Zoom": "縮放", + "Free models": "免費模型", + "Today's Free Models": "今日免費模型", + "{{count}} free models available": "{{count}} 個免費模型", + "View all free models": "查看全部免費模型" }, "Recharge bonus: pay {{pay}} get {{credit}} — the more you top up, the more you get.": "儲值優惠:儲值 {{pay}} 元實際入帳 {{credit}} 元,以此類推,儲多少送多少。", "Credited amount": "入帳金額", diff --git a/web/src/i18n/locales/zh.json b/web/src/i18n/locales/zh.json index aef0d44..44a714f 100644 --- a/web/src/i18n/locales/zh.json +++ b/web/src/i18n/locales/zh.json @@ -6144,7 +6144,11 @@ "Zero retention": "零数据保留", "Zhipu": "智谱", "Zhipu V4": "智谱 V4", - "Zoom": "缩放" + "Zoom": "缩放", + "Free models": "免费模型", + "Today's Free Models": "今日免费模型", + "{{count}} free models available": "{{count}} 个免费模型", + "View all free models": "查看全部免费模型" }, "Recharge bonus: pay {{pay}} get {{credit}} — the more you top up, the more you get.": "充值优惠:充值 {{pay}} 元实际到账 {{credit}} 元,以此类推,充多少送多少。", "Credited amount": "到账金额", diff --git a/web/src/styles/index.css b/web/src/styles/index.css index 0493ed2..d044508 100644 --- a/web/src/styles/index.css +++ b/web/src/styles/index.css @@ -730,3 +730,60 @@ For commercial licensing, please contact support@quantumnous.com display: none; } } + +/* ── Model square free-models banner: shining text ── */ +@keyframes free-banner-shine { + 0% { + background-position: 200% center; + } + 100% { + background-position: -200% center; + } +} + +@keyframes free-banner-glow { + 0%, + 100% { + opacity: 0.55; + } + 50% { + opacity: 1; + } +} + +.free-banner-shine-text { + background: linear-gradient( + 100deg, + oklch(0.75 0.13 85) 0%, + oklch(0.95 0.17 95) 20%, + oklch(0.85 0.16 75) 40%, + oklch(0.98 0.18 100) 60%, + oklch(0.75 0.13 85) 80% + ); + background-size: 200% auto; + background-clip: text; + -webkit-background-clip: text; + color: transparent; + animation: free-banner-shine 3s linear infinite; + filter: drop-shadow(0 0 8px oklch(0.8 0.16 95 / 45%)); +} + +.free-banner-shine-dot { + color: oklch(0.95 0.18 100); + animation: free-banner-glow 1.6s ease-in-out infinite; + filter: drop-shadow(0 0 6px oklch(0.85 0.18 100 / 70%)); +} + +@media (prefers-reduced-motion: reduce) { + .free-banner-shine-text, + .free-banner-shine-dot { + animation: none; + } + .free-banner-shine-text { + background: none; + -webkit-background-clip: initial; + background-clip: initial; + color: oklch(0.85 0.16 95); + filter: none; + } +}