Skip to content

[Feature Request: Add missing usage fields] #434

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

Open
torstenrudolf opened this issue Apr 4, 2025 · 0 comments · May be fixed by #435
Open

[Feature Request: Add missing usage fields] #434

torstenrudolf opened this issue Apr 4, 2025 · 0 comments · May be fixed by #435
Labels
enhancement New feature or request

Comments

@torstenrudolf
Copy link

Feature Description

OpenAI /chat/completion API returns some "usage" information.
While this library makes some of that available in Usage.kt, the prompt_tokens_details and completion_tokens_details fields are missing.
Also see OpenAI doc for field details.

It would be great to make those details available.

Problem it Solves

Particular the prompt_tokens_details contains information about cached_tokens, which informs if OpenAI's caching is working as expected to avoid unexpected costs.

Proposed Solution

Add the missing fields to Usage.kt and read them from OpenAI's response.

@torstenrudolf torstenrudolf added the enhancement New feature or request label Apr 4, 2025
torstenrudolf added a commit to torstenrudolf/openai-kotlin that referenced this issue Apr 4, 2025
@torstenrudolf torstenrudolf changed the title [Feature Request: Brief Description] [Feature Request: Add missing usage fields] Apr 4, 2025
@torstenrudolf torstenrudolf linked a pull request Apr 4, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant