diff --git a/.changeset/gateway-caching-provider-option.md b/.changeset/gateway-caching-provider-option.md new file mode 100644 index 000000000000..e8b89c01049b --- /dev/null +++ b/.changeset/gateway-caching-provider-option.md @@ -0,0 +1,5 @@ +--- +"@ai-sdk/gateway": patch +--- + +feat(gateway): add `caching` provider option to `GatewayProviderOptions` diff --git a/packages/gateway/src/gateway-provider-options.ts b/packages/gateway/src/gateway-provider-options.ts index 491758f95291..f55730882374 100644 --- a/packages/gateway/src/gateway-provider-options.ts +++ b/packages/gateway/src/gateway-provider-options.ts @@ -108,6 +108,15 @@ const gatewayProviderOptions = lazySchema(() => * default. */ serviceTier: z.enum(['flex', 'priority']).optional(), + /** + * Enables automatic prompt caching across providers. When set to + * `'auto'`, the gateway applies the appropriate caching strategy for + * the routed provider: it adds a `cache_control` breakpoint to static + * content for providers that require explicit markers (such as + * Anthropic), while providers with implicit caching cache + * automatically. Leave unset to pass requests through unmodified. + */ + caching: z.literal('auto').optional(), }), ), );