Skip to content

Missing cached_tokens_details property in RealtimeResponseUsage.InputTokenDetails #1600

@ericleib

Description

@ericleib

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 properties text_tokens and audio_tokens.

This information is needed to accurately evaluate the cost of generating the response.

To Reproduce

  1. Open a websocket connection with the realtime API at wss://api.openai.com/v1/realtime.
  2. Send a session.update and a response.create event.
  3. Inspect the content of the response.done event sent by the server, in particular response.usage.input_token_details

Code snippets

OS

Windows

Node version

Node v20

Library version

openai 5.11.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingopenapi

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions