-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
Confirm this is a Node library issue and not an underlying OpenAI API issue
- This is an issue with the Node library
Describe the bug
The OpenAI.Beta.Realtime.RealtimeResponseUsage.InputTokenDetails
type has 3 properties:
text_tokens
audio_tokens
cached_tokens
But in fact, the API returns a fourth property (which is indeed very important):
cached_tokens_details
, an object with 2 propertiestext_tokens
andaudio_tokens
.
This information is needed to accurately evaluate the cost of generating the response.
To Reproduce
- Open a websocket connection with the realtime API at
wss://api.openai.com/v1/realtime
. - Send a
session.update
and aresponse.create
event. - Inspect the content of the
response.done
event sent by the server, in particularresponse.usage.input_token_details
Code snippets
OS
Windows
Node version
Node v20
Library version
openai 5.11.0