feat: normalize provider specific model options type names and ensure they are exported#12443
Conversation
…as in the wrong file and inconsistently named
gr2m
left a comment
There was a problem hiding this comment.
Looks good, just remove the changes to the migration guides.
I've seen that happen in the past, I wonder if we can somehow skill-ify the best-practice of not touching migration guides and codemods when doing bigger updates across the codebase
There was a problem hiding this comment.
revert the change in migration guides
There was a problem hiding this comment.
reverted. also pushed fccfe5d as an attempt to teach agents
| ## Provider-Specific Model Options Types | ||
|
|
||
| Types and Zod schemas for the provider specific model options follow the pattern `{Provider}{ModelType}Options`, e.g. `AnthropicLanguageModelOptions`. | ||
| If a provider has multiple implementations for the same model type, add a qualifier: `{Provider}{ModelType}{Qualifier}Options`, e.g. `OpenAILanguageModelChatOptions` and `OpenAILanguageModelResponsesOptions`. | ||
|
|
||
| - types are PascalCase, Zod schemas are camelCase (e.g. `openaiLanguageModelChatOptions`) | ||
| - types must be exported from the provider package, Zod schemas must not |
|
shortly put the PR to draft mode to confirm that CI fails when a type error is introduced to Confirmed locally that the Line 108 in b3b5624 |
This reverts commit 7b401bf.
… for existing schemas (#12457) ## Background Follow-up to #12443: six providers still had internal providerOptions schemas that weren't renamed to the normalized naming convention or exported. This PR addresses those remaining gaps tracked in #12269. ## Summary Renames and exports provider-specific model options types for 6 providers that already had Zod schemas internally but weren't following the normalized naming convention: - `@ai-sdk/amazon-bedrock`: `AmazonBedrockEmbeddingModelOptions` - `@ai-sdk/lmnt`: `LMNTSpeechModelOptions` - `@ai-sdk/hume`: `HumeSpeechModelOptions` - `@ai-sdk/revai`: `RevaiTranscriptionModelOptions` - `@ai-sdk/assemblyai`: `AssemblyAITranscriptionModelOptions` - `@ai-sdk/gladia`: `GladiaTranscriptionModelOptions` Also updates documentation code snippets and examples to use `satisfies` with the newly exported types. ## Checklist - [x] Tests have been added / updated (for bug fixes / features) - [x] 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) ## Future Work Other categories of providers from #12269 still need attention: - Providers using raw passthrough without schemas (e.g. elevenlabs, fal, sarvam) - Providers extending OpenAI-compatible that inherit options - Providers without embedding providerOptions support These will require separate follow up issues for consideration. ## Related Issues Fixes #12269
…atewayProviderOptions (#13855) ## Background When provider options types were recently renamed from `{Provider}ProviderOptions` to `{Provider}{ModelType}Options` across all providers (see #12443), the AI Gateway's type was renamed from `GatewayProviderOptions` to `GatewayLanguageModelOptions`. However, unlike other providers, the gateway's options are truly provider-wide (routing, fallbacks, tags, BYOK, etc.) — not specific to any model type. The original name was more accurate. ## Summary - Renamed `GatewayLanguageModelOptions` back to `GatewayProviderOptions` as the primary export, with `GatewayLanguageModelOptions` kept as a deprecated alias - Updated all examples, docs, and type tests to use `GatewayProviderOptions` - Added a note to `contributing/providers.md` documenting when `{Provider}ProviderOptions` should be used instead of `{Provider}{ModelType}Options` ## Checklist - [x] Tests have been added / updated (for bug fixes / features) - [x] 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)
…atewayProviderOptions (#13855) ## Background When provider options types were recently renamed from `{Provider}ProviderOptions` to `{Provider}{ModelType}Options` across all providers (see #12443), the AI Gateway's type was renamed from `GatewayProviderOptions` to `GatewayLanguageModelOptions`. However, unlike other providers, the gateway's options are truly provider-wide (routing, fallbacks, tags, BYOK, etc.) — not specific to any model type. The original name was more accurate. ## Summary - Renamed `GatewayLanguageModelOptions` back to `GatewayProviderOptions` as the primary export, with `GatewayLanguageModelOptions` kept as a deprecated alias - Updated all examples, docs, and type tests to use `GatewayProviderOptions` - Added a note to `contributing/providers.md` documenting when `{Provider}ProviderOptions` should be used instead of `{Provider}{ModelType}Options` ## Checklist - [x] Tests have been added / updated (for bug fixes / features) - [x] 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)
Background
Provider-specific model options types had inconsistent naming (
*ProviderOptions,*CallOptions,*ChatOptions, etc.) and many were not exported from their packages, making it impossible for consumers to usesatisfiesfor type-safeproviderOptions. This needs to be normalized before the v7 beta release, especially in preparation for renamingproviderOptionstooptions.Summary
Normalizes all provider-specific model options type names across 31 packages to follow a consistent
*ModelOptionsconvention and ensures they are all exported:{Provider}{ModelType}{OptionalModelSuffix}Optionspattern, e.g.:AnthropicProviderOptions→AnthropicLanguageModelOptionsOpenAIResponsesProviderOptions→OpenAILanguageModelResponsesOptionsanthropicProviderOptions→anthropicLanguageModelOptionsGroqTranscriptionModelOptionsOpenAITranscriptionModelOptionsFalSpeechModelOptions@ai-sdk/groq: Already had a transcription model options type, but in the wrong file and under the wrong name and not exportedsatisfies *OptionsonproviderOptionsinner objectscontributing/providers.mdAll changes are fully backward compatible — no breaking changes.
Manual Verification
pnpm type-check:fullpasses with no errorspnpm buildsucceeds for all packagespnpm prettier-checkpassesChecklist
pnpm changesetin the project root)Future Work
Consider adding options types for providers that don't have them yet, and add
satisfiesto those examples accordingly. For example:AmazonBedrockImageModelOptions#12435OpenAIImageModelOptions#12437useSearchGrounding#12438Related Issues
Fixes #12269