Skip to content

Commit 385dd89

Browse files
ryoppippicktang88
andcommitted
fix(codex): apply GPT-6 Astra fast multiplier
Use the documented 2x Fast rate while preserving standard pricing, with core and adapter regression coverage. Co-authored-by: Kwuang Tang <[email protected]>
1 parent a4a31c3 commit 385dd89

4 files changed

Lines changed: 28 additions & 2 deletions

File tree

‎docs/guide/codex/index.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ By default, `ccusage codex` uses `--speed auto`. Codex CLI 0.144.0 and later can
6969

7070
Some usage remains unclassified, including older rollouts, saved headless `codex exec --json` output, and startup usage before the first persisted settings event. For only that unclassified portion, auto mode reads `config.toml` from each `CODEX_HOME` root and uses Fast when any root has `service_tier = "priority"` or legacy `service_tier = "fast"`; otherwise it uses Standard. An unsupported recorded tier is also left unclassified rather than inheriting a stale Fast value. Explicit `--speed fast` and `--speed standard` override all recorded and fallback tiers.
7171

72-
Fast pricing uses a model-specific multiplier only when one is published. GPT-5.6 Sol, Terra, and Luna use the [documented 2× API Priority rate](https://learn.chatgpt.com/docs/agent-configuration/speed#fast-mode). This is distinct from the 2.5× ChatGPT credit-consumption rate shown for GPT-5.6 Fast mode: ccusage's `costUSD` is an API-equivalent estimate, not a ChatGPT credit balance. When a model's Fast rate is unknown, ccusage reports standard pricing rather than assuming a multiplier, which may underestimate actual Fast usage.
72+
Fast pricing uses a model-specific multiplier only when one is published. GPT-5.6 Sol, Terra, and Luna use the [documented 2× API Priority rate](https://learn.chatgpt.com/docs/agent-configuration/speed#fast-mode), and GPT-6 Astra uses its [documented 2× Fast rate](https://developers.openai.com/api/docs/models/gpt-6-astra). This is distinct from the 2.5× ChatGPT credit-consumption rate shown for GPT-5.6 Fast mode: ccusage's `costUSD` is an API-equivalent estimate, not a ChatGPT credit balance. When a model's Fast rate is unknown, ccusage reports standard pricing rather than assuming a multiplier, which may underestimate actual Fast usage.
7373

7474
```bash
7575
# Default: use recorded tiers, then config.toml for unmarked usage

‎rust/adapters/codex/src/lib.rs‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,24 @@ mod tests {
509509
assert!((fast - (standard * 2.0)).abs() < f64::EPSILON);
510510
}
511511

512+
#[test]
513+
fn applies_gpt_6_astra_fast_multiplier_without_changing_standard_cost() {
514+
let pricing = PricingMap::load_embedded();
515+
let usage = CodexModelUsage {
516+
input_tokens: 1_000_000,
517+
cached_input_tokens: 1_000_000,
518+
total_tokens: 1_000_000,
519+
..CodexModelUsage::default()
520+
};
521+
522+
let standard =
523+
calculate_codex_model_cost("gpt-6-astra", &usage, &pricing, CodexSpeed::Standard);
524+
let fast = calculate_codex_model_cost("gpt-6-astra", &usage, &pricing, CodexSpeed::Fast);
525+
526+
assert!((standard - 1.0).abs() < f64::EPSILON);
527+
assert!((fast - 2.0).abs() < f64::EPSILON);
528+
}
529+
512530
#[test]
513531
fn uses_recorded_service_tiers_in_auto_mode() {
514532
let mut pricing = PricingMap::default();

‎rust/crates/ccusage-core/src/fast-multiplier-overrides.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"gpt-5.6-luna": 2.0,
66
"gpt-5.5": 2.5,
77
"gpt-5.4": 2.0,
8-
"gpt-5.3-codex": 2.0
8+
"gpt-5.3-codex": 2.0,
9+
"gpt-6-astra": 2.0
910
},
1011
"normalized_prefix": {
1112
"claude-opus-4-6": 6.0,

‎rust/crates/ccusage-core/src/pricing.rs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4679,6 +4679,7 @@ mod tests {
46794679
assert_eq!(pricing.find("gpt-5.5").unwrap().fast_multiplier, 2.5);
46804680
assert_eq!(pricing.find("gpt-5.4").unwrap().fast_multiplier, 2.0);
46814681
assert_eq!(pricing.find("gpt-5.3-codex").unwrap().fast_multiplier, 2.0);
4682+
assert_eq!(pricing.find("gpt-6-astra").unwrap().fast_multiplier, 2.0);
46824683
}
46834684

46844685
#[test]
@@ -4887,6 +4888,11 @@ mod tests {
48874888
"input_cost_per_token": 0.00000175,
48884889
"output_cost_per_token": 0.000014,
48894890
"cache_read_input_token_cost": 0.000000175
4891+
},
4892+
"gpt-6-astra": {
4893+
"input_cost_per_token": 0.000010,
4894+
"output_cost_per_token": 0.000050,
4895+
"cache_read_input_token_cost": 0.000001
48904896
}
48914897
}"#,
48924898
);
@@ -4895,6 +4901,7 @@ mod tests {
48954901
assert_eq!(pricing.find("gpt-5.4").unwrap().fast_multiplier, 2.0);
48964902
assert_eq!(pricing.find("gpt-5.3-codex").unwrap().fast_multiplier, 2.0);
48974903
assert_eq!(pricing.find("gpt-5.2-codex").unwrap().fast_multiplier, 1.0);
4904+
assert_eq!(pricing.find("gpt-6-astra").unwrap().fast_multiplier, 2.0);
48984905
}
48994906

49004907
#[test]

0 commit comments

Comments
 (0)