@ai-sdk/gateway 4.0.35 → 4.0.37

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.37
4
+
5
+ ### Patch Changes
6
+
7
+ - bdd5e28: feat(provider/gateway): support `'vision'` (image input) in the `has` provider option
8
+
9
+ ## 4.0.36
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [5fc7da5]
14
+ - Updated dependencies [93b2acd]
15
+ - @ai-sdk/provider-utils@5.0.18
16
+
3
17
  ## 4.0.35
4
18
 
5
19
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -840,9 +840,9 @@ type GatewayProviderOptions = {
840
840
  disallowPromptTraining?: boolean;
841
841
  /**
842
842
  * Restrict routing to models that have all of the given capabilities.
843
- * Currently supports `'implicit-caching'`.
843
+ * Currently supports `'implicit-caching'` and `'vision'` (image input).
844
844
  */
845
- has?: Array<'implicit-caching'>;
845
+ has?: Array<'implicit-caching' | 'vision'>;
846
846
  /** Array of model slugs specifying fallback models to use in order. */
847
847
  models?: string[];
848
848
  /** Array of provider slugs that are the only ones allowed to be used. */
package/dist/index.js CHANGED
@@ -2631,7 +2631,7 @@ async function getVercelRequestId() {
2631
2631
  }
2632
2632
 
2633
2633
  // src/version.ts
2634
- var VERSION = true ? "4.0.35" : "0.0.0-test";
2634
+ var VERSION = true ? "4.0.37" : "0.0.0-test";
2635
2635
 
2636
2636
  // src/gateway-provider.ts
2637
2637
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
@@ -1041,11 +1041,15 @@ The following gateway provider options are available:
1041
1041
 
1042
1042
  The unique identifier for the entity against which quota is tracked. Used for quota management and enforcement purposes.
1043
1043
 
1044
- - **has** _Array&lt;'implicit-caching'&gt;_
1044
+ - **has** _Array&lt;'implicit-caching' | 'vision'&gt;_
1045
1045
 
1046
- Restricts routing to provider models that have all of the specified capabilities. Currently supports `'implicit-caching'`, which limits routing to models that perform automatic (implicit) prompt caching. 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.
1046
+ 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.
1047
1047
 
1048
- Example: `has: ['implicit-caching']` will only route to models that support implicit caching.
1048
+ Supported capabilities:
1049
+ - `'implicit-caching'` — models that perform automatic (implicit) prompt caching.
1050
+ - `'vision'` — models that accept image input.
1051
+
1052
+ 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.
1049
1053
 
1050
1054
  - **providerTimeouts** _object_
1051
1055
 
@@ -1183,7 +1187,7 @@ const { text } = await generateText({
1183
1187
 
1184
1188
  #### Filtering by Model Capability
1185
1189
 
1186
- 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. Currently `'implicit-caching'` is supported, which limits routing to models that perform automatic prompt caching. If no provider model for the requested model satisfies the capabilities, the request fails.
1190
+ 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, and `'vision'` limits routing to models that accept image input. If no provider model for the requested model satisfies the capabilities, the request fails.
1187
1191
 
1188
1192
  ```ts
1189
1193
  import type { GatewayProviderOptions } from '@ai-sdk/gateway';
@@ -1200,6 +1204,37 @@ const { text } = await generateText({
1200
1204
  });
1201
1205
  ```
1202
1206
 
1207
+ Use `'vision'` when the request sends image input, so the gateway only routes to
1208
+ provider models that can accept it:
1209
+
1210
+ ```ts
1211
+ import type { GatewayProviderOptions } from '@ai-sdk/gateway';
1212
+ import { generateText } from 'ai';
1213
+ import fs from 'node:fs';
1214
+
1215
+ const { text } = await generateText({
1216
+ model: 'anthropic/claude-sonnet-4.6',
1217
+ messages: [
1218
+ {
1219
+ role: 'user',
1220
+ content: [
1221
+ { type: 'text', text: 'Describe the image in detail.' },
1222
+ {
1223
+ type: 'file',
1224
+ mediaType: 'image/png',
1225
+ data: fs.readFileSync('./data/comic-cat.png'),
1226
+ },
1227
+ ],
1228
+ },
1229
+ ],
1230
+ providerOptions: {
1231
+ gateway: {
1232
+ has: ['vision'],
1233
+ } satisfies GatewayProviderOptions,
1234
+ },
1235
+ });
1236
+ ```
1237
+
1203
1238
  ### Provider-Specific Options
1204
1239
 
1205
1240
  When using provider-specific options through AI Gateway, use the actual provider name (e.g. `anthropic`, `openai`, not `gateway`) as the key:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ai-sdk/gateway",
3
3
  "private": false,
4
- "version": "4.0.35",
4
+ "version": "4.0.37",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "sideEffects": false,
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "@vercel/oidc": "3.2.0",
34
34
  "@ai-sdk/provider": "4.0.4",
35
- "@ai-sdk/provider-utils": "5.0.17"
35
+ "@ai-sdk/provider-utils": "5.0.18"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "22.19.19",
@@ -17,9 +17,9 @@ export type GatewayProviderOptions = {
17
17
 
18
18
  /**
19
19
  * Restrict routing to models that have all of the given capabilities.
20
- * Currently supports `'implicit-caching'`.
20
+ * Currently supports `'implicit-caching'` and `'vision'` (image input).
21
21
  */
22
- has?: Array<'implicit-caching'>;
22
+ has?: Array<'implicit-caching' | 'vision'>;
23
23
 
24
24
  /** Array of model slugs specifying fallback models to use in order. */
25
25
  models?: string[];