mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-06 16:06:08 +00:00
fix(openai): add built-in GPT-6.1 Sol pricing
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -228,7 +228,7 @@ struct PricingRule {
|
||||
|
||||
// 价格来源:https://developers.openai.com/api/docs/pricing。
|
||||
// 只登记已核验的常规价格及服务档位;临时优惠不写入内置价目。
|
||||
// 原有规则于 2026-09-09 核验,新增型号的核验日期见对应条目。
|
||||
// 原有规则于 2026-09-09 核验,GPT-6.1 Sol 于 2026-09-29 核验,其余新增型号见对应条目。
|
||||
// 已按 https://developers.openai.com/api/docs/deprecations 核验至 2026-09-13,
|
||||
// 移除已关闭的型号;仅宣布弃用但尚未到关闭日期的型号继续保留。
|
||||
const PRICING_RULES: &[PricingRule] = &[
|
||||
@@ -244,6 +244,16 @@ const PRICING_RULES: &[PricingRule] = &[
|
||||
.with_long_flex(100_000, 375_000, 10_000)
|
||||
.with_long_fast(400_000, 1_500_000, 40_000),
|
||||
},
|
||||
PricingRule {
|
||||
model: "gpt-6.1-sol",
|
||||
pricing: ModelPricing::new(20_000, 100_000, 1_000)
|
||||
.with_cache_write(125)
|
||||
.with_flex(10_000, 50_000, 500)
|
||||
.with_fast(40_000, 200_000, 2_000)
|
||||
.with_long(40_000, 150_000, 2_000)
|
||||
.with_long_flex(20_000, 75_000, 1_000)
|
||||
.with_long_fast(80_000, 300_000, 4_000),
|
||||
},
|
||||
// https://developers.openai.com/api/docs/models/gpt-6-sol,核验日期 2026-09-24。
|
||||
PricingRule {
|
||||
model: "gpt-6-sol",
|
||||
@@ -864,7 +874,10 @@ fn reasoning_model(model: &str) -> bool {
|
||||
let normalized = normalize_model_name(model);
|
||||
let model = pricing_model_name(&normalized);
|
||||
model.starts_with("gpt-5")
|
||||
|| matches!(model, "gpt-6-astra" | "gpt-6-sol" | "gpt-6-luna")
|
||||
|| matches!(
|
||||
model,
|
||||
"gpt-6-astra" | "gpt-6.1-sol" | "gpt-6-sol" | "gpt-6-luna"
|
||||
)
|
||||
|| model.starts_with("o1")
|
||||
|| model.starts_with("o3")
|
||||
|| model.starts_with("o4")
|
||||
|
||||
@@ -352,7 +352,14 @@ async fn copying_builtin_prices_keeps_cache_read_and_write_fallback_costs() {
|
||||
.await
|
||||
.unwrap();
|
||||
let prices = bundle.admin_provider().pricing_catalog();
|
||||
for model in ["gpt-4", "gpt-4o", "gpt-6-astra", "gpt-6-sol", "gpt-6-luna"] {
|
||||
for model in [
|
||||
"gpt-4",
|
||||
"gpt-4o",
|
||||
"gpt-6-astra",
|
||||
"gpt-6.1-sol",
|
||||
"gpt-6-sol",
|
||||
"gpt-6-luna",
|
||||
] {
|
||||
let usage = OpenAiBillingUsage::new(100, 10, 20, 15);
|
||||
let inherited = openai_billing_breakdown(model, usage, None).unwrap();
|
||||
let copied =
|
||||
|
||||
@@ -399,7 +399,7 @@ fn decoder_should_use_non_reasoning_preview_web_search_price() {
|
||||
#[test]
|
||||
fn gpt_6_decoders_should_use_reasoning_preview_web_search_price() {
|
||||
let tools = vec![json!({ "type": "web_search_preview" })];
|
||||
for model in ["gpt-6-astra", "gpt-6-sol", "gpt-6-luna"] {
|
||||
for model in ["gpt-6-astra", "gpt-6.1-sol", "gpt-6-sol", "gpt-6-luna"] {
|
||||
let created = json!({
|
||||
"type":"response.created",
|
||||
"response":{"id":"resp_preview_search_cost","model":model}
|
||||
|
||||
@@ -80,6 +80,17 @@ fn astra_billing_should_preserve_components_across_tiers_and_context_boundary()
|
||||
fn new_gpt_6_models_should_use_published_prices_across_tiers_and_context_boundary() {
|
||||
// 每档依次核对每百万 Token 的输入、缓存读取、缓存写入和输出价格。
|
||||
for (model, cases) in [
|
||||
(
|
||||
"gpt-6.1-sol",
|
||||
[
|
||||
(None, 272_000, ["2", "0.1", "2.5", "10"]),
|
||||
(None, 272_001, ["4", "0.2", "5", "15"]),
|
||||
(Some("flex"), 272_000, ["1", "0.05", "1.25", "5"]),
|
||||
(Some("flex"), 272_001, ["2", "0.1", "2.5", "7.5"]),
|
||||
(Some("fast"), 272_000, ["4", "0.2", "5", "20"]),
|
||||
(Some("priority"), 272_001, ["8", "0.4", "10", "30"]),
|
||||
],
|
||||
),
|
||||
(
|
||||
"gpt-6-sol",
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user