From 566ece873f13e191d82b87b93ba1f35b98aed67c Mon Sep 17 00:00:00 2001 From: merefield Date: Fri, 4 Sep 2026 20:04:31 +0100 Subject: [PATCH] FEAT: add GPT-6 Astra API pricing --- README.md | 6 ++-- internal/codex/benchmark.go | 3 +- internal/codex/benchmark_test.go | 49 ++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5e6b0616..63af5a06 100644 --- a/README.md +++ b/README.md @@ -476,7 +476,7 @@ hidden from Monitor; hiding presentation does not exclude their aggregate subscription impact from Quota views. The embedded rates come from the [official OpenAI API pricing page](https://developers.openai.com/api/docs/pricing) -and were retrieved on **2026-08-23**. +and were retrieved on **2026-09-04**. Every Quota presentation repeats that retrieval date and a terminal hyperlink to the source in its footer when the terminal is wide enough, matching the Benchmark view and making stale compiled pricing conspicuous wherever a priced @@ -1175,9 +1175,11 @@ release was built. Codexometer does not inherit or guess such a price. Pricing can change after a binary is released; consult the [official OpenAI API pricing page](https://developers.openai.com/api/docs/pricing) for current values. The rates compiled into this version were retrieved from -that page on **2026-08-23**; every pricing-bearing Quota or Benchmark footer +that page on **2026-09-04**; every pricing-bearing Quota or Benchmark footer displays both the retrieval date and a terminal hyperlink to the source when space permits, so stale embedded pricing is visible while interpreting results. +The maintained price table covers GPT-6 Astra, GPT-5.6 Sol, GPT-5.6 Terra, +GPT-5.6 Luna, GPT-5.5, GPT-5.4, GPT-5.4 Mini, and GPT-5.3 Codex. The figures are useful for comparing these particular observed trials, but they have important limitations: diff --git a/internal/codex/benchmark.go b/internal/codex/benchmark.go index 57360496..7d9f8da6 100644 --- a/internal/codex/benchmark.go +++ b/internal/codex/benchmark.go @@ -33,7 +33,7 @@ const ( // the published rates compiled into this release. Keep both in sync whenever // standardAPIPrices changes. StandardAPIPricingSourceURL = "https://developers.openai.com/api/docs/pricing" - StandardAPIPricingRetrievedOn = "2026-08-23" + StandardAPIPricingRetrievedOn = "2026-09-04" ) // BenchmarkUsage is the app-server token breakdown for one isolated turn. @@ -1609,6 +1609,7 @@ type apiPrice struct { } var standardAPIPrices = map[string]apiPrice{ + "gpt-6-astra": {input: 10.00, cached: 1.00, cacheWrite: 12.50, cacheWriteKnown: true, output: 50.00, longInput: 20.00, longCached: 2.00, longCacheWrite: 25.00, longOutput: 75.00, longKnown: true}, "gpt-5.6-sol": {input: 4.00, cached: 0.40, cacheWrite: 5.00, cacheWriteKnown: true, output: 20.00, longInput: 8.00, longCached: 0.80, longCacheWrite: 10.00, longOutput: 30.00, longKnown: true}, "gpt-5.6-terra": {input: 2.00, cached: 0.20, cacheWrite: 2.50, cacheWriteKnown: true, output: 12.00, longInput: 4.00, longCached: 0.40, longCacheWrite: 5.00, longOutput: 18.00, longKnown: true}, "gpt-5.6-luna": {input: 0.20, cached: 0.02, cacheWrite: 0.25, cacheWriteKnown: true, output: 1.20, longInput: 0.40, longCached: 0.04, longCacheWrite: 0.50, longOutput: 1.80, longKnown: true}, diff --git a/internal/codex/benchmark_test.go b/internal/codex/benchmark_test.go index bdf23b25..bf6f6542 100644 --- a/internal/codex/benchmark_test.go +++ b/internal/codex/benchmark_test.go @@ -1203,6 +1203,55 @@ func TestEstimateAPICostUsesCachedAndOutputRates(t *testing.T) { } } +func TestStandardAPIPricesMatchPublishedRates(t *testing.T) { + want := map[string]apiPrice{ + "gpt-6-astra": {input: 10.00, cached: 1.00, cacheWrite: 12.50, cacheWriteKnown: true, output: 50.00, longInput: 20.00, longCached: 2.00, longCacheWrite: 25.00, longOutput: 75.00, longKnown: true}, + "gpt-5.6-sol": {input: 4.00, cached: 0.40, cacheWrite: 5.00, cacheWriteKnown: true, output: 20.00, longInput: 8.00, longCached: 0.80, longCacheWrite: 10.00, longOutput: 30.00, longKnown: true}, + "gpt-5.6-terra": {input: 2.00, cached: 0.20, cacheWrite: 2.50, cacheWriteKnown: true, output: 12.00, longInput: 4.00, longCached: 0.40, longCacheWrite: 5.00, longOutput: 18.00, longKnown: true}, + "gpt-5.6-luna": {input: 0.20, cached: 0.02, cacheWrite: 0.25, cacheWriteKnown: true, output: 1.20, longInput: 0.40, longCached: 0.04, longCacheWrite: 0.50, longOutput: 1.80, longKnown: true}, + "gpt-5.5": {input: 5.00, cached: 0.50, output: 30.00, longInput: 10.00, longCached: 1.00, longOutput: 45.00, longKnown: true}, + "gpt-5.4": {input: 2.50, cached: 0.25, output: 15.00, longInput: 5.00, longCached: 0.50, longOutput: 22.50, longKnown: true}, + "gpt-5.4-mini": {input: 0.75, cached: 0.075, output: 4.50}, + "gpt-5.3-codex": {input: 1.75, cached: 0.175, output: 14.00}, + } + + if len(standardAPIPrices) != len(want) { + t.Fatalf("maintained price count = %d, want %d", len(standardAPIPrices), len(want)) + } + for model, wantPrice := range want { + got, ok := standardAPIPrices[model] + if !ok { + t.Errorf("maintained prices are missing %s", model) + continue + } + if got != wantPrice { + t.Errorf("%s price = %#v, want %#v", model, got, wantPrice) + } + } +} + +func TestEstimateAPICostUsesGPT6AstraShortAndLongContextRates(t *testing.T) { + shortUsage := BenchmarkUsage{ + InputTokens: 2_000, CachedInputTokens: 500, CacheWriteInputTokens: 100, + OutputTokens: 300, TotalTokens: 2_300, + } + shortCost, known, issue := EstimateStandardAPIEqCost("gpt-6-astra", shortUsage) + wantShort := (1_400*10.00 + 500*1.00 + 100*12.50 + 300*50.00) / 1_000_000.0 + if !known || issue != "" || math.Abs(shortCost-wantShort) > 1e-12 { + t.Fatalf("Astra short-context cost = %f, %v, %q; want %f", shortCost, known, issue, wantShort) + } + + longUsage := BenchmarkUsage{ + InputTokens: 300_000, CachedInputTokens: 100_000, CacheWriteInputTokens: 20_000, + OutputTokens: 10_000, TotalTokens: 310_000, + } + longCost, known, issue := EstimateStandardAPIEqCost("gpt-6-astra", longUsage) + wantLong := (180_000*20.00 + 100_000*2.00 + 20_000*25.00 + 10_000*75.00) / 1_000_000.0 + if !known || issue != "" || math.Abs(longCost-wantLong) > 1e-12 { + t.Fatalf("Astra long-context cost = %f, %v, %q; want %f", longCost, known, issue, wantLong) + } +} + func TestEstimateAPICostUsesPublishedLongContextRates(t *testing.T) { usage := BenchmarkUsage{ InputTokens: 300_000, CachedInputTokens: 100_000, CacheWriteInputTokens: 20_000,