@ai-sdk/gateway 4.0.56 → 4.0.57

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,11 @@
1
1
  # @ai-sdk/gateway
2
2
 
3
+ ## 4.0.57
4
+
5
+ ### Patch Changes
6
+
7
+ - 936719b: add experimental batch API support (startTextBatch/getBatchStatus/getBatchResults) via the AI Gateway batch routes
8
+
3
9
  ## 4.0.56
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { LanguageModelV4, ProviderV4, EmbeddingModelV4, ImageModelV4, Experimental_VideoModelV4, RerankingModelV4, SpeechModelV4, TranscriptionModelV4, Experimental_RealtimeFactoryV4, TypeValidationError } from '@ai-sdk/provider';
1
+ import { LanguageModelV4, ProviderV4, Experimental_BatchLanguageModelV4, EmbeddingModelV4, ImageModelV4, Experimental_VideoModelV4, RerankingModelV4, SpeechModelV4, TranscriptionModelV4, Experimental_RealtimeFactoryV4, TypeValidationError } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { FetchFunction, WebSocketConstructor, InferSchema } from '@ai-sdk/provider-utils';
4
4
 
@@ -664,15 +664,15 @@ declare const gatewayTools: {
664
664
  };
665
665
 
666
666
  interface GatewayProvider extends ProviderV4 {
667
- (modelId: GatewayModelId): LanguageModelV4;
667
+ (modelId: GatewayModelId): Experimental_BatchLanguageModelV4;
668
668
  /**
669
669
  * Creates a model for text generation.
670
670
  */
671
- chat(modelId: GatewayModelId): LanguageModelV4;
671
+ chat(modelId: GatewayModelId): Experimental_BatchLanguageModelV4;
672
672
  /**
673
673
  * Creates a model for text generation.
674
674
  */
675
- languageModel(modelId: GatewayModelId): LanguageModelV4;
675
+ languageModel(modelId: GatewayModelId): Experimental_BatchLanguageModelV4;
676
676
  /**
677
677
  * Returns available providers and models for use with the remote provider.
678
678
  */
@@ -843,6 +843,11 @@ type GatewayProviderOptions = {
843
843
  * Currently supports `'implicit-caching'` and `'vision'` (image input).
844
844
  */
845
845
  has?: Array<'implicit-caching' | 'vision'>;
846
+ /**
847
+ * Idempotency key for `experimental_startTextBatch`: retries with the same
848
+ * key replay the original batch instead of creating a duplicate.
849
+ */
850
+ idempotencyKey?: string;
846
851
  /** Array of model slugs specifying fallback models to use in order. */
847
852
  models?: string[];
848
853
  /** Array of provider slugs that are the only ones allowed to be used. */
@@ -867,9 +872,9 @@ type GatewayProviderOptions = {
867
872
  zeroDataRetention?: boolean;
868
873
  };
869
874
 
870
- declare const symbol$8: unique symbol;
875
+ declare const symbol$9: unique symbol;
871
876
  declare abstract class GatewayError extends Error {
872
- private readonly [symbol$8];
877
+ private readonly [symbol$9];
873
878
  abstract readonly name: string;
874
879
  abstract readonly type: string;
875
880
  readonly statusCode: number;
@@ -903,12 +908,12 @@ declare const gatewayErrorResponseSchema: _ai_sdk_provider_utils.LazySchema<{
903
908
  }>;
904
909
  type GatewayErrorResponse = InferSchema<typeof gatewayErrorResponseSchema>;
905
910
 
906
- declare const symbol$7: unique symbol;
911
+ declare const symbol$8: unique symbol;
907
912
  /**
908
913
  * Authentication failed - invalid API key or OIDC token
909
914
  */
910
915
  declare class GatewayAuthenticationError extends GatewayError {
911
- private readonly [symbol$7];
916
+ private readonly [symbol$8];
912
917
  readonly name = "GatewayAuthenticationError";
913
918
  readonly type = "authentication_error";
914
919
  constructor({ message, statusCode, cause, generationId, }?: {
@@ -931,14 +936,14 @@ declare class GatewayAuthenticationError extends GatewayError {
931
936
  }): GatewayAuthenticationError;
932
937
  }
933
938
 
934
- declare const symbol$6: unique symbol;
939
+ declare const symbol$7: unique symbol;
935
940
  /**
936
941
  * The request could not be fulfilled because a dependency it relied on was not
937
942
  * available on the credentials or provider used to serve it (HTTP 424). Not
938
943
  * retryable — the caller must change the request.
939
944
  */
940
945
  declare class GatewayFailedDependencyError extends GatewayError {
941
- private readonly [symbol$6];
946
+ private readonly [symbol$7];
942
947
  readonly name = "GatewayFailedDependencyError";
943
948
  readonly type = "failed_dependency";
944
949
  constructor({ message, statusCode, cause, generationId, }?: {
@@ -950,13 +955,13 @@ declare class GatewayFailedDependencyError extends GatewayError {
950
955
  static isInstance(error: unknown): error is GatewayFailedDependencyError;
951
956
  }
952
957
 
953
- declare const symbol$5: unique symbol;
958
+ declare const symbol$6: unique symbol;
954
959
  /**
955
960
  * Forbidden - the request was rejected by policy (e.g. a routing rule),
956
961
  * not an authentication failure.
957
962
  */
958
963
  declare class GatewayForbiddenError extends GatewayError {
959
- private readonly [symbol$5];
964
+ private readonly [symbol$6];
960
965
  readonly name = "GatewayForbiddenError";
961
966
  readonly type = "forbidden";
962
967
  readonly ruleId?: string;
@@ -970,12 +975,12 @@ declare class GatewayForbiddenError extends GatewayError {
970
975
  static isInstance(error: unknown): error is GatewayForbiddenError;
971
976
  }
972
977
 
973
- declare const symbol$4: unique symbol;
978
+ declare const symbol$5: unique symbol;
974
979
  /**
975
980
  * Internal server error from the Gateway
976
981
  */
977
982
  declare class GatewayInternalServerError extends GatewayError {
978
- private readonly [symbol$4];
983
+ private readonly [symbol$5];
979
984
  readonly name = "GatewayInternalServerError";
980
985
  readonly type = "internal_server_error";
981
986
  constructor({ message, statusCode, cause, generationId, }?: {
@@ -987,12 +992,12 @@ declare class GatewayInternalServerError extends GatewayError {
987
992
  static isInstance(error: unknown): error is GatewayInternalServerError;
988
993
  }
989
994
 
990
- declare const symbol$3: unique symbol;
995
+ declare const symbol$4: unique symbol;
991
996
  /**
992
997
  * Invalid request - missing headers, malformed data, etc.
993
998
  */
994
999
  declare class GatewayInvalidRequestError extends GatewayError {
995
- private readonly [symbol$3];
1000
+ private readonly [symbol$4];
996
1001
  readonly name = "GatewayInvalidRequestError";
997
1002
  readonly type = "invalid_request_error";
998
1003
  constructor({ message, statusCode, cause, generationId, }?: {
@@ -1004,12 +1009,12 @@ declare class GatewayInvalidRequestError extends GatewayError {
1004
1009
  static isInstance(error: unknown): error is GatewayInvalidRequestError;
1005
1010
  }
1006
1011
 
1007
- declare const symbol$2: unique symbol;
1012
+ declare const symbol$3: unique symbol;
1008
1013
  /**
1009
1014
  * Model not found or not available
1010
1015
  */
1011
1016
  declare class GatewayModelNotFoundError extends GatewayError {
1012
- private readonly [symbol$2];
1017
+ private readonly [symbol$3];
1013
1018
  readonly name = "GatewayModelNotFoundError";
1014
1019
  readonly type = "model_not_found";
1015
1020
  readonly modelId?: string;
@@ -1023,6 +1028,25 @@ declare class GatewayModelNotFoundError extends GatewayError {
1023
1028
  static isInstance(error: unknown): error is GatewayModelNotFoundError;
1024
1029
  }
1025
1030
 
1031
+ declare const symbol$2: unique symbol;
1032
+ /**
1033
+ * Not found - the requested Gateway resource does not exist or is not
1034
+ * visible to the caller (e.g. an unknown async batch/video job id).
1035
+ * Distinct from `GatewayModelNotFoundError`, which is model-specific.
1036
+ */
1037
+ declare class GatewayNotFoundError extends GatewayError {
1038
+ private readonly [symbol$2];
1039
+ readonly name = "GatewayNotFoundError";
1040
+ readonly type = "not_found";
1041
+ constructor({ message, statusCode, cause, generationId, }?: {
1042
+ message?: string;
1043
+ statusCode?: number;
1044
+ cause?: unknown;
1045
+ generationId?: string;
1046
+ });
1047
+ static isInstance(error: unknown): error is GatewayNotFoundError;
1048
+ }
1049
+
1026
1050
  declare const symbol$1: unique symbol;
1027
1051
  /**
1028
1052
  * Rate limit exceeded.
@@ -1063,4 +1087,4 @@ declare class GatewayResponseError extends GatewayError {
1063
1087
 
1064
1088
  declare const VERSION: string;
1065
1089
 
1066
- export { GATEWAY_AUTH_SUBPROTOCOL_PREFIX, GATEWAY_REALTIME_SUBPROTOCOL, GATEWAY_TEAM_SUBPROTOCOL_PREFIX, GATEWAY_TRANSCRIPTION_SUBPROTOCOL, GatewayAuthenticationError, type GatewayCreditsResponse, type GatewayEmbeddingModelId, GatewayError, type GatewayErrorResponse, GatewayFailedDependencyError, GatewayForbiddenError, type GatewayGenerationInfo, type GatewayGenerationInfoParams, type GatewayImageModelId, GatewayInternalServerError, GatewayInvalidRequestError, type GatewayLanguageModelEntry, type GatewayProviderOptions as GatewayLanguageModelOptions, type GatewayLanguageModelSpecification, type GatewayLanguageModelEntry as GatewayModelEntry, type GatewayModelId, GatewayModelNotFoundError, type GatewayProvider, type GatewayProviderOptions, type GatewayProviderSettings, GatewayRateLimitError, type GatewayRealtimeModelId, type GatewayRerankingModelId, GatewayResponseError, type GatewaySpeechModelId, type GatewaySpendReportParams, type GatewaySpendReportResponse, type GatewaySpendReportRow, type GatewayTranscriptionModelId, type GatewayVideoModelId, VERSION, createGateway, createGateway as createGatewayProvider, gateway, getGatewayRealtimeAuthToken, getGatewayRealtimeProtocols, getGatewayRealtimeTeamIdOrSlug, getGatewayTranscriptionProtocols };
1090
+ export { GATEWAY_AUTH_SUBPROTOCOL_PREFIX, GATEWAY_REALTIME_SUBPROTOCOL, GATEWAY_TEAM_SUBPROTOCOL_PREFIX, GATEWAY_TRANSCRIPTION_SUBPROTOCOL, GatewayAuthenticationError, type GatewayCreditsResponse, type GatewayEmbeddingModelId, GatewayError, type GatewayErrorResponse, GatewayFailedDependencyError, GatewayForbiddenError, type GatewayGenerationInfo, type GatewayGenerationInfoParams, type GatewayImageModelId, GatewayInternalServerError, GatewayInvalidRequestError, type GatewayLanguageModelEntry, type GatewayProviderOptions as GatewayLanguageModelOptions, type GatewayLanguageModelSpecification, type GatewayLanguageModelEntry as GatewayModelEntry, type GatewayModelId, GatewayModelNotFoundError, GatewayNotFoundError, type GatewayProvider, type GatewayProviderOptions, type GatewayProviderSettings, GatewayRateLimitError, type GatewayRealtimeModelId, type GatewayRerankingModelId, GatewayResponseError, type GatewaySpeechModelId, type GatewaySpendReportParams, type GatewaySpendReportResponse, type GatewaySpendReportRow, type GatewayTranscriptionModelId, type GatewayVideoModelId, VERSION, createGateway, createGateway as createGatewayProvider, gateway, getGatewayRealtimeAuthToken, getGatewayRealtimeProtocols, getGatewayRealtimeTeamIdOrSlug, getGatewayTranscriptionProtocols };