Skip to content

Caching does not work or not return cache info when streaming is enabled #994

@gulbaki

Description

@gulbaki

After investigating the issue in more detail, I found that caching does not work when streaming: true is set. However, when I disable streaming (streaming: false), caching works correctly — and I receive the expected cache-related response headers.
With streaming disabled (streaming: false):

  "cache_creation_input_tokens": 0,
  "cache_read_input_tokens": 1454,

With streaming enabled (streaming: true):

"cache_creation_input_tokens": null,
 "cache_read_input_tokens": null,

As you can see, the cache usage fields are null when streaming is turned on, which suggests caching is not working in that mode, or at least the information is not returned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions