getaiapi 1.1.0 → 1.3.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/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  generate,
5
5
  listModels,
6
6
  resolveModel
7
- } from "./chunk-3V2PDK26.js";
7
+ } from "./chunk-7MV7SODR.js";
8
8
 
9
9
  // src/cli.ts
10
10
  import { parseArgs } from "util";
package/dist/index.d.ts CHANGED
@@ -210,9 +210,27 @@ interface ProviderAdapter {
210
210
  poll(taskId: string, auth: string, endpoint?: string): Promise<ProviderResponse>;
211
211
  parseOutput(raw: unknown, outputMapping: OutputMapping): OutputItem[];
212
212
  }
213
+ interface FetchLogEntry {
214
+ kind: 'request' | 'response' | 'error';
215
+ method: string;
216
+ url: string;
217
+ bodyBytes?: number;
218
+ headers?: Record<string, string>;
219
+ status?: number;
220
+ durationMs?: number;
221
+ responseBytes?: number;
222
+ error?: string;
223
+ }
224
+ type LogFn = (entry: FetchLogEntry) => void;
225
+ interface FetchOptions {
226
+ timeoutMs?: number;
227
+ logging?: boolean;
228
+ logger?: LogFn;
229
+ }
213
230
  interface ConfigureOptions {
214
231
  keys?: Partial<Record<ProviderName, string>>;
215
232
  storage?: StorageConfig;
233
+ fetch?: FetchOptions;
216
234
  }
217
235
  interface StorageConfig {
218
236
  accountId: string;
@@ -246,6 +264,8 @@ declare function configure(options: ConfigureOptions): void;
246
264
 
247
265
  declare function configureAuth(keys: Partial<Record<ProviderName, string>>): void;
248
266
 
267
+ declare function configureFetch(options: FetchOptions): void;
268
+
249
269
  /**
250
270
  * Lists models filtered by modality, provider, or text query.
251
271
  * Category is derived, not stored — filter by input/output modality instead.
@@ -348,4 +368,4 @@ declare class StorageError extends GetAIApiError {
348
368
  constructor(operation: StorageOperation, message: string, statusCode?: number);
349
369
  }
350
370
 
351
- export { AuthError, type ConfigureOptions, type GenerateRequest, type GenerateResponse, GetAIApiError, type InputType, type KlingCameraControl, type KlingImageModel, type KlingOptions, type KlingVideoModel, type ListModelsFilters, type ModelEntry, ModelNotFoundError, NoProviderError, type OutputItem, type OutputMapping, type OutputType, type PollResponse, type ProviderAdapter, type ProviderBinding, ProviderError, type ProviderName, type ProviderResponse, RateLimitError, type StorageConfig, StorageError, type SubmitResponse, TimeoutError, type UploadOptions, type UploadResult, ValidationError, clearRegistryCache, configure, configureAuth, configureStorage, deleteAsset, deriveCategory, generate, klingAdapter, listModels, loadRegistry, mapInput, mapOutput, poll, presignAsset, resolveModel, submit, submitAndPoll, uploadAsset };
371
+ export { AuthError, type ConfigureOptions, type FetchLogEntry, type FetchOptions, type GenerateRequest, type GenerateResponse, GetAIApiError, type InputType, type KlingCameraControl, type KlingImageModel, type KlingOptions, type KlingVideoModel, type ListModelsFilters, type LogFn, type ModelEntry, ModelNotFoundError, NoProviderError, type OutputItem, type OutputMapping, type OutputType, type PollResponse, type ProviderAdapter, type ProviderBinding, ProviderError, type ProviderName, type ProviderResponse, RateLimitError, type StorageConfig, StorageError, type SubmitResponse, TimeoutError, type UploadOptions, type UploadResult, ValidationError, clearRegistryCache, configure, configureAuth, configureFetch, configureStorage, deleteAsset, deriveCategory, generate, klingAdapter, listModels, loadRegistry, mapInput, mapOutput, poll, presignAsset, resolveModel, submit, submitAndPoll, uploadAsset };
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  ValidationError,
11
11
  clearRegistryCache,
12
12
  configureAuth,
13
+ configureFetch,
13
14
  configureStorage,
14
15
  deleteAsset,
15
16
  deriveCategory,
@@ -25,7 +26,7 @@ import {
25
26
  submit,
26
27
  submitAndPoll,
27
28
  uploadAsset
28
- } from "./chunk-3V2PDK26.js";
29
+ } from "./chunk-7MV7SODR.js";
29
30
 
30
31
  // src/configure.ts
31
32
  function configure(options) {
@@ -35,6 +36,9 @@ function configure(options) {
35
36
  if (options.storage) {
36
37
  configureStorage(options.storage);
37
38
  }
39
+ if (options.fetch) {
40
+ configureFetch(options.fetch);
41
+ }
38
42
  }
39
43
  export {
40
44
  AuthError,
@@ -49,6 +53,7 @@ export {
49
53
  clearRegistryCache,
50
54
  configure,
51
55
  configureAuth,
56
+ configureFetch,
52
57
  configureStorage,
53
58
  deleteAsset,
54
59
  deriveCategory,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/configure.ts"],"sourcesContent":["import type { ConfigureOptions } from \"./types.js\";\nimport { configureAuth } from \"./auth.js\";\nimport { configureStorage } from \"./storage.js\";\n\nexport function configure(options: ConfigureOptions): void {\n if (options.keys) {\n configureAuth(options.keys);\n }\n if (options.storage) {\n configureStorage(options.storage);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,SAAS,UAAU,SAAiC;AACzD,MAAI,QAAQ,MAAM;AAChB,kBAAc,QAAQ,IAAI;AAAA,EAC5B;AACA,MAAI,QAAQ,SAAS;AACnB,qBAAiB,QAAQ,OAAO;AAAA,EAClC;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/configure.ts"],"sourcesContent":["import type { ConfigureOptions } from \"./types.js\";\nimport { configureAuth } from \"./auth.js\";\nimport { configureStorage } from \"./storage.js\";\nimport { configureFetch } from \"./fetch.js\";\n\nexport function configure(options: ConfigureOptions): void {\n if (options.keys) {\n configureAuth(options.keys);\n }\n if (options.storage) {\n configureStorage(options.storage);\n }\n if (options.fetch) {\n configureFetch(options.fetch);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,SAAS,UAAU,SAAiC;AACzD,MAAI,QAAQ,MAAM;AAChB,kBAAc,QAAQ,IAAI;AAAA,EAC5B;AACA,MAAI,QAAQ,SAAS;AACnB,qBAAiB,QAAQ,OAAO;AAAA,EAClC;AACA,MAAI,QAAQ,OAAO;AACjB,mBAAe,QAAQ,KAAK;AAAA,EAC9B;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "getaiapi",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "description": "Unified AI API Gateway - one function to call any AI model",
6
6
  "main": "./dist/index.js",