@ai-sdk/gateway 4.0.97 → 4.0.100

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.
@@ -620,7 +620,7 @@ import { gateway, generateText } from 'ai';
620
620
 
621
621
  // Make a request
622
622
  const result = await generateText({
623
- model: gateway('anthropic/claude-sonnet-5'),
623
+ model: gateway('anthropic/claude-sonnet-5.5'),
624
624
  prompt: 'Explain quantum entanglement briefly',
625
625
  });
626
626
 
@@ -643,7 +643,7 @@ With `streamText`, you can capture the generation ID from the first chunk via `s
643
643
  import { gateway, streamText } from 'ai';
644
644
 
645
645
  const result = streamText({
646
- model: gateway('anthropic/claude-sonnet-5'),
646
+ model: gateway('anthropic/claude-sonnet-5.5'),
647
647
  prompt: 'Explain quantum entanglement briefly',
648
648
  });
649
649
 
@@ -673,7 +673,7 @@ a tool is running:
673
673
  import { gateway, generateText } from 'ai';
674
674
 
675
675
  await generateText({
676
- model: gateway('anthropic/claude-sonnet-5'),
676
+ model: gateway('anthropic/claude-sonnet-5.5'),
677
677
  prompt: 'Explain quantum entanglement briefly',
678
678
  onLanguageModelCallEnd({ providerMetadata }) {
679
679
  const generationId = providerMetadata?.gateway?.generationId as
@@ -720,7 +720,7 @@ It returns a `GatewayGenerationInfo` object with the following fields:
720
720
  import { generateText } from 'ai';
721
721
 
722
722
  const { text } = await generateText({
723
- model: 'anthropic/claude-sonnet-5',
723
+ model: 'anthropic/claude-sonnet-5.5',
724
724
  prompt: 'Write a haiku about programming',
725
725
  });
726
726
 
@@ -1375,7 +1375,7 @@ The `getSpendReport()` method accepts the following parameters:
1375
1375
  - **groupBy** _string_ - Aggregation dimension: `'day'` (default), `'user'`, `'model'`, `'tag'`, `'provider'`, or `'credential_type'`
1376
1376
  - **datePart** _string_ - Time granularity when `groupBy` is `'day'`: `'day'` or `'hour'`
1377
1377
  - **userId** _string_ - Filter to a specific user
1378
- - **model** _string_ - Filter to a specific model (e.g. `'anthropic/claude-sonnet-5'`)
1378
+ - **model** _string_ - Filter to a specific model (e.g. `'anthropic/claude-sonnet-5.5'`)
1379
1379
  - **provider** _string_ - Filter to a specific provider (e.g. `'anthropic'`)
1380
1380
  - **credentialType** _string_ - Filter by `'byok'` or `'system'` credentials
1381
1381
  - **tags** _string[]_ - Filter to requests matching these tags
@@ -1434,7 +1434,7 @@ import type { GatewayProviderOptions } from '@ai-sdk/gateway';
1434
1434
  import { generateText } from 'ai';
1435
1435
 
1436
1436
  const { text } = await generateText({
1437
- model: 'anthropic/claude-sonnet-5',
1437
+ model: 'anthropic/claude-sonnet-5.5',
1438
1438
  prompt: 'Explain quantum computing',
1439
1439
  providerOptions: {
1440
1440
  gateway: {
@@ -1478,7 +1478,7 @@ The following gateway provider options are available:
1478
1478
 
1479
1479
  Example: `models: ['openai/gpt-5.4-nano', 'google/gemini-3.8-flash']` will try the fallback models in order if the primary model fails.
1480
1480
 
1481
- A direct condition uses `{ question, confidenceBelow }` for Choice and Score questions, or `{ question, probabilityBetween: [minimum, maximum] }` for Boolean questions. Boolean probability is P(true), not confidence in the selected Boolean outcome. Bounds are inclusive, finite, ordered, and within `[0, 1]`.
1481
+ A direct condition uses `{ question, confidenceBelow }` for Choice and Score questions, or `{ question, probabilityBetween: [minimum, maximum] }` for Boolean questions. Leave out `question` to check every question of that type: `{ confidenceBelow: 0.6 }` matches when any Choice or Score answer is below 0.6, and a request with no Choice or Score questions never matches it. Boolean probability is P(true), not confidence in the selected Boolean outcome. Bounds are inclusive, finite, ordered, and within `[0, 1]`.
1482
1482
 
1483
1483
  Combine conditions with `{ any: [...] }`, `{ all: [...] }`, or `{ atLeast: { count, conditions: [...] } }`. Each condition list holds 1 to 20 conditions. `atLeast.count` must be an integer from `1` through the number of conditions. Conditions nest at most 5 levels deep. Question IDs are 1 to 256 characters, and the conditional `model` must not be empty. The SDK checks these bounds before sending the request, and the gateway also checks that each question exists and has a kind that matches its condition. String error fallbacks may follow the conditional entry.
1484
1484
 
@@ -1576,7 +1576,7 @@ import type { GatewayProviderOptions } from '@ai-sdk/gateway';
1576
1576
  import { generateText } from 'ai';
1577
1577
 
1578
1578
  const { text } = await generateText({
1579
- model: 'anthropic/claude-sonnet-5',
1579
+ model: 'anthropic/claude-sonnet-5.5',
1580
1580
  prompt: 'Write a haiku about programming',
1581
1581
  providerOptions: {
1582
1582
  gateway: {
@@ -1678,7 +1678,7 @@ import type { GatewayProviderOptions } from '@ai-sdk/gateway';
1678
1678
  import { generateText } from 'ai';
1679
1679
 
1680
1680
  const { text } = await generateText({
1681
- model: 'anthropic/claude-sonnet-5',
1681
+ model: 'anthropic/claude-sonnet-5.5',
1682
1682
  prompt: 'Analyze this sensitive document...',
1683
1683
  providerOptions: {
1684
1684
  gateway: {
@@ -1697,7 +1697,7 @@ import type { GatewayProviderOptions } from '@ai-sdk/gateway';
1697
1697
  import { generateText } from 'ai';
1698
1698
 
1699
1699
  const { text } = await generateText({
1700
- model: 'anthropic/claude-sonnet-5',
1700
+ model: 'anthropic/claude-sonnet-5.5',
1701
1701
  prompt: 'Analyze this proprietary business data...',
1702
1702
  providerOptions: {
1703
1703
  gateway: {
@@ -1716,7 +1716,7 @@ import type { GatewayProviderOptions } from '@ai-sdk/gateway';
1716
1716
  import { generateText } from 'ai';
1717
1717
 
1718
1718
  const { text } = await generateText({
1719
- model: 'anthropic/claude-sonnet-5',
1719
+ model: 'anthropic/claude-sonnet-5.5',
1720
1720
  prompt: 'Summarize this report...',
1721
1721
  providerOptions: {
1722
1722
  gateway: {
@@ -1754,7 +1754,7 @@ import { generateText } from 'ai';
1754
1754
  import fs from 'node:fs';
1755
1755
 
1756
1756
  const { text } = await generateText({
1757
- model: 'anthropic/claude-sonnet-5',
1757
+ model: 'anthropic/claude-sonnet-5.5',
1758
1758
  messages: [
1759
1759
  {
1760
1760
  role: 'user',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ai-sdk/gateway",
3
3
  "private": false,
4
- "version": "4.0.97",
4
+ "version": "4.0.100",
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.19",
34
- "@ai-sdk/provider-utils": "5.0.50",
34
+ "@ai-sdk/provider-utils": "5.0.51",
35
35
  "@vercel/oidc": "3.2.0"
36
36
  },
37
37
  "devDependencies": {
@@ -53,6 +53,7 @@ export type GatewayModelId =
53
53
  | 'anthropic/claude-sonnet-4.5'
54
54
  | 'anthropic/claude-sonnet-4.6'
55
55
  | 'anthropic/claude-sonnet-5'
56
+ | 'anthropic/claude-sonnet-5.5'
56
57
  | 'arcee-ai/trinity-large-thinking'
57
58
  | 'bytedance/seed-1.6'
58
59
  | 'bytedance/seed-1.8'
@@ -94,13 +95,13 @@ export type GatewayModelId =
94
95
  | 'inception/mercury-coder-small'
95
96
  | 'inclusionai/ling-3.0-flash'
96
97
  | 'inclusionai/ling-3.0-flash-fin'
97
- | 'inclusionai/ling-3.0-flash-fin-free'
98
98
  | 'inclusionai/ling-3.0-flash-sante'
99
99
  | 'inclusionai/ling-3.0-flash-sante-free'
100
100
  | 'inclusionai/ling-3.0-flash-vl'
101
101
  | 'inference-net/schematron-v2-small'
102
102
  | 'inference-net/schematron-v2-turbo'
103
103
  | 'interfaze/interfaze-beta'
104
+ | 'meituan/longcat-2.5-preview'
104
105
  | 'meta/llama-3.1-70b'
105
106
  | 'meta/llama-3.1-8b'
106
107
  | 'meta/llama-3.3-70b'
@@ -208,8 +209,6 @@ export type GatewayModelId =
208
209
  | 'openai/o4-mini'
209
210
  | 'openai/o4-mini-fast'
210
211
  | 'perplexity/sonar'
211
- | 'perplexity/sonar-pro'
212
- | 'perplexity/sonar-reasoning-pro'
213
212
  | 'poolside/laguna-s-2.1'
214
213
  | 'poolside/laguna-s-2.1-free'
215
214
  | 'quiverai/arrow-2'
@@ -231,6 +230,7 @@ export type GatewayModelId =
231
230
  | 'spacexai/grok-4.6'
232
231
  | 'spacexai/grok-4.7'
233
232
  | 'spacexai/grok-build-0.1'
233
+ | 'stealth/pixel-canary'
234
234
  | 'stepfun/step-3.5-flash'
235
235
  | 'stepfun/step-3.7-flash'
236
236
  | 'stepfun/step-5-preview'
@@ -19,13 +19,15 @@ export const gatewayEvaluationProviderOptionsSchema = lazySchema(() =>
19
19
 
20
20
  /**
21
21
  * A condition on the primary model's answers. `QUESTION_ID` narrows
22
- * `question` to your question IDs. Groups nest at most five levels deep,
23
- * which the SDK checks at runtime.
22
+ * `question` to your question IDs. Without `question`, `confidenceBelow`
23
+ * checks every Choice and Score question and `probabilityBetween` every
24
+ * Boolean question. Groups nest at most five levels deep, which the SDK
25
+ * checks at runtime.
24
26
  */
25
27
  export type EvaluationFallbackCondition<QUESTION_ID extends string = string> =
26
- | ExclusiveCondition<{ question: QUESTION_ID; confidenceBelow: number }>
28
+ | ExclusiveCondition<{ question?: QUESTION_ID; confidenceBelow: number }>
27
29
  | ExclusiveCondition<{
28
- question: QUESTION_ID;
30
+ question?: QUESTION_ID;
29
31
  probabilityBetween: [number, number];
30
32
  }>
31
33
  | ExclusiveCondition<{ any: EvaluationFallbackConditionList<QUESTION_ID> }>
@@ -162,13 +164,13 @@ const questionSchema = z
162
164
  const directConditionSchema = z.union([
163
165
  z
164
166
  .object({
165
- question: questionSchema,
167
+ question: questionSchema.optional(),
166
168
  confidenceBelow: probabilitySchema,
167
169
  })
168
170
  .strict(),
169
171
  z
170
172
  .object({
171
- question: questionSchema,
173
+ question: questionSchema.optional(),
172
174
  probabilityBetween: z
173
175
  .array(probabilitySchema)
174
176
  .length(2)
@@ -330,7 +330,7 @@ export function createGateway(
330
330
  : {}),
331
331
  ...options.headers,
332
332
  },
333
- `ai-sdk/gateway/${VERSION}`,
333
+ `ai-sdk-gateway/${VERSION}`,
334
334
  );
335
335
 
336
336
  const getHeaders = async () => {