@ai-sdk/gateway 4.0.0-canary.99 → 4.0.1

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/dist/index.d.ts CHANGED
@@ -1,16 +1,71 @@
1
- import { LanguageModelV4, ProviderV4, EmbeddingModelV4, ImageModelV4, Experimental_VideoModelV4, RerankingModelV4, SpeechModelV4, TranscriptionModelV4, TypeValidationError } from '@ai-sdk/provider';
1
+ import { LanguageModelV4, ProviderV4, EmbeddingModelV4, ImageModelV4, Experimental_VideoModelV4, RerankingModelV4, SpeechModelV4, TranscriptionModelV4, Experimental_RealtimeFactoryV4, TypeValidationError } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { FetchFunction, InferSchema } from '@ai-sdk/provider-utils';
4
4
 
5
- type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'arcee-ai/trinity-large-preview' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-preview' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.5-flash' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking-2601' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'minimax/minimax-m3' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-medium-3.5' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2-thinking-turbo' | 'moonshotai/kimi-k2-turbo' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-3-ultra-550b-a55b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'stepfun/step-3.5-flash' | 'stepfun/step-3.7-flash' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xai/grok-build-0.1' | 'xiaomi/mimo-v2-flash' | 'xiaomi/mimo-v2-pro' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | '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-5v-turbo' | (string & {});
5
+ type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'arcee-ai/trinity-large-preview' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-preview' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.5-flash' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking-2601' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'minimax/minimax-m3' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-medium-3.5' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'moonshotai/kimi-k2.7-code' | 'moonshotai/kimi-k2.7-code-highspeed' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-3-ultra-550b-a55b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'sakana/fugu-ultra' | 'stepfun/step-3.5-flash' | 'stepfun/step-3.7-flash' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xai/grok-build-0.1' | 'xiaomi/mimo-v2-flash' | 'xiaomi/mimo-v2-pro' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | '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-5v-turbo' | (string & {});
6
+
7
+ /**
8
+ * Shared WebSocket subprotocol contract for AI Gateway realtime auth.
9
+ *
10
+ * The browser `WebSocket` API cannot set request headers, so the Gateway auth
11
+ * (bearer) token is carried through the `Sec-WebSocket-Protocol` handshake
12
+ * instead of an `Authorization` header — the same workaround OpenAI uses for
13
+ * `openai-insecure-api-key.<token>`.
14
+ *
15
+ * This module is the single source of truth for that contract so the client and
16
+ * the Gateway server can't drift: the client encodes values with
17
+ * `getGatewayRealtimeProtocols`, and the Gateway server decodes them with
18
+ * `getGatewayRealtimeAuthToken` / `getGatewayRealtimeTeamIdOrSlug`.
19
+ *
20
+ * WebSocket subprotocol values must fit the RFC token grammar. The auth token is
21
+ * sent as-is, so callers must use tokens that are valid subprotocol tokens; the
22
+ * optional team scope is base64url-encoded by this module. Keep the complete
23
+ * `Sec-WebSocket-Protocol` header compact (target under an 8 KiB safe header
24
+ * budget) because intermediaries may reject large upgrade headers.
25
+ */
26
+ /**
27
+ * Marker subprotocol offered on every handshake so the Gateway can echo a
28
+ * negotiated subprotocol on the 101 response (some clients require the server to
29
+ * select one of the offered subprotocols).
30
+ */
31
+ declare const GATEWAY_REALTIME_SUBPROTOCOL = "ai-gateway-realtime.v1";
32
+ /** Subprotocol prefix that carries the Gateway auth (bearer) token. */
33
+ declare const GATEWAY_AUTH_SUBPROTOCOL_PREFIX = "ai-gateway-auth.";
34
+ /** Subprotocol prefix that carries optional Vercel team scoping. */
35
+ declare const GATEWAY_TEAM_SUBPROTOCOL_PREFIX = "ai-gateway-team.";
36
+ /**
37
+ * Client-side: build the WebSocket subprotocols that carry `token` to the
38
+ * Gateway. Pass the result as the second argument to `new WebSocket(url, ...)`.
39
+ */
40
+ declare function getGatewayRealtimeProtocols(token: string, options?: {
41
+ teamIdOrSlug?: string;
42
+ }): string[];
43
+ /**
44
+ * Server-side: extract the Gateway auth (bearer) token from a
45
+ * `Sec-WebSocket-Protocol` header value, or `undefined` when it is absent or
46
+ * empty. The Gateway upgrade handler turns this into an
47
+ * `Authorization: Bearer <token>` before its normal auth path.
48
+ *
49
+ * Accepts the raw header value (subprotocols are comma-separated and may carry
50
+ * surrounding whitespace).
51
+ */
52
+ declare function getGatewayRealtimeAuthToken(secWebSocketProtocol: string | null | undefined): string | undefined;
53
+ /**
54
+ * Server-side: extract the optional Vercel team ID or slug from the
55
+ * `Sec-WebSocket-Protocol` header value. Team scoping is base64url-encoded so
56
+ * arbitrary team slugs stay within the WebSocket subprotocol token grammar.
57
+ */
58
+ declare function getGatewayRealtimeTeamIdOrSlug(secWebSocketProtocol: string | null | undefined): string | undefined;
59
+
60
+ type GatewayRealtimeModelId = 'openai/gpt-realtime-1.5' | 'openai/gpt-realtime-2' | 'openai/gpt-realtime-mini' | 'xai/grok-voice-think-fast-1.0' | (string & {});
6
61
 
