From 79c10414474b8834999ac3cceec9baf3cf9b1f9e Mon Sep 17 00:00:00 2001 From: Tyler South Date: Mon, 7 Sep 2026 10:41:39 -0400 Subject: [PATCH] Add GPT-6 Astra pricing --- rust/src/core/cost_pricing.rs | 18 +++++++++++++++++ rust/src/core/cost_pricing_tests.rs | 30 +++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/rust/src/core/cost_pricing.rs b/rust/src/core/cost_pricing.rs index bd202496..0e397584 100755 --- a/rust/src/core/cost_pricing.rs +++ b/rust/src/core/cost_pricing.rs @@ -342,6 +342,20 @@ static CODEX_PRICING: LazyLock> = LazyLock:: }, ); + // GPT-6 Astra standard rates. Codex usage of Astra does not incur the + // >272K long-context multipliers and Codex does not charge cache writes, + // so the short-context rates apply at every context size. + m.insert( + "gpt-6-astra", + CodexPricing { + input_cost_per_token: 1e-5, + output_cost_per_token: 5e-5, + cache_read_input_cost_per_token: 1e-6, + display_label: None, + long_context: None, + }, + ); + m }); @@ -669,6 +683,10 @@ impl CostUsagePricing { return "gpt-5.6-sol".to_string(); } + if trimmed == "gpt-6" { + return "gpt-6-astra".to_string(); + } + trimmed } diff --git a/rust/src/core/cost_pricing_tests.rs b/rust/src/core/cost_pricing_tests.rs index 7a43b6f3..0565ad6d 100644 --- a/rust/src/core/cost_pricing_tests.rs +++ b/rust/src/core/cost_pricing_tests.rs @@ -310,6 +310,36 @@ fn test_normalize_codex_model() { ); } +#[test] +fn gpt_6_astra_normalizes_variants_and_prices_published_rates() { + assert_eq!( + CostUsagePricing::normalize_codex_model("gpt-6-astra"), + "gpt-6-astra" + ); + assert_eq!( + CostUsagePricing::normalize_codex_model("gpt-6-astra-2026-09-04"), + "gpt-6-astra" + ); + assert_eq!( + CostUsagePricing::normalize_codex_model("gpt-6-astra-codex"), + "gpt-6-astra" + ); + assert_eq!( + CostUsagePricing::normalize_codex_model("gpt-6"), + "gpt-6-astra" + ); + + // Standard API rates: $10 input / $1 cached input / $50 output per 1M. + let full = CostUsagePricing::codex_cost_usd("gpt-6-astra", 1_000_000, 0, 1_000_000); + assert_close(full.unwrap(), 60.0); + let half_cached = CostUsagePricing::codex_cost_usd("gpt-6-astra", 2_000_000, 1_000_000, 0); + assert_close(half_cached.unwrap(), 11.0); + + // Codex does not apply Astra long-context multipliers above 272K. + let long_input = CostUsagePricing::codex_cost_usd("gpt-6-astra", 300_000, 0, 0); + assert_close(long_input.unwrap(), 3.0); +} + #[test] fn codex_variant_pricing_entries_are_not_collapsed_to_the_base_model() { for model in ["gpt-5.1-codex-max", "gpt-5.1-codex-mini"] {