@ai-sdk/gateway 4.0.63 → 4.0.64

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,14 @@
1
1
  # @ai-sdk/gateway
2
2
 
3
+ ## 4.0.64
4
+
5
+ ### Patch Changes
6
+
7
+ - 591d25b: feat: add batch completion webhooks. `experimental_startTextBatch` accepts a `webhookUrl`, and the gateway provider registers it through the batch `callbackUrl` contract and exports typed async-job metadata. Direct Anthropic and OpenAI batch providers return an unsupported warning when the option is provided.
8
+ - Updated dependencies [591d25b]
9
+ - @ai-sdk/provider@4.0.8
10
+ - @ai-sdk/provider-utils@5.0.30
11
+
3
12
  ## 4.0.63
4
13
 
5
14
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { LanguageModelV4, ProviderV4, Experimental_BatchLanguageModelV4, 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, JSONValue, 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
 
@@ -1058,6 +1058,30 @@ interface GatewayProviderSettings {
1058
1058
  declare function createGateway(options?: GatewayProviderSettings): GatewayProvider;
1059
1059
  declare const gateway: GatewayProvider;
1060
1060
 
1061
+ /**
1062
+ * Metadata for an asynchronous AI Gateway job.
1063
+ */
1064
+ type GatewayAsyncJobMetadata = {
1065
+ readonly jobId: string;
1066
+ readonly status: string;
1067
+ /**
1068
+ * Secret for verifying customer webhook deliveries. This is sensitive,
1069
+ * start-response-only metadata and must not be logged or forwarded.
1070
+ */
1071
+ readonly webhookSigningSecret?: string;
1072
+ readonly [key: string]: JSONValue | undefined;
1073
+ };
1074
+ /**
1075
+ * Shape of the inner `providerMetadata.gateway` object returned by AI Gateway
1076
+ * operations.
1077
+ *
1078
+ * Additional fields may be added without a package update.
1079
+ */
1080
+ type GatewayProviderMetadata = {
1081
+ readonly asyncJob?: GatewayAsyncJobMetadata;
1082
+ readonly [key: string]: JSONValue | undefined;
1083
+ };
1084
+
1061
1085
  type GatewayProviderOptions = {
1062
1086
  /**
1063
1087
  * Service-owned options may be added by the Gateway without requiring an SDK
@@ -1319,4 +1343,4 @@ declare class GatewayResponseError extends GatewayError {
1319
1343
 
1320
1344
  declare const VERSION: string;
1321
1345
 
1322
- 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 };
1346
+ export { GATEWAY_AUTH_SUBPROTOCOL_PREFIX, GATEWAY_REALTIME_SUBPROTOCOL, GATEWAY_TEAM_SUBPROTOCOL_PREFIX, GATEWAY_TRANSCRIPTION_SUBPROTOCOL, type GatewayAsyncJobMetadata, 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 GatewayProviderMetadata, 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 };
package/dist/index.js CHANGED
@@ -1232,7 +1232,8 @@ var GatewayBatchLanguageModel = class _GatewayBatchLanguageModel extends Gateway
1232
1232
  requests,
1233
1233
  providerOptions,
1234
1234
  headers,
1235
- abortSignal
1235
+ abortSignal,
1236
+ webhookUrl
1236
1237
  }) {
1237
1238
  var _a12;
1238
1239
  const resolvedHeaders = this.config.headers ? await resolve5(this.config.headers) : void 0;
@@ -1249,6 +1250,7 @@ var GatewayBatchLanguageModel = class _GatewayBatchLanguageModel extends Gateway
1249
1250
  idempotencyKey != null ? { "idempotency-key": idempotencyKey } : void 0
1250
1251
  ),
1251
1252
  body: {
1253
+ ...webhookUrl != null && { callbackUrl: webhookUrl },
1252
1254
  modelId: this.modelId,
1253
1255
  requests: requests.map((request) => ({
1254
1256
  id: request.id,
@@ -3465,7 +3467,7 @@ async function getVercelRequestId() {
3465
3467
  }
3466
3468
 
3467
3469
  // src/version.ts
3468
- var VERSION = true ? "4.0.63" : "0.0.0-test";
3470
+ var VERSION = true ? "4.0.64" : "0.0.0-test";
3469
3471
 
3470
3472
  // src/gateway-provider.ts
3471
3473
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";