diff --git a/crates/switchyard-translation/src/codecs/openai_chat/buffered.rs b/crates/switchyard-translation/src/codecs/openai_chat/buffered.rs index 0dc0641625..4e00f5d0a6 100644 --- a/crates/switchyard-translation/src/codecs/openai_chat/buffered.rs +++ b/crates/switchyard-translation/src/codecs/openai_chat/buffered.rs @@ -1292,7 +1292,7 @@ pub(crate) fn encode_openai_usage(usage: &Usage) -> Value { if usage.cached_input_tokens().is_some() || usage.cache_creation_input_tokens().is_some() { value["prompt_tokens_details"] = json!({ "cached_tokens": usage.cached_input_tokens().unwrap_or(0), - "cache_creation_tokens": usage.cache_creation_input_tokens().unwrap_or(0), + "cache_write_tokens": usage.cache_creation_input_tokens().unwrap_or(0), }); } if let Some(reasoning_tokens) = usage.reasoning_tokens { diff --git a/crates/switchyard-translation/tests/response_translation.rs b/crates/switchyard-translation/tests/response_translation.rs index cef7155dd7..7d3ce5df57 100644 --- a/crates/switchyard-translation/tests/response_translation.rs +++ b/crates/switchyard-translation/tests/response_translation.rs @@ -377,7 +377,7 @@ fn responses_reasoning_usage_translates_to_openai_chat_usage_details() -> TestRe json!({"reasoning_tokens": 3}) ); assert_eq!( - output["usage"]["prompt_tokens_details"]["cache_creation_tokens"], + output["usage"]["prompt_tokens_details"]["cache_write_tokens"], 2 ); let decoded = engine