8000 Add Cached Tokens to UsageResponse by Mungert69 · Pull Request #642 · betalgo/openai · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add Cached Tokens to UsageResponse #642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 8, 2024
Merged

Conversation

Mungert69
Copy link
Contributor

Openai Api has added prompt caching : https://openai.com/index/api-prompt-caching/
This has added new property to the usage response returned this contain the number of tokens that where retrieved from the cache.
Here is the example from the docs
usage: {
total_tokens: 2306,
prompt_tokens: 2006,
completion_tokens: 300,

prompt_tokens_details: {
cached_tokens: 1920,
audio_tokens: 0,
},
completion_tokens_details: {
reasoning_tokens: 0,
audio_tokens: 0,
}
}

I have added a new class for prompt_tokens_details with property cached_tokens . The prompt_tokens_details has been added as a property of usage.

@kayhantolga kayhantolga merged commit 9a391eb into betalgo:dev Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0