@ai-sdk/gateway
Advanced tools
| import type { SharedV3Warning } from '@ai-sdk/provider'; | ||
| type GatewayResponseWarning = | ||
| | SharedV3Warning | ||
| | { type: 'deprecated'; setting: string; message: string }; | ||
| /** | ||
| * Maps warnings from gateway responses to `SharedV3Warning`. | ||
| * | ||
| * The gateway backend can emit `deprecated` warnings, which the v3 | ||
| * specification cannot represent — they are mapped to `other` warnings. | ||
| */ | ||
| export function mapGatewayWarnings( | ||
| warnings: Array<GatewayResponseWarning> | undefined, | ||
| ): Array<SharedV3Warning> { | ||
| return (warnings ?? []).map(warning => | ||
| warning.type === 'deprecated' | ||
| ? { type: 'other', message: warning.message } | ||
| : warning, | ||
| ); | ||
| } |
+9
-0
| # @ai-sdk/gateway | ||
| ## 3.0.145 | ||
| ### Patch Changes | ||
| - 9c54a9f: fix(gateway): accept deprecated warnings in image, speech, transcription, and video responses | ||
| - bbc4bd5: Backport: chore(provider/gateway): update gateway model settings files | ||
| - Updated dependencies [d559de9] | ||
| - @ai-sdk/provider-utils@4.0.37 | ||
| ## 3.0.144 | ||
@@ -4,0 +13,0 @@ |
+1
-1
@@ -13,3 +13,3 @@ import { LanguageModelV3, ProviderV3, EmbeddingModelV3, ImageModelV3, Experimental_VideoModelV3, RerankingModelV3, SpeechModelV3, TranscriptionModelV3, TypeValidationError } from '@ai-sdk/provider'; | ||
| type GatewayVideoModelId = 'alibaba/wan-v2.5-t2v-preview' | 'alibaba/wan-v2.6-i2v' | 'alibaba/wan-v2.6-i2v-flash' | 'alibaba/wan-v2.6-r2v' | 'alibaba/wan-v2.6-r2v-flash' | 'alibaba/wan-v2.6-t2v' | 'bytedance/seedance-2.0' | 'bytedance/seedance-2.0-fast' | 'bytedance/seedance-v1.0-pro' | 'bytedance/seedance-v1.0-pro-fast' | 'bytedance/seedance-v1.5-pro' | 'google/veo-3.0-fast-generate-001' | 'google/veo-3.0-generate-001' | 'google/veo-3.1-fast-generate-001' | 'google/veo-3.1-generate-001' | 'klingai/kling-v2.5-turbo-i2v' | 'klingai/kling-v2.5-turbo-t2v' | 'klingai/kling-v2.6-i2v' | 'klingai/kling-v2.6-motion-control' | 'klingai/kling-v2.6-t2v' | 'klingai/kling-v3.0-i2v' | 'klingai/kling-v3.0-motion-control' | 'klingai/kling-v3.0-t2v' | 'xai/grok-imagine-video' | 'xai/grok-imagine-video-1.5' | 'xai/grok-imagine-video-1.5-preview' | (string & {}); | ||
| type GatewayVideoModelId = 'alibaba/wan-v2.5-t2v-preview' | 'alibaba/wan-v2.6-i2v' | 'alibaba/wan-v2.6-i2v-flash' | 'alibaba/wan-v2.6-r2v' | 'alibaba/wan-v2.6-r2v-flash' | 'alibaba/wan-v2.6-t2v' | 'alibaba/wan-v2.7-r2v' | 'alibaba/wan-v2.7-t2v' | 'bytedance/seedance-2.0' | 'bytedance/seedance-2.0-fast' | 'bytedance/seedance-v1.0-pro' | 'bytedance/seedance-v1.0-pro-fast' | 'bytedance/seedance-v1.5-pro' | 'google/veo-3.0-fast-generate-001' | 'google/veo-3.0-generate-001' | 'google/veo-3.1-fast-generate-001' | 'google/veo-3.1-generate-001' | 'klingai/kling-v2.5-turbo-i2v' | 'klingai/kling-v2.5-turbo-t2v' | 'klingai/kling-v2.6-i2v' | 'klingai/kling-v2.6-motion-control' | 'klingai/kling-v2.6-t2v' | 'klingai/kling-v3.0-i2v' | 'klingai/kling-v3.0-motion-control' | 'klingai/kling-v3.0-t2v' | 'xai/grok-imagine-video' | 'xai/grok-imagine-video-1.5' | 'xai/grok-imagine-video-1.5-preview' | (string & {}); | ||
@@ -16,0 +16,0 @@ declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "speech", "transcription", "video"]; |
+1
-1
@@ -13,3 +13,3 @@ import { LanguageModelV3, ProviderV3, EmbeddingModelV3, ImageModelV3, Experimental_VideoModelV3, RerankingModelV3, SpeechModelV3, TranscriptionModelV3, TypeValidationError } from '@ai-sdk/provider'; | ||
| type GatewayVideoModelId = 'alibaba/wan-v2.5-t2v-preview' | 'alibaba/wan-v2.6-i2v' | 'alibaba/wan-v2.6-i2v-flash' | 'alibaba/wan-v2.6-r2v' | 'alibaba/wan-v2.6-r2v-flash' | 'alibaba/wan-v2.6-t2v' | 'bytedance/seedance-2.0' | 'bytedance/seedance-2.0-fast' | 'bytedance/seedance-v1.0-pro' | 'bytedance/seedance-v1.0-pro-fast' | 'bytedance/seedance-v1.5-pro' | 'google/veo-3.0-fast-generate-001' | 'google/veo-3.0-generate-001' | 'google/veo-3.1-fast-generate-001' | 'google/veo-3.1-generate-001' | 'klingai/kling-v2.5-turbo-i2v' | 'klingai/kling-v2.5-turbo-t2v' | 'klingai/kling-v2.6-i2v' | 'klingai/kling-v2.6-motion-control' | 'klingai/kling-v2.6-t2v' | 'klingai/kling-v3.0-i2v' | 'klingai/kling-v3.0-motion-control' | 'klingai/kling-v3.0-t2v' | 'xai/grok-imagine-video' | 'xai/grok-imagine-video-1.5' | 'xai/grok-imagine-video-1.5-preview' | (string & {}); | ||
| type GatewayVideoModelId = 'alibaba/wan-v2.5-t2v-preview' | 'alibaba/wan-v2.6-i2v' | 'alibaba/wan-v2.6-i2v-flash' | 'alibaba/wan-v2.6-r2v' | 'alibaba/wan-v2.6-r2v-flash' | 'alibaba/wan-v2.6-t2v' | 'alibaba/wan-v2.7-r2v' | 'alibaba/wan-v2.7-t2v' | 'bytedance/seedance-2.0' | 'bytedance/seedance-2.0-fast' | 'bytedance/seedance-v1.0-pro' | 'bytedance/seedance-v1.0-pro-fast' | 'bytedance/seedance-v1.5-pro' | 'google/veo-3.0-fast-generate-001' | 'google/veo-3.0-generate-001' | 'google/veo-3.1-fast-generate-001' | 'google/veo-3.1-generate-001' | 'klingai/kling-v2.5-turbo-i2v' | 'klingai/kling-v2.5-turbo-t2v' | 'klingai/kling-v2.6-i2v' | 'klingai/kling-v2.6-motion-control' | 'klingai/kling-v2.6-t2v' | 'klingai/kling-v3.0-i2v' | 'klingai/kling-v3.0-motion-control' | 'klingai/kling-v3.0-t2v' | 'xai/grok-imagine-video' | 'xai/grok-imagine-video-1.5' | 'xai/grok-imagine-video-1.5-preview' | (string & {}); | ||
@@ -16,0 +16,0 @@ declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "speech", "transcription", "video"]; |
+4
-4
| { | ||
| "name": "@ai-sdk/gateway", | ||
| "private": false, | ||
| "version": "3.0.144", | ||
| "version": "3.0.145", | ||
| "license": "Apache-2.0", | ||
@@ -35,3 +35,3 @@ "sideEffects": false, | ||
| "@ai-sdk/provider": "3.0.13", | ||
| "@ai-sdk/provider-utils": "4.0.36" | ||
| "@ai-sdk/provider-utils": "4.0.37" | ||
| }, | ||
@@ -44,4 +44,4 @@ "devDependencies": { | ||
| "zod": "3.25.76", | ||
| "@vercel/ai-tsconfig": "0.0.0", | ||
| "@ai-sdk/test-server": "1.0.6" | ||
| "@ai-sdk/test-server": "1.0.6", | ||
| "@vercel/ai-tsconfig": "0.0.0" | ||
| }, | ||
@@ -48,0 +48,0 @@ "peerDependencies": { |
@@ -16,2 +16,3 @@ import type { | ||
| import { z } from 'zod/v4'; | ||
| import { mapGatewayWarnings } from './map-gateway-warnings'; | ||
| import type { GatewayConfig } from './gateway-config'; | ||
@@ -91,3 +92,3 @@ import { asGatewayError } from './errors'; | ||
| images: responseBody.images, // Always base64 strings from server | ||
| warnings: responseBody.warnings ?? [], | ||
| warnings: mapGatewayWarnings(responseBody.warnings), | ||
| providerMetadata: | ||
@@ -153,2 +154,7 @@ responseBody.providerMetadata as ImageModelV3ProviderMetadata, | ||
| z.object({ | ||
| type: z.literal('deprecated'), | ||
| setting: z.string(), | ||
| message: z.string(), | ||
| }), | ||
| z.object({ | ||
| type: z.literal('other'), | ||
@@ -155,0 +161,0 @@ message: z.string(), |
@@ -1,6 +0,2 @@ | ||
| import type { | ||
| SharedV3ProviderMetadata, | ||
| SharedV3Warning, | ||
| SpeechModelV3, | ||
| } from '@ai-sdk/provider'; | ||
| import type { SharedV3ProviderMetadata, SpeechModelV3 } from '@ai-sdk/provider'; | ||
| import { | ||
@@ -15,2 +11,3 @@ combineHeaders, | ||
| import { z } from 'zod/v4'; | ||
| import { mapGatewayWarnings } from './map-gateway-warnings'; | ||
| import { asGatewayError } from './errors'; | ||
@@ -84,3 +81,3 @@ import { parseAuthMethod } from './errors/parse-auth-method'; | ||
| audio: responseBody.audio, | ||
| warnings: (responseBody.warnings ?? []) as Array<SharedV3Warning>, | ||
| warnings: mapGatewayWarnings(responseBody.warnings), | ||
| providerMetadata: | ||
@@ -129,2 +126,7 @@ responseBody.providerMetadata as SharedV3ProviderMetadata, | ||
| z.object({ | ||
| type: z.literal('deprecated'), | ||
| setting: z.string(), | ||
| message: z.string(), | ||
| }), | ||
| z.object({ | ||
| type: z.literal('other'), | ||
@@ -131,0 +133,0 @@ message: z.string(), |
| import type { | ||
| SharedV3ProviderMetadata, | ||
| SharedV3Warning, | ||
| TranscriptionModelV3, | ||
@@ -16,2 +15,3 @@ } from '@ai-sdk/provider'; | ||
| import { z } from 'zod/v4'; | ||
| import { mapGatewayWarnings } from './map-gateway-warnings'; | ||
| import { asGatewayError } from './errors'; | ||
@@ -83,3 +83,3 @@ import { parseAuthMethod } from './errors/parse-auth-method'; | ||
| durationInSeconds: responseBody.durationInSeconds ?? undefined, | ||
| warnings: (responseBody.warnings ?? []) as Array<SharedV3Warning>, | ||
| warnings: mapGatewayWarnings(responseBody.warnings), | ||
| providerMetadata: | ||
@@ -128,2 +128,7 @@ responseBody.providerMetadata as SharedV3ProviderMetadata, | ||
| z.object({ | ||
| type: z.literal('deprecated'), | ||
| setting: z.string(), | ||
| message: z.string(), | ||
| }), | ||
| z.object({ | ||
| type: z.literal('other'), | ||
@@ -130,0 +135,0 @@ message: z.string(), |
@@ -8,2 +8,4 @@ export type GatewayVideoModelId = | ||
| | 'alibaba/wan-v2.6-t2v' | ||
| | 'alibaba/wan-v2.7-r2v' | ||
| | 'alibaba/wan-v2.7-t2v' | ||
| | 'bytedance/seedance-2.0' | ||
@@ -10,0 +12,0 @@ | 'bytedance/seedance-2.0-fast' |
@@ -20,2 +20,3 @@ import { | ||
| import { z } from 'zod/v4'; | ||
| import { mapGatewayWarnings } from './map-gateway-warnings'; | ||
| import type { GatewayConfig } from './gateway-config'; | ||
@@ -187,3 +188,3 @@ import { asGatewayError } from './errors'; | ||
| videos: responseBody.videos, | ||
| warnings: responseBody.warnings ?? [], | ||
| warnings: mapGatewayWarnings(responseBody.warnings), | ||
| providerMetadata: | ||
@@ -255,2 +256,7 @@ responseBody.providerMetadata as SharedV3ProviderMetadata, | ||
| z.object({ | ||
| type: z.literal('deprecated'), | ||
| setting: z.string(), | ||
| message: z.string(), | ||
| }), | ||
| z.object({ | ||
| type: z.literal('other'), | ||
@@ -257,0 +263,0 @@ message: z.string(), |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
785996
0.89%55
1.85%9745
0.93%+ Added
- Removed