@ai-sdk/gateway 3.0.130 → 3.0.132

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,18 @@
1
1
  # @ai-sdk/gateway
2
2
 
3
+ ## 3.0.132
4
+
5
+ ### Patch Changes
6
+
7
+ - e962dda: Backport: chore(provider/gateway): update gateway model settings files
8
+
9
+ ## 3.0.131
10
+
11
+ ### Patch Changes
12
+
13
+ - 6160ced: fix(gateway): surface provider warnings in embedding and reranking responses
14
+ - c9b8abd: fix(provider/gateway): map `forbidden` error responses to GatewayForbiddenError instead of GatewayInternalServerError
15
+
3
16
  ## 3.0.130
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@ import { LanguageModelV3, ProviderV3, EmbeddingModelV3, ImageModelV3, Experiment
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-fable-5' | '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' | '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' | '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 & {});
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
 
@@ -572,9 +572,9 @@ declare const gatewayProviderOptions: _ai_sdk_provider_utils.LazySchema<{
572
572
  }>;
573
573
  type GatewayProviderOptions = InferSchema<typeof gatewayProviderOptions>;
574
574
 
575
- declare const symbol$7: unique symbol;
575
+ declare const symbol$8: unique symbol;
576
576
  declare abstract class GatewayError extends Error {
577
- private readonly [symbol$7];
577
+ private readonly [symbol$8];
578
578
  abstract readonly name: string;
579
579
  abstract readonly type: string;
580
580
  readonly statusCode: number;
@@ -608,12 +608,12 @@ declare const gatewayErrorResponseSchema: _ai_sdk_provider_utils.LazySchema<{
608
608
  }>;
609
609
  type GatewayErrorResponse = InferSchema<typeof gatewayErrorResponseSchema>;
610
610
 
611
- declare const symbol$6: unique symbol;
611
+ declare const symbol$7: unique symbol;
612
612
  /**
613
613
  * Authentication failed - invalid API key or OIDC token
614
614
  */
615
615
  declare class GatewayAuthenticationError extends GatewayError {
616
- private readonly [symbol$6];
616
+ private readonly [symbol$7];
617
617
  readonly name = "GatewayAuthenticationError";
618
618
  readonly type = "authentication_error";
619
619
  constructor({ message, statusCode, cause, generationId, }?: {
@@ -636,14 +636,14 @@ declare class GatewayAuthenticationError extends GatewayError {
636
636
  }): GatewayAuthenticationError;
637
637
  }
638
638
 
639
- declare const symbol$5: unique symbol;
639
+ declare const symbol$6: unique symbol;
640
640
  /**
641
641
  * The request could not be fulfilled because a dependency it relied on was not
642
642
  * available on the credentials or provider used to serve it (HTTP 424). Not
643
643
  * retryable — the caller must change the request.
644
644
  */
645
645
  declare class GatewayFailedDependencyError extends GatewayError {
646
- private readonly [symbol$5];
646
+ private readonly [symbol$6];
647
647
  readonly name = "GatewayFailedDependencyError";
648
648
  readonly type = "failed_dependency";
649
649
  constructor({ message, statusCode, cause, generationId, }?: {
@@ -655,6 +655,24 @@ declare class GatewayFailedDependencyError extends GatewayError {
655
655
  static isInstance(error: unknown): error is GatewayFailedDependencyError;
656
656
  }
657
657
 
658
+ declare const symbol$5: unique symbol;
659
+ /**
660
+ * Forbidden - the request was rejected by policy (e.g. a routing rule),
661
+ * not an authentication failure.
662
+ */
663
+ declare class GatewayForbiddenError extends GatewayError {
664
+ private readonly [symbol$5];
665
+ readonly name = "GatewayForbiddenError";
666
+ readonly type = "forbidden";
667
+ constructor({ message, statusCode, cause, generationId, }?: {
668
+ message?: string;
669
+ statusCode?: number;
670
+ cause?: unknown;
671
+ generationId?: string;
672
+ });
673
+ static isInstance(error: unknown): error is GatewayForbiddenError;
674
+ }
675
+
658
676
  declare const symbol$4: unique symbol;
659
677
  /**
660
678
  * Internal server error from the Gateway
@@ -746,4 +764,4 @@ declare class GatewayResponseError extends GatewayError {
746
764
  static isInstance(error: unknown): error is GatewayResponseError;
747
765
  }
748
766
 
749
- export { GatewayAuthenticationError, type GatewayCreditsResponse, GatewayError, type GatewayErrorResponse, GatewayFailedDependencyError, 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { LanguageModelV3, ProviderV3, EmbeddingModelV3, ImageModelV3, Experiment
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-fable-5' | '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' | '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' | '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 & {});
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
 
@@ -572,9 +572,9 @@ declare const gatewayProviderOptions: _ai_sdk_provider_utils.LazySchema<{
572
572
  }>;
573
573
  type GatewayProviderOptions = InferSchema<typeof gatewayProviderOptions>;
574
574
 
575
- declare const symbol$7: unique symbol;
575
+ declare const symbol$8: unique symbol;
576
576
  declare abstract class GatewayError extends Error {
577
- private readonly [symbol$7];
577
+ private readonly [symbol$8];
578
578
  abstract readonly name: string;
579
579
  abstract readonly type: string;
580
580
  readonly statusCode: number;
@@ -608,12 +608,12 @@ declare const gatewayErrorResponseSchema: _ai_sdk_provider_utils.LazySchema<{
608
608
  }>;
609
609
  type GatewayErrorResponse = InferSchema<typeof gatewayErrorResponseSchema>;
610
610
 
611
- declare const symbol$6: unique symbol;
611
+ declare const symbol$7: unique symbol;
612
612
  /**
613
613
  * Authentication failed - invalid API key or OIDC token
614
614
  */
615
615
  declare class GatewayAuthenticationError extends GatewayError {
616
- private readonly [symbol$6];
616
+ private readonly [symbol$7];
617
617
  readonly name = "GatewayAuthenticationError";
618
618
  readonly type = "authentication_error";
619
619
  constructor({ message, statusCode, cause, generationId, }?: {
@@ -636,14 +636,14 @@ declare class GatewayAuthenticationError extends GatewayError {
636
636
  }): GatewayAuthenticationError;
637
637
  }
638
638
 
639
- declare const symbol$5: unique symbol;
639
+ declare const symbol$6: unique symbol;
640
640
  /**
641
641
  * The request could not be fulfilled because a dependency it relied on was not
642
642
  * available on the credentials or provider used to serve it (HTTP 424). Not
643
643
  * retryable — the caller must change the request.
644
644
  */
645
645
  declare class GatewayFailedDependencyError extends GatewayError {
646
- private readonly [symbol$5];
646
+ private readonly [symbol$6];
647
647
  readonly name = "GatewayFailedDependencyError";
648
648
  readonly type = "failed_dependency";
649
649
  constructor({ message, statusCode, cause, generationId, }?: {
@@ -655,6 +655,24 @@ declare class GatewayFailedDependencyError extends GatewayError {
655
655
  static isInstance(error: unknown): error is GatewayFailedDependencyError;
656
656
  }
657
657
 
658
+ declare const symbol$5: unique symbol;
659
+ /**
660
+ * Forbidden - the request was rejected by policy (e.g. a routing rule),
661
+ * not an authentication failure.
662
+ */
663
+ declare class GatewayForbiddenError extends GatewayError {
664
+ private readonly [symbol$5];
665
+ readonly name = "GatewayForbiddenError";
666
+ readonly type = "forbidden";
667
+ constructor({ message, statusCode, cause, generationId, }?: {
668
+ message?: string;
669
+ statusCode?: number;
670
+ cause?: unknown;
671
+ generationId?: string;
672
+ });
673
+ static isInstance(error: unknown): error is GatewayForbiddenError;
674
+ }
675
+
658
676
  declare const symbol$4: unique symbol;
659
677
  /**
660
678
  * Internal server error from the Gateway
@@ -746,4 +764,4 @@ declare class GatewayResponseError extends GatewayError {
746
764
  static isInstance(error: unknown): error is GatewayResponseError;
747
765
  }
748
766
 
749
- export { GatewayAuthenticationError, type GatewayCreditsResponse, GatewayError, type GatewayErrorResponse, GatewayFailedDependencyError, 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 };
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 };
package/dist/index.js CHANGED
@@ -4,8 +4,8 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __export = (target, all) => {
7
- for (var name9 in all)
8
- __defProp(target, name9, { get: all[name9], enumerable: true });
7
+ for (var name10 in all)
8
+ __defProp(target, name10, { get: all[name10], enumerable: true });
9
9
  };
10
10
  var __copyProps = (to, from, except, desc) => {
11
11
  if (from && typeof from === "object" || typeof from === "function") {
@@ -23,6 +23,7 @@ __export(index_exports, {
23
23
  GatewayAuthenticationError: () => GatewayAuthenticationError,
24
24
  GatewayError: () => GatewayError,
25
25
  GatewayFailedDependencyError: () => GatewayFailedDependencyError,
26
+ GatewayForbiddenError: () => GatewayForbiddenError,
26
27
  GatewayInternalServerError: () => GatewayInternalServerError,
27
28
  GatewayInvalidRequestError: () => GatewayInvalidRequestError,
28
29
  GatewayModelNotFoundError: () => GatewayModelNotFoundError,
@@ -269,12 +270,35 @@ var GatewayFailedDependencyError = class extends (_b7 = GatewayError, _a7 = symb
269
270
  }
270
271
  };
271
272
 
272
- // src/errors/gateway-response-error.ts
273
- var name7 = "GatewayResponseError";
273
+ // src/errors/gateway-forbidden-error.ts
274
+ var name7 = "GatewayForbiddenError";
274
275
  var marker8 = `vercel.ai.gateway.error.${name7}`;
275
276
  var symbol8 = Symbol.for(marker8);
276
277
  var _a8, _b8;
277
- var GatewayResponseError = class extends (_b8 = GatewayError, _a8 = symbol8, _b8) {
278
+ var GatewayForbiddenError = class extends (_b8 = GatewayError, _a8 = symbol8, _b8) {
279
+ constructor({
280
+ message = "Forbidden",
281
+ statusCode = 403,
282
+ cause,
283
+ generationId
284
+ } = {}) {
285
+ super({ message, statusCode, cause, generationId });
286
+ this[_a8] = true;
287
+ // used in isInstance
288
+ this.name = name7;
289
+ this.type = "forbidden";
290
+ }
291
+ static isInstance(error) {
292
+ return GatewayError.hasMarker(error) && symbol8 in error;
293
+ }
294
+ };
295
+
296
+ // src/errors/gateway-response-error.ts
297
+ var name8 = "GatewayResponseError";
298
+ var marker9 = `vercel.ai.gateway.error.${name8}`;
299
+ var symbol9 = Symbol.for(marker9);
300
+ var _a9, _b9;
301
+ var GatewayResponseError = class extends (_b9 = GatewayError, _a9 = symbol9, _b9) {
278
302
  constructor({
279
303
  message = "Invalid response from Gateway",
280
304
  statusCode = 502,
@@ -284,15 +308,15 @@ var GatewayResponseError = class extends (_b8 = GatewayError, _a8 = symbol8, _b8
284
308
  generationId
285
309
  } = {}) {
286
310
  super({ message, statusCode, cause, generationId });
287
- this[_a8] = true;
311
+ this[_a9] = true;
288
312
  // used in isInstance
289
- this.name = name7;
313
+ this.name = name8;
290
314
  this.type = "response_error";
291
315
  this.response = response;
292
316
  this.validationError = validationError;
293
317
  }
294
318
  static isInstance(error) {
295
- return GatewayError.hasMarker(error) && symbol8 in error;
319
+ return GatewayError.hasMarker(error) && symbol9 in error;
296
320
  }
297
321
  };
298
322
 
@@ -305,7 +329,7 @@ async function createGatewayErrorFromResponse({
305
329
  cause,
306
330
  authMethod
307
331
  }) {
308
- var _a10;
332
+ var _a11;
309
333
  const parseResult = await (0, import_provider_utils2.safeValidateTypes)({
310
334
  value: response,
311
335
  schema: gatewayErrorResponseSchema
@@ -324,7 +348,7 @@ async function createGatewayErrorFromResponse({
324
348
  const validatedResponse = parseResult.value;
325
349
  const errorType = validatedResponse.error.type;
326
350
  const message = validatedResponse.error.message;
327
- const generationId = (_a10 = validatedResponse.generationId) != null ? _a10 : void 0;
351
+ const generationId = (_a11 = validatedResponse.generationId) != null ? _a11 : void 0;
328
352
  switch (errorType) {
329
353
  case "authentication_error":
330
354
  return GatewayAuthenticationError.createContextualError({
@@ -375,6 +399,13 @@ async function createGatewayErrorFromResponse({
375
399
  cause,
376
400
  generationId
377
401
  });
402
+ case "forbidden":
403
+ return new GatewayForbiddenError({
404
+ message,
405
+ statusCode,
406
+ cause,
407
+ generationId
408
+ });
378
409
  default:
379
410
  return new GatewayInternalServerError({
380
411
  message,
@@ -414,11 +445,11 @@ function extractApiCallResponse(error) {
414
445
  }
415
446
 
416
447
  // src/errors/gateway-timeout-error.ts
417
- var name8 = "GatewayTimeoutError";
418
- var marker9 = `vercel.ai.gateway.error.${name8}`;
419
- var symbol9 = Symbol.for(marker9);
420
- var _a9, _b9;
421
- var GatewayTimeoutError = class _GatewayTimeoutError extends (_b9 = GatewayError, _a9 = symbol9, _b9) {
448
+ var name9 = "GatewayTimeoutError";
449
+ var marker10 = `vercel.ai.gateway.error.${name9}`;
450
+ var symbol10 = Symbol.for(marker10);
451
+ var _a10, _b10;
452
+ var GatewayTimeoutError = class _GatewayTimeoutError extends (_b10 = GatewayError, _a10 = symbol10, _b10) {
422
453
  constructor({
423
454
  message = "Request timed out",
424
455
  statusCode = 408,
@@ -426,13 +457,13 @@ var GatewayTimeoutError = class _GatewayTimeoutError extends (_b9 = GatewayError
426
457
  generationId
427
458
  } = {}) {
428
459
  super({ message, statusCode, cause, generationId });
429
- this[_a9] = true;
460
+ this[_a10] = true;
430
461
  // used in isInstance
431
- this.name = name8;
462
+ this.name = name9;
432
463
  this.type = "timeout_error";
433
464
  }
434
465
  static isInstance(error) {
435
- return GatewayError.hasMarker(error) && symbol9 in error;
466
+ return GatewayError.hasMarker(error) && symbol10 in error;
436
467
  }
437
468
  /**
438
469
  * Creates a helpful timeout error message with troubleshooting guidance
@@ -472,7 +503,7 @@ function isTimeoutError(error) {
472
503
  return false;
473
504
  }
474
505
  async function asGatewayError(error, authMethod) {
475
- var _a10;
506
+ var _a11;
476
507
  if (GatewayError.isInstance(error)) {
477
508
  return error;
478
509
  }
@@ -491,7 +522,7 @@ async function asGatewayError(error, authMethod) {
491
522
  }
492
523
  return await createGatewayErrorFromResponse({
493
524
  response: extractApiCallResponse(error),
494
- statusCode: (_a10 = error.statusCode) != null ? _a10 : 500,
525
+ statusCode: (_a11 = error.statusCode) != null ? _a11 : 500,
495
526
  defaultMessage: "Gateway request failed",
496
527
  cause: error,
497
528
  authMethod
@@ -985,7 +1016,7 @@ var GatewayEmbeddingModel = class {
985
1016
  abortSignal,
986
1017
  providerOptions
987
1018
  }) {
988
- var _a10;
1019
+ var _a11, _b11;
989
1020
  const resolvedHeaders = await (0, import_provider_utils8.resolve)(this.config.headers());
990
1021
  try {
991
1022
  const {
@@ -1016,10 +1047,10 @@ var GatewayEmbeddingModel = class {
1016
1047
  });
1017
1048
  return {
1018
1049
  embeddings: responseBody.embeddings,
1019
- usage: (_a10 = responseBody.usage) != null ? _a10 : void 0,
1050
+ usage: (_a11 = responseBody.usage) != null ? _a11 : void 0,
1020
1051
  providerMetadata: responseBody.providerMetadata,
1021
1052
  response: { headers: responseHeaders, body: rawValue },
1022
- warnings: []
1053
+ warnings: (_b11 = responseBody.warnings) != null ? _b11 : []
1023
1054
  };
1024
1055
  } catch (error) {
1025
1056
  throw await asGatewayError(error, await parseAuthMethod(resolvedHeaders));
@@ -1035,11 +1066,28 @@ var GatewayEmbeddingModel = class {
1035
1066
  };
1036
1067
  }
1037
1068
  };
1069
+ var gatewayEmbeddingWarningSchema = import_v48.z.discriminatedUnion("type", [
1070
+ import_v48.z.object({
1071
+ type: import_v48.z.literal("unsupported"),
1072
+ feature: import_v48.z.string(),
1073
+ details: import_v48.z.string().optional()
1074
+ }),
1075
+ import_v48.z.object({
1076
+ type: import_v48.z.literal("compatibility"),
1077
+ feature: import_v48.z.string(),
1078
+ details: import_v48.z.string().optional()
1079
+ }),
1080
+ import_v48.z.object({
1081
+ type: import_v48.z.literal("other"),
1082
+ message: import_v48.z.string()
1083
+ })
1084
+ ]);
1038
1085
  var gatewayEmbeddingResponseSchema = (0, import_provider_utils8.lazySchema)(
1039
1086
  () => (0, import_provider_utils8.zodSchema)(
1040
1087
  import_v48.z.object({
1041
1088
  embeddings: import_v48.z.array(import_v48.z.array(import_v48.z.number())),
1042
1089
  usage: import_v48.z.object({ tokens: import_v48.z.number() }).nullish(),
1090
+ warnings: import_v48.z.array(gatewayEmbeddingWarningSchema).optional(),
1043
1091
  providerMetadata: import_v48.z.record(import_v48.z.string(), import_v48.z.record(import_v48.z.string(), import_v48.z.unknown())).optional()
1044
1092
  })
1045
1093
  )
@@ -1071,7 +1119,7 @@ var GatewayImageModel = class {
1071
1119
  headers,
1072
1120
  abortSignal
1073
1121
  }) {
1074
- var _a10, _b10, _c, _d;
1122
+ var _a11, _b11, _c, _d;
1075
1123
  const resolvedHeaders = await (0, import_provider_utils9.resolve)(this.config.headers());
1076
1124
  try {
1077
1125
  const {
@@ -1111,7 +1159,7 @@ var GatewayImageModel = class {
1111
1159
  return {
1112
1160
  images: responseBody.images,
1113
1161
  // Always base64 strings from server
1114
- warnings: (_a10 = responseBody.warnings) != null ? _a10 : [],
1162
+ warnings: (_a11 = responseBody.warnings) != null ? _a11 : [],
1115
1163
  providerMetadata: responseBody.providerMetadata,
1116
1164
  response: {
1117
1165
  timestamp: /* @__PURE__ */ new Date(),
@@ -1120,7 +1168,7 @@ var GatewayImageModel = class {
1120
1168
  },
1121
1169
  ...responseBody.usage != null && {
1122
1170
  usage: {
1123
- inputTokens: (_b10 = responseBody.usage.inputTokens) != null ? _b10 : void 0,
1171
+ inputTokens: (_b11 = responseBody.usage.inputTokens) != null ? _b11 : void 0,
1124
1172
  outputTokens: (_c = responseBody.usage.outputTokens) != null ? _c : void 0,
1125
1173
  totalTokens: (_d = responseBody.usage.totalTokens) != null ? _d : void 0
1126
1174
  }
@@ -1209,7 +1257,7 @@ var GatewayVideoModel = class {
1209
1257
  headers,
1210
1258
  abortSignal
1211
1259
  }) {
1212
- var _a10;
1260
+ var _a11;
1213
1261
  const resolvedHeaders = await (0, import_provider_utils10.resolve)(this.config.headers());
1214
1262
  try {
1215
1263
  const { responseHeaders, value: responseBody } = await (0, import_provider_utils10.postJsonToApi)({
@@ -1305,7 +1353,7 @@ var GatewayVideoModel = class {
1305
1353
  });
1306
1354
  return {
1307
1355
  videos: responseBody.videos,
1308
- warnings: (_a10 = responseBody.warnings) != null ? _a10 : [],
1356
+ warnings: (_a11 = responseBody.warnings) != null ? _a11 : [],
1309
1357
  providerMetadata: responseBody.providerMetadata,
1310
1358
  response: {
1311
1359
  timestamp: /* @__PURE__ */ new Date(),
@@ -1403,6 +1451,7 @@ var GatewayRerankingModel = class {
1403
1451
  abortSignal,
1404
1452
  providerOptions
1405
1453
  }) {
1454
+ var _a11;
1406
1455
  const resolvedHeaders = await (0, import_provider_utils11.resolve)(this.config.headers());
1407
1456
  try {
1408
1457
  const {
@@ -1437,7 +1486,7 @@ var GatewayRerankingModel = class {
1437
1486
  ranking: responseBody.ranking,
1438
1487
  providerMetadata: responseBody.providerMetadata,
1439
1488
  response: { headers: responseHeaders, body: rawValue },
1440
- warnings: []
1489
+ warnings: (_a11 = responseBody.warnings) != null ? _a11 : []
1441
1490
  };
1442
1491
  } catch (error) {
1443
1492
  throw await asGatewayError(error, await parseAuthMethod(resolvedHeaders));
@@ -1453,6 +1502,22 @@ var GatewayRerankingModel = class {
1453
1502
  };
1454
1503
  }
1455
1504
  };
1505
+ var gatewayRerankingWarningSchema = import_v411.z.discriminatedUnion("type", [
1506
+ import_v411.z.object({
1507
+ type: import_v411.z.literal("unsupported"),
1508
+ feature: import_v411.z.string(),
1509
+ details: import_v411.z.string().optional()
1510
+ }),
1511
+ import_v411.z.object({
1512
+ type: import_v411.z.literal("compatibility"),
1513
+ feature: import_v411.z.string(),
1514
+ details: import_v411.z.string().optional()
1515
+ }),
1516
+ import_v411.z.object({
1517
+ type: import_v411.z.literal("other"),
1518
+ message: import_v411.z.string()
1519
+ })
1520
+ ]);
1456
1521
  var gatewayRerankingResponseSchema = (0, import_provider_utils11.lazySchema)(
1457
1522
  () => (0, import_provider_utils11.zodSchema)(
1458
1523
  import_v411.z.object({
@@ -1462,6 +1527,7 @@ var gatewayRerankingResponseSchema = (0, import_provider_utils11.lazySchema)(
1462
1527
  relevanceScore: import_v411.z.number()
1463
1528
  })
1464
1529
  ),
1530
+ warnings: import_v411.z.array(gatewayRerankingWarningSchema).optional(),
1465
1531
  providerMetadata: import_v411.z.record(import_v411.z.string(), import_v411.z.record(import_v411.z.string(), import_v411.z.unknown())).optional()
1466
1532
  })
1467
1533
  )
@@ -1653,22 +1719,22 @@ var gatewayTools = {
1653
1719
  var import_oidc = require("@vercel/oidc");
1654
1720
  var import_oidc2 = require("@vercel/oidc");
1655
1721
  async function getVercelRequestId() {
1656
- var _a10;
1657
- return (_a10 = (0, import_oidc.getContext)().headers) == null ? void 0 : _a10["x-vercel-id"];
1722
+ var _a11;
1723
+ return (_a11 = (0, import_oidc.getContext)().headers) == null ? void 0 : _a11["x-vercel-id"];
1658
1724
  }
1659
1725
 
1660
1726
  // src/version.ts
1661
- var VERSION = true ? "3.0.130" : "0.0.0-test";
1727
+ var VERSION = true ? "3.0.132" : "0.0.0-test";
1662
1728
 
1663
1729
  // src/gateway-provider.ts
1664
1730
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
1665
1731
  function createGatewayProvider(options = {}) {
1666
- var _a10, _b10;
1732
+ var _a11, _b11;
1667
1733
  let pendingMetadata = null;
1668
1734
  let metadataCache = null;
1669
- const cacheRefreshMillis = (_a10 = options.metadataCacheRefreshMillis) != null ? _a10 : 1e3 * 60 * 5;
1735
+ const cacheRefreshMillis = (_a11 = options.metadataCacheRefreshMillis) != null ? _a11 : 1e3 * 60 * 5;
1670
1736
  let lastFetchTime = 0;
1671
- const baseURL = (_b10 = (0, import_provider_utils14.withoutTrailingSlash)(options.baseURL)) != null ? _b10 : "https://ai-gateway.vercel.sh/v3/ai";
1737
+ const baseURL = (_b11 = (0, import_provider_utils14.withoutTrailingSlash)(options.baseURL)) != null ? _b11 : "https://ai-gateway.vercel.sh/v3/ai";
1672
1738
  const getHeaders = async () => {
1673
1739
  try {
1674
1740
  const auth = await getGatewayAuthToken(options);
@@ -1728,8 +1794,8 @@ function createGatewayProvider(options = {}) {
1728
1794
  });
1729
1795
  };
1730
1796
  const getAvailableModels = async () => {
1731
- var _a11, _b11, _c;
1732
- const now = (_c = (_b11 = (_a11 = options._internal) == null ? void 0 : _a11.currentDate) == null ? void 0 : _b11.call(_a11).getTime()) != null ? _c : Date.now();
1797
+ var _a12, _b12, _c;
1798
+ const now = (_c = (_b12 = (_a12 = options._internal) == null ? void 0 : _a12.currentDate) == null ? void 0 : _b12.call(_a12).getTime()) != null ? _c : Date.now();
1733
1799
  if (!pendingMetadata || now - lastFetchTime > cacheRefreshMillis) {
1734
1800
  lastFetchTime = now;
1735
1801
  pendingMetadata = new GatewayFetchMetadata({
@@ -1868,6 +1934,7 @@ async function getGatewayAuthToken(options) {
1868
1934
  GatewayAuthenticationError,
1869
1935
  GatewayError,
1870
1936
  GatewayFailedDependencyError,
1937
+ GatewayForbiddenError,
1871
1938
  GatewayInternalServerError,
1872
1939
  GatewayInvalidRequestError,
1873
1940
  GatewayModelNotFoundError,