@ai-sdk/gateway 4.0.153 → 4.0.155
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 +20 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/gateway-model-catalog.ts +3 -3
- package/src/gateway-video-model.ts +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @ai-sdk/gateway
|
|
2
2
|
|
|
3
|
+
## 4.0.155
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ff3b865: chore(provider/gateway): update gateway model settings files
|
|
8
|
+
- aa7cb79: fix(provider-utils): limit the size of a single server-sent event
|
|
9
|
+
|
|
10
|
+
`parseJsonEventStream` and `createEventSourceResponseHandler` buffered an event until it was complete, without a limit. A streaming response that never completed an event could exhaust the memory and crash the process. A single event is now limited to 67,108,864 characters (64 MiB of ASCII text). A stream that exceeds the limit fails with an error and the response body is cancelled.
|
|
11
|
+
|
|
12
|
+
The limit also applies to the streams that `useChat` and `useCompletion` read. `parseJsonEventStream` has a new `maxEventSize` option to change it. The gateway video model uses it to accept a result event of up to 536,870,912 characters, because that event contains the generated videos.
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [aa7cb79]
|
|
15
|
+
- @ai-sdk/provider-utils@5.0.84
|
|
16
|
+
|
|
17
|
+
## 4.0.154
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- f2732a6: chore(provider/gateway): update gateway model settings files
|
|
22
|
+
|
|
3
23
|
## 4.0.153
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { FetchFunction, InferSchema, Resolvable, WebSocketConstructor } from "@a
|
|
|
2
2
|
import { APICallError, EmbeddingModelV4, Experimental_BatchV4, Experimental_DecisionModelV4, Experimental_ExtractionModelV4, Experimental_RealtimeFactoryV4, Experimental_RealtimeFactoryV4GetTokenOptions, Experimental_RealtimeFactoryV4GetTokenResult, Experimental_RealtimeModelV4, Experimental_RealtimeModelV4ClientEvent, Experimental_RealtimeModelV4ClientSecretOptions, Experimental_RealtimeModelV4ClientSecretResult, Experimental_RealtimeModelV4ServerConnection, Experimental_RealtimeModelV4ServerEvent, Experimental_RealtimeModelV4SessionConfig, Experimental_RealtimeModelV4SessionIntent, Experimental_StreamingSpeechModelV4, Experimental_VideoModelV4, ImageModelV4, JSONValue, LanguageModelV4, ProviderV4, RerankingModelV4, SpeechModelV4, TranscriptionModelV4, TypeValidationError } from "@ai-sdk/provider";
|
|
3
3
|
//#region src/gateway-model-catalog.d.ts
|
|
4
4
|
declare const gatewayModelIds: {
|
|
5
|
-
readonly language: readonly ["alibaba/qwen-3-14b", "alibaba/qwen-3-30b", "alibaba/qwen-3-32b", "alibaba/qwen3-coder-30b-a3b", "alibaba/qwen3-coder-next", "alibaba/qwen3-
|
|
5
|
+
readonly language: readonly ["alibaba/qwen-3-14b", "alibaba/qwen-3-30b", "alibaba/qwen-3-32b", "alibaba/qwen3-coder-30b-a3b", "alibaba/qwen3-coder-next", "alibaba/qwen3-next-80b-a3b-instruct", "alibaba/qwen3-vl-instruct", "alibaba/qwen3.5-flash", "alibaba/qwen3.5-plus", "alibaba/qwen3.6-27b", "alibaba/qwen3.6-35b-a3b", "alibaba/qwen3.6-plus", "alibaba/qwen3.7-flash", "alibaba/qwen3.7-max", "alibaba/qwen3.7-plus", "alibaba/qwen3.8-2.4t-a95b", "alibaba/qwen3.8-27b", "alibaba/qwen3.8-flash", "alibaba/qwen3.8-max", "alibaba/qwen3.8-max-0902", "alibaba/qwen3.8-max-prime", "alibaba/qwen3.8-omni-flash", "alibaba/qwen4-max", "amazon/nova-2-lite", "amazon/nova-lite", "amazon/nova-micro", "amazon/nova-pro", "anthropic/claude-fable-5", "anthropic/claude-fable-5-batch", "anthropic/claude-fable-5.1", "anthropic/claude-fable-5.1-batch", "anthropic/claude-fable-5.2", "anthropic/claude-fable-5.2-batch", "anthropic/claude-fable-5.2-fast", "anthropic/claude-haiku-4.5", "anthropic/claude-haiku-4.5-batch", "anthropic/claude-haiku-5.5", "anthropic/claude-haiku-5.5-batch", "anthropic/claude-opus-4.5", "anthropic/claude-opus-4.5-batch", "anthropic/claude-opus-4.6", "anthropic/claude-opus-4.6-batch", "anthropic/claude-opus-4.7", "anthropic/claude-opus-4.7-batch", "anthropic/claude-opus-4.8", "anthropic/claude-opus-4.8-batch", "anthropic/claude-opus-4.8-fast", "anthropic/claude-opus-5", "anthropic/claude-opus-5-batch", "anthropic/claude-opus-5-fast", "anthropic/claude-opus-5.5", "anthropic/claude-opus-5.5-batch", "anthropic/claude-opus-5.5-fast", "anthropic/claude-sonnet-4.5", "anthropic/claude-sonnet-4.5-batch", "anthropic/claude-sonnet-4.6", "anthropic/claude-sonnet-4.6-batch", "anthropic/claude-sonnet-5", "anthropic/claude-sonnet-5-batch", "anthropic/claude-sonnet-5.5", "anthropic/claude-sonnet-5.5-batch", "bytedance/seed-2.1-turbo", "callstack/apex", "cohere/command-a", "deepseek/deepseek-r1", "deepseek/deepseek-v3.1", "deepseek/deepseek-v3.2", "deepseek/deepseek-v3.2-thinking", "deepseek/deepseek-v4-flash", "deepseek/deepseek-v4-flash-0731", "deepseek/deepseek-v4-flash-vision-exp", "deepseek/deepseek-v4-pro", "deepseek/deepseek-v4-pro-0813", "deepseek/deepseek-v4.1-flash", "deepseek/deepseek-v4.1-flash-1017", "deepseek/deepseek-v4.1-flash-1017-fast", "deepseek/deepseek-v4.1-flash-1017-ultrafast", "deepseek/deepseek-v4.1-flash-fast", "elorian/glimpse", "fireworks/ember-1", "google/gemini-2.5-flash", "google/gemini-2.5-flash-batch", "google/gemini-2.5-flash-image", "google/gemini-2.5-flash-lite", "google/gemini-2.5-flash-lite-batch", "google/gemini-2.5-pro", "google/gemini-2.5-pro-batch", "google/gemini-3-flash", "google/gemini-3-flash-batch", "google/gemini-3-pro-image", "google/gemini-3.1-flash-image", "google/gemini-3.1-flash-lite", "google/gemini-3.1-flash-lite-batch", "google/gemini-3.1-flash-lite-image", "google/gemini-3.1-pro-preview", "google/gemini-3.1-pro-preview-batch", "google/gemini-3.5-flash", "google/gemini-3.5-flash-lite", "google/gemini-3.5-flash-lite-batch", "google/gemini-3.6-flash", "google/gemini-3.6-flash-batch", "google/gemini-3.7-flash", "google/gemini-3.8-flash", "google/gemini-4-argon", "google/gemini-4-carbon", "google/gemini-4-hydrogen", "google/gemini-4-neon", "google/gemini-nano-banana-2.1", "google/gemini-omni-1.2-flash", "google/gemini-omni-flash-preview", "google/gemma-4-26b-a4b-it", "google/gemma-4-31b-it", "humansand/ampersand-v0.1", "inception/mercury-3", "inclusionai/ling-3.0-flash", "inclusionai/ling-3.0-flash-fin", "inclusionai/ling-3.0-flash-sante", "inclusionai/ling-3.0-flash-vl", "inclusionai/ling-3.1-flash", "inclusionai/ling-3.1-flash-1019", "inference-net/schematron-v2-small", "inference-net/schematron-v2-turbo", "interfaze/interfaze-beta", "liquid/lfm2.5-24b-a2b", "meituan/longcat-2.5", "meta/llama-3.1-70b", "meta/llama-3.1-8b", "meta/llama-3.3-70b", "meta/llama-4-maverick", "meta/llama-4-scout", "meta/muse-ember", "meta/muse-glimmer-30b", "meta/muse-spark-1.1", "meta/muse-spark-1.2", "meta/muse-spark-1.2-contributor", "meta/muse-spark-1.3", "meta/muse-spark-1.3-contributor", "meta/muse-spark-open", "meta/muse-wonder-1.0", "minimax/minimax-m2.1", "minimax/minimax-m2.5", "minimax/minimax-m2.7", "minimax/minimax-m3", "minimax/minimax-m3.1-flash", "mistral/codestral", "mistral/ministral-14b", "mistral/ministral-3b", "mistral/ministral-8b", "mistral/mistral-large-3", "mistral/mistral-large-4", "mistral/mistral-medium-3.5", "mistral/mistral-nemo", "mistral/mistral-small", "mixedbread/toast-1", "moonshotai/kimi-k2", "moonshotai/kimi-k2.5", "moonshotai/kimi-k2.6", "moonshotai/kimi-k2.7-code", "moonshotai/kimi-k2.7-code-highspeed", "moonshotai/kimi-k3", "moonshotai/kimi-k3-fast", "moonshotai/kimi-k3.1-pro", "moonshotai/kimi-k3.1-pro-highspeed", "morph/morph-v3-fast", "morph/morph-v3-large", "nvidia/nemotron-3-super-120b-a12b", "nvidia/nemotron-3-ultra-550b-a55b", "nvidia/nemotron-3.5-lightning", "nvidia/nemotron-3.5-lightning-free", "nvidia/nemotron-3.5-super-vl", "nvidia/nemotron-nano-12b-v2-vl", "nvidia/nemotron-nano-9b-v2", "openai/gpt-4.1", "openai/gpt-4.1-batch", "openai/gpt-4.1-fast", "openai/gpt-4.1-mini", "openai/gpt-4.1-mini-batch", "openai/gpt-4.1-mini-fast", "openai/gpt-4.1-nano", "openai/gpt-4o", "openai/gpt-4o-batch", "openai/gpt-4o-fast", "openai/gpt-4o-mini", "openai/gpt-4o-mini-batch", "openai/gpt-4o-mini-fast", "openai/gpt-5", "openai/gpt-5-batch", "openai/gpt-5-codex", "openai/gpt-5-fast", "openai/gpt-5-mini", "openai/gpt-5-mini-batch", "openai/gpt-5-mini-fast", "openai/gpt-5-nano", "openai/gpt-5-nano-batch", "openai/gpt-5-pro", "openai/gpt-5-pro-batch", "openai/gpt-5.1-codex", "openai/gpt-5.1-codex-max", "openai/gpt-5.1-codex-mini", "openai/gpt-5.1-thinking", "openai/gpt-5.1-thinking-fast", "openai/gpt-5.2", "openai/gpt-5.2-batch", "openai/gpt-5.2-codex", "openai/gpt-5.2-fast", "openai/gpt-5.2-pro", "openai/gpt-5.3-codex", "openai/gpt-5.3-codex-fast", "openai/gpt-5.4", "openai/gpt-5.4-batch", "openai/gpt-5.4-fast", "openai/gpt-5.4-mini", "openai/gpt-5.4-mini-batch", "openai/gpt-5.4-mini-fast", "openai/gpt-5.4-nano", "openai/gpt-5.4-nano-batch", "openai/gpt-5.4-pro", "openai/gpt-5.5", "openai/gpt-5.5-batch", "openai/gpt-5.5-fast", "openai/gpt-5.5-pro", "openai/gpt-5.5-pro-batch", "openai/gpt-5.6-luna", "openai/gpt-5.6-luna-batch", "openai/gpt-5.6-luna-fast", "openai/gpt-5.6-sol", "openai/gpt-5.6-sol-batch", "openai/gpt-5.6-sol-fast", "openai/gpt-5.6-terra", "openai/gpt-5.6-terra-batch", "openai/gpt-5.6-terra-fast", "openai/gpt-6-astra", "openai/gpt-6-astra-batch", "openai/gpt-6-astra-fast", "openai/gpt-6-luna", "openai/gpt-6-luna-batch", "openai/gpt-6-luna-fast", "openai/gpt-6-sol", "openai/gpt-6-sol-batch", "openai/gpt-6-sol-fast", "openai/gpt-6.1-sol", "openai/gpt-6.1-sol-batch", "openai/gpt-6.1-sol-fast", "openai/gpt-6.1-terra", "openai/gpt-6.1-terra-fast", "openai/gpt-6.2-astra", "openai/gpt-6.2-astra-fast", "openai/gpt-6.2-sol", "openai/gpt-6.2-sol-fast", "openai/gpt-oss-120b", "openai/gpt-oss-20b", "openai/gpt-oss-safeguard-120b", "openai/gpt-oss-safeguard-20b", "openai/o1", "openai/o3", "openai/o3-fast", "openai/o3-mini", "openai/o3-pro", "openai/o4-mini", "paperinstruments/ultramarine-1-flash", "particle/particle-1", "perplexity/sonar", "quiverai/arrow-2", "quiverai/arrow-2-telos", "recursive/flint-v1.0", "reflection/beam", "reflection/beam-free", "sakana/fugu-max", "sakana/fugu-ultra", "sakana/fugu-ultra-v2", "sakana/namazu", "scaledown/scaledown-extract-1", "scaledown/scaledown-summarize-1", "spacexai/grok-4.20-multi-agent", "spacexai/grok-4.20-multi-agent-batch", "spacexai/grok-4.20-multi-agent-beta", "spacexai/grok-4.20-non-reasoning", "spacexai/grok-4.20-non-reasoning-batch", "spacexai/grok-4.20-non-reasoning-beta", "spacexai/grok-4.20-reasoning", "spacexai/grok-4.20-reasoning-batch", "spacexai/grok-4.20-reasoning-beta", "spacexai/grok-4.3", "spacexai/grok-4.3-batch", "spacexai/grok-4.5", "spacexai/grok-4.6", "spacexai/grok-4.7", "stealth/glyph-cluster", "stepfun/step-3.7-flash", "stepfun/step-5-preview", "tencent/hy-mt2-lite", "tencent/hy-mt2-plus", "tencent/hy-mt2-pro", "tencent/hy3", "tencent/hy4", "tencent/hy4-flash", "tencent/hy4-preview", "thinkingmachines/inkling", "thinkingmachines/inkling-2-mini", "thinkingmachines/inkling-2-small", "thinkingmachines/inkling-small", "xiaomi/mimo-v2.6-flash", "xiaomi/mimo-v2.6-pro", "xiaomi/mimo-v2.6-pro-ultraspeed", "zai/glm-4.5", "zai/glm-4.5-air", "zai/glm-4.5v", "zai/glm-4.6", "zai/glm-4.7", "zai/glm-4.7-flash", "zai/glm-4.7-flashx", "zai/glm-5", "zai/glm-5-turbo", "zai/glm-5.1", "zai/glm-5.2", "zai/glm-5.2-fast", "zai/glm-5.3", "zai/glm-5.3-fast", "zai/glm-5.3-flash", "zai/glm-5.3-flashx", "zai/glm-5.3-flashx-legal", "zai/glm-5v-turbo"];
|
|
6
6
|
readonly embedding: readonly ["alibaba/qwen3-embedding-0.6b", "alibaba/qwen3-embedding-4b", "alibaba/qwen3-embedding-8b", "amazon/titan-embed-text-v2", "cohere/embed-v4.0", "cohere/embed-v5.0-fast", "cohere/embed-v5.0-pro", "google/gemini-embedding-001", "google/gemini-embedding-2", "google/text-embedding-005", "google/text-multilingual-embedding-002", "mistral/codestral-embed", "mistral/mistral-embed", "openai/text-embedding-3-large", "openai/text-embedding-3-small", "openai/text-embedding-ada-002", "perplexity/pplx-embed-v1-0.6b", "perplexity/pplx-embed-v1-4b", "voyage/voyage-3-large", "voyage/voyage-3.5", "voyage/voyage-3.5-lite", "voyage/voyage-4", "voyage/voyage-4-large", "voyage/voyage-4-lite", "voyage/voyage-code-2", "voyage/voyage-code-3", "voyage/voyage-finance-2", "voyage/voyage-law-2"];
|
|
7
|
-
readonly decision: readonly ["baseten/elephant-1", "baseten/joey-1", "baseten/mammoth-1", "convaiinnovations/laya", "google/gemini-decision-1", "heygen/heygen-decision-1", "heygen/heygen-decision-1-turbo", "liquid/d1
|
|
7
|
+
readonly decision: readonly ["baseten/bison-1", "baseten/elephant-1", "baseten/groundhog-1", "baseten/joey-1", "baseten/mammoth-1", "convaiinnovations/laya", "google/gemini-decision-1", "heygen/heygen-decision-1", "heygen/heygen-decision-1-turbo", "liquid/d1.2", "liquid/d1.2-ultra", "microsoft/decision-1.1", "microsoft/microsoft-decision-1", "modaic/mo", "nace-ai/drex-max-finance", "nace-ai/drex-max-v1.1", "nace-ai/drex-v2.0", "openai/gpt-6-luna-decisions", "parallel/parallel-decisions-fast", "perplexity/pplx-decider-flash-v1.2", "perplexity/pplx-decider-flash-v1.3", "perplexity/pplx-decider-v1.2", "perplexity/pplx-decider-v1.3", "scaledown/scaledown-classify-1", "typesafe-ai/jev", "typesafe-ai/jev-1.13.0", "typesafe-ai/jev-1.14.0"];
|
|
8
8
|
readonly extraction: readonly ["scaledown/extract-1"];
|
|
9
9
|
readonly image: readonly ["bfl/flux-2-flex", "bfl/flux-2-klein-4b", "bfl/flux-2-klein-9b", "bfl/flux-2-max", "bfl/flux-2-pro", "bfl/flux-3-image", "bfl/flux-3-image-klein", "bfl/flux-kontext-max", "bfl/flux-kontext-pro", "bfl/flux-pro-1.0-fill", "bfl/flux-pro-1.1", "bfl/flux-pro-1.1-ultra", "bytedance/seedream-4.0", "bytedance/seedream-4.5", "bytedance/seedream-5.0-lite", "bytedance/seedream-5.0-pro", "bytedance/seedream-5.5", "meta/muse-image-1.0", "microsoft/mai-image-2.6", "microsoft/mai-image-2.6-flash", "microsoft/mai-image-2.7", "microsoft/mai-image-2.7-flash", "minimax/minimax-h3-image", "minimax/minimax-h3-image-highspeed", "openai/gpt-image-1-mini", "openai/gpt-image-1.5", "openai/gpt-image-2", "openai/gpt-image-2.5-flare", "openai/gpt-image-2.5-sunburst", "openai/gpt-image-2.6-flare", "openai/gpt-image-2.6-sunburst", "recraft/recraft-v2", "recraft/recraft-v3", "recraft/recraft-v4", "recraft/recraft-v4-pro", "recraft/recraft-v4.1", "recraft/recraft-v4.1-flash", "recraft/recraft-v4.1-pro", "recraft/recraft-v4.1-utility", "recraft/recraft-v4.1-utility-pro", "spacexai/grok-imagine-image", "spacexai/grok-imagine-image-2.0", "topaz/wonder-3.5"];
|
|
10
10
|
readonly video: readonly ["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", "alibaba/wan-v3.0-video", "alibaba/wan-v3.0-video-prime", "bfl/flux-3-video", "bytedance/seedance-2.0", "bytedance/seedance-2.0-fast", "bytedance/seedance-2.0-mini", "bytedance/seedance-2.5", "bytedance/seedance-2.5-flash", "bytedance/seedance-v1.0-pro", "bytedance/seedance-v1.0-pro-fast", "google/veo-3.1-fast-generate-001", "google/veo-3.1-generate-001", "google/veo-3.1-lite-generate-001", "heygen/heygen-video-1", "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", "minimax/minimax-h3", "minimax/minimax-h3-max", "spacexai/grok-imagine-video", "spacexai/grok-imagine-video-1.5", "spacexai/grok-imagine-video-1.5-lite", "topaz/proteus", "topaz/starlight-precise-2.6"];
|
package/dist/index.js
CHANGED
|
@@ -1642,6 +1642,14 @@ const gatewayImageResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
|
1642
1642
|
})));
|
|
1643
1643
|
//#endregion
|
|
1644
1644
|
//#region src/gateway-video-model.ts
|
|
1645
|
+
/**
|
|
1646
|
+
* Maximum size of the result event: 512 * 1024 * 1024 characters.
|
|
1647
|
+
*
|
|
1648
|
+
* The result event contains all generated videos, which can be base64 encoded,
|
|
1649
|
+
* so it can be much larger than the default maximum event size. The limit is
|
|
1650
|
+
* about the maximum length of a string in V8.
|
|
1651
|
+
*/
|
|
1652
|
+
const MAX_RESULT_EVENT_SIZE = 536870912;
|
|
1645
1653
|
var GatewayVideoModel = class {
|
|
1646
1654
|
constructor(modelId, config) {
|
|
1647
1655
|
this.modelId = modelId;
|
|
@@ -1669,7 +1677,8 @@ var GatewayVideoModel = class {
|
|
|
1669
1677
|
});
|
|
1670
1678
|
const reader = parseJsonEventStream({
|
|
1671
1679
|
stream: response.body,
|
|
1672
|
-
schema: gatewayVideoEventSchema
|
|
1680
|
+
schema: gatewayVideoEventSchema,
|
|
1681
|
+
maxEventSize: MAX_RESULT_EVENT_SIZE
|
|
1673
1682
|
}).getReader();
|
|
1674
1683
|
const { done, value: parseResult } = await reader.read();
|
|
1675
1684
|
reader.releaseLock();
|
|
@@ -3912,7 +3921,7 @@ async function getVercelRequestId() {
|
|
|
3912
3921
|
}
|
|
3913
3922
|
//#endregion
|
|
3914
3923
|
//#region src/version.ts
|
|
3915
|
-
const VERSION = "4.0.
|
|
3924
|
+
const VERSION = "4.0.155";
|
|
3916
3925
|
//#endregion
|
|
3917
3926
|
//#region src/gateway-provider.ts
|
|
3918
3927
|
const AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|