mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
DeepSeek: cache pricing support
This commit is contained in:
@@ -339,6 +339,16 @@ function _fromOpenAIUsage(usage: OpenAIWire_API_Chat_Completions.Response['usage
|
||||
}
|
||||
}
|
||||
|
||||
// [DeepSeek] Input redistribution: Cache Read
|
||||
if (usage.prompt_cache_hit_tokens !== undefined) {
|
||||
const TCacheRead = usage.prompt_cache_hit_tokens;
|
||||
if (TCacheRead > 0) {
|
||||
metricsUpdate.TCacheRead = TCacheRead;
|
||||
if (usage.prompt_cache_miss_tokens !== undefined)
|
||||
metricsUpdate.TIn = usage.prompt_cache_miss_tokens;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Input redistribution: Audio tokens
|
||||
|
||||
// Output Metrics
|
||||
|
||||
@@ -384,6 +384,10 @@ export namespace OpenAIWire_API_Chat_Completions {
|
||||
accepted_prediction_tokens: z.number().optional(), // [OpenAI, 2024-11-05] Predicted Outputs
|
||||
rejected_prediction_tokens: z.number().optional(), // [OpenAI, 2024-11-05] Predicted Outputs
|
||||
}).optional(), // not present in other APIs yet
|
||||
|
||||
// [DeepSeek, 2024-08-02] context caching on disk
|
||||
prompt_cache_hit_tokens: z.number().optional(),
|
||||
prompt_cache_miss_tokens: z.number().optional(),
|
||||
}).nullable();
|
||||
|
||||
const Choice_NS_schema = z.object({
|
||||
|
||||
Reference in New Issue
Block a user