7
62
  type GatewayRerankingModelId = 'cohere/rerank-v3.5' | 'cohere/rerank-v4-fast' | 'cohere/rerank-v4-pro' | 'voyage/rerank-2.5' | 'voyage/rerank-2.5-lite' | (string & {});
8
63
 
9
- type GatewaySpeechModelId = string & {};
64
+ type GatewaySpeechModelId = 'openai/tts-1' | 'openai/tts-1-hd' | 'xai/grok-tts' | (string & {});
10
65
 
11
- type GatewayTranscriptionModelId = string & {};
66
+ type GatewayTranscriptionModelId = 'openai/gpt-4o-mini-transcribe' | 'openai/gpt-4o-transcribe' | 'openai/whisper-1' | 'xai/grok-stt' | (string & {});
12
67
 
13
- 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-lite-i2v' | 'bytedance/seedance-v1.0-lite-t2v' | '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-preview' | (string & {});
68
+ 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 & {});
14
69
 
15
70
  declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "speech", "transcription", "video"];
16
71
  type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
@@ -436,10 +491,145 @@ interface ParallelSearchInput {
436
491
  type ParallelSearchOutput = ParallelSearchResponse | ParallelSearchError;
437
492
  declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderExecutedToolFactory<ParallelSearchInput, ParallelSearchOutput, ParallelSearchConfig, {}>;
438
493
 
494
+ type ExaSearchType = 'auto' | 'fast' | 'instant';
495
+ type ExaSearchCategory = 'company' | 'people' | 'research paper' | 'news' | 'personal site' | 'financial report';
496
+ type ExaTextSection = 'header' | 'navigation' | 'banner' | 'body' | 'sidebar' | 'footer' | 'metadata';
497
+ interface ExaSearchTextConfig {
498
+ maxCharacters?: number;
499
+ includeHtmlTags?: boolean;
500
+ verbosity?: 'compact' | 'standard' | 'full';
501
+ includeSections?: ExaTextSection[];
502
+ excludeSections?: ExaTextSection[];
503
+ }
504
+ interface ExaSearchHighlightsConfig {
505
+ query?: string;
506
+ maxCharacters?: number;
507
+ }
508
+ interface ExaSearchExtrasConfig {
509
+ links?: number;
510
+ imageLinks?: number;
511
+ }
512
+ interface ExaSearchContentsConfig {
513
+ text?: boolean | ExaSearchTextConfig;
514
+ highlights?: boolean | ExaSearchHighlightsConfig;
515
+ maxAgeHours?: number;
516
+ livecrawlTimeout?: number;
517
+ subpages?: number;
518
+ subpageTarget?: string | string[];
519
+ extras?: ExaSearchExtrasConfig;
520
+ }
521
+ interface ExaSearchConfig {
522
+ /**
523
+ * Default search method. Exa defaults to auto when omitted.
524
+ */
525
+ type?: ExaSearchType;
526
+ /**
527
+ * Default maximum number of results to return (1-100, default: 10).
528
+ */
529
+ numResults?: number;
530
+ /**
531
+ * Default category filter for result types.
532
+ */
533
+ category?: ExaSearchCategory;
534
+ /**
535
+ * Default two-letter ISO country code for location-aware search.
536
+ */
537
+ userLocation?: string;
538
+ /**
539
+ * Default domains to include or exclude.
540
+ */
541
+ includeDomains?: string[];
542
+ excludeDomains?: string[];
543
+ /**
544
+ * Default published date filters in ISO 8601 format.
545
+ */
546
+ startPublishedDate?: string;
547
+ endPublishedDate?: string;
548
+ /**
549
+ * Default content extraction controls.
550
+ */
551
+ contents?: ExaSearchContentsConfig;
552
+ }
553
+ interface ExaSearchResult {
554
+ title: string;
555
+ url: string;
556
+ id: string;
557
+ publishedDate?: string | null;
558
+ author?: string | null;
559
+ image?: string | null;
560
+ favicon?: string | null;
561
+ text?: string;
562
+ highlights?: string[];
563
+ highlightScores?: number[];
564
+ summary?: string;
565
+ subpages?: ExaSearchResult[];
566
+ extras?: {
567
+ links?: string[];
568
+ imageLinks?: string[];
569
+ };
570
+ }
571
+ interface ExaSearchResponse {
572
+ requestId: string;
573
+ searchType?: string;
574
+ resolvedSearchType?: string;
575
+ results: ExaSearchResult[];
576
+ costDollars?: {
577
+ total?: number;
578
+ search?: Record<string, number>;
579
+ };
580
+ }
581
+ interface ExaSearchError {
582
+ error: 'api_error' | 'rate_limit' | 'timeout' | 'invalid_input' | 'configuration_error' | 'execution_error' | 'unknown';
583
+ statusCode?: number;
584
+ message: string;
585
+ }
586
+ interface ExaSearchInput {
587
+ query: string;
588
+ type?: ExaSearchType;
589
+ num_results?: number;
590
+ category?: ExaSearchCategory;
591
+ user_location?: string;
592
+ include_domains?: string[];
593
+ exclude_domains?: string[];
594
+ start_published_date?: string;
595
+ end_published_date?: string;
596
+ contents?: {
597
+ text?: boolean | {
598
+ max_characters?: number;
599
+ include_html_tags?: boolean;
600
+ verbosity?: 'compact' | 'standard' | 'full';
601
+ include_sections?: ExaTextSection[];
602
+ exclude_sections?: ExaTextSection[];
603
+ };
604
+ highlights?: boolean | {
605
+ query?: string;
606
+ max_characters?: number;
607
+ };
608
+ max_age_hours?: number;
609
+ livecrawl_timeout?: number;
610
+ subpages?: number;
611
+ subpage_target?: string | string[];
612
+ extras?: {
613
+ links?: number;
614
+ image_links?: number;
615
+ };
616
+ };
617
+ }
618
+ type ExaSearchOutput = ExaSearchResponse | ExaSearchError;
619
+ declare const exaSearchToolFactory: _ai_sdk_provider_utils.ProviderExecutedToolFactory<ExaSearchInput, ExaSearchOutput, ExaSearchConfig, {}>;
620
+
439
621
  /**
440
622
  * Gateway-specific provider-defined tools.
441
623
  */
442
624
  declare const gatewayTools: {
625
+ /**
626
+ * Search the web using Exa for current information and token-efficient
627
+ * excerpts optimized for agent workflows.
628
+ *
629
+ * Supports search type, category, domain, date, location, and content
630
+ * extraction controls.
631
+ */
632
+ exaSearch: (config?: ExaSearchConfig) => ReturnType<typeof exaSearchToolFactory>;
443
633
  /**
444
634
  * Search the web using Parallel AI's Search API for LLM-optimized excerpts.
445
635
  *
@@ -539,6 +729,11 @@ interface GatewayProvider extends ProviderV4 {
539
729
  * Creates a model for audio transcription.
540
730
  */
541
731
  transcriptionModel(modelId: GatewayTranscriptionModelId): TranscriptionModelV4;
732
+ /**
733
+ * Creates an experimental realtime model for bidirectional audio/text
734
+ * communication over WebSocket, normalized through the AI Gateway.
735
+ */
736
+ experimental_realtime: Experimental_RealtimeFactoryV4;
542
737
  /**
543
738
  * Gateway-specific tools executed server-side.
544
739
  */
@@ -579,28 +774,47 @@ interface GatewayProviderSettings {
579
774
  declare function createGateway(options?: GatewayProviderSettings): GatewayProvider;
580
775
  declare const gateway: GatewayProvider;
581
776
 
582
- declare const gatewayProviderOptions: _ai_sdk_provider_utils.LazySchema<{
583
- only?: string[] | undefined;
584
- order?: string[] | undefined;
585
- sort?: "cost" | "ttft" | "tps" | undefined;
586
- user?: string | undefined;
587
- tags?: string[] | undefined;
588
- models?: string[] | undefined;
589
- byok?: Record<string, Record<string, unknown>[]> | undefined;
590
- zeroDataRetention?: boolean | undefined;
591
- disallowPromptTraining?: boolean | undefined;
592
- hipaaCompliant?: boolean | undefined;
593
- quotaEntityId?: string | undefined;
777
+ type GatewayProviderOptions = {
778
+ /**
779
+ * Service-owned options may be added by the Gateway without requiring an SDK
780
+ * release. The Gateway service validates and applies the runtime schema.
781
+ */
782
+ [key: string]: unknown;
783
+ /** Request-scoped BYOK credentials to use instead of cached credentials. */
784
+ byok?: Record<string, Array<Record<string, unknown>>>;
785
+ /** Enables automatic caching behavior when supported by the Gateway. */
786
+ caching?: 'auto';
787
+ /** Filter to providers that do not train on prompt data. */
788
+ disallowPromptTraining?: boolean;
789
+ /** Filter to providers that are HIPAA compliant with Vercel AI Gateway. */
790
+ hipaaCompliant?: boolean;
791
+ /** Array of model slugs specifying fallback models to use in order. */
792
+ models?: string[];
793
+ /** Array of provider slugs that are the only ones allowed to be used. */
794
+ only?: string[];
795
+ /** Array of provider slugs specifying the provider attempt order. */
796
+ order?: string[];
797
+ /** Per-provider timeouts for BYOK credentials in milliseconds. */
594
798
  providerTimeouts?: {
595
- byok?: Record<string, number> | undefined;
596
- } | undefined;
597
- serviceTier?: "flex" | "priority" | undefined;
598
- }>;
599
- type GatewayProviderOptions = InferSchema<typeof gatewayProviderOptions>;
799
+ byok?: Record<string, number>;
800
+ };
801
+ /** Entity identifier against which quota is tracked. */
802
+ quotaEntityId?: string;
803
+ /** Unified service tier intent. */
804
+ serviceTier?: 'flex' | 'priority';
805
+ /** Sort providers by a performance or cost metric before routing. */
806
+ sort?: 'cost' | 'tps' | 'ttft';
807
+ /** User-specified tags for reporting and filtering usage. */
808
+ tags?: string[];
809
+ /** End-user identifier for spend tracking and attribution. */
810
+ user?: string;
811
+ /** Filter to providers with zero data retention agreements. */
812
+ zeroDataRetention?: boolean;
813
+ };
600
814
 
601
- declare const symbol$6: unique symbol;
815
+ declare const symbol$8: unique symbol;
602
816
  declare abstract class GatewayError extends Error {
603
- private readonly [symbol$6];
817
+ private readonly [symbol$8];
604
818
  abstract readonly name: string;
605
819
  abstract readonly type: string;
606
820
  readonly statusCode: number;
@@ -634,12 +848,12 @@ declare const gatewayErrorResponseSchema: _ai_sdk_provider_utils.LazySchema<{
634
848
  }>;
635
849
  type GatewayErrorResponse = InferSchema<typeof gatewayErrorResponseSchema>;
636
850
 
637
- declare const symbol$5: unique symbol;
851
+ declare const symbol$7: unique symbol;
638
852
  /**
639
853
  * Authentication failed - invalid API key or OIDC token
640
854
  */
641
855
  declare class GatewayAuthenticationError extends GatewayError {
642
- private readonly [symbol$5];
856
+ private readonly [symbol$7];
643
857
  readonly name = "GatewayAuthenticationError";
644
858
  readonly type = "authentication_error";
645
859
  constructor({ message, statusCode, cause, generationId, }?: {
@@ -662,6 +876,43 @@ declare class GatewayAuthenticationError extends GatewayError {
662
876
  }): GatewayAuthenticationError;
663
877
  }
664
878
 
879
+ declare const symbol$6: unique symbol;
880
+ /**
881
+ * The request could not be fulfilled because a dependency it relied on was not
882
+ * available on the credentials or provider used to serve it (HTTP 424). Not
883
+ * retryable — the caller must change the request.
884
+ */
885
+ declare class GatewayFailedDependencyError extends GatewayError {
886
+ private readonly [symbol$6];
887
+ readonly name = "GatewayFailedDependencyError";
888
+ readonly type = "failed_dependency";
889
+ constructor({ message, statusCode, cause, generationId, }?: {
890
+ message?: string;
891
+ statusCode?: number;
892
+ cause?: unknown;
893
+ generationId?: string;
894
+ });
895
+ static isInstance(error: unknown): error is GatewayFailedDependencyError;
896
+ }
897
+
898
+ declare const symbol$5: unique symbol;
899
+ /**
900
+ * Forbidden - the request was rejected by policy (e.g. a routing rule),
901
+ * not an authentication failure.
902
+ */
903
+ declare class GatewayForbiddenError extends GatewayError {
904
+ private readonly [symbol$5];
905
+ readonly name = "GatewayForbiddenError";
906
+ readonly type = "forbidden";
907
+ constructor({ message, statusCode, cause, generationId, }?: {
908
+ message?: string;
909
+ statusCode?: number;
910
+ cause?: unknown;
911
+ generationId?: string;
912
+ });
913
+ static isInstance(error: unknown): error is GatewayForbiddenError;
914
+ }
915
+
665
916
  declare const symbol$4: unique symbol;
666
917
  /**
667
918
  * Internal server error from the Gateway
@@ -755,4 +1006,4 @@ declare class GatewayResponseError extends GatewayError {
755
1006
 
756
1007
  declare const VERSION: string;
757
1008
 
758
- export { GatewayAuthenticationError, type GatewayCreditsResponse, GatewayError, type GatewayErrorResponse, type GatewayGenerationInfo, type GatewayGenerationInfoParams, GatewayInternalServerError, GatewayInvalidRequestError, type GatewayLanguageModelEntry, type GatewayProviderOptions as GatewayLanguageModelOptions, type GatewayLanguageModelSpecification, type GatewayLanguageModelEntry as GatewayModelEntry, type GatewayModelId, GatewayModelNotFoundError, type GatewayProvider, type GatewayProviderOptions, type GatewayProviderSettings, GatewayRateLimitError, type GatewayRerankingModelId, GatewayResponseError, type GatewaySpeechModelId, type GatewaySpendReportParams, type GatewaySpendReportResponse, type GatewaySpendReportRow, type GatewayTranscriptionModelId, type GatewayVideoModelId, VERSION, createGateway, createGateway as createGatewayProvider, gateway };
1009
+ export { GATEWAY_AUTH_SUBPROTOCOL_PREFIX, GATEWAY_REALTIME_SUBPROTOCOL, GATEWAY_TEAM_SUBPROTOCOL_PREFIX, GatewayAuthenticationError, type GatewayCreditsResponse, GatewayError, type GatewayErrorResponse, GatewayFailedDependencyError, GatewayForbiddenError, type GatewayGenerationInfo, type GatewayGenerationInfoParams, GatewayInternalServerError, GatewayInvalidRequestError, type GatewayLanguageModelEntry, type GatewayProviderOptions as GatewayLanguageModelOptions, type GatewayLanguageModelSpecification, type GatewayLanguageModelEntry as GatewayModelEntry, type GatewayModelId, GatewayModelNotFoundError, type GatewayProvider, type GatewayProviderOptions, type GatewayProviderSettings, GatewayRateLimitError, type GatewayRealtimeModelId, type GatewayRerankingModelId, GatewayResponseError, type GatewaySpeechModelId, type GatewaySpendReportParams, type GatewaySpendReportResponse, type GatewaySpendReportRow, type GatewayTranscriptionModelId, type GatewayVideoModelId, VERSION, createGateway, createGateway as createGatewayProvider, gateway, getGatewayRealtimeAuthToken, getGatewayRealtimeProtocols, getGatewayRealtimeTeamIdOrSlug };