mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-12 20:19:51 +08:00
fix: 修复缓存 token usage 转换语义
统一 OpenAI、Gemini、Claude 之间缓存 token 的 usage 语义,避免 Claude 侧重复统计缓存输入 token。 同时补充 stream 合并逻辑、字段注释和覆盖转换链路的测试。
This commit is contained in:
@@ -2824,6 +2824,7 @@ mod tests {
|
||||
.expect("usage should parse");
|
||||
|
||||
assert_eq!(usage.input_tokens, 20_435);
|
||||
assert!(usage.input_tokens_include_cache);
|
||||
assert_eq!(usage.output_tokens, 177);
|
||||
assert_eq!(usage.cache_read_tokens, 19_840);
|
||||
assert_eq!(usage.reasoning_tokens, 7);
|
||||
@@ -3734,6 +3735,7 @@ mod tests {
|
||||
finish_reason: Some("stop".to_string()),
|
||||
usage: Some(CanonicalUsage {
|
||||
input_tokens: 1,
|
||||
input_tokens_include_cache: true,
|
||||
output_tokens: 2,
|
||||
total_tokens: 3,
|
||||
cache_creation_tokens: 5,
|
||||
|
||||
Reference in New Issue
Block a user