Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/gateway-caching-option.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ai-sdk/gateway": patch
---

feat(gateway): add `caching` option to `GatewayProviderOptions` type, enabling automatic prompt caching across supported providers (Anthropic, MiniMax)
9 changes: 9 additions & 0 deletions packages/gateway/src/gateway-provider-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ const gatewayProviderOptions = lazySchema(() =>
byok: z.record(z.string(), z.number().int().min(1000)).optional(),
})
.optional(),
/**
* Enables automatic prompt caching across providers.
* When set to `'auto'`, AI Gateway applies the appropriate caching
* strategy based on the provider (e.g., adding `cache_control` breakpoints
* for Anthropic or MiniMax, which require explicit cache markers).
*
* Supported providers: Anthropic (direct, Vertex, Bedrock), MiniMax.
*/
caching: z.enum(['auto']).optional(),
}),
),
);
Expand Down