@ai-sdk/gateway 4.0.90 → 4.0.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @ai-sdk/gateway
2
2
 
3
+ ## 4.0.91
4
+
5
+ ### Patch Changes
6
+
7
+ - 2693319: Add Gemini 3.8 TTS support with structured speech metadata and per-turn speaker and style controls for prebuilt voices. Preserve native WAV responses without adding a second header, support explicit raw PCM, mu-law, and A-law output, and identify headerless audio formats correctly. Add the Gemini 3.8 speech model IDs to Google and Gateway types.
8
+
9
+ Share transcript and custom-voice inspection through the Google provider internal export, and reject empty speech transcripts before sending a request. Default newer and custom model IDs to structured speech while preserving the legacy format for Gemini 2.5 and 3.1.
10
+
11
+ - b73f2f9: feat(provider/gateway): add quantization conditions to the has provider option
12
+ - Updated dependencies [fe07867]
13
+ - Updated dependencies [a4b0940]
14
+ - Updated dependencies [771e74b]
15
+ - @ai-sdk/provider-utils@5.0.47
16
+
3
17
  ## 4.0.90
4
18
 
5
19
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -81,7 +81,7 @@ type GatewayRealtimeModelId = 'google/gemini-3.8-live' | 'google/gemini-3.8-live
81
81
 
82
82
  type GatewayRerankingModelId = 'cohere/rerank-v3.5' | 'cohere/rerank-v4-fast' | 'cohere/rerank-v4-pro' | 'voyage/rerank-2.5' | 'voyage/rerank-2.5-lite' | (string & {});
83
83
 
84
- type GatewaySpeechModelId = 'fish-audio/s1' | 'fish-audio/s2-pro' | 'fish-audio/s2.1-pro' | 'openai/tts-1' | 'openai/tts-1-hd' | 'spacexai/grok-tts' | (string & {});
84
+ type GatewaySpeechModelId = 'fish-audio/s1' | 'fish-audio/s2-pro' | 'fish-audio/s2.1-pro' | 'google/gemini-3.8-flash-tts' | 'google/gemini-3.8-flash-lite-tts' | 'openai/tts-1' | 'openai/tts-1-hd' | 'spacexai/grok-tts' | (string & {});
85
85
 
86
86
  type GatewayTranscriptionModelId = 'fish-audio/transcribe-1' | 'google/gemini-3.5-transcribe' | 'google/gemini-3.5-transcribe-live' | 'openai/gpt-4o-mini-transcribe' | 'openai/gpt-4o-transcribe' | 'openai/gpt-realtime-whisper' | 'openai/whisper-1' | 'spacexai/grok-stt' | (string & {});
87
87
 
