Skip to content

cached_token_details is missing from realtime_response_usage #2355

Open
@jverkoey

Description

@jverkoey

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

InputTokenDetails has the following structure when using the realtime API:

InputTokenDetails(audio_tokens=0, cached_tokens=192, text_tokens=239, cached_tokens_details={'text_tokens': 192, 'audio_tokens': 0})

But the InputTokenDetails type has the following definition:


class InputTokenDetails(BaseModel):
    audio_tokens: Optional[int] = None
    """The number of audio tokens used in the Response."""

    cached_tokens: Optional[int] = None
    """The number of cached tokens used in the Response."""

    text_tokens: Optional[int] = None
    """The number of text tokens used in the Response."""

Note that cached_tokens_details is missing.

To Reproduce

See the above.

Code snippets

OS

macOS

Python version

Python v3.13

Library version

v1.78.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions