feat(usage): add GPT-6.2 list prices and distinguish Ultrafast requests

Use regular Ultrafast rates for Astra and Sol. Show a double bolt for Ultrafast requests and remove backgrounds from error origin icons.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Zyy
2026-11-18 10:55:09 +08:00
co-authored by Codex
parent 89b6d2256f
commit bb440a3cbb
11 changed files with 90 additions and 17 deletions
@@ -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")
@@ -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);
}
@@ -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",
@@ -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")),
+2 -1
View File
@@ -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;不能用文本输出单价替代图像输出单价。用量无法完整拆分时不估算
@@ -9,12 +9,22 @@ import UsageDetailPopover from '@/components/usage/UsageDetailPopover.vue'
import { usageBillingText } from './shared/presenter'
const props = defineProps<{
record: Pick<UsageListRecord, 'billing'>
record: Pick<UsageListRecord, 'billing'> & Partial<Pick<UsageListRecord, 'serviceTier'>>
}>()
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) }}
</span>
<div v-if="billing" class="flex items-center gap-1">
<div v-if="billing || speedMode" class="flex shrink-0 items-center gap-1">
<span
v-if="billing.serviceTierDisplay === 'Fast'"
class="inline-flex size-4 items-center justify-center rounded-full bg-z-warning-container text-z-warning-on-container"
:title="t('usage.billing.fastMode')"
v-if="speedMode"
class="inline-flex h-4 items-center rounded-full bg-z-warning-container px-0.5 text-z-warning-on-container"
:title="speedModeLabel"
role="img"
:aria-label="t('usage.billing.fastMode')"
:aria-label="speedModeLabel"
>
<Zap class="size-3" stroke-width="2.2" aria-hidden="true" />
<Zap v-if="speedMode === 'Ultrafast'" class="size-3" stroke-width="2.2" aria-hidden="true" />
</span>
<UsageDetailPopover
v-if="billing"
:title="billing.longContextBillingApplied ? t('usage.billing.longContextBillingDetails') : t('usage.billing.billingDetails')"
:trigger-label="billing.longContextBillingApplied ? t('usage.billing.viewLongContextBillingDetails') : t('usage.billing.viewCostDetails')"
:tone="billing.longContextBillingApplied ? 'warning' : 'primary'"
@@ -26,7 +26,7 @@ const outcome = computed(() => usageErrorTitle(props.record))
<div class="min-w-0 py-0.5">
<div class="flex min-w-0 items-center gap-2">
<span
class="inline-flex size-5 shrink-0 items-center justify-center rounded-z-sm"
class="inline-flex size-5 shrink-0 items-center justify-center"
:class="origin.className"
role="img"
:aria-label="origin.label"
@@ -24,22 +24,22 @@ export function usageErrorOrigin(record: Pick<UsageErrorFacts, 'errorOrigin'>) {
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'),
},
}
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -45,7 +45,7 @@
"cacheReadCost": "缓存读取费用",
"cacheWriteCost": "缓存写入费用",
"cacheWriteUnitPrice": "缓存写入单价",
"fastMode": "Fast 模式",
"speedMode": "{mode} 模式",
"longContextBillingDetails": "长上下文计费明细",
"billingDetails": "计费明细",
"viewLongContextBillingDetails": "查看长上下文计费明细",
+1 -1
View File
@@ -45,7 +45,7 @@
"cacheReadCost": "緩存讀取費用",
"cacheWriteCost": "緩存寫入費用",
"cacheWriteUnitPrice": "緩存寫入單價",
"fastMode": "Fast 模式",
"speedMode": "{mode} 模式",
"longContextBillingDetails": "長上下文計費明細",
"billingDetails": "計費明細",
"viewLongContextBillingDetails": "查看長上下文計費明細",