@@ -1120,11 +1120,17 @@ type GatewayProviderOptions = {
1120
1120
  /** Filter to providers that do not train on prompt data. */
1121
1121
  disallowPromptTraining?: boolean;
1122
1122
  /**
1123
- * Restrict routing to models that have all of the given capabilities.
1124
- * Currently supports `'implicit-caching'`, `'reasoning'`, `'tool-use'`, and
1125
- * `'vision'` (image input).
1126
- */
1127
- has?: Array<'implicit-caching' | 'reasoning' | 'tool-use' | 'vision'>;
1123
+ * Restrict routing to provider models that satisfy every given entry.
1124
+ *
1125
+ * Entries are capability tags (`'implicit-caching'`, `'reasoning'`,
1126
+ * `'tool-use'`, `'vision'`) or weight-format conditions: `'quantization:fp8'`
1127
+ * requires the serving provider to report that weight format,
1128
+ * `'!quantization:fp8'` excludes it (providers with no recorded format still
1129
+ * pass an exclusion). Format values are an open space but must match
1130
+ * `[a-zA-Z0-9._-]{1,32}` and compare case-insensitively; unknown capability
1131
+ * names are rejected by the Gateway with a 400.
1132
+ */
1133
+ has?: Array<'implicit-caching' | 'reasoning' | 'tool-use' | 'vision' | `quantization:${string}` | `!quantization:${string}`>;
1128
1134
  /**
1129
1135
  * Idempotency key for `experimental_startBatch`: retries with the same
1130
1136
  * key replay the original batch instead of creating a duplicate.
package/dist/index.js CHANGED
@@ -3662,7 +3662,7 @@ async function getVercelRequestId() {
3662
3662
  }
3663
3663
 
3664
3664
  // src/version.ts
3665
- var VERSION = true ? "4.0.90" : "0.0.0-test";
3665
+ var VERSION = true ? "4.0.91" : "0.0.0-test";
3666
3666
 
3667
3667
  // src/gateway-provider.ts
3668
3668
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
@@ -1390,7 +1390,7 @@ The following gateway provider options are available:
1390
1390
 
1391
1391
  The unique identifier for the entity against which quota is tracked. Used for quota management and enforcement purposes.
1392
1392
 
1393
- - **has** _Array&lt;'implicit-caching' | 'reasoning' | 'tool-use' | 'vision'&gt;_
1393
+ - **has** _Array&lt;'implicit-caching' | 'reasoning' | 'tool-use' | 'vision' | `quantization:${string}` | `!quantization:${string}`&gt;_
1394
1394
 
1395
1395
  Restricts routing to provider models that have all of the specified capabilities. Applies to both BYOK and system credentials, since the capability is a property of the model rather than the credential. If no provider model for the requested model satisfies the capabilities, the request fails. Unsupported values are rejected.
1396
1396
 
@@ -1400,7 +1400,9 @@ The following gateway provider options are available:
1400
1400
  - `'tool-use'` — models that support tool calling.
1401
1401
  - `'vision'` — models that accept image input.
1402
1402
 
1403
- Example: `has: ['implicit-caching']` will only route to models that support implicit caching. Example: `has: ['vision']` will only route to models that accept image input. Example: `has: ['tool-use']` will only route to models that support tool calling.
1403
+ Weight-format conditions route on the serving provider's recorded weight format: `'quantization:fp8'` requires a provider serving fp8 weights, while `'!quantization:fp8'` excludes fp8 providers. A negated condition also matches providers whose weight format is not recorded, so exclusions remain usable while the catalog is populated.
1404
+
1405
+ Example: `has: ['implicit-caching']` will only route to models that support implicit caching. Example: `has: ['vision']` will only route to models that accept image input. Example: `has: ['tool-use']` will only route to models that support tool calling. Example: `has: ['!quantization:fp8']` will only route to providers that do not serve fp8 weights.
1404
1406
 
1405
1407
  - **providerTimeouts** _object_
1406
1408
 
@@ -1538,7 +1540,7 @@ const { text } = await generateText({
1538
1540
 
1539
1541
  #### Filtering by Model Capability
1540
1542
 
1541
- Set `has` to restrict routing to provider models that have the specified capabilities. This applies to both BYOK and system credentials, since the capability is a property of the model rather than the credential. `'implicit-caching'` limits routing to models that perform automatic prompt caching, `'vision'` limits routing to models that accept image input, `'reasoning'` limits routing to models that support reasoning, and `'tool-use'` limits routing to models that support tool calling. If no provider model for the requested model satisfies the capabilities, the request fails.
1543
+ Set `has` to restrict routing to provider models that have the specified capabilities. This applies to both BYOK and system credentials, since the capability is a property of the model rather than the credential. `'implicit-caching'` limits routing to models that perform automatic prompt caching, `'vision'` limits routing to models that accept image input, `'reasoning'` limits routing to models that support reasoning, and `'tool-use'` limits routing to models that support tool calling. Weight-format conditions (`'quantization:fp8'` to require, `'!quantization:fp8'` to exclude) limit routing by the serving provider's recorded weight format. If no provider model for the requested model satisfies the capabilities, the request fails.
1542
1544
 
1543
1545
  ```ts
1544
1546
  import type { GatewayProviderOptions } from '@ai-sdk/gateway';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ai-sdk/gateway",
3
3
  "private": false,
4
- "version": "4.0.90",
4
+ "version": "4.0.91",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "sideEffects": false,
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@ai-sdk/provider": "4.0.18",
34
- "@ai-sdk/provider-utils": "5.0.46",
34
+ "@ai-sdk/provider-utils": "5.0.47",
35
35
  "@vercel/oidc": "3.2.0"
36
36
  },
37
37
  "devDependencies": {
@@ -16,11 +16,24 @@ export type GatewayProviderOptions = {
16
16
  disallowPromptTraining?: boolean;
17
17
 
18
18
  /**
19
- * Restrict routing to models that have all of the given capabilities.
20
- * Currently supports `'implicit-caching'`, `'reasoning'`, `'tool-use'`, and
21
- * `'vision'` (image input).
19
+ * Restrict routing to provider models that satisfy every given entry.
20
+ *
21
+ * Entries are capability tags (`'implicit-caching'`, `'reasoning'`,
22
+ * `'tool-use'`, `'vision'`) or weight-format conditions: `'quantization:fp8'`
23
+ * requires the serving provider to report that weight format,
24
+ * `'!quantization:fp8'` excludes it (providers with no recorded format still
25
+ * pass an exclusion). Format values are an open space but must match
26
+ * `[a-zA-Z0-9._-]{1,32}` and compare case-insensitively; unknown capability
27
+ * names are rejected by the Gateway with a 400.
22
28
  */
23
- has?: Array<'implicit-caching' | 'reasoning' | 'tool-use' | 'vision'>;
29
+ has?: Array<
30
+ | 'implicit-caching'
31
+ | 'reasoning'
32
+ | 'tool-use'
33
+ | 'vision'
34
+ | `quantization:${string}`
35
+ | `!quantization:${string}`
36
+ >;
24
37
 
25
38
  /**
26
39
  * Idempotency key for `experimental_startBatch`: retries with the same
@@ -2,6 +2,8 @@ export type GatewaySpeechModelId =
2
2
  | 'fish-audio/s1'
3
3
  | 'fish-audio/s2-pro'
4
4
  | 'fish-audio/s2.1-pro'
5
+ | 'google/gemini-3.8-flash-tts'
6
+ | 'google/gemini-3.8-flash-lite-tts'
5
7
  | 'openai/tts-1'
6
8
  | 'openai/tts-1-hd'
7
9
  | 'spacexai/grok-tts'