mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
Preserve native USD amounts in thread usage responses (#50442)
## What changed Add optional `native_usage_usd_micros` fields to thread usage totals and breakdown groups, and carry backend values through the client alongside existing credit and USD estimates. Missing or null native amounts remain `None`, while explicit zero amounts remain `Some(0)`. ## Testing Add coverage for native totals and group amounts, mixed batches with legacy responses, and the distinction between missing, null, and zero native group amounts. GitOrigin-RevId: 53891fc95807138e2eccb99d4cda1520b857dba4
This commit is contained in:
@@ -36,6 +36,7 @@ async fn incomplete_chat_batches_retain_available_estimates_without_inventing_ze
|
||||
thread_id: "available".into(),
|
||||
estimated_usage_credits_micros: 1250000,
|
||||
estimated_usage_usd_micros: None,
|
||||
native_usage_usd_micros: None,
|
||||
groups: Vec::new(),
|
||||
}]
|
||||
);
|
||||
|
||||
@@ -158,11 +158,13 @@ pub(super) fn chats() -> super::chats::Chats {
|
||||
thread_id: format!("test-{index}"),
|
||||
estimated_usage_credits_micros: credits * 1_000_000,
|
||||
estimated_usage_usd_micros: None,
|
||||
native_usage_usd_micros: None,
|
||||
groups: vec![ThreadUsageBreakdownGroup {
|
||||
model: Some("GPT-5.6-Sol".into()),
|
||||
reasoning_effort: Some("high".into()),
|
||||
speed: Some("standard".into()),
|
||||
estimated_usage_credits_micros: credits * 1_000_000,
|
||||
native_usage_usd_micros: None,
|
||||
net_new_input_tokens: None,
|
||||
cached_input_tokens: None,
|
||||
input_tokens: None,
|
||||
|
||||
Reference in New Issue
Block a user