@ai-sdk/gateway 3.0.135 → 3.0.136

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @ai-sdk/gateway
2
2
 
3
+ ## 3.0.136
4
+
5
+ ### Patch Changes
6
+
7
+ - 6ce12b0: Add Gateway speech and transcription model support.
8
+ - 4cb4414: Backport: chore(provider/gateway): update gateway model settings files
9
+
3
10
  ## 3.0.135
4
11
 
5
12
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,14 +1,18 @@
1
- import { LanguageModelV3, ProviderV3, EmbeddingModelV3, ImageModelV3, Experimental_VideoModelV3, RerankingModelV3, TypeValidationError } from '@ai-sdk/provider';
1
+ import { LanguageModelV3, ProviderV3, EmbeddingModelV3, ImageModelV3, Experimental_VideoModelV3, RerankingModelV3, SpeechModelV3, TranscriptionModelV3, 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.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-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
6
 
7
7
  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
8
 
9
- 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-preview' | (string & {});
9
+ type GatewaySpeechModelId = 'openai/tts-1' | 'openai/tts-1-hd' | 'xai/grok-tts' | (string & {});
10
10
 
11
- declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "video"];
11
+ type GatewayTranscriptionModelId = 'openai/gpt-4o-mini-transcribe' | 'openai/gpt-4o-transcribe' | 'openai/whisper-1' | 'xai/grok-stt' | (string & {});
12
+
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-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
+
15
+ declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "speech", "transcription", "video"];
12
16
  type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
13
17
  interface GatewayLanguageModelEntry {
14
18
  /**
@@ -519,6 +523,22 @@ interface GatewayProvider extends ProviderV3 {
519
523
  * Creates a model for reranking documents.
520
524
  */
521
525
  rerankingModel(modelId: GatewayRerankingModelId): RerankingModelV3;
526
+ /**
527
+ * Creates a model for text-to-speech generation.
528
+ */
529
+ speech(modelId: GatewaySpeechModelId): SpeechModelV3;
530
+ /**
531
+ * Creates a model for text-to-speech generation.
532
+ */
533
+ speechModel(modelId: GatewaySpeechModelId): SpeechModelV3;
534
+ /**
535
+ * Creates a model for audio transcription.
536
+ */
537
+ transcription(modelId: GatewayTranscriptionModelId): TranscriptionModelV3;
538
+ /**
539
+ * Creates a model for audio transcription.
540
+ */
541
+ transcriptionModel(modelId: GatewayTranscriptionModelId): TranscriptionModelV3;
522
542
  /**
523
543
  * Gateway-specific tools executed server-side.
524
544
  */
@@ -764,4 +784,4 @@ declare class GatewayResponseError extends GatewayError {
764
784
  static isInstance(error: unknown): error is GatewayResponseError;
765
785
  }
766
786
 
767
- export { 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 GatewayRerankingModelId, GatewayResponseError, type GatewaySpendReportParams, type GatewaySpendReportResponse, type GatewaySpendReportRow, type GatewayVideoModelId, createGatewayProvider as createGateway, createGatewayProvider, gateway };
787
+ export { 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 GatewayRerankingModelId, GatewayResponseError, type GatewaySpeechModelId, type GatewaySpendReportParams, type GatewaySpendReportResponse, type GatewaySpendReportRow, type GatewayTranscriptionModelId, type GatewayVideoModelId, createGatewayProvider as createGateway, createGatewayProvider, gateway };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,18 @@
1
- import { LanguageModelV3, ProviderV3, EmbeddingModelV3, ImageModelV3, Experimental_VideoModelV3, RerankingModelV3, TypeValidationError } from '@ai-sdk/provider';
1
+ import { LanguageModelV3, ProviderV3, EmbeddingModelV3, ImageModelV3, Experimental_VideoModelV3, RerankingModelV3, SpeechModelV3, TranscriptionModelV3, 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.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-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
6
 
7
7
  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
8
 
9
- 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-preview' | (string & {});
9
+ type GatewaySpeechModelId = 'openai/tts-1' | 'openai/tts-1-hd' | 'xai/grok-tts' | (string & {});
10
10
 
11
- declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "video"];
11
+ type GatewayTranscriptionModelId = 'openai/gpt-4o-mini-transcribe' | 'openai/gpt-4o-transcribe' | 'openai/whisper-1' | 'xai/grok-stt' | (string & {});
12
+
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-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
+
15
+ declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "speech", "transcription", "video"];
12
16
  type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
13
17
  interface GatewayLanguageModelEntry {
14
18
  /**
@@ -519,6 +523,22 @@ interface GatewayProvider extends ProviderV3 {
519
523
  * Creates a model for reranking documents.
520
524
  */
521
525
  rerankingModel(modelId: GatewayRerankingModelId): RerankingModelV3;
526
+ /**
527
+ * Creates a model for text-to-speech generation.
528
+ */
529
+ speech(modelId: GatewaySpeechModelId): SpeechModelV3;
530
+ /**
531
+ * Creates a model for text-to-speech generation.
532
+ */
533
+ speechModel(modelId: GatewaySpeechModelId): SpeechModelV3;
534
+ /**
535
+ * Creates a model for audio transcription.
536
+ */
537
+ transcription(modelId: GatewayTranscriptionModelId): TranscriptionModelV3;
538
+ /**
539
+ * Creates a model for audio transcription.
540
+ */
541
+ transcriptionModel(modelId: GatewayTranscriptionModelId): TranscriptionModelV3;
522
542
  /**
523
543
  * Gateway-specific tools executed server-side.
524
544
  */
@@ -764,4 +784,4 @@ declare class GatewayResponseError extends GatewayError {
764
784
  static isInstance(error: unknown): error is GatewayResponseError;
765
785
  }
766
786
 
767
- export { 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 GatewayRerankingModelId, GatewayResponseError, type GatewaySpendReportParams, type GatewaySpendReportResponse, type GatewaySpendReportRow, type GatewayVideoModelId, createGatewayProvider as createGateway, createGatewayProvider, gateway };
787
+ export { 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 GatewayRerankingModelId, GatewayResponseError, type GatewaySpeechModelId, type GatewaySpendReportParams, type GatewaySpendReportResponse, type GatewaySpendReportRow, type GatewayTranscriptionModelId, type GatewayVideoModelId, createGatewayProvider as createGateway, createGatewayProvider, gateway };
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ __export(index_exports, {
36
36
  module.exports = __toCommonJS(index_exports);
37
37
 
38
38
  // src/gateway-provider.ts
39
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
39
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
40
40
 
41
41
  // src/errors/as-gateway-error.ts
42
42
  var import_provider = require("@ai-sdk/provider");
@@ -562,6 +562,8 @@ var KNOWN_MODEL_TYPES = [
562
562
  "image",
563
563
  "language",
564
564
  "reranking",
565
+ "speech",
566
+ "transcription",
565
567
  "video"
566
568
  ];
567
569
 
@@ -1533,11 +1535,231 @@ var gatewayRerankingResponseSchema = (0, import_provider_utils11.lazySchema)(
1533
1535
  )
1534
1536
  );
1535
1537
 
1536
- // src/tool/parallel-search.ts
1538
+ // src/gateway-speech-model.ts
1537
1539
  var import_provider_utils12 = require("@ai-sdk/provider-utils");
1540
+ var import_v412 = require("zod/v4");
1541
+ var GatewaySpeechModel = class {
1542
+ constructor(modelId, config) {
1543
+ this.modelId = modelId;
1544
+ this.config = config;
1545
+ this.specificationVersion = "v3";
1546
+ }
1547
+ get provider() {
1548
+ return this.config.provider;
1549
+ }
1550
+ async doGenerate({
1551
+ text,
1552
+ voice,
1553
+ outputFormat,
1554
+ instructions,
1555
+ speed,
1556
+ language,
1557
+ providerOptions,
1558
+ headers,
1559
+ abortSignal
1560
+ }) {
1561
+ var _a11;
1562
+ const resolvedHeaders = await (0, import_provider_utils12.resolve)(this.config.headers());
1563
+ try {
1564
+ const {
1565
+ responseHeaders,
1566
+ value: responseBody,
1567
+ rawValue
1568
+ } = await (0, import_provider_utils12.postJsonToApi)({
1569
+ url: this.getUrl(),
1570
+ headers: (0, import_provider_utils12.combineHeaders)(
1571
+ resolvedHeaders,
1572
+ headers != null ? headers : {},
1573
+ this.getModelConfigHeaders(),
1574
+ await (0, import_provider_utils12.resolve)(this.config.o11yHeaders)
1575
+ ),
1576
+ body: {
1577
+ text,
1578
+ ...voice && { voice },
1579
+ ...outputFormat && { outputFormat },
1580
+ ...instructions && { instructions },
1581
+ ...speed != null && { speed },
1582
+ ...language && { language },
1583
+ ...providerOptions && { providerOptions }
1584
+ },
1585
+ successfulResponseHandler: (0, import_provider_utils12.createJsonResponseHandler)(
1586
+ gatewaySpeechResponseSchema
1587
+ ),
1588
+ failedResponseHandler: (0, import_provider_utils12.createJsonErrorResponseHandler)({
1589
+ errorSchema: import_v412.z.any(),
1590
+ errorToMessage: (data) => data
1591
+ }),
1592
+ ...abortSignal && { abortSignal },
1593
+ fetch: this.config.fetch
1594
+ });
1595
+ return {
1596
+ audio: responseBody.audio,
1597
+ warnings: (_a11 = responseBody.warnings) != null ? _a11 : [],
1598
+ providerMetadata: responseBody.providerMetadata,
1599
+ response: {
1600
+ timestamp: /* @__PURE__ */ new Date(),
1601
+ modelId: this.modelId,
1602
+ headers: responseHeaders,
1603
+ body: rawValue
1604
+ }
1605
+ };
1606
+ } catch (error) {
1607
+ throw await asGatewayError(
1608
+ error,
1609
+ await parseAuthMethod(resolvedHeaders != null ? resolvedHeaders : {})
1610
+ );
1611
+ }
1612
+ }
1613
+ getUrl() {
1614
+ return `${this.config.baseURL}/speech-model`;
1615
+ }
1616
+ getModelConfigHeaders() {
1617
+ return {
1618
+ "ai-speech-model-specification-version": "3",
1619
+ "ai-model-id": this.modelId
1620
+ };
1621
+ }
1622
+ };
1623
+ var providerMetadataEntrySchema3 = import_v412.z.object({}).catchall(import_v412.z.unknown());
1624
+ var gatewaySpeechWarningSchema = import_v412.z.discriminatedUnion("type", [
1625
+ import_v412.z.object({
1626
+ type: import_v412.z.literal("unsupported"),
1627
+ feature: import_v412.z.string(),
1628
+ details: import_v412.z.string().optional()
1629
+ }),
1630
+ import_v412.z.object({
1631
+ type: import_v412.z.literal("compatibility"),
1632
+ feature: import_v412.z.string(),
1633
+ details: import_v412.z.string().optional()
1634
+ }),
1635
+ import_v412.z.object({
1636
+ type: import_v412.z.literal("other"),
1637
+ message: import_v412.z.string()
1638
+ })
1639
+ ]);
1640
+ var gatewaySpeechResponseSchema = import_v412.z.object({
1641
+ audio: import_v412.z.string(),
1642
+ warnings: import_v412.z.array(gatewaySpeechWarningSchema).optional(),
1643
+ providerMetadata: import_v412.z.record(import_v412.z.string(), providerMetadataEntrySchema3).optional()
1644
+ });
1645
+
1646
+ // src/gateway-transcription-model.ts
1647
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
1648
+ var import_v413 = require("zod/v4");
1649
+ var GatewayTranscriptionModel = class {
1650
+ constructor(modelId, config) {
1651
+ this.modelId = modelId;
1652
+ this.config = config;
1653
+ this.specificationVersion = "v3";
1654
+ }
1655
+ get provider() {
1656
+ return this.config.provider;
1657
+ }
1658
+ async doGenerate({
1659
+ audio,
1660
+ mediaType,
1661
+ providerOptions,
1662
+ headers,
1663
+ abortSignal
1664
+ }) {
1665
+ var _a11, _b11, _c, _d;
1666
+ const resolvedHeaders = await (0, import_provider_utils13.resolve)(this.config.headers());
1667
+ try {
1668
+ const {
1669
+ responseHeaders,
1670
+ value: responseBody,
1671
+ rawValue
1672
+ } = await (0, import_provider_utils13.postJsonToApi)({
1673
+ url: this.getUrl(),
1674
+ headers: (0, import_provider_utils13.combineHeaders)(
1675
+ resolvedHeaders,
1676
+ headers != null ? headers : {},
1677
+ this.getModelConfigHeaders(),
1678
+ await (0, import_provider_utils13.resolve)(this.config.o11yHeaders)
1679
+ ),
1680
+ body: {
1681
+ audio: audio instanceof Uint8Array ? (0, import_provider_utils13.convertUint8ArrayToBase64)(audio) : audio,
1682
+ mediaType,
1683
+ ...providerOptions && { providerOptions }
1684
+ },
1685
+ successfulResponseHandler: (0, import_provider_utils13.createJsonResponseHandler)(
1686
+ gatewayTranscriptionResponseSchema
1687
+ ),
1688
+ failedResponseHandler: (0, import_provider_utils13.createJsonErrorResponseHandler)({
1689
+ errorSchema: import_v413.z.any(),
1690
+ errorToMessage: (data) => data
1691
+ }),
1692
+ ...abortSignal && { abortSignal },
1693
+ fetch: this.config.fetch
1694
+ });
1695
+ return {
1696
+ text: responseBody.text,
1697
+ segments: (_a11 = responseBody.segments) != null ? _a11 : [],
1698
+ language: (_b11 = responseBody.language) != null ? _b11 : void 0,
1699
+ durationInSeconds: (_c = responseBody.durationInSeconds) != null ? _c : void 0,
1700
+ warnings: (_d = responseBody.warnings) != null ? _d : [],
1701
+ providerMetadata: responseBody.providerMetadata,
1702
+ response: {
1703
+ timestamp: /* @__PURE__ */ new Date(),
1704
+ modelId: this.modelId,
1705
+ headers: responseHeaders,
1706
+ body: rawValue
1707
+ }
1708
+ };
1709
+ } catch (error) {
1710
+ throw await asGatewayError(
1711
+ error,
1712
+ await parseAuthMethod(resolvedHeaders != null ? resolvedHeaders : {})
1713
+ );
1714
+ }
1715
+ }
1716
+ getUrl() {
1717
+ return `${this.config.baseURL}/transcription-model`;
1718
+ }
1719
+ getModelConfigHeaders() {
1720
+ return {
1721
+ "ai-transcription-model-specification-version": "3",
1722
+ "ai-model-id": this.modelId
1723
+ };
1724
+ }
1725
+ };
1726
+ var providerMetadataEntrySchema4 = import_v413.z.object({}).catchall(import_v413.z.unknown());
1727
+ var gatewayTranscriptionWarningSchema = import_v413.z.discriminatedUnion("type", [
1728
+ import_v413.z.object({
1729
+ type: import_v413.z.literal("unsupported"),
1730
+ feature: import_v413.z.string(),
1731
+ details: import_v413.z.string().optional()
1732
+ }),
1733
+ import_v413.z.object({
1734
+ type: import_v413.z.literal("compatibility"),
1735
+ feature: import_v413.z.string(),
1736
+ details: import_v413.z.string().optional()
1737
+ }),
1738
+ import_v413.z.object({
1739
+ type: import_v413.z.literal("other"),
1740
+ message: import_v413.z.string()
1741
+ })
1742
+ ]);
1743
+ var gatewayTranscriptionResponseSchema = import_v413.z.object({
1744
+ text: import_v413.z.string(),
1745
+ segments: import_v413.z.array(
1746
+ import_v413.z.object({
1747
+ text: import_v413.z.string(),
1748
+ startSecond: import_v413.z.number(),
1749
+ endSecond: import_v413.z.number()
1750
+ })
1751
+ ).optional(),
1752
+ language: import_v413.z.string().nullish(),
1753
+ durationInSeconds: import_v413.z.number().nullish(),
1754
+ warnings: import_v413.z.array(gatewayTranscriptionWarningSchema).optional(),
1755
+ providerMetadata: import_v413.z.record(import_v413.z.string(), providerMetadataEntrySchema4).optional()
1756
+ });
1757
+
1758
+ // src/tool/parallel-search.ts
1759
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
1538
1760
  var import_zod = require("zod");
1539
- var parallelSearchInputSchema = (0, import_provider_utils12.lazySchema)(
1540
- () => (0, import_provider_utils12.zodSchema)(
1761
+ var parallelSearchInputSchema = (0, import_provider_utils14.lazySchema)(
1762
+ () => (0, import_provider_utils14.zodSchema)(
1541
1763
  import_zod.z.object({
1542
1764
  objective: import_zod.z.string().describe(
1543
1765
  "Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
@@ -1572,8 +1794,8 @@ var parallelSearchInputSchema = (0, import_provider_utils12.lazySchema)(
1572
1794
  })
1573
1795
  )
1574
1796
  );
1575
- var parallelSearchOutputSchema = (0, import_provider_utils12.lazySchema)(
1576
- () => (0, import_provider_utils12.zodSchema)(
1797
+ var parallelSearchOutputSchema = (0, import_provider_utils14.lazySchema)(
1798
+ () => (0, import_provider_utils14.zodSchema)(
1577
1799
  import_zod.z.union([
1578
1800
  // Success response
1579
1801
  import_zod.z.object({
@@ -1604,7 +1826,7 @@ var parallelSearchOutputSchema = (0, import_provider_utils12.lazySchema)(
1604
1826
  ])
1605
1827
  )
1606
1828
  );
1607
- var parallelSearchToolFactory = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
1829
+ var parallelSearchToolFactory = (0, import_provider_utils14.createProviderToolFactoryWithOutputSchema)({
1608
1830
  id: "gateway.parallel_search",
1609
1831
  inputSchema: parallelSearchInputSchema,
1610
1832
  outputSchema: parallelSearchOutputSchema
@@ -1612,10 +1834,10 @@ var parallelSearchToolFactory = (0, import_provider_utils12.createProviderToolFa
1612
1834
  var parallelSearch = (config = {}) => parallelSearchToolFactory(config);
1613
1835
 
1614
1836
  // src/tool/perplexity-search.ts
1615
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
1837
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
1616
1838
  var import_zod2 = require("zod");
1617
- var perplexitySearchInputSchema = (0, import_provider_utils13.lazySchema)(
1618
- () => (0, import_provider_utils13.zodSchema)(
1839
+ var perplexitySearchInputSchema = (0, import_provider_utils15.lazySchema)(
1840
+ () => (0, import_provider_utils15.zodSchema)(
1619
1841
  import_zod2.z.object({
1620
1842
  query: import_zod2.z.union([import_zod2.z.string(), import_zod2.z.array(import_zod2.z.string())]).describe(
1621
1843
  "Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."
@@ -1656,8 +1878,8 @@ var perplexitySearchInputSchema = (0, import_provider_utils13.lazySchema)(
1656
1878
  })
1657
1879
  )
1658
1880
  );
1659
- var perplexitySearchOutputSchema = (0, import_provider_utils13.lazySchema)(
1660
- () => (0, import_provider_utils13.zodSchema)(
1881
+ var perplexitySearchOutputSchema = (0, import_provider_utils15.lazySchema)(
1882
+ () => (0, import_provider_utils15.zodSchema)(
1661
1883
  import_zod2.z.union([
1662
1884
  // Success response
1663
1885
  import_zod2.z.object({
@@ -1687,7 +1909,7 @@ var perplexitySearchOutputSchema = (0, import_provider_utils13.lazySchema)(
1687
1909
  ])
1688
1910
  )
1689
1911
  );
1690
- var perplexitySearchToolFactory = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
1912
+ var perplexitySearchToolFactory = (0, import_provider_utils15.createProviderToolFactoryWithOutputSchema)({
1691
1913
  id: "gateway.perplexity_search",
1692
1914
  inputSchema: perplexitySearchInputSchema,
1693
1915
  outputSchema: perplexitySearchOutputSchema
@@ -1724,7 +1946,7 @@ async function getVercelRequestId() {
1724
1946
  }
1725
1947
 
1726
1948
  // src/version.ts
1727
- var VERSION = true ? "3.0.135" : "0.0.0-test";
1949
+ var VERSION = true ? "3.0.136" : "0.0.0-test";
1728
1950
 
1729
1951
  // src/gateway-provider.ts
1730
1952
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
@@ -1734,11 +1956,11 @@ function createGatewayProvider(options = {}) {
1734
1956
  let metadataCache = null;
1735
1957
  const cacheRefreshMillis = (_a11 = options.metadataCacheRefreshMillis) != null ? _a11 : 1e3 * 60 * 5;
1736
1958
  let lastFetchTime = 0;
1737
- const baseURL = (_b11 = (0, import_provider_utils14.withoutTrailingSlash)(options.baseURL)) != null ? _b11 : "https://ai-gateway.vercel.sh/v3/ai";
1959
+ const baseURL = (_b11 = (0, import_provider_utils16.withoutTrailingSlash)(options.baseURL)) != null ? _b11 : "https://ai-gateway.vercel.sh/v3/ai";
1738
1960
  const getHeaders = async () => {
1739
1961
  try {
1740
1962
  const auth = await getGatewayAuthToken(options);
1741
- return (0, import_provider_utils14.withUserAgentSuffix)(
1963
+ return (0, import_provider_utils16.withUserAgentSuffix)(
1742
1964
  {
1743
1965
  Authorization: `Bearer ${auth.token}`,
1744
1966
  "ai-gateway-protocol-version": AI_GATEWAY_PROTOCOL_VERSION,
@@ -1757,19 +1979,19 @@ function createGatewayProvider(options = {}) {
1757
1979
  }
1758
1980
  };
1759
1981
  const createO11yHeaders = () => {
1760
- const deploymentId = (0, import_provider_utils14.loadOptionalSetting)({
1982
+ const deploymentId = (0, import_provider_utils16.loadOptionalSetting)({
1761
1983
  settingValue: void 0,
1762
1984
  environmentVariableName: "VERCEL_DEPLOYMENT_ID"
1763
1985
  });
1764
- const environment = (0, import_provider_utils14.loadOptionalSetting)({
1986
+ const environment = (0, import_provider_utils16.loadOptionalSetting)({
1765
1987
  settingValue: void 0,
1766
1988
  environmentVariableName: "VERCEL_ENV"
1767
1989
  });
1768
- const region = (0, import_provider_utils14.loadOptionalSetting)({
1990
+ const region = (0, import_provider_utils16.loadOptionalSetting)({
1769
1991
  settingValue: void 0,
1770
1992
  environmentVariableName: "VERCEL_REGION"
1771
1993
  });
1772
- const projectId = (0, import_provider_utils14.loadOptionalSetting)({
1994
+ const projectId = (0, import_provider_utils16.loadOptionalSetting)({
1773
1995
  settingValue: void 0,
1774
1996
  environmentVariableName: "VERCEL_PROJECT_ID"
1775
1997
  });
@@ -1904,6 +2126,28 @@ function createGatewayProvider(options = {}) {
1904
2126
  };
1905
2127
  provider.rerankingModel = createRerankingModel;
1906
2128
  provider.reranking = createRerankingModel;
2129
+ const createSpeechModel = (modelId) => {
2130
+ return new GatewaySpeechModel(modelId, {
2131
+ provider: "gateway",
2132
+ baseURL,
2133
+ headers: getHeaders,
2134
+ fetch: options.fetch,
2135
+ o11yHeaders: createO11yHeaders()
2136
+ });
2137
+ };
2138
+ provider.speechModel = createSpeechModel;
2139
+ provider.speech = createSpeechModel;
2140
+ const createTranscriptionModel = (modelId) => {
2141
+ return new GatewayTranscriptionModel(modelId, {
2142
+ provider: "gateway",
2143
+ baseURL,
2144
+ headers: getHeaders,
2145
+ fetch: options.fetch,
2146
+ o11yHeaders: createO11yHeaders()
2147
+ });
2148
+ };
2149
+ provider.transcriptionModel = createTranscriptionModel;
2150
+ provider.transcription = createTranscriptionModel;
1907
2151
  provider.chat = provider.languageModel;
1908
2152
  provider.embedding = provider.embeddingModel;
1909
2153
  provider.image = provider.imageModel;
@@ -1913,7 +2157,7 @@ function createGatewayProvider(options = {}) {
1913
2157
  }
1914
2158
  var gateway = createGatewayProvider();
1915
2159
  async function getGatewayAuthToken(options) {
1916
- const apiKey = (0, import_provider_utils14.loadOptionalSetting)({
2160
+ const apiKey = (0, import_provider_utils16.loadOptionalSetting)({
1917
2161
  settingValue: options.apiKey,
1918
2162
  environmentVariableName: "AI_GATEWAY_API_KEY"
1919
2163
  });