Skip to content

Prompt caching for Anthropic is not working even with the new options #35

Description

@rajatady

We have tried adding the following in three different versions:

providerOptions: {
                    openrouter: {
                        // cache_control also works
                        // cache_control: { type: 'ephemeral' }
                        cacheControl: { type: 'ephemeral' },
                    },
                },
                experimental_providerMetadata: {
                    openrouter: {
                        // cache_control also works
                        // cache_control: { type: 'ephemeral' }
                        cacheControl: { type: 'ephemeral' },
                    },
                },
                // @ts-ignore
                providerMetadata: {
                    openrouter: {
                        // cache_control also works
                        // cache_control: { type: 'ephemeral' }
                        cacheControl: { type: 'ephemeral' },
                    },
                },

and added directly at the message level as well as individual parts. The caching with open router is not working at all.

We added a hack to override the fetch implementation and overriding the body but even then only the system prompt caching works.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions