@voltro/ai 0.83.0 → 0.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1226,9 +1226,15 @@ export declare const embed: (text: string, config?: EmbeddingProviderConfig) =>
1226
1226
 
1227
1227
  export declare interface EmbeddingProviderConfig {
1228
1228
  readonly name: EmbeddingProviderName;
1229
- /** Model id. For 'openai': e.g. 'text-embedding-3-small'. Ignored by the
1229
+ /** Model id. For 'openai': e.g. 'text-embedding-3-small'; for 'gateway' a
1230
+ * `creator/model` id, e.g. 'openai/text-embedding-3-small'. Ignored by the
1230
1231
  * mock provider (which derives its output from `mockDim`). */
1231
1232
  readonly model: string;
1233
+ /** 'gateway' only: the gateway key and endpoint for THIS call — the same
1234
+ * override the text-side `gateway` provider takes. Absent → the
1235
+ * `AI_GATEWAY_API_KEY` the gateway package reads itself. */
1236
+ readonly apiKey?: string;
1237
+ readonly baseURL?: string;
1232
1238
  /** Mock-only: the deterministic output-vector length. Default 8. */
1233
1239
  readonly mockDim?: number;
1234
1240
  /** Native SDK options, e.g. `{ openai: { dimensions: 512 } }` or
@@ -1242,13 +1248,13 @@ export declare interface EmbeddingProviderConfig {
1242
1248
 
1243
1249
  /**
1244
1250
  * Read the embedding-provider config from env:
1245
- * AI_EMBED_PROVIDER=mock|openai|voyage|cohere (default: mock)
1251
+ * AI_EMBED_PROVIDER=mock|openai|voyage|cohere|gateway (default: mock)
1246
1252
  * AI_EMBED_MODEL=<model-id> (default per provider)
1247
1253
  * AI_EMBED_MOCK_DIM=<n> (mock-only, default 8)
1248
1254
  */
1249
1255
  export declare const embeddingProviderFromEnv: (env?: Record<string, string | undefined>) => EmbeddingProviderConfig;
1250
1256
 
1251
- export declare type EmbeddingProviderName = 'mock' | 'openai' | 'voyage' | 'cohere';
1257
+ export declare type EmbeddingProviderName = 'mock' | 'openai' | 'voyage' | 'cohere' | 'gateway';
1252
1258
 
1253
1259
  /**
1254
1260
  * Embed many strings in one batched call. Order-preserving: result[i] is the
@@ -1429,11 +1435,16 @@ export declare const fromRaw: (raw: RawGatewayModel) => GatewayModelInfo;
1429
1435
 
1430
1436
  /**
1431
1437
  * Pull the ACTUAL per-call cost (USD) out of an AI-SDK result's provider
1432
- * metadata, when the Vercel AI Gateway reported it. The gateway attaches
1433
- * `providerMetadata.gateway.cost` (a USD number or numeric string) to
1434
- * generate/stream results; returns `undefined` when absent or invalid so the
1435
- * caller falls back to the price table. Empty, negative and non-finite values
1436
- * are not evidence of a charge. An explicit zero remains authoritative.
1438
+ * metadata, when the Vercel AI Gateway reported it: what the gateway charged
1439
+ * (`providerMetadata.gateway.cost`) plus, when the successful attempt ran on
1440
+ * the team's own provider key (BYOK), what that provider bills for it
1441
+ * (`marketCost`). The gateway charges a BYOK call nothing and reports the
1442
+ * provider's bill separately, so `cost` alone recorded every BYOK call as $0 —
1443
+ * in the ledger and in every budget. A BYOK receipt without a usable
1444
+ * `marketCost` returns `undefined` rather than $0, so the caller falls back to
1445
+ * the price table instead of recording a free call. Empty, negative and
1446
+ * non-finite values are not evidence of a charge; an explicit zero remains
1447
+ * authoritative.
1437
1448
  */
1438
1449
  export declare const gatewayCostUsd: (providerMetadata: unknown) => number | undefined;
1439
1450
 
@@ -2912,6 +2923,11 @@ export declare type ProviderConfig = {
2912
2923
  readonly model: GatewayModel;
2913
2924
  readonly apiKey?: string;
2914
2925
  readonly baseURL?: string;
2926
+ /** Media calls only (image, video, speech, transcription): the largest
2927
+ * response read, in bytes — refused before reading when declared, cut
2928
+ * off while streaming otherwise. Default `VOLTRO_AI_MEDIA_MAX_RESPONSE_BYTES`,
2929
+ * else 128 MiB. */
2930
+ readonly maxResponseBytes?: number;
2915
2931
  };
2916
2932
 
2917
2933
  /**