diff --git a/backend/crates/providers/openai/src/transport/usage.rs b/backend/crates/providers/openai/src/transport/usage.rs index 72584b502..1aca5fb74 100644 --- a/backend/crates/providers/openai/src/transport/usage.rs +++ b/backend/crates/providers/openai/src/transport/usage.rs @@ -251,6 +251,27 @@ struct PricingRule { // 已按 https://developers.openai.com/api/docs/deprecations 核验至 2026-09-13, // 移除已关闭的型号;仅宣布弃用但尚未到关闭日期的型号继续保留 const PRICING_RULES: &[PricingRule] = &[ + // GPT-6.2 的 Ultrafast 使用官方价目表中的 6 倍常规价,核验日期 2026-11-18 + PricingRule { + model: "gpt-6.2-astra", + pricing: ModelPricing::new(80_000, 400_000, 4_000) + .with_cache_write(125) + .with_fast(160_000, 800_000, 8_000) + .with_ultrafast(480_000, 2_400_000, 24_000) + .with_long(160_000, 600_000, 8_000) + .with_long_fast(320_000, 1_200_000, 16_000) + .with_long_ultrafast(960_000, 3_600_000, 48_000), + }, + PricingRule { + model: "gpt-6.2-sol", + pricing: ModelPricing::new(20_000, 100_000, 1_000) + .with_cache_write(125) + .with_fast(40_000, 200_000, 2_000) + .with_ultrafast(120_000, 600_000, 6_000) + .with_long(40_000, 150_000, 2_000) + .with_long_fast(80_000, 300_000, 4_000) + .with_long_ultrafast(240_000, 900_000, 12_000), + }, // Astra:https://developers.openai.com/api/docs/models/gpt-6-astra // 已于 2026-09-09 对照官方价目表核验 PricingRule { @@ -924,7 +945,13 @@ fn reasoning_model(model: &str) -> bool { model.starts_with("gpt-5") || matches!( model, - "gpt-6-astra" | "gpt-6.1-sol" | "gpt-6.1-terra" | "gpt-6-sol" | "gpt-6-luna" + "gpt-6.2-astra" + | "gpt-6.2-sol" + | "gpt-6-astra" + | "gpt-6.1-sol" + | "gpt-6.1-terra" + | "gpt-6-sol" + | "gpt-6-luna" ) || model.starts_with("o1") || model.starts_with("o3") diff --git a/backend/crates/providers/openai/tests/admin/mod.rs b/backend/crates/providers/openai/tests/admin/mod.rs index ca2918f25..bd99783e1 100644 --- a/backend/crates/providers/openai/tests/admin/mod.rs +++ b/backend/crates/providers/openai/tests/admin/mod.rs @@ -523,13 +523,18 @@ async fn copying_builtin_prices_keeps_cache_read_and_write_fallback_costs() { for model in [ "gpt-4", "gpt-4o", + "gpt-6.2-astra", + "gpt-6.2-sol", "gpt-6-astra", "gpt-6.1-sol", "gpt-6.1-terra", "gpt-6-sol", "gpt-6-luna", ] { - let ultrafast_supported = matches!(model, "gpt-6-astra" | "gpt-6.1-sol"); + let ultrafast_supported = matches!( + model, + "gpt-6.2-astra" | "gpt-6.2-sol" | "gpt-6-astra" | "gpt-6.1-sol" + ); for band in ["ultrafast", "long_ultrafast"] { assert_eq!(prices[model].bands.contains_key(band), ultrafast_supported); } diff --git a/backend/crates/providers/openai/tests/transport/canonical.rs b/backend/crates/providers/openai/tests/transport/canonical.rs index 9e8bcdb4c..416869cf0 100644 --- a/backend/crates/providers/openai/tests/transport/canonical.rs +++ b/backend/crates/providers/openai/tests/transport/canonical.rs @@ -546,6 +546,8 @@ fn decoder_should_use_non_reasoning_preview_web_search_price() { fn gpt_6_decoders_should_use_reasoning_preview_web_search_price() { let tools = vec![json!({ "type": "web_search_preview" })]; for model in [ + "gpt-6.2-astra", + "gpt-6.2-sol", "gpt-6-astra", "gpt-6.1-sol", "gpt-6.1-terra", diff --git a/backend/crates/providers/openai/tests/transport/usage.rs b/backend/crates/providers/openai/tests/transport/usage.rs index 493d679ad..d44ae490e 100644 --- a/backend/crates/providers/openai/tests/transport/usage.rs +++ b/backend/crates/providers/openai/tests/transport/usage.rs @@ -82,6 +82,28 @@ fn astra_billing_should_preserve_components_across_tiers_and_context_boundary() fn gpt_6_models_should_use_published_prices_across_tiers_and_context_boundary() { // 每档依次核对每百万 Token 的输入、缓存读取、缓存写入和输出价格 for (model, cases) in [ + ( + "gpt-6.2-astra", + [ + (None, 272_000, ["8", "0.4", "10", "40"]), + (None, 272_001, ["16", "0.8", "20", "60"]), + (Some("fast"), 272_000, ["16", "0.8", "20", "80"]), + (Some("priority"), 272_001, ["32", "1.6", "40", "120"]), + (Some("ultrafast"), 272_000, ["48", "2.4", "60", "240"]), + (Some("ultrafast"), 272_001, ["96", "4.8", "120", "360"]), + ], + ), + ( + "gpt-6.2-sol", + [ + (None, 272_000, ["2", "0.1", "2.5", "10"]), + (None, 272_001, ["4", "0.2", "5", "15"]), + (Some("fast"), 272_000, ["4", "0.2", "5", "20"]), + (Some("priority"), 272_001, ["8", "0.4", "10", "30"]), + (Some("ultrafast"), 272_000, ["12", "0.6", "15", "60"]), + (Some("ultrafast"), 272_001, ["24", "1.2", "30", "90"]), + ], + ), ( "gpt-6.1-sol", [ @@ -457,6 +479,10 @@ fn billing_should_not_inherit_prices_for_unknown_models_or_tiers() { ("gpt-5.5-cyber", 272_001, None), ("gpt-5.6-cyber", 1, Some("fast")), ("gpt-5.3-codex", 1, Some("flex")), + ("gpt-6.2-astra", 1, Some("flex")), + ("gpt-6.2-astra", 272_001, Some("flex")), + ("gpt-6.2-sol", 1, Some("flex")), + ("gpt-6.2-sol", 272_001, Some("flex")), ("gpt-6-astra", 1, Some("auto")), ("gpt-6-astra", 1, Some("future")), ("gpt-6.1-terra", 1, Some("ultrafast")), diff --git a/docs/api.md b/docs/api.md index 948ea1a63..d9e58dca3 100644 --- a/docs/api.md +++ b/docs/api.md @@ -2420,7 +2420,8 @@ Token,范围 0~1000000、最多四位小数。`"0"` 表示免费,缺少整 `bands` 可用键为 `standard`、`fast`、`ultrafast`、`flex`、`long_standard`、`long_fast`、`long_ultrafast`、`long_flex`、`image`。 OpenAI 长上下文为输入超过 272000 Token,xAI 为输入达到 200000 Token;仍按 Provider 支持的 -模型与服务档位判断是否能估算。OpenAI 内置 Ultrafast 价目覆盖 `gpt-6-astra` 与 `gpt-6.1-sol`。 +模型与服务档位判断是否能估算。OpenAI 内置 Ultrafast 价目覆盖 `gpt-6-astra`、`gpt-6.1-sol`、 +`gpt-6.2-astra` 和 `gpt-6.2-sol`,均按对应上下文标准价的 6 倍估算。 xAI 不接受 `flex`、`long_flex`、`ultrafast`、`long_ultrafast`、`image`。图像端点的 `standard` 用于文本输入,`image` 用于图像 Token;不能用文本输出单价替代图像输出单价。用量无法完整拆分时不估算 diff --git a/frontend/src/components/usage/UsageBillingCell.vue b/frontend/src/components/usage/UsageBillingCell.vue index 5b6623483..8aad69d64 100644 --- a/frontend/src/components/usage/UsageBillingCell.vue +++ b/frontend/src/components/usage/UsageBillingCell.vue @@ -9,12 +9,22 @@ import UsageDetailPopover from '@/components/usage/UsageDetailPopover.vue' import { usageBillingText } from './shared/presenter' const props = defineProps<{ - record: Pick + record: Pick & Partial> }>() const { t } = useI18n({ useScope: 'global' }) const billing = computed(() => props.record.billing) +const speedMode = computed(() => { + const tier = props.record.serviceTier ?? billing.value?.serviceTierDisplay.toLowerCase() + if (tier === 'fast' || tier === 'priority') + return 'Fast' + if (tier === 'ultrafast') + return 'Ultrafast' + return null +}) +const speedModeLabel = computed(() => t('usage.billing.speedMode', { mode: speedMode.value })) + const billingItems = computed(() => { const value = billing.value if (!value) @@ -137,17 +147,19 @@ function itemValueClass(tone?: string, accent?: boolean) { {{ usageBillingText(record) }} -
+
usageErrorTitle(props.record))
) { const origins = { proxy: { label: t('usage.error.origin.proxy'), - className: 'bg-z-blue-container text-z-blue-on-container', + className: 'text-z-blue-text', hint: null, }, upstream: { label: t('usage.error.origin.upstream'), - className: 'bg-z-error-container text-z-error-on-container', + className: 'text-z-error-text', hint: null, }, connection: { label: t('usage.error.origin.connection'), - className: 'bg-z-warning-container text-z-warning-on-container', + className: 'text-z-warning-text', hint: t('usage.error.origin.connectionHint'), }, unknown: { label: t('usage.error.origin.unknown'), - className: 'bg-z-fill-tertiary text-z-text-secondary', + className: 'text-z-text-secondary', hint: t('usage.error.origin.unknownHint'), }, } diff --git a/frontend/src/i18n/locales/en/usage.json b/frontend/src/i18n/locales/en/usage.json index 88ebda2e7..dad774284 100644 --- a/frontend/src/i18n/locales/en/usage.json +++ b/frontend/src/i18n/locales/en/usage.json @@ -45,7 +45,7 @@ "cacheReadCost": "Cache read cost", "cacheWriteCost": "Cache write cost", "cacheWriteUnitPrice": "Cache write unit price", - "fastMode": "Fast mode", + "speedMode": "{mode} mode", "longContextBillingDetails": "Long-context cost details", "billingDetails": "Cost details", "viewLongContextBillingDetails": "View long-context cost details", diff --git a/frontend/src/i18n/locales/zh-Hans/usage.json b/frontend/src/i18n/locales/zh-Hans/usage.json index fa426c7c4..201ac6304 100644 --- a/frontend/src/i18n/locales/zh-Hans/usage.json +++ b/frontend/src/i18n/locales/zh-Hans/usage.json @@ -45,7 +45,7 @@ "cacheReadCost": "缓存读取费用", "cacheWriteCost": "缓存写入费用", "cacheWriteUnitPrice": "缓存写入单价", - "fastMode": "Fast 模式", + "speedMode": "{mode} 模式", "longContextBillingDetails": "长上下文计费明细", "billingDetails": "计费明细", "viewLongContextBillingDetails": "查看长上下文计费明细", diff --git a/frontend/src/i18n/locales/zh-Hant/usage.json b/frontend/src/i18n/locales/zh-Hant/usage.json index b486064a9..4c0f44afe 100644 --- a/frontend/src/i18n/locales/zh-Hant/usage.json +++ b/frontend/src/i18n/locales/zh-Hant/usage.json @@ -45,7 +45,7 @@ "cacheReadCost": "緩存讀取費用", "cacheWriteCost": "緩存寫入費用", "cacheWriteUnitPrice": "緩存寫入單價", - "fastMode": "Fast 模式", + "speedMode": "{mode} 模式", "longContextBillingDetails": "長上下文計費明細", "billingDetails": "計費明細", "viewLongContextBillingDetails": "查看長上下文計費明細",