Skip to content

Commit e69062d

Browse files
Backport: chore(provider/gateway): rename GatewayLanguageModelOptions back to GatewayProviderOptions (#13856)
This is an automated backport of #13855 to the release-v6.0 branch. FYI @felixarntz Co-authored-by: Felix Arntz <felix.arntz@vercel.com>
1 parent ba97d4b commit e69062d

File tree

12 files changed

+37
-33
lines changed

12 files changed

+37
-33
lines changed

.changeset/unlucky-seas-prove.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ai-sdk/gateway": patch
3+
---
4+
5+
chore(provider/gateway): rename GatewayLanguageModelOptions back to GatewayProviderOptions

content/docs/02-foundations/06-provider-options.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ You can also combine gateway-specific options (like routing and fallbacks) with
301301

302302
```ts
303303
import type { AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';
304-
import type { GatewayLanguageModelOptions } from '@ai-sdk/gateway';
304+
import type { GatewayProviderOptions } from '@ai-sdk/gateway';
305305
import { generateText } from 'ai';
306306

307307
const result = await generateText({
@@ -311,7 +311,7 @@ const result = await generateText({
311311
// Gateway-specific: control routing
312312
gateway: {
313313
order: ['vertex', 'anthropic'],
314-
} satisfies GatewayLanguageModelOptions,
314+
} satisfies GatewayProviderOptions,
315315
// Provider-specific: enable reasoning
316316
anthropic: {
317317
thinking: { type: 'enabled', budgetTokens: 12000 },

content/providers/01-ai-sdk-providers/00-ai-gateway.mdx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ for await (const part of result.fullStream) {
538538
Track usage per end-user and categorize requests with tags:
539539

540540
```ts
541-
import type { GatewayLanguageModelOptions } from '@ai-sdk/gateway';
541+
import type { GatewayProviderOptions } from '@ai-sdk/gateway';
542542
import { generateText } from 'ai';
543543

544544
const { text } = await generateText({
@@ -548,7 +548,7 @@ const { text } = await generateText({
548548
gateway: {
549549
user: 'user-abc-123', // Track usage for this specific end-user
550550
tags: ['document-summary', 'premium-feature'], // Categorize for reporting
551-
} satisfies GatewayLanguageModelOptions,
551+
} satisfies GatewayProviderOptions,
552552
},
553553
});
554554
```
@@ -568,7 +568,7 @@ The AI Gateway provider accepts provider options that control routing behavior a
568568
You can use the `gateway` key in `providerOptions` to control how AI Gateway routes requests:
569569

570570
```ts
571-
import type { GatewayLanguageModelOptions } from '@ai-sdk/gateway';
571+
import type { GatewayProviderOptions } from '@ai-sdk/gateway';
572572
import { generateText } from 'ai';
573573

574574
const { text } = await generateText({
@@ -578,7 +578,7 @@ const { text } = await generateText({
578578
gateway: {
579579
order: ['vertex', 'anthropic'], // Try Vertex AI first, then Anthropic
580580
only: ['vertex', 'anthropic'], // Only use these providers
581-
} satisfies GatewayLanguageModelOptions,
581+
} satisfies GatewayProviderOptions,
582582
},
583583
});
584584
```
@@ -642,7 +642,7 @@ The following gateway provider options are available:
642642
You can combine these options to have fine-grained control over routing and tracking:
643643

644644
```ts
645-
import type { GatewayLanguageModelOptions } from '@ai-sdk/gateway';
645+
import type { GatewayProviderOptions } from '@ai-sdk/gateway';
646646
import { generateText } from 'ai';
647647

648648
const { text } = await generateText({
@@ -652,7 +652,7 @@ const { text } = await generateText({
652652
gateway: {
653653
order: ['vertex'], // Prefer Vertex AI
654654
only: ['anthropic', 'vertex'], // Only allow these providers
655-
} satisfies GatewayLanguageModelOptions,
655+
} satisfies GatewayProviderOptions,
656656
},
657657
});
658658
```
@@ -662,7 +662,7 @@ const { text } = await generateText({
662662
The `models` option enables automatic fallback to alternative models when the primary model fails:
663663

664664
```ts
665-
import type { GatewayLanguageModelOptions } from '@ai-sdk/gateway';
665+
import type { GatewayProviderOptions } from '@ai-sdk/gateway';
666666
import { generateText } from 'ai';
667667

668668
const { text } = await generateText({
@@ -671,7 +671,7 @@ const { text } = await generateText({
671671
providerOptions: {
672672
gateway: {
673673
models: ['openai/gpt-5-nano', 'gemini-2.0-flash'], // Fallback models
674-
} satisfies GatewayLanguageModelOptions,
674+
} satisfies GatewayProviderOptions,
675675
},
676676
});
677677

@@ -689,7 +689,7 @@ that have zero data retention policies. When `zeroDataRetention` is `false` or n
689689
specified, there is no enforcement of restricting routing.
690690

691691
```ts
692-
import type { GatewayLanguageModelOptions } from '@ai-sdk/gateway';
692+
import type { GatewayProviderOptions } from '@ai-sdk/gateway';
693693
import { generateText } from 'ai';
694694

695695
const { text } = await generateText({
@@ -698,7 +698,7 @@ const { text } = await generateText({
698698
providerOptions: {
699699
gateway: {
700700
zeroDataRetention: true,
701-
} satisfies GatewayLanguageModelOptions,
701+
} satisfies GatewayProviderOptions,
702702
},
703703
});
704704
```
@@ -709,7 +709,7 @@ When using provider-specific options through AI Gateway, use the actual provider
709709

710710
```ts
711711
import type { AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';
712-
import type { GatewayLanguageModelOptions } from '@ai-sdk/gateway';
712+
import type { GatewayProviderOptions } from '@ai-sdk/gateway';
713713
import { generateText } from 'ai';
714714

715715
const { text } = await generateText({
@@ -718,7 +718,7 @@ const { text } = await generateText({
718718
providerOptions: {
719719
gateway: {
720720
order: ['vertex', 'anthropic'],
721-
} satisfies GatewayLanguageModelOptions,
721+
} satisfies GatewayProviderOptions,
722722
anthropic: {
723723
thinking: { type: 'enabled', budgetTokens: 12000 },
724724
} satisfies AnthropicLanguageModelOptions,

contributing/providers.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ to prevent unnecessary breakages.
1919

2020
Types and Zod schemas for the provider specific model options follow the pattern `{Provider}{ModelType}Options`, e.g. `AnthropicLanguageModelOptions`.
2121
If a provider has multiple implementations for the same model type, add a qualifier: `{Provider}{ModelType}{Qualifier}Options`, e.g. `OpenAILanguageModelChatOptions` and `OpenAILanguageModelResponsesOptions`.
22+
If options apply provider-wide rather than to a specific model type, use `{Provider}ProviderOptions` instead, e.g. `GatewayProviderOptions`.
2223

2324
- types are PascalCase, Zod schemas are camelCase (e.g. `openaiLanguageModelChatOptions`)
2425
- types must be exported from the provider package, Zod schemas must not

examples/ai-functions/src/deprecated-options-types.test-d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ describe('deprecated provider options type aliases', () => {
206206
});
207207

208208
describe('@ai-sdk/gateway', () => {
209-
it('GatewayProviderOptions equals GatewayLanguageModelOptions', () => {
210-
expectTypeOf<GatewayProviderOptions>().toEqualTypeOf<GatewayLanguageModelOptions>();
209+
it('GatewayLanguageModelOptions equals GatewayProviderOptions', () => {
210+
expectTypeOf<GatewayLanguageModelOptions>().toEqualTypeOf<GatewayProviderOptions>();
211211
});
212212
});
213213

examples/ai-functions/src/generate-text/gateway/request-byok.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type GatewayLanguageModelOptions } from '@ai-sdk/gateway';
1+
import { type GatewayProviderOptions } from '@ai-sdk/gateway';
22
import { generateText } from 'ai';
33
import { run } from '../../lib/run';
44

@@ -11,7 +11,7 @@ run(async () => {
1111
byok: {
1212
anthropic: [{ apiKey: process.env.ANTHROPIC_API_KEY }],
1313
},
14-
} satisfies GatewayLanguageModelOptions,
14+
} satisfies GatewayProviderOptions,
1515
},
1616
});
1717

examples/ai-functions/src/stream-text/gateway/provider-options-models.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { GatewayLanguageModelOptions } from '@ai-sdk/gateway';
1+
import type { GatewayProviderOptions } from '@ai-sdk/gateway';
22
import { streamText } from 'ai';
33
import { run } from '../../lib/run';
44

@@ -12,7 +12,7 @@ run(async () => {
1212
providerOptions: {
1313
gateway: {
1414
models: ['openai/gpt-5-nano', 'zai/glm-4.6'],
15-
} satisfies GatewayLanguageModelOptions,
15+
} satisfies GatewayProviderOptions,
1616
},
1717
});
1818

examples/ai-functions/src/stream-text/gateway/provider-options-order.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type GatewayLanguageModelOptions } from '@ai-sdk/gateway';
1+
import { type GatewayProviderOptions } from '@ai-sdk/gateway';
22
import { streamText } from 'ai';
33
import { run } from '../../lib/run';
44

@@ -9,7 +9,7 @@ run(async () => {
99
providerOptions: {
1010
gateway: {
1111
order: ['bedrock', 'anthropic'],
12-
} satisfies GatewayLanguageModelOptions,
12+
} satisfies GatewayProviderOptions,
1313
},
1414
});
1515

examples/ai-functions/src/stream-text/gateway/provider-options-tags.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { GatewayLanguageModelOptions } from '@ai-sdk/gateway';
1+
import type { GatewayProviderOptions } from '@ai-sdk/gateway';
22
import { streamText } from 'ai';
33
import { run } from '../../lib/run';
44

@@ -10,7 +10,7 @@ run(async () => {
1010
gateway: {
1111
user: 'user-123',
1212
tags: ['chat', 'v2'],
13-
} satisfies GatewayLanguageModelOptions,
13+
} satisfies GatewayProviderOptions,
1414
},
1515
});
1616

examples/ai-functions/src/stream-text/gateway/provider-options-zero-data-retention.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { GatewayLanguageModelOptions } from '@ai-sdk/gateway';
1+
import type { GatewayProviderOptions } from '@ai-sdk/gateway';
22
import { streamText } from 'ai';
33
import { run } from '../../lib/run';
44

@@ -9,7 +9,7 @@ run(async () => {
99
providerOptions: {
1010
gateway: {
1111
zeroDataRetention: true,
12-
} satisfies GatewayLanguageModelOptions,
12+
} satisfies GatewayProviderOptions,
1313
},
1414
});
1515

0 commit comments

Comments
 (0)