@ai-sdk/gateway 3.0.145 → 3.0.147

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.
@@ -419,7 +419,7 @@ import { generateText, tool } from "ai";
419
419
  import { z } from "zod";
420
420
 
421
421
  const { text } = await generateText({
422
- model: "xai/grok-4",
422
+ model: "xai/grok-4.5",
423
423
  prompt: "What is the weather like in San Francisco?",
424
424
  tools: {
425
425
  getWeather: tool({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ai-sdk/gateway",
3
3
  "private": false,
4
- "version": "3.0.145",
4
+ "version": "3.0.147",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/index.js",
@@ -31,8 +31,8 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@vercel/oidc": "3.2.0",
34
- "@ai-sdk/provider": "3.0.13",
35
- "@ai-sdk/provider-utils": "4.0.37"
34
+ "@ai-sdk/provider": "3.0.14",
35
+ "@ai-sdk/provider-utils": "4.0.38"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "18.15.11",
@@ -9,7 +9,10 @@ import {
9
9
  } from './gateway-model-not-found-error';
10
10
  import { GatewayInternalServerError } from './gateway-internal-server-error';
11
11
  import { GatewayFailedDependencyError } from './gateway-failed-dependency-error';
12
- import { GatewayForbiddenError } from './gateway-forbidden-error';
12
+ import {
13
+ GatewayForbiddenError,
14
+ forbiddenParamSchema,
15
+ } from './gateway-forbidden-error';
13
16
  import { GatewayResponseError } from './gateway-response-error';
14
17
  import {
15
18
  lazySchema,
@@ -112,13 +115,20 @@ export async function createGatewayErrorFromResponse({
112
115
  cause,
113
116
  generationId,
114
117
  });
115
- case 'forbidden':
118
+ case 'forbidden': {
119
+ const ruleResult = await safeValidateTypes({
120
+ value: validatedResponse.error.param,
121
+ schema: forbiddenParamSchema,
122
+ });
123
+
116
124
  return new GatewayForbiddenError({
117
125
  message,
118
126
  statusCode,
119
127
  cause,
120
128
  generationId,
129
+ ruleId: ruleResult.success ? ruleResult.value.ruleId : undefined,
121
130
  });
131
+ }
122
132
  default:
123
133
  return new GatewayInternalServerError({
124
134
  message,
@@ -1,9 +1,19 @@
1
+ import { z } from 'zod/v4';
1
2
  import { GatewayError } from './gateway-error';
3
+ import { lazySchema, zodSchema } from '@ai-sdk/provider-utils';
2
4
 
3
5
  const name = 'GatewayForbiddenError';
4
6
  const marker = `vercel.ai.gateway.error.${name}`;
5
7
  const symbol = Symbol.for(marker);
6
8
 
9
+ export const forbiddenParamSchema = lazySchema(() =>
10
+ zodSchema(
11
+ z.object({
12
+ ruleId: z.string(),
13
+ }),
14
+ ),
15
+ );
16
+
7
17
  /**
8
18
  * Forbidden - the request was rejected by policy (e.g. a routing rule),
9
19
  * not an authentication failure.
@@ -13,19 +23,23 @@ export class GatewayForbiddenError extends GatewayError {
13
23
 
14
24
  readonly name = name;
15
25
  readonly type = 'forbidden';
26
+ readonly ruleId?: string;
16
27
 
17
28
  constructor({
18
29
  message = 'Forbidden',
19
30
  statusCode = 403,
20
31
  cause,
21
32
  generationId,
33
+ ruleId,
22
34
  }: {
23
35
  message?: string;
24
36
  statusCode?: number;
25
37
  cause?: unknown;
26
38
  generationId?: string;
39
+ ruleId?: string;
27
40
  } = {}) {
28
41
  super({ message, statusCode, cause, generationId });
42
+ this.ruleId = ruleId;
29
43
  }
30
44
 
31
45
  static isInstance(error: unknown): error is GatewayForbiddenError {
@@ -69,6 +69,7 @@ export type GatewayModelId =
69
69
  | 'google/gemini-3.1-flash-lite-preview'
70
70
  | 'google/gemini-3.1-pro-preview'
71
71
  | 'google/gemini-3.5-flash'
72
+ | 'google/gemini-omni-flash-preview'
72
73
  | 'google/gemma-4-26b-a4b-it'
73
74
  | 'google/gemma-4-31b-it'
74
75
  | 'inception/mercury-2'
@@ -156,6 +157,10 @@ export type GatewayModelId =
156
157
  | 'openai/gpt-5.4-pro'
157
158
  | 'openai/gpt-5.5'
158
159
  | 'openai/gpt-5.5-pro'
160
+ | 'openai/gpt-5.6'
161
+ | 'openai/gpt-5.6-luna'
162
+ | 'openai/gpt-5.6-sol'
163
+ | 'openai/gpt-5.6-terra'
159
164
  | 'openai/gpt-oss-120b'
160
165
  | 'openai/gpt-oss-20b'
161
166
  | 'openai/gpt-oss-safeguard-20b'
@@ -180,6 +185,7 @@ export type GatewayModelId =
180
185
  | 'xai/grok-4.20-reasoning'
181
186
  | 'xai/grok-4.20-reasoning-beta'
182
187
  | 'xai/grok-4.3'
188
+ | 'xai/grok-4.5'
183
189
  | 'xai/grok-build-0.1'
184
190
  | 'xiaomi/mimo-v2-flash'
185
191
  | 'xiaomi/mimo-v2-pro'