You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add OpenAI compatible cost calculation
* Requesty: Prepare for correct price calculation
* Native OpenAI: Update model caching info
According to [OpenAI's
website](https://platform.openai.com/docs/guides/prompt-caching),
gpt-4o, gpt-4o-mini, o1-preview and o1-mini support caching.
For gpt-4o, even though gpt-4o-2024-05-13 and
chatgpt-4o-latest do no support caching, users will see there are no
cached tokens, which will help avoid confusion.
* Native OpenAI: Call getModel once
* Native OpenAI: Extract yield usage into method
* Native OpenAI: Add caching and cost info to task header
* DeepSeek: Add cost info to task header
* Add changeset
@@ -61,15 +93,7 @@ export class DeepSeekHandler implements ApiHandler {
61
93
}
62
94
63
95
if(chunk.usage){
64
-
yield{
65
-
type: "usage",
66
-
inputTokens: chunk.usage.prompt_tokens||0,// (deepseek reports total input AND cache reads/writes, see context caching: https://api-docs.deepseek.com/guides/kv_cache) where the input tokens is the sum of the cache hits/misses, while anthropic reports them as separate tokens. This is important to know for 1) context management truncation algorithm, and 2) cost calculation (NOTE: we report both input and cache stats but for now set input price to 0 since all the cost calculation will be done using cache hits/misses)
supportsPromptCache: true,// supports context caching, but not in the way anthropic does it (deepseek reports input tokens and reads/writes in the same usage report) FIXME: we need to show users cache stats how deepseek does it
481
-
inputPrice: 0,// technically there is no input price, it's all either a cache hit or miss (ApiOptions will not show this)
supportsPromptCache: true,// supports context caching, but not in the way anthropic does it (deepseek reports input tokens and reads/writes in the same usage report) FIXME: we need to show users cache stats how deepseek does it
491
-
inputPrice: 0,// technically there is no input price, it's all either a cache hit or miss (ApiOptions will not show this)
0 commit comments