diff --git a/frontend/src/components/admin/channel/__tests__/PricingEntryCard.modelDefaultPrice.spec.ts b/frontend/src/components/admin/channel/__tests__/PricingEntryCard.modelDefaultPrice.spec.ts
index 3eaab643a7..c03722deab 100644
--- a/frontend/src/components/admin/channel/__tests__/PricingEntryCard.modelDefaultPrice.spec.ts
+++ b/frontend/src/components/admin/channel/__tests__/PricingEntryCard.modelDefaultPrice.spec.ts
@@ -25,6 +25,7 @@ function createEntry(models: string[] = []): PricingFormEntry {
cache_read_price: null,
fast_multiplier: null,
flex_multiplier: null,
+ ultrafast_multiplier: null,
reasoning_effort_multipliers: null,
image_input_price: null,
image_output_price: null,
diff --git a/frontend/src/components/admin/channel/__tests__/PricingEntryCard.timePricing.spec.ts b/frontend/src/components/admin/channel/__tests__/PricingEntryCard.timePricing.spec.ts
index deee992b31..22e0c35978 100644
--- a/frontend/src/components/admin/channel/__tests__/PricingEntryCard.timePricing.spec.ts
+++ b/frontend/src/components/admin/channel/__tests__/PricingEntryCard.timePricing.spec.ts
@@ -23,6 +23,7 @@ function createEntry(billingMode: PricingFormEntry['billing_mode'] = 'token'): P
cache_read_price: null,
fast_multiplier: null,
flex_multiplier: null,
+ ultrafast_multiplier: null,
reasoning_effort_multipliers: null,
image_input_price: null,
image_output_price: null,
diff --git a/frontend/src/components/admin/channel/types.ts b/frontend/src/components/admin/channel/types.ts
index 03c74071e5..faebc8bd73 100644
--- a/frontend/src/components/admin/channel/types.ts
+++ b/frontend/src/components/admin/channel/types.ts
@@ -32,6 +32,7 @@ export interface PricingFormEntry {
cache_read_price: number | string | null
fast_multiplier?: number | string | null
flex_multiplier?: number | string | null
+ ultrafast_multiplier?: number | string | null
reasoning_effort_multipliers?: Record
| null
image_input_price: number | string | null
image_output_price: number | string | null
diff --git a/frontend/src/components/keys/UseKeyModal.vue b/frontend/src/components/keys/UseKeyModal.vue
index e0aea84e01..26c36a1fec 100644
--- a/frontend/src/components/keys/UseKeyModal.vue
+++ b/frontend/src/components/keys/UseKeyModal.vue
@@ -1410,6 +1410,11 @@ function generateOpenCodeConfig(platform: string, baseUrl: string, apiKey: strin
}
}
}
+ const solAstraOptions = {
+ limit: { context: 1050000, output: 128000 },
+ options: { store: false },
+ variants: { low: {}, medium: {}, high: {}, xhigh: {}, max: {} }
+ }
const openaiModels = {
'gpt-6': {
name: 'GPT-6 (Astra)',
@@ -1484,23 +1489,9 @@ function generateOpenCodeConfig(platform: string, baseUrl: string, apiKey: strin
options: { store: false },
variants: { none: {}, low: {}, medium: {}, high: {}, xhigh: {}, max: {} }
},
- 'gpt-6.1-sol': {
- name: 'GPT-6.1 Sol',
- limit: {
- context: 1050000,
- output: 128000
- },
- options: {
- store: false
- },
- variants: {
- low: {},
- medium: {},
- high: {},
- xhigh: {},
- max: {}
- }
- },
+ 'gpt-6.2-sol': { name: 'GPT-6.2 Sol', ...solAstraOptions },
+ 'gpt-6.2-astra': { name: 'GPT-6.2 Astra', ...solAstraOptions },
+ 'gpt-6.1-sol': { name: 'GPT-6.1 Sol', ...solAstraOptions },
'gpt-6-sol': {
name: 'GPT-6 Sol',
limit: {
diff --git a/frontend/src/components/keys/__tests__/UseKeyModal.spec.ts b/frontend/src/components/keys/__tests__/UseKeyModal.spec.ts
index 64d9c9bed9..46233b7908 100644
--- a/frontend/src/components/keys/__tests__/UseKeyModal.spec.ts
+++ b/frontend/src/components/keys/__tests__/UseKeyModal.spec.ts
@@ -723,12 +723,17 @@ describe('UseKeyModal', () => {
const parsed = JSON.parse(wrapper.find('pre code').text())
const models = parsed.provider.openai.models
- for (const model of ['gpt-5.6', 'gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna', 'gpt-6.1-sol', 'gpt-6-sol', 'gpt-6-luna']) {
+ for (const model of ['gpt-5.6', 'gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna', 'gpt-6.2-sol', 'gpt-6.2-astra', 'gpt-6.1-sol', 'gpt-6-sol', 'gpt-6-luna']) {
expect(models[model]).toBeDefined()
expect(models[model].variants).toHaveProperty('max')
expect(models[model].variants).toHaveProperty('xhigh')
}
expect(models['gpt-5.6'].name).toBe('GPT-5.6 (Sol)')
+ for (const model of ['gpt-6.2-sol', 'gpt-6.2-astra']) {
+ expect(models[model].variants).not.toHaveProperty('none')
+ expect(models[model].variants).not.toHaveProperty('minimal')
+ expect(models[model].limit).toEqual({ context: 1050000, output: 128000 })
+ }
expect(models['gpt-6.1-sol'].variants).not.toHaveProperty('none')
expect(models['gpt-6.1-terra']).toEqual({
name: 'GPT-6.1 Terra',
diff --git a/frontend/src/components/modelPlaza/PlazaModelPricingTable.vue b/frontend/src/components/modelPlaza/PlazaModelPricingTable.vue
index 6daf1194e8..a667095329 100644
--- a/frontend/src/components/modelPlaza/PlazaModelPricingTable.vue
+++ b/frontend/src/components/modelPlaza/PlazaModelPricingTable.vue
@@ -65,7 +65,18 @@
- {{ m.name }}
+
+ {{ m.name }}
+
+
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
+import Icon from '@/components/icons/Icon.vue'
+import { useClipboard } from '@/composables/useClipboard'
import { formatScaled, resolveIntervalPrices } from '@/utils/pricing'
import { platformAccentColor, platformBadgeLightClass, platformLabel } from '@/utils/platformColors'
import {
@@ -366,6 +379,7 @@ const props = defineProps<{
}>()
const { t } = useI18n()
+const { copyToClipboard } = useClipboard()
/** 实付分区只从平台拿一个主色,浅底/标题/下划线全部由 scoped CSS 用 color-mix 派生。 */
const accentStyle = computed(() => ({ '--plaza-accent': platformAccentColor(props.platform ?? '') }))
diff --git a/frontend/src/components/modelPlaza/__tests__/PlazaModelPricingTable.spec.ts b/frontend/src/components/modelPlaza/__tests__/PlazaModelPricingTable.spec.ts
index 1cfe916d0b..ce2c1108ef 100644
--- a/frontend/src/components/modelPlaza/__tests__/PlazaModelPricingTable.spec.ts
+++ b/frontend/src/components/modelPlaza/__tests__/PlazaModelPricingTable.spec.ts
@@ -3,6 +3,14 @@ import { mount } from '@vue/test-utils'
import PlazaModelPricingTable from '../PlazaModelPricingTable.vue'
import type { PlazaModel } from '@/api/modelPlaza'
+const { copyToClipboard } = vi.hoisted(() => ({
+ copyToClipboard: vi.fn().mockResolvedValue(true)
+}))
+
+vi.mock('@/composables/useClipboard', () => ({
+ useClipboard: () => ({ copyToClipboard })
+}))
+
vi.mock('vue-i18n', async () => {
const actual = await vi.importActual('vue-i18n')
return {
@@ -58,6 +66,27 @@ function mountTable(
}
describe('PlazaModelPricingTable', () => {
+ it('copies the exact model ID from the clicked pricing row', async () => {
+ const model = tokenModel({
+ name: 'provider/Model-v2',
+ time_pricing: {
+ timezone: 'Asia/Shanghai',
+ periods: [{ start_time: '09:00', end_time: '12:00', multiplier: 0.5 }]
+ }
+ })
+ const wrapper = mountTable([tokenModel(), model], 1)
+ const rows = wrapper.findAll('tbody tr').filter(row => row.text().includes(model.name))
+ expect(rows).toHaveLength(2)
+
+ for (const row of rows) {
+ const button = row.get('button[aria-label="modelPlaza.table.copyModelId"]')
+ await button.trigger('click')
+ }
+
+ expect(copyToClipboard.mock.calls).toEqual([[model.name], [model.name]])
+ wrapper.unmount()
+ })
+
it.each([false, true])('shows independent 12h prices without a 1h label (intervals=%s)', (intervals) => {
const model = tokenModel({ name: 'gpt-6-luna', platform: 'openai' })
model.pricing!.cache_write_price = null
diff --git a/frontend/src/composables/__tests__/useModelWhitelist.spec.ts b/frontend/src/composables/__tests__/useModelWhitelist.spec.ts
index 2a54604be5..8b7b658c47 100644
--- a/frontend/src/composables/__tests__/useModelWhitelist.spec.ts
+++ b/frontend/src/composables/__tests__/useModelWhitelist.spec.ts
@@ -46,6 +46,8 @@ describe('useModelWhitelist', () => {
expect(models).toContain('gpt-5.6')
expect(models).toContain('gpt-6')
expect(models).toContain('gpt-6-astra')
+ expect(models).toContain('gpt-6.2-sol')
+ expect(models).toContain('gpt-6.2-astra')
expect(models).toContain('gpt-6.1-sol')
expect(models).toContain('gpt-6.1-terra')
expect(models).toContain('gpt-6-sol')
@@ -56,6 +58,8 @@ describe('useModelWhitelist', () => {
it('openai 预设映射包含 GPT-6 别名和 Astra', () => {
expect(getPresetMappingsByPlatform('openai')).toEqual(expect.arrayContaining([
+ expect.objectContaining({ label: 'GPT-6.2 Sol', from: 'gpt-6.2-sol', to: 'gpt-6.2-sol' }),
+ expect.objectContaining({ label: 'GPT-6.2 Astra', from: 'gpt-6.2-astra', to: 'gpt-6.2-astra' }),
expect.objectContaining({ label: 'GPT-6.1 Sol', from: 'gpt-6.1-sol', to: 'gpt-6.1-sol' }),
expect.objectContaining({ label: 'GPT-6.1 Terra', from: 'gpt-6.1-terra', to: 'gpt-6.1-terra' }),
expect.objectContaining({ label: 'GPT-6', from: 'gpt-6', to: 'gpt-6' }),
diff --git a/frontend/src/composables/useModelWhitelist.ts b/frontend/src/composables/useModelWhitelist.ts
index 62a7e6f35b..2237179e3e 100644
--- a/frontend/src/composables/useModelWhitelist.ts
+++ b/frontend/src/composables/useModelWhitelist.ts
@@ -12,7 +12,7 @@ const openaiModels = [
// GPT-5.6 系列
'gpt-5.6', 'gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna',
// GPT-6 系列
- 'gpt-6', 'gpt-6-astra', 'gpt-6.1-sol', 'gpt-6.1-terra', 'gpt-6-sol', 'gpt-6-luna',
+ 'gpt-6', 'gpt-6-astra', 'gpt-6.2-sol', 'gpt-6.2-astra', 'gpt-6.1-sol', 'gpt-6.1-terra', 'gpt-6-sol', 'gpt-6-luna',
// GPT-5.5 系列
'gpt-5.5',
// GPT-5.4 系列
@@ -360,6 +360,8 @@ const openaiPresetMappings = [
{ label: 'GPT-6', from: 'gpt-6', to: 'gpt-6', color: 'bg-cyan-100 text-cyan-700 hover:bg-cyan-200 dark:bg-cyan-900/30 dark:text-cyan-400' },
{ label: 'GPT-5.6', from: 'gpt-5.6', to: 'gpt-5.6', color: 'bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-400' },
{ label: 'GPT-6.1 Terra', from: 'gpt-6.1-terra', to: 'gpt-6.1-terra', color: 'bg-lime-100 text-lime-700 hover:bg-lime-200 dark:bg-lime-900/30 dark:text-lime-400' },
+ { label: 'GPT-6.2 Sol', from: 'gpt-6.2-sol', to: 'gpt-6.2-sol', color: 'bg-orange-100 text-orange-700 hover:bg-orange-200 dark:bg-orange-900/30 dark:text-orange-400' },
+ { label: 'GPT-6.2 Astra', from: 'gpt-6.2-astra', to: 'gpt-6.2-astra', color: 'bg-orange-100 text-orange-700 hover:bg-orange-200 dark:bg-orange-900/30 dark:text-orange-400' },
{ label: 'GPT-6.1 Sol', from: 'gpt-6.1-sol', to: 'gpt-6.1-sol', color: 'bg-orange-100 text-orange-700 hover:bg-orange-200 dark:bg-orange-900/30 dark:text-orange-400' },
{ label: 'GPT-6 Sol', from: 'gpt-6-sol', to: 'gpt-6-sol', color: 'bg-orange-100 text-orange-700 hover:bg-orange-200 dark:bg-orange-900/30 dark:text-orange-400' },
{ label: 'GPT-5.6 Sol', from: 'gpt-5.6-sol', to: 'gpt-5.6-sol', color: 'bg-orange-100 text-orange-700 hover:bg-orange-200 dark:bg-orange-900/30 dark:text-orange-400' },
diff --git a/frontend/src/i18n/locales/en/admin/accounts.ts b/frontend/src/i18n/locales/en/admin/accounts.ts
index 1dbb8658d2..9b3d97afe9 100644
--- a/frontend/src/i18n/locales/en/admin/accounts.ts
+++ b/frontend/src/i18n/locales/en/admin/accounts.ts
@@ -504,6 +504,8 @@ export default {
testConnection: 'Test Connection',
reAuthorize: 'Re-Authorize',
refreshToken: 'Refresh Token',
+ refreshTokenHint: 'Tokens are refreshed automatically in the background. Frequent manual refreshes can race the automatic refresh and invalidate the token, pausing the account.',
+ refreshTokenFrequentWarning: 'Less than a minute since the last manual refresh: frequent refreshes can race the background auto-refresh and invalidate the token. Only retry when necessary.',
noAccountsYet: 'No accounts yet',
createFirstAccount: 'Create your first account to start using AI services.',
tokenRefreshed: 'Token refreshed successfully',
diff --git a/frontend/src/i18n/locales/en/admin/channels.ts b/frontend/src/i18n/locales/en/admin/channels.ts
index d0aa35cc19..d2ac27d2ba 100644
--- a/frontend/src/i18n/locales/en/admin/channels.ts
+++ b/frontend/src/i18n/locales/en/admin/channels.ts
@@ -150,6 +150,7 @@ export default {
pricePlaceholder: 'Default',
fastMultiplier: 'Fast Multiplier',
flexMultiplier: 'Flex Multiplier',
+ ultrafastMultiplier: 'Ultrafast Multiplier',
reasoningEffortMultipliers: 'Custom Reasoning Effort Multipliers (optional)',
reasoningEffortMultipliersHint: 'Apply the multiplier for the final forwarded reasoning effort to the entire request cost and quota usage. Unconfigured levels use 1×. These multiply with other billing multipliers.',
reasoningEffortMultiplierLabel: '{effort} reasoning effort multiplier',
diff --git a/frontend/src/i18n/locales/en/admin/overview.ts b/frontend/src/i18n/locales/en/admin/overview.ts
index 64cc010818..250c911632 100644
--- a/frontend/src/i18n/locales/en/admin/overview.ts
+++ b/frontend/src/i18n/locales/en/admin/overview.ts
@@ -1274,7 +1274,7 @@ export default {
force: 'Force Fast (priority)',
hint: 'Forces service_tier=priority on OpenAI requests in this group. The global Fast/Flex policy can still filter or block it. New requests update immediately after saving; existing WebSocket sessions must reconnect.',
forceUltrafast: 'Force Ultra Fast (ultrafast)',
- ultrafastHint: 'Forces service_tier=ultrafast only on models that support Ultra Fast (GPT-6 Astra, GPT-6.1 Sol), taking precedence over "Force Fast". Other models get priority when "Force Fast" is also on, otherwise they follow the client. Ultra Fast is billed at 6x the Standard price, is not covered by "Free Fast", and requires upstream accounts with Ultra Fast access.',
+ ultrafastHint: 'Forces Ultra Fast (service_tier=ultrafast) on supported models. Pro 200 includes GPT-6.2 Sol Ultrafast. Pro 500 includes both Sol and Astra Ultrafast. Other subscriptions use the tiers advertised by their account. If unavailable, Force Fast takes precedence over the client tier. GPT-6.2 Sol and Astra cost 3× Standard through February 28, 2027 (Pacific time), then 6×. GPT-6 Astra and GPT-6.1 Sol cost 6×. Free Fast excludes Ultra Fast.',
free: 'Free Fast',
freeHint: 'Fast requests in this group still use the priority tier, but customers are charged the equivalent Standard price.'
},
diff --git a/frontend/src/i18n/locales/en/admin/settings.ts b/frontend/src/i18n/locales/en/admin/settings.ts
index 868097a92d..b3d3de35ac 100644
--- a/frontend/src/i18n/locales/en/admin/settings.ts
+++ b/frontend/src/i18n/locales/en/admin/settings.ts
@@ -460,8 +460,8 @@ export default {
'Duplicate subscription group: {groupId}. Each group can only appear once.',
subscriptionGroup: 'Subscription Group',
subscriptionValidityDays: 'Validity (days)',
- defaultPlatformQuotas: 'Default Platform Quotas (on signup)',
- defaultPlatformQuotasHint: 'Applied to new users on signup; existing users are not affected. Leave blank = no limit for that platform and window.',
+ defaultPlatformQuotas: 'Default Platform Quotas (on user creation)',
+ defaultPlatformQuotasHint: 'Applied to regular users created by an administrator or through signup; existing users are not affected. Leave blank = no limit for that platform and window.',
platformQuotaNotice: 'Monthly quota uses a 30-day rolling window, not a calendar month.',
},
platformQuota: {
@@ -576,7 +576,7 @@ export default {
cacheTTL5m: '5 minutes',
cacheTTL1h: '1 hour',
anthropicCacheTTL1hInjection: 'Anthropic Cache TTL Injection',
- anthropicCacheTTL1hInjectionHint: 'When enabled, existing ephemeral cache_control blocks in Anthropic OAuth/Setup Token request bodies are forced to 1h; response usage is billed back as 5m by default, with account-level TTL billing override taking priority.',
+ anthropicCacheTTL1hInjectionHint: 'When enabled, existing ephemeral cache_control blocks in Anthropic OAuth/Setup Token request bodies are forced to 1h, except Claude Code compaction requests, which use 5m; response usage is billed back as 5m by default, with account-level TTL billing override taking priority.',
rewriteMessageCacheControl: 'Rewrite Message Cache Breakpoints',
rewriteMessageCacheControlHint: 'Default off: preserve client cache_control on message content blocks. When enabled, client breakpoints are stripped and proxy breakpoints are injected for clients that do not manage caching themselves.',
clientDatelineNormalization: 'Client Dateline Normalization',
diff --git a/frontend/src/i18n/locales/en/dashboard.ts b/frontend/src/i18n/locales/en/dashboard.ts
index c7792ad476..5b41a4b239 100644
--- a/frontend/src/i18n/locales/en/dashboard.ts
+++ b/frontend/src/i18n/locales/en/dashboard.ts
@@ -679,6 +679,7 @@ export default {
},
table: {
model: 'Model',
+ copyModelId: 'Copy model ID {model}',
input: 'Input',
output: 'Output',
cache: 'Cache',
diff --git a/frontend/src/i18n/locales/zh/admin/accounts.ts b/frontend/src/i18n/locales/zh/admin/accounts.ts
index a3e16a3f38..a7640ffa8c 100644
--- a/frontend/src/i18n/locales/zh/admin/accounts.ts
+++ b/frontend/src/i18n/locales/zh/admin/accounts.ts
@@ -297,6 +297,8 @@ export default {
testConnection: '测试连接',
reAuthorize: '重新授权',
refreshToken: '刷新令牌',
+ refreshTokenHint: '系统已在后台自动刷新令牌,频繁手动刷新可能与自动刷新相互冲突,导致令牌失效、账号被暂停',
+ refreshTokenFrequentWarning: '距离上次手动刷新不足一分钟:频繁刷新可能与后台自动刷新冲突,导致令牌失效。如无必要请稍候再试。',
noAccountsYet: '暂无账号',
createFirstAccount: '添加 AI 平台账号以开始使用 API 网关。',
tokenRefreshed: 'Token 刷新成功',
diff --git a/frontend/src/i18n/locales/zh/admin/channels.ts b/frontend/src/i18n/locales/zh/admin/channels.ts
index 236e6ba54a..3e7bc09d33 100644
--- a/frontend/src/i18n/locales/zh/admin/channels.ts
+++ b/frontend/src/i18n/locales/zh/admin/channels.ts
@@ -150,6 +150,7 @@ export default {
pricePlaceholder: '默认',
fastMultiplier: 'Fast 倍率',
flexMultiplier: 'Flex 倍率',
+ ultrafastMultiplier: 'Ultra Fast 倍率',
reasoningEffortMultipliers: '自定义思考等级倍率(可选)',
reasoningEffortMultipliersHint: '按请求最终转发的思考等级,对整次请求的费用与额度消耗应用对应倍率。未配置的等级按 1 倍计费,可与其他计费倍率叠加。',
reasoningEffortMultiplierLabel: '{effort} 思考等级倍率',
diff --git a/frontend/src/i18n/locales/zh/admin/overview.ts b/frontend/src/i18n/locales/zh/admin/overview.ts
index e8c34f2ce2..5386e7c5a7 100644
--- a/frontend/src/i18n/locales/zh/admin/overview.ts
+++ b/frontend/src/i18n/locales/zh/admin/overview.ts
@@ -1272,7 +1272,7 @@ export default {
force: '强制使用 Fast(priority)',
hint: '开启后,此分组的 OpenAI 请求会强制写入 service_tier=priority;全局 Fast/Flex 策略仍可过滤或拦截。保存后新请求立即生效,已建立的 WebSocket 会话需重连。',
forceUltrafast: '强制使用 Ultra Fast(ultrafast)',
- ultrafastHint: '开启后,仅对支持 Ultra Fast 的模型(GPT-6 Astra、GPT-6.1 Sol)强制写入 service_tier=ultrafast,优先于"强制使用 Fast";其他模型在同时开启"强制使用 Fast"时写入 priority,否则跟随客户端。Ultra Fast 按标准价 6 倍计费,不受"免费 Fast"影响,且需要上游账号具备 Ultra Fast 权限。',
+ ultrafastHint: '对支持的模型强制使用 Ultra Fast(service_tier=ultrafast)。GPT-6.2 订阅档位按套餐补全:Pro 200 支持 Sol,Pro 500 支持 Sol 和 Astra;其他账号使用其目录明确提供的档位。不可用时,若同时开启强制 Fast 则使用 Fast,否则跟随客户端。6.2 Sol 和 Astra 在太平洋时间 2027 年 2 月 28 日及之前按标准价 3 倍计费,之后为 6 倍。GPT-6 Astra 和 GPT-6.1 Sol 为 6 倍。免费 Fast 不包含 Ultra Fast。',
free: '免费 Fast',
freeHint: '该分组的 Fast 请求仍使用 priority 档位,但客户实际费用按同一请求的 Standard 价格计算。'
},
diff --git a/frontend/src/i18n/locales/zh/admin/settings.ts b/frontend/src/i18n/locales/zh/admin/settings.ts
index 31c2dba3f3..085c74e8da 100644
--- a/frontend/src/i18n/locales/zh/admin/settings.ts
+++ b/frontend/src/i18n/locales/zh/admin/settings.ts
@@ -455,8 +455,8 @@ export default {
defaultSubscriptionsDuplicate: '默认订阅存在重复分组:{groupId}。每个分组只能出现一次。',
subscriptionGroup: '订阅分组',
subscriptionValidityDays: '有效期(天)',
- defaultPlatformQuotas: '默认平台限额(注册时分配)',
- defaultPlatformQuotasHint: '新用户注册时自动获得这里配置的限额;已有用户不受影响。留空 = 该平台该窗口不限制。',
+ defaultPlatformQuotas: '默认平台限额(创建用户时分配)',
+ defaultPlatformQuotasHint: '后台创建或自行注册的普通用户会自动获得这里配置的限额;已有用户不受影响。留空 = 该平台该窗口不限制。',
platformQuotaNotice: '月限额为 30 天滚动窗口,非自然月',
},
platformQuota: {
@@ -569,7 +569,7 @@ export default {
cacheTTL5m: '5 分钟',
cacheTTL1h: '1 小时',
anthropicCacheTTL1hInjection: 'Anthropic 缓存 TTL 注入',
- anthropicCacheTTL1hInjectionHint: '开启后,对 Anthropic OAuth/Setup Token 请求体中已有的 ephemeral 缓存块强制写入 1h;响应 usage 默认按 5m 回写计费,账号级 TTL 计费设置优先。',
+ anthropicCacheTTL1hInjectionHint: '开启后,对 Anthropic OAuth/Setup Token 请求体中已有的 ephemeral 缓存块强制写入 1h,Claude Code 压缩请求除外,写入 5m;响应 usage 默认按 5m 回写计费,账号级 TTL 计费设置优先。',
rewriteMessageCacheControl: '改写消息缓存断点',
rewriteMessageCacheControlHint: '默认关闭,保留客户端在 messages 内容块中的 cache_control。开启后会清除客户端断点并注入代理断点,适合不自行管理缓存策略的客户端。',
clientDatelineNormalization: '客户端 dateline 归一化',
diff --git a/frontend/src/i18n/locales/zh/dashboard.ts b/frontend/src/i18n/locales/zh/dashboard.ts
index 6b18eab4ce..4bbd070fa8 100644
--- a/frontend/src/i18n/locales/zh/dashboard.ts
+++ b/frontend/src/i18n/locales/zh/dashboard.ts
@@ -684,6 +684,7 @@ export default {
},
table: {
model: '模型',
+ copyModelId: '复制模型 ID {model}',
input: '输入',
output: '输出',
cache: '缓存',
diff --git a/frontend/src/utils/__tests__/accountUsageRefresh.spec.ts b/frontend/src/utils/__tests__/accountUsageRefresh.spec.ts
index f9559697e1..f2d21a4212 100644
--- a/frontend/src/utils/__tests__/accountUsageRefresh.spec.ts
+++ b/frontend/src/utils/__tests__/accountUsageRefresh.spec.ts
@@ -1,5 +1,30 @@
import { describe, expect, it } from 'vitest'
-import { buildGrokUsageRefreshKey, buildOpenAIUsageRefreshKey } from '../accountUsageRefresh'
+import { buildAccountUsageRefreshKey, buildGrokUsageRefreshKey, buildOpenAIUsageRefreshKey } from '../accountUsageRefresh'
+
+describe('buildAccountUsageRefreshKey', () => {
+ it.each(['oauth', 'setup-token'])('tracks every Claude %s passive snapshot input', (type) => {
+ const base = { id: 1, platform: 'anthropic', type, extra: {} } as any
+ for (const field of ['last_used_at', 'session_window_start', 'session_window_end', 'session_window_status']) {
+ expect(buildAccountUsageRefreshKey({ ...base, [field]: 'new' })).not.toBe(buildAccountUsageRefreshKey(base))
+ }
+ for (const field of ['session_window_utilization', 'passive_usage_sampled_at', 'passive_usage_7d_utilization', 'passive_usage_7d_reset', 'passive_usage_7d_oi_utilization', 'passive_usage_7d_oi_reset']) {
+ expect(buildAccountUsageRefreshKey({ ...base, extra: { [field]: 1 } })).not.toBe(buildAccountUsageRefreshKey(base))
+ }
+ })
+
+ it.each(['anthropic', 'gemini'])('ignores unrelated %s changes and extra key ordering', (platform) => {
+ const base = { id: 1, platform, type: 'oauth', extra: { session_window_utilization: 0, other: 1 } } as any
+ expect(buildAccountUsageRefreshKey({ ...base, updated_at: 'new', current_concurrency: 5, extra: { other: 2, session_window_utilization: 0 } } as any)).toBe(buildAccountUsageRefreshKey(base))
+ expect(buildAccountUsageRefreshKey({ ...base, last_used_at: 'new' })).not.toBe(buildAccountUsageRefreshKey(base))
+ })
+
+ it('retains OpenAI keys and excludes unsupported platforms/types', () => {
+ const base = { id: 1, platform: 'openai', type: 'oauth', extra: {} } as any
+ expect(buildAccountUsageRefreshKey(base)).toBe(buildOpenAIUsageRefreshKey(base))
+ expect(buildAccountUsageRefreshKey({ ...base, platform: 'anthropic', type: 'apikey' })).toBe('')
+ expect(buildAccountUsageRefreshKey({ ...base, platform: 'antigravity' })).toBe('')
+ })
+})
describe('buildOpenAIUsageRefreshKey', () => {
it('会在 codex 快照变化时生成不同 key', () => {
diff --git a/frontend/src/utils/accountUsageRefresh.ts b/frontend/src/utils/accountUsageRefresh.ts
index 121dae253a..4d64ee7899 100644
--- a/frontend/src/utils/accountUsageRefresh.ts
+++ b/frontend/src/utils/accountUsageRefresh.ts
@@ -69,3 +69,29 @@ export const buildGrokUsageRefreshKey = (account: Pick): string => {
+ if (account.platform === 'openai') return buildOpenAIUsageRefreshKey(account)
+
+ const isClaude = account.platform === 'anthropic' && (account.type === 'oauth' || account.type === 'setup-token')
+ if (!isClaude && account.platform !== 'gemini') return ''
+
+ const extra = account.extra ?? {}
+ return serializeSnapshotRefreshValue([
+ account.id,
+ account.platform,
+ account.type,
+ account.last_used_at ?? null,
+ account.session_window_start ?? null,
+ account.session_window_end ?? null,
+ ...(isClaude ? [
+ account.session_window_status ?? null,
+ extra.session_window_utilization ?? null,
+ extra.passive_usage_sampled_at ?? null,
+ extra.passive_usage_7d_utilization ?? null,
+ extra.passive_usage_7d_reset ?? null,
+ extra.passive_usage_7d_oi_utilization ?? null,
+ extra.passive_usage_7d_oi_reset ?? null
+ ] : [])
+ ])
+}
diff --git a/frontend/src/views/admin/AccountsView.vue b/frontend/src/views/admin/AccountsView.vue
index 7384e4858b..fc3bea8757 100644
--- a/frontend/src/views/admin/AccountsView.vue
+++ b/frontend/src/views/admin/AccountsView.vue
@@ -531,7 +531,7 @@ import Icon from '@/components/icons/Icon.vue'
import ErrorPassthroughRulesModal from '@/components/admin/ErrorPassthroughRulesModal.vue'
import TLSFingerprintProfilesModal from '@/components/admin/TLSFingerprintProfilesModal.vue'
import { fetchAllAccountIds } from '@/utils/accountSelection'
-import { buildGrokUsageRefreshKey, buildOpenAIUsageRefreshKey } from '@/utils/accountUsageRefresh'
+import { buildGrokUsageRefreshKey, buildAccountUsageRefreshKey } from '@/utils/accountUsageRefresh'
import { formatDateTime, formatRelativeTime } from '@/utils/format'
import { proxyExpiryBadgeClass, proxyExpiryLabelKey } from '@/utils/proxyExpiry'
import { extractApiErrorMessage } from '@/utils/apiError'
@@ -747,7 +747,7 @@ const usageBatchByAccountId = ref>({})
const usageBatchErrorByAccountId = ref>({})
const usageBatchLoadingByAccountId = ref>({})
const usageBatchRequestTokenByAccountId = ref>({})
-const usageBatchCache = new Map()
+const usageBatchCache = new Map()
const USAGE_BATCH_CACHE_TTL = 5 * 60 * 1000
const pendingUsageBatchIds = new Set()
let usageBatchFlushTimer: ReturnType | null = null
@@ -801,6 +801,7 @@ const flushQueuedUsageBatch = async () => {
usageBatchFlushTimer = null
const accountIDs = Array.from(pendingUsageBatchIds)
const force = queuedUsageBatchForce
+ const refreshKeys = new Map(accounts.value.map(account => [account.id, buildAccountUsageRefreshKey(account)]))
pendingUsageBatchIds.clear()
queuedUsageBatchForce = false
@@ -831,7 +832,7 @@ const flushQueuedUsageBatch = async () => {
nextErrors[key] = errorMap[key] ?? null
nextLoading[key] = false
if (usage) {
- usageBatchCache.set(accountID, { data: usage, ts: now })
+ usageBatchCache.set(accountID, { data: usage, ts: now, refreshKey: refreshKeys.get(accountID) ?? '' })
} else {
usageBatchCache.delete(accountID)
}
@@ -869,7 +870,7 @@ const queueBatchedUsage = (account: Account, options?: { force?: boolean }) => {
usageBatchCache.delete(cacheKey)
} else {
const cached = usageBatchCache.get(cacheKey)
- if (cached && Date.now() - cached.ts < USAGE_BATCH_CACHE_TTL) {
+ if (cached && cached.refreshKey === buildAccountUsageRefreshKey(account) && Date.now() - cached.ts < USAGE_BATCH_CACHE_TTL) {
setUsageBatchState(cacheKey, cached.data, null)
setUsageBatchLoading(cacheKey, false)
return
@@ -1435,7 +1436,7 @@ const shouldReplaceAutoRefreshRow = (current: Account, next: Account) => {
current.rate_limit_reset_at !== next.rate_limit_reset_at ||
current.overload_until !== next.overload_until ||
current.temp_unschedulable_until !== next.temp_unschedulable_until ||
- buildOpenAIUsageRefreshKey(current) !== buildOpenAIUsageRefreshKey(next) ||
+ buildAccountUsageRefreshKey(current) !== buildAccountUsageRefreshKey(next) ||
buildGrokUsageRefreshKey(current) !== buildGrokUsageRefreshKey(next)
)
}
@@ -2392,7 +2393,16 @@ const handleDuplicateAccount = async (a: Account) => {
duplicatingAccountIDs.delete(a.id)
}
}
+const lastManualRefreshAt = new Map()
+const MANUAL_REFRESH_WARN_INTERVAL_MS = 60_000
+
const handleRefresh = async (a: Account) => {
+ // 只提醒不阻拦:短时间内反复手动刷新可能与后台自动刷新竞争同一份轮换令牌
+ const lastAt = lastManualRefreshAt.get(a.id) ?? 0
+ if (Date.now() - lastAt < MANUAL_REFRESH_WARN_INTERVAL_MS) {
+ appStore.showWarning(t('admin.accounts.refreshTokenFrequentWarning'))
+ }
+ lastManualRefreshAt.set(a.id, Date.now())
try {
const result = await adminAPI.accounts.refreshCredentials(a.id)
patchAccountInList(result.account)
diff --git a/frontend/src/views/admin/ChannelsView.vue b/frontend/src/views/admin/ChannelsView.vue
index 3633f27267..c53bb78093 100644
--- a/frontend/src/views/admin/ChannelsView.vue
+++ b/frontend/src/views/admin/ChannelsView.vue
@@ -883,6 +883,7 @@ function addPricingEntry(sectionIdx: number) {
cache_read_price: null,
fast_multiplier: null,
flex_multiplier: null,
+ ultrafast_multiplier: null,
reasoning_effort_multipliers: null,
image_input_price: null,
image_output_price: null,
@@ -923,6 +924,7 @@ async function syncLatestModels(sectionIdx: number) {
cache_read_price: null,
fast_multiplier: null,
flex_multiplier: null,
+ ultrafast_multiplier: null,
reasoning_effort_multipliers: null,
image_input_price: null,
image_output_price: null,
@@ -1158,6 +1160,7 @@ function formToAPI(): { group_ids: number[], model_pricing: ChannelModelPricing[
cache_read_price: mTokToPerToken(entry.cache_read_price),
fast_multiplier: entry.fast_multiplier != null && entry.fast_multiplier !== '' ? Number(entry.fast_multiplier) : null,
flex_multiplier: entry.flex_multiplier != null && entry.flex_multiplier !== '' ? Number(entry.flex_multiplier) : null,
+ ultrafast_multiplier: entry.ultrafast_multiplier != null && entry.ultrafast_multiplier !== '' ? Number(entry.ultrafast_multiplier) : null,
reasoning_effort_multipliers: formReasoningEffortMultipliersToAPI(entry.reasoning_effort_multipliers),
image_input_price: mTokToPerToken(entry.image_input_price),
image_output_price: mTokToPerToken(entry.image_output_price),
@@ -1252,6 +1255,7 @@ function apiToForm(channel: Channel): PlatformSection[] {
cache_read_price: perTokenToMTok(p.cache_read_price),
fast_multiplier: p.fast_multiplier,
flex_multiplier: p.flex_multiplier,
+ ultrafast_multiplier: p.ultrafast_multiplier,
reasoning_effort_multipliers: p.reasoning_effort_multipliers ? { ...p.reasoning_effort_multipliers } : null,
image_input_price: perTokenToMTok(p.image_input_price),
image_output_price: perTokenToMTok(p.image_output_price),
@@ -1579,7 +1583,8 @@ async function handleSubmit() {
for (const section of form.platforms.filter(s => s.enabled)) {
for (const entry of section.model_pricing) {
if (!isValidPositiveMultiplier(entry.fast_multiplier) ||
- !isValidPositiveMultiplier(entry.flex_multiplier)) {
+ !isValidPositiveMultiplier(entry.flex_multiplier) ||
+ !isValidPositiveMultiplier(entry.ultrafast_multiplier)) {
const platformLabel = t('admin.groups.platforms.' + section.platform, catalogPlatformLabel(section.platform))
const modelLabel = entry.models.join(', ') || t('admin.channels.form.unnamed')
appStore.showError(`${platformLabel} - ${modelLabel}: ${t('admin.channels.form.multiplierPositive')}`)
diff --git a/frontend/src/views/admin/SettingsView.vue b/frontend/src/views/admin/SettingsView.vue
index 6e63f04232..0db478ce1d 100644
--- a/frontend/src/views/admin/SettingsView.vue
+++ b/frontend/src/views/admin/SettingsView.vue
@@ -5962,6 +5962,7 @@
:options="[
{ value: 'brave', label: 'Brave Search' },
{ value: 'tavily', label: 'Tavily' },
+ { value: 'exa', label: 'Exa' },
]"
class="w-36"
@click.stop
diff --git a/frontend/src/views/admin/__tests__/AccountsView.lite.spec.ts b/frontend/src/views/admin/__tests__/AccountsView.lite.spec.ts
index 9d8d7266e5..64115c43f5 100644
--- a/frontend/src/views/admin/__tests__/AccountsView.lite.spec.ts
+++ b/frontend/src/views/admin/__tests__/AccountsView.lite.spec.ts
@@ -10,6 +10,7 @@ const {
listWithEtag,
getById,
getBatchTodayStats,
+ getBatchUsage,
getUpstreamBillingProbeSettings,
getAllProxies,
getAllGroups,
@@ -21,6 +22,7 @@ const {
listWithEtag: vi.fn(),
getById: vi.fn(),
getBatchTodayStats: vi.fn(),
+ getBatchUsage: vi.fn(),
getUpstreamBillingProbeSettings: vi.fn(),
getAllProxies: vi.fn(),
getAllGroups: vi.fn(),
@@ -36,6 +38,7 @@ vi.mock('@/api/admin', () => ({
getById,
listWithEtag,
getBatchTodayStats,
+ getBatchUsage,
getUpstreamBillingProbeSettings,
delete: vi.fn(),
batchClearError: vi.fn(),
@@ -67,6 +70,7 @@ const DataTableStub = defineComponent({
@@ -93,7 +97,7 @@ const AccountStatsModalStub = defineComponent({
template: '{{ show ? account?.name : "" }} '
})
-function mountView(stubActionMenu = true) {
+function mountView(stubActionMenu = true, realUsageCell = false) {
return mount(AccountsView, {
attachTo: document.body,
global: {
@@ -124,7 +128,7 @@ function mountView(stubActionMenu = true) {
AccountStatusIndicator: true,
AccountTodayStatsCell: true,
AccountGroupsCell: AccountGroupsCellStub,
- AccountUsageCell: true,
+ AccountUsageCell: !realUsageCell,
UpstreamBillingRateCell: true,
HelpTooltip: true,
Icon: true,
@@ -163,6 +167,7 @@ describe('admin AccountsView lite account list', () => {
listWithEtag.mockReset().mockResolvedValue({ notModified: true, etag: 'compact-etag', data: null })
getById.mockReset().mockResolvedValue(fullAccount)
getBatchTodayStats.mockReset().mockResolvedValue({ stats: {} })
+ getBatchUsage.mockReset().mockResolvedValue({ usage: { '42': { five_hour: { utilization: 21 }, seven_day: { utilization: 31 } } }, errors: {} })
getUpstreamBillingProbeSettings.mockReset().mockResolvedValue({ enabled: true })
getAllProxies.mockReset().mockResolvedValue([])
getAllGroups.mockReset().mockResolvedValue([{ id: 7, name: 'codex', platform: 'openai' }])
@@ -176,6 +181,45 @@ describe('admin AccountsView lite account list', () => {
vi.restoreAllMocks()
})
+ it.each([
+ ['anthropic', 'oauth'], ['anthropic', 'setup-token'], ['gemini', 'oauth']
+ ])('updates %s %s usage on auto-refresh without force or unrelated probes', async (platform, type) => {
+ vi.useFakeTimers()
+ vi.spyOn(document, 'hidden', 'get').mockReturnValue(false)
+ vi.spyOn(window, 'matchMedia').mockImplementation(() => ({
+ matches: true, addEventListener: vi.fn(), removeEventListener: vi.fn()
+ }) as unknown as MediaQueryList)
+ localStorage.setItem('account-auto-refresh', JSON.stringify({ enabled: true, interval_seconds: 5 }))
+ const account = { ...listRow, platform, type }
+ listAccounts.mockResolvedValue({ items: [account], total: 1, page: 1, page_size: 20, pages: 1 })
+ const wrapper = mountView(true, true)
+ await flushPromises()
+ await vi.advanceTimersByTimeAsync(1)
+ await flushPromises()
+ expect(getBatchUsage).toHaveBeenCalledTimes(1)
+ expect(getBatchUsage).toHaveBeenCalledWith([42], false)
+
+ const next = { ...account, extra: { session_window_utilization: 0.44, passive_usage_7d_utilization: 0.54 }, last_used_at: platform === 'gemini' ? '2026-11-16T10:00:00Z' : null }
+ getBatchUsage.mockResolvedValue({ usage: { '42': { five_hour: { utilization: 44 }, seven_day: { utilization: 54 } } }, errors: {} })
+ listWithEtag.mockResolvedValue({ notModified: false, etag: 'new', data: { items: [next], total: 1, pages: 1 } })
+ await vi.advanceTimersByTimeAsync(6000)
+ await flushPromises()
+ expect(getBatchUsage).toHaveBeenCalledTimes(2)
+ expect(getBatchUsage).toHaveBeenLastCalledWith([42], false)
+ const cell = wrapper.findComponent({ name: 'AccountUsageCell' })
+ expect(cell.props('account').last_used_at).toBe(next.last_used_at)
+ expect(cell.props('batchedUsage').seven_day.utilization).toBe(54)
+ cell.props('requestBatchedUsage')(cell.props('account'))
+ await vi.advanceTimersByTimeAsync(1)
+ expect(getBatchUsage).toHaveBeenCalledTimes(2)
+
+ listWithEtag.mockResolvedValue({ notModified: false, etag: 'unrelated', data: { items: [{ ...next, updated_at: 'new', current_concurrency: 2, extra: { ...next.extra, unrelated: true } }], total: 1, pages: 1 } })
+ await vi.advanceTimersByTimeAsync(6000)
+ await flushPromises()
+ expect(getBatchUsage).toHaveBeenCalledTimes(2)
+ wrapper.unmount()
+ })
+
it('keeps lite=1 on the initial list request', async () => {
const wrapper = mountView()
await flushPromises()
diff --git a/frontend/src/views/admin/__tests__/ChannelsView.ultrafastPricing.spec.ts b/frontend/src/views/admin/__tests__/ChannelsView.ultrafastPricing.spec.ts
new file mode 100644
index 0000000000..e8b5cf2b8f
--- /dev/null
+++ b/frontend/src/views/admin/__tests__/ChannelsView.ultrafastPricing.spec.ts
@@ -0,0 +1,166 @@
+import { defineComponent } from 'vue'
+import { flushPromises, mount } from '@vue/test-utils'
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+import type { Channel, CreateChannelRequest, UpdateChannelRequest } from '@/api/admin/channels'
+import ChannelsView from '@/views/admin/ChannelsView.vue'
+import PricingEntryCard from '@/components/admin/channel/PricingEntryCard.vue'
+
+const { list, create, update, getGroups, showError } = vi.hoisted(() => ({
+ list: vi.fn(), create: vi.fn(), update: vi.fn(), getGroups: vi.fn(), showError: vi.fn()
+}))
+
+vi.mock('@/api/admin', () => ({
+ adminAPI: {
+ channels: { list, create, update },
+ groups: { getAll: getGroups },
+ settings: { getWebSearchEmulationConfig: vi.fn().mockResolvedValue({ enabled: false }) }
+ }
+}))
+vi.mock('@/api/admin/channels', () => ({
+ default: { getModelDefaultPricing: vi.fn().mockResolvedValue({ found: false }) }
+}))
+vi.mock('@/stores/app', () => ({ useAppStore: () => ({ showSuccess: vi.fn(), showError }) }))
+vi.mock('vue-i18n', async () => ({
+ ...await vi.importActual('vue-i18n'),
+ useI18n: () => ({ t: (key: string) => key })
+}))
+
+function mountView() {
+ return mount(ChannelsView, {
+ global: {
+ stubs: {
+ AppLayout: defineComponent({ template: '' }),
+ TablePageLayout: defineComponent({
+ template: ''
+ }),
+ BaseDialog: defineComponent({
+ props: ['show'], template: ''
+ }),
+ DataTable: defineComponent({
+ props: ['data'],
+ template: ' '
+ }),
+ Pagination: true, ConfirmDialog: true, EmptyState: true,
+ Select: true, Icon: true, PlatformIcon: true
+ }
+ }
+ })
+}
+
+type View = ReturnType
+
+async function clickButton(wrapper: View, text: string) {
+ const button = wrapper.findAll('button').find(button => button.text() === text)
+ expect(button).toBeDefined()
+ await button!.trigger('click')
+ await flushPromises()
+}
+
+function multiplierInput(wrapper: View) {
+ return wrapper.findAll('label')
+ .find(label => label.text() === 'admin.channels.form.ultrafastMultiplier')!
+ .element.parentElement!.querySelector('input')!
+}
+
+function makeChannel(): Channel {
+ return {
+ id: 1, name: 'Ultra Fast channel', description: '', status: 'active',
+ billing_model_source: 'channel_mapped', restrict_models: false,
+ features_config: {}, group_ids: [22], model_pricing: [], model_mapping: {},
+ apply_pricing_to_account_stats: false, account_stats_pricing_rules: [],
+ created_at: '2026-01-01T00:00:00Z', updated_at: '2026-01-01T00:00:00Z'
+ }
+}
+
+describe('ChannelsView Ultra Fast pricing', () => {
+ let stored: Channel[]
+
+ beforeEach(() => {
+ vi.clearAllMocks()
+ localStorage.clear()
+ stored = []
+ list.mockImplementation(async () => ({ items: stored, total: stored.length }))
+ getGroups.mockResolvedValue([{ id: 22, name: 'OpenAI group', platform: 'openai', rate_multiplier: 1 }])
+ create.mockImplementation(async (request: CreateChannelRequest) => {
+ stored = [{ ...makeChannel(), ...request } as Channel]
+ return stored[0]
+ })
+ update.mockImplementation(async (_id: number, request: UpdateChannelRequest) => {
+ stored = [{ ...stored[0], ...request } as Channel]
+ return stored[0]
+ })
+ })
+
+ async function createPricingForm() {
+ const wrapper = mountView()
+ await flushPromises()
+ await clickButton(wrapper, 'admin.channels.createChannel')
+ await wrapper.get('input[required]').setValue('Ultra Fast channel')
+ await wrapper.findAll('label').find(label => label.text() === 'admin.groups.platforms.openai')!
+ .get('input[type="checkbox"]').setValue(true)
+ await clickButton(wrapper, 'admin.groups.platforms.openai')
+ await wrapper.findAll('label').find(label => label.text().includes('OpenAI group'))!
+ .get('input[type="checkbox"]').setValue(true)
+ await wrapper.findAll('button').filter(button => button.text() === '+ common.add').at(-1)!.trigger('click')
+ await flushPromises()
+ const modelInput = wrapper.get('input[placeholder="admin.channels.form.modelsPlaceholder"]')
+ await modelInput.setValue('gpt-6-astra')
+ await modelInput.trigger('keydown', { key: 'Enter' })
+ await flushPromises()
+ return wrapper
+ }
+
+ async function setMultiplier(wrapper: View, value: string) {
+ multiplierInput(wrapper).value = value
+ multiplierInput(wrapper).dispatchEvent(new Event('input', { bubbles: true }))
+ await flushPromises()
+ }
+
+ it('persists, reopens, updates and clears the multiplier through the real pricing card', async () => {
+ const wrapper = await createPricingForm()
+ await setMultiplier(wrapper, '3')
+ await wrapper.get('#channel-form').trigger('submit')
+ await flushPromises()
+ expect(showError).not.toHaveBeenCalled()
+ expect(create).toHaveBeenCalledOnce()
+ expect(create.mock.calls[0][0].model_pricing[0].ultrafast_multiplier).toBe(3)
+
+ for (const [previous, next] of [['3', '1.25'], ['1.25', '']]) {
+ await clickButton(wrapper, 'common.edit')
+ await clickButton(wrapper, 'admin.groups.platforms.openai')
+ expect(multiplierInput(wrapper).value).toBe(previous)
+ await setMultiplier(wrapper, next)
+ await wrapper.get('#channel-form').trigger('submit')
+ await flushPromises()
+ expect(showError).not.toHaveBeenCalled()
+ expect(update.mock.lastCall![1].model_pricing[0].ultrafast_multiplier).toBe(next ? Number(next) : null)
+ }
+ await clickButton(wrapper, 'common.edit')
+ await clickButton(wrapper, 'admin.groups.platforms.openai')
+ expect(multiplierInput(wrapper).value).toBe('')
+ wrapper.unmount()
+ })
+
+ it.each(['0', '-1'])('rejects a non-positive multiplier %s before sending a request', async value => {
+ const wrapper = await createPricingForm()
+ await setMultiplier(wrapper, value)
+ await wrapper.get('#channel-form').trigger('submit')
+ await flushPromises()
+ expect(showError).toHaveBeenCalledWith(expect.stringContaining('admin.channels.form.multiplierPositive'))
+ expect(create).not.toHaveBeenCalled()
+ wrapper.unmount()
+ })
+
+ it('shows Ultra Fast only for OpenAI channel pricing', async () => {
+ const wrapper = await createPricingForm()
+ const entry = wrapper.findComponent(PricingEntryCard).props('entry')
+ for (const [platform, enabled, visible] of [
+ ['openai', true, true], ['anthropic', true, false], ['openai', false, false]
+ ] as const) {
+ const card = mount(PricingEntryCard, { props: { entry, platform, enableTierMultipliers: enabled } })
+ expect(card.text().includes('admin.channels.form.ultrafastMultiplier')).toBe(visible)
+ card.unmount()
+ }
+ wrapper.unmount()
+ })
+})
|