Skip to content

fix(gateway): add caching provider option#14664

Closed
MukundaKatta wants to merge 1 commit into
vercel:mainfrom
MukundaKatta:codex/gateway-caching-option
Closed

fix(gateway): add caching provider option#14664
MukundaKatta wants to merge 1 commit into
vercel:mainfrom
MukundaKatta:codex/gateway-caching-option

Conversation

@MukundaKatta

@MukundaKatta MukundaKatta commented Apr 21, 2026

Copy link
Copy Markdown

Summary

  • add caching: 'auto' to GatewayProviderOptions
  • add request-body coverage for both doGenerate and doStream
  • align the exported type with Vercel documentation for AI Gateway provider options

Closes #14595

Verification

  • ran git diff --check
  • added regression tests covering the new option in both generate and stream paths

Notes

  • I did not run the package test suite locally because repo dependencies were not installed in this environment.

@tigent tigent Bot added ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label feature New feature or request provider/gateway Issues related to the @ai-sdk/gateway provider labels Apr 21, 2026
gr2m pushed a commit that referenced this pull request Jun 29, 2026
…16483)

## Background

The `caching` provider option for the AI Gateway was previously untyped
despite being in AI Gateway docs.

#15768 added it, but only to v7

## Summary

Backported that change by updating the `gatewayProviderOptions` zod
schema in v6.

## Manual Verification

This is properly typed in v6 now with intellisense working and no
errors:

```typescript
  const result = streamText({
    model: 'anthropic/claude-sonnet-4.6',
    system:
      'You are a helpful assistant with access to a large knowledge base...',
    prompt: 'What is the capital of France?',
    providerOptions: {
        gateway: {
            caching: 'auto',
        } satisfies GatewayProviderOptions,
    },
  });
```

## Checklist

- [X] All commits are signed (PRs with unsigned commits cannot be
merged)
- [ ] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [X] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [X] I have reviewed this pull request (self-review)

## Related Issues

Fixed #14595

Closes #14609
Closes #14632
Closes #14664
Closes #14886
Closes #15298
Closes #15329
Closes #15458
Closes #15500
Closes #15857
@n1ckoates

Copy link
Copy Markdown
Member

Added to AI SDK 7 in #15768
Backported to AI SDK 6 in #16483

@n1ckoates n1ckoates closed this Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label feature New feature or request provider/gateway Issues related to the @ai-sdk/gateway provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GatewayProviderOptions type missing 'caching' property (docs mismatch)

2 participants