@vargai/gateway 0.1.6 → 0.2.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/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type FileUploadResponse, type ImageRequest, type JobResponse, type MusicRequest, type SpeechRequest, type VideoRequest } from "./schemas.ts";
1
+ import { type FileUploadResponse, type ImageRequest, type JobResponse, type MusicRequest, type SpeechRequest, type TranscriptionRequest, type VideoRequest } from "./schemas.ts";
2
2
  export interface VargClientConfig {
3
3
  apiKey: string;
4
4
  baseUrl?: string;
@@ -7,6 +7,7 @@ export interface VargClientConfig {
7
7
  elevenlabs?: string;
8
8
  higgsfield?: string;
9
9
  replicate?: string;
10
+ groq?: string;
10
11
  };
11
12
  }
12
13
  export interface WaitForJobOptions {
@@ -16,18 +17,35 @@ export interface WaitForJobOptions {
16
17
  export interface VoiceInfo {
17
18
  voice_id: string;
18
19
  name: string;
19
- category: string;
20
+ category: string | null;
20
21
  labels: {
21
- gender?: string;
22
- age?: string;
23
- accent?: string;
24
- description?: string;
25
- use_case?: string;
22
+ gender: string | null;
23
+ age: string | null;
24
+ accent: string | null;
25
+ description: string | null;
26
+ use_case: string | null;
26
27
  };
27
- preview_url?: string;
28
+ preview_url: string | null;
29
+ is_curated: boolean;
30
+ usage_count: number;
28
31
  }
29
32
  export interface VoiceListResponse {
30
33
  voices: VoiceInfo[];
34
+ total: number;
35
+ page: number;
36
+ page_size: number;
37
+ }
38
+ export interface VoiceSearchParams {
39
+ search?: string;
40
+ category?: string;
41
+ gender?: string;
42
+ age?: string;
43
+ accent?: string;
44
+ is_curated?: boolean;
45
+ page?: number;
46
+ page_size?: number;
47
+ sort_by?: "usage_count" | "name" | "created_at";
48
+ sort_order?: "asc" | "desc";
31
49
  }
32
50
  export declare class VargGatewayError extends Error {
33
51
  statusCode?: number | undefined;
@@ -46,8 +64,13 @@ export declare class VargClient {
46
64
  createImage(params: ImageRequest): Promise<JobResponse>;
47
65
  createSpeech(params: SpeechRequest): Promise<JobResponse>;
48
66
  createMusic(params: MusicRequest): Promise<JobResponse>;
67
+ createTranscription(params: TranscriptionRequest): Promise<JobResponse>;
49
68
  uploadFile(file: Blob | Buffer, mediaType: string): Promise<FileUploadResponse>;
50
- listVoices(): Promise<VoiceListResponse>;
69
+ listVoices(params?: VoiceSearchParams): Promise<VoiceListResponse>;
70
+ syncVoices(): Promise<{
71
+ status: string;
72
+ message: string;
73
+ }>;
51
74
  getJob(id: string): Promise<JobResponse>;
52
75
  cancelJob(id: string): Promise<void>;
53
76
  waitForJob(id: string, options?: WaitForJobOptions): Promise<JobResponse>;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,YAAY,EAEjB,KAAK,WAAW,EAEhB,KAAK,YAAY,EAEjB,KAAK,aAAa,EAElB,KAAK,YAAY,EAElB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE;QACN,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM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OAAO,CAAC,WAAW,CAAC;IAUzD,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAUvD,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC;IAUvE,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA8B/E,UAAU,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAmClE,UAAU,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAoB1D,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAQxC,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBpC,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC;YASjE,aAAa;YA4Eb,cAAc;CAgB7B"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { VargClient, VargGatewayError } from "./client.ts";
2
- export type { VargClientConfig, WaitForJobOptions, VoiceInfo, VoiceListResponse } from "./client.ts";
3
- export { createVarg } from "./provider.ts";
2
+ export type { VargClientConfig, WaitForJobOptions, VoiceInfo, VoiceListResponse, VoiceSearchParams, } from "./client.ts";
3
+ export { createVarg, varg } from "./provider.ts";
4
4
  export type { VargProvider } from "./provider.ts";
5
- export { ErrorResponseSchema, FileInputSchema, FileUploadResponseSchema, ImageRequestSchema, JobResponseSchema, JobStatusSchema, MusicRequestSchema, SpeechRequestSchema, VideoRequestSchema, } from "./schemas.ts";
6
- export type { ErrorResponse, FileInput, FileUploadResponse, ImageRequest, JobResponse, JobStatus, MusicRequest, SpeechRequest, VideoRequest, } from "./schemas.ts";
5
+ export { ErrorResponseSchema, FileInputSchema, FileUploadResponseSchema, ImageRequestSchema, JobResponseSchema, JobStatusSchema, MusicRequestSchema, SpeechRequestSchema, TranscriptionRequestSchema, VideoRequestSchema, } from "./schemas.ts";
6
+ export type { ErrorResponse, FileInput, FileUploadResponse, ImageRequest, JobResponse, JobStatus, MusicRequest, SpeechRequest, TranscriptionRequest, VideoRequest, } from "./schemas.ts";
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC3D,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrG,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,SAAS,EACT,YAAY,EACZ,aAAa,EACb,YAAY,GACb,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC3D,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACjD,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,SAAS,EACT,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,YAAY,GACb,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -267,7 +267,7 @@ __export(exports_core2, {
267
267
  safeDecode: () => safeDecode,
268
268
  registry: () => registry,
269
269
  regexes: () => exports_regexes,
270
- process: () => process,
270
+ process: () => process2,
271
271
  prettifyError: () => prettifyError,
272
272
  parseAsync: () => parseAsync,
273
273
  parse: () => parse,
@@ -10731,7 +10731,7 @@ function initializeContext(params) {
10731
10731
  external: params?.external ?? undefined
10732
10732
  };
10733
10733
  }
10734
- function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
10734
+ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
10735
10735
  var _a2;
10736
10736
  const def = schema._zod.def;
10737
10737
  const seen = ctx.seen.get(schema);
@@ -10768,7 +10768,7 @@ function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
10768
10768
  if (parent) {
10769
10769
  if (!result.ref)
10770
10770
  result.ref = parent;
10771
- process(parent, ctx, params);
10771
+ process2(parent, ctx, params);
10772
10772
  ctx.seen.get(parent).isParent = true;
10773
10773
  }
10774
10774
  }
@@ -11044,14 +11044,14 @@ function isTransforming(_schema, _ctx) {
11044
11044
  }
11045
11045
  var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
11046
11046
  const ctx = initializeContext({ ...params, processors });
11047
- process(schema, ctx);
11047
+ process2(schema, ctx);
11048
11048
  extractDefs(ctx, schema);
11049
11049
  return finalize(ctx, schema);
11050
11050
  };
11051
11051
  var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
11052
11052
  const { libraryOptions, target } = params ?? {};
11053
11053
  const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
11054
- process(schema, ctx);
11054
+ process2(schema, ctx);
11055
11055
  extractDefs(ctx, schema);
11056
11056
  return finalize(ctx, schema);
11057
11057
  };
@@ -11302,7 +11302,7 @@ var arrayProcessor = (schema, ctx, _json, params) => {
11302
11302
  if (typeof maximum === "number")
11303
11303
  json.maxItems = maximum;
11304
11304
  json.type = "array";
11305
- json.items = process(def.element, ctx, { ...params, path: [...params.path, "items"] });
11305
+ json.items = process2(def.element, ctx, { ...params, path: [...params.path, "items"] });
11306
11306
  };
11307
11307
  var objectProcessor = (schema, ctx, _json, params) => {
11308
11308
  const json = _json;
@@ -11311,7 +11311,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
11311
11311
  json.properties = {};
11312
11312
  const shape = def.shape;
11313
11313
  for (const key in shape) {
11314
- json.properties[key] = process(shape[key], ctx, {
11314
+ json.properties[key] = process2(shape[key], ctx, {
11315
11315
  ...params,
11316
11316
  path: [...params.path, "properties", key]
11317
11317
  });
@@ -11334,7 +11334,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
11334
11334
  if (ctx.io === "output")
11335
11335
  json.additionalProperties = false;
11336
11336
  } else if (def.catchall) {
11337
- json.additionalProperties = process(def.catchall, ctx, {
11337
+ json.additionalProperties = process2(def.catchall, ctx, {
11338
11338
  ...params,
11339
11339
  path: [...params.path, "additionalProperties"]
11340
11340
  });
@@ -11343,7 +11343,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
11343
11343
  var unionProcessor = (schema, ctx, json, params) => {
11344
11344
  const def = schema._zod.def;
11345
11345
  const isExclusive = def.inclusive === false;
11346
- const options = def.options.map((x, i) => process(x, ctx, {
11346
+ const options = def.options.map((x, i) => process2(x, ctx, {
11347
11347
  ...params,
11348
11348
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
11349
11349
  }));
@@ -11355,11 +11355,11 @@ var unionProcessor = (schema, ctx, json, params) => {
11355
11355
  };
11356
11356
  var intersectionProcessor = (schema, ctx, json, params) => {
11357
11357
  const def = schema._zod.def;
11358
- const a = process(def.left, ctx, {
11358
+ const a = process2(def.left, ctx, {
11359
11359
  ...params,
11360
11360
  path: [...params.path, "allOf", 0]
11361
11361
  });
11362
- const b = process(def.right, ctx, {
11362
+ const b = process2(def.right, ctx, {
11363
11363
  ...params,
11364
11364
  path: [...params.path, "allOf", 1]
11365
11365
  });
@@ -11376,11 +11376,11 @@ var tupleProcessor = (schema, ctx, _json, params) => {
11376
11376
  json.type = "array";
11377
11377
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
11378
11378
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
11379
- const prefixItems = def.items.map((x, i) => process(x, ctx, {
11379
+ const prefixItems = def.items.map((x, i) => process2(x, ctx, {
11380
11380
  ...params,
11381
11381
  path: [...params.path, prefixPath, i]
11382
11382
  }));
11383
- const rest = def.rest ? process(def.rest, ctx, {
11383
+ const rest = def.rest ? process2(def.rest, ctx, {
11384
11384
  ...params,
11385
11385
  path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
11386
11386
  }) : null;
@@ -11420,7 +11420,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
11420
11420
  const keyBag = keyType._zod.bag;
11421
11421
  const patterns = keyBag?.patterns;
11422
11422
  if (def.mode === "loose" && patterns && patterns.size > 0) {
11423
- const valueSchema = process(def.valueType, ctx, {
11423
+ const valueSchema = process2(def.valueType, ctx, {
11424
11424
  ...params,
11425
11425
  path: [...params.path, "patternProperties", "*"]
11426
11426
  });
@@ -11430,12 +11430,12 @@ var recordProcessor = (schema, ctx, _json, params) => {
11430
11430
  }
11431
11431
  } else {
11432
11432
  if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
11433
- json.propertyNames = process(def.keyType, ctx, {
11433
+ json.propertyNames = process2(def.keyType, ctx, {
11434
11434
  ...params,
11435
11435
  path: [...params.path, "propertyNames"]
11436
11436
  });
11437
11437
  }
11438
- json.additionalProperties = process(def.valueType, ctx, {
11438
+ json.additionalProperties = process2(def.valueType, ctx, {
11439
11439
  ...params,
11440
11440
  path: [...params.path, "additionalProperties"]
11441
11441
  });
@@ -11450,7 +11450,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
11450
11450
  };
11451
11451
  var nullableProcessor = (schema, ctx, json, params) => {
11452
11452
  const def = schema._zod.def;
11453
- const inner = process(def.innerType, ctx, params);
11453
+ const inner = process2(def.innerType, ctx, params);
11454
11454
  const seen = ctx.seen.get(schema);
11455
11455
  if (ctx.target === "openapi-3.0") {
11456
11456
  seen.ref = def.innerType;
@@ -11461,20 +11461,20 @@ var nullableProcessor = (schema, ctx, json, params) => {
11461
11461
  };
11462
11462
  var nonoptionalProcessor = (schema, ctx, _json, params) => {
11463
11463
  const def = schema._zod.def;
11464
- process(def.innerType, ctx, params);
11464
+ process2(def.innerType, ctx, params);
11465
11465
  const seen = ctx.seen.get(schema);
11466
11466
  seen.ref = def.innerType;
11467
11467
  };
11468
11468
  var defaultProcessor = (schema, ctx, json, params) => {
11469
11469
  const def = schema._zod.def;
11470
- process(def.innerType, ctx, params);
11470
+ process2(def.innerType, ctx, params);
11471
11471
  const seen = ctx.seen.get(schema);
11472
11472
  seen.ref = def.innerType;
11473
11473
  json.default = JSON.parse(JSON.stringify(def.defaultValue));
11474
11474
  };
11475
11475
  var prefaultProcessor = (schema, ctx, json, params) => {
11476
11476
  const def = schema._zod.def;
11477
- process(def.innerType, ctx, params);
11477
+ process2(def.innerType, ctx, params);
11478
11478
  const seen = ctx.seen.get(schema);
11479
11479
  seen.ref = def.innerType;
11480
11480
  if (ctx.io === "input")
@@ -11482,7 +11482,7 @@ var prefaultProcessor = (schema, ctx, json, params) => {
11482
11482
  };
11483
11483
  var catchProcessor = (schema, ctx, json, params) => {
11484
11484
  const def = schema._zod.def;
11485
- process(def.innerType, ctx, params);
11485
+ process2(def.innerType, ctx, params);
11486
11486
  const seen = ctx.seen.get(schema);
11487
11487
  seen.ref = def.innerType;
11488
11488
  let catchValue;
@@ -11496,32 +11496,32 @@ var catchProcessor = (schema, ctx, json, params) => {
11496
11496
  var pipeProcessor = (schema, ctx, _json, params) => {
11497
11497
  const def = schema._zod.def;
11498
11498
  const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
11499
- process(innerType, ctx, params);
11499
+ process2(innerType, ctx, params);
11500
11500
  const seen = ctx.seen.get(schema);
11501
11501
  seen.ref = innerType;
11502
11502
  };
11503
11503
  var readonlyProcessor = (schema, ctx, json, params) => {
11504
11504
  const def = schema._zod.def;
11505
- process(def.innerType, ctx, params);
11505
+ process2(def.innerType, ctx, params);
11506
11506
  const seen = ctx.seen.get(schema);
11507
11507
  seen.ref = def.innerType;
11508
11508
  json.readOnly = true;
11509
11509
  };
11510
11510
  var promiseProcessor = (schema, ctx, _json, params) => {
11511
11511
  const def = schema._zod.def;
11512
- process(def.innerType, ctx, params);
11512
+ process2(def.innerType, ctx, params);
11513
11513
  const seen = ctx.seen.get(schema);
11514
11514
  seen.ref = def.innerType;
11515
11515
  };
11516
11516
  var optionalProcessor = (schema, ctx, _json, params) => {
11517
11517
  const def = schema._zod.def;
11518
- process(def.innerType, ctx, params);
11518
+ process2(def.innerType, ctx, params);
11519
11519
  const seen = ctx.seen.get(schema);
11520
11520
  seen.ref = def.innerType;
11521
11521
  };
11522
11522
  var lazyProcessor = (schema, ctx, _json, params) => {
11523
11523
  const innerType = schema._zod.innerType;
11524
- process(innerType, ctx, params);
11524
+ process2(innerType, ctx, params);
11525
11525
  const seen = ctx.seen.get(schema);
11526
11526
  seen.ref = innerType;
11527
11527
  };
@@ -11573,7 +11573,7 @@ function toJSONSchema(input, params) {
11573
11573
  const defs = {};
11574
11574
  for (const entry of registry2._idmap.entries()) {
11575
11575
  const [_, schema] = entry;
11576
- process(schema, ctx2);
11576
+ process2(schema, ctx2);
11577
11577
  }
11578
11578
  const schemas = {};
11579
11579
  const external = {
@@ -11596,7 +11596,7 @@ function toJSONSchema(input, params) {
11596
11596
  return { schemas };
11597
11597
  }
11598
11598
  const ctx = initializeContext({ ...params, processors: allProcessors });
11599
- process(input, ctx);
11599
+ process2(input, ctx);
11600
11600
  extractDefs(ctx, input);
11601
11601
  return finalize(ctx, input);
11602
11602
  }
@@ -11642,7 +11642,7 @@ class JSONSchemaGenerator {
11642
11642
  });
11643
11643
  }
11644
11644
  process(schema, _params = { path: [], schemaPath: [] }) {
11645
- return process(schema, this.ctx, _params);
11645
+ return process2(schema, this.ctx, _params);
11646
11646
  }
11647
11647
  emit(schema, _params) {
11648
11648
  if (_params) {
@@ -13604,7 +13604,8 @@ var JobResponse = exports_external.object({
13604
13604
  completed_at: exports_external.string().optional(),
13605
13605
  output: exports_external.object({
13606
13606
  url: exports_external.string(),
13607
- media_type: exports_external.string()
13607
+ media_type: exports_external.string(),
13608
+ metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
13608
13609
  }).optional(),
13609
13610
  cache: exports_external.object({
13610
13611
  hit: exports_external.boolean(),
@@ -13667,6 +13668,9 @@ class VargClient {
13667
13668
  if (this.providerKeys?.replicate) {
13668
13669
  headers["X-Provider-Key-Replicate"] = this.providerKeys.replicate;
13669
13670
  }
13671
+ if (this.providerKeys?.groq) {
13672
+ headers["X-Provider-Key-Groq"] = this.providerKeys.groq;
13673
+ }
13670
13674
  return headers;
13671
13675
  }
13672
13676
  async handleResponse(response, schema) {
@@ -13714,6 +13718,15 @@ class VargClient {
13714
13718
  });
13715
13719
  return this.handleResponse(response, JobResponse);
13716
13720
  }
13721
+ async createTranscription(params) {
13722
+ TranscriptionRequest.parse(params);
13723
+ const response = await fetch(`${this.baseUrl}/transcription`, {
13724
+ method: "POST",
13725
+ headers: this.getHeaders(),
13726
+ body: JSON.stringify(params)
13727
+ });
13728
+ return this.handleResponse(response, JobResponse);
13729
+ }
13717
13730
  async uploadFile(file2, mediaType) {
13718
13731
  const headers = {
13719
13732
  Authorization: `Bearer ${this.apiKey}`,
@@ -13731,6 +13744,9 @@ class VargClient {
13731
13744
  if (this.providerKeys?.replicate) {
13732
13745
  headers["X-Provider-Key-Replicate"] = this.providerKeys.replicate;
13733
13746
  }
13747
+ if (this.providerKeys?.groq) {
13748
+ headers["X-Provider-Key-Groq"] = this.providerKeys.groq;
13749
+ }
13734
13750
  const response = await fetch(`${this.baseUrl}/files`, {
13735
13751
  method: "POST",
13736
13752
  headers,
@@ -13738,8 +13754,31 @@ class VargClient {
13738
13754
  });
13739
13755
  return this.handleResponse(response, FileUploadResponse);
13740
13756
  }
13741
- async listVoices() {
13742
- const response = await fetch(`${this.baseUrl}/voices`, {
13757
+ async listVoices(params) {
13758
+ const searchParams = new URLSearchParams;
13759
+ if (params?.search)
13760
+ searchParams.set("search", params.search);
13761
+ if (params?.category)
13762
+ searchParams.set("category", params.category);
13763
+ if (params?.gender)
13764
+ searchParams.set("gender", params.gender);
13765
+ if (params?.age)
13766
+ searchParams.set("age", params.age);
13767
+ if (params?.accent)
13768
+ searchParams.set("accent", params.accent);
13769
+ if (params?.is_curated !== undefined)
13770
+ searchParams.set("is_curated", String(params.is_curated));
13771
+ if (params?.page)
13772
+ searchParams.set("page", String(params.page));
13773
+ if (params?.page_size)
13774
+ searchParams.set("page_size", String(params.page_size));
13775
+ if (params?.sort_by)
13776
+ searchParams.set("sort_by", params.sort_by);
13777
+ if (params?.sort_order)
13778
+ searchParams.set("sort_order", params.sort_order);
13779
+ const qs = searchParams.toString();
13780
+ const url2 = `${this.baseUrl}/voices${qs ? `?${qs}` : ""}`;
13781
+ const response = await fetch(url2, {
13743
13782
  method: "GET",
13744
13783
  headers: this.getHeaders()
13745
13784
  });
@@ -13750,6 +13789,18 @@ class VargClient {
13750
13789
  }
13751
13790
  return await response.json();
13752
13791
  }
13792
+ async syncVoices() {
13793
+ const response = await fetch(`${this.baseUrl}/voices/sync`, {
13794
+ method: "POST",
13795
+ headers: this.getHeaders()
13796
+ });
13797
+ if (!response.ok) {
13798
+ const raw = await response.json().catch(() => null);
13799
+ const errorData = (raw?.error ?? raw) || {};
13800
+ throw new VargGatewayError(errorData?.message ?? `gateway returned ${response.status}`, response.status);
13801
+ }
13802
+ return await response.json();
13803
+ }
13753
13804
  async getJob(id) {
13754
13805
  const response = await fetch(`${this.baseUrl}/jobs/${id}`, {
13755
13806
  method: "GET",
@@ -14163,6 +14214,7 @@ function createVarg(config2) {
14163
14214
  imageModel: (modelId) => new VargImageModel(modelId, client),
14164
14215
  speechModel: (modelId) => new VargSpeechModel(modelId, client),
14165
14216
  musicModel: (modelId) => new VargMusicModel(modelId, client),
14217
+ transcriptionModel: (modelId) => new VargTranscriptionModel(modelId, client),
14166
14218
  languageModel(modelId) {
14167
14219
  throw new NoSuchModelError({ modelId, modelType: "languageModel" });
14168
14220
  },
@@ -14181,6 +14233,8 @@ async function submitJob(client, capability, params) {
14181
14233
  return client.createSpeech(params);
14182
14234
  case "music":
14183
14235
  return client.createMusic(params);
14236
+ case "transcription":
14237
+ return client.createTranscription(params);
14184
14238
  }
14185
14239
  }
14186
14240
  async function executeJob(client, capability, params) {
@@ -14193,7 +14247,8 @@ async function executeJob(client, capability, params) {
14193
14247
  return {
14194
14248
  data: new Uint8Array(await res2.arrayBuffer()),
14195
14249
  mediaType: job.output.media_type,
14196
- jobId: job.job_id
14250
+ jobId: job.job_id,
14251
+ metadata: job.output.metadata
14197
14252
  };
14198
14253
  }
14199
14254
  const completed = await client.waitForJob(job.job_id);
@@ -14211,10 +14266,11 @@ async function executeJob(client, capability, params) {
14211
14266
  return {
14212
14267
  data: new Uint8Array(await res.arrayBuffer()),
14213
14268
  mediaType: output.media_type,
14214
- jobId: job.job_id
14269
+ jobId: job.job_id,
14270
+ metadata: output.metadata
14215
14271
  };
14216
14272
  }
14217
-
14273
+ var varg_provider = createVarg({ apiKey: process.env.VARG_API_KEY ?? "" });
14218
14274
  class VargVideoModel {
14219
14275
  specificationVersion = "v3";
14220
14276
  provider = "varg";
@@ -14339,7 +14395,8 @@ class VargSpeechModel {
14339
14395
  response: {
14340
14396
  timestamp: new Date,
14341
14397
  modelId: this.modelId
14342
- }
14398
+ },
14399
+ providerMetadata: result.metadata
14343
14400
  };
14344
14401
  }
14345
14402
  }
@@ -14376,11 +14433,61 @@ class VargMusicModel {
14376
14433
  };
14377
14434
  }
14378
14435
  }
14436
+
14437
+ class VargTranscriptionModel {
14438
+ specificationVersion = "v3";
14439
+ provider = "varg";
14440
+ modelId;
14441
+ client;
14442
+ constructor(modelId, client) {
14443
+ this.modelId = modelId;
14444
+ this.client = client;
14445
+ }
14446
+ async doGenerate(options) {
14447
+ const warnings = [];
14448
+ const audioData = typeof options.audio === "string" ? Uint8Array.from(atob(options.audio), (c) => c.charCodeAt(0)) : options.audio;
14449
+ const uploaded = await this.client.uploadFile(new Blob([audioData], { type: options.mediaType }), options.mediaType);
14450
+ const job = await this.client.createTranscription({
14451
+ model: this.modelId,
14452
+ audio_url: uploaded.url,
14453
+ ...options.providerOptions?.varg?.language ? { language: options.providerOptions.varg.language } : {},
14454
+ ...options.providerOptions?.varg ? { provider_options: options.providerOptions.varg } : {}
14455
+ });
14456
+ const completed = await this.client.waitForJob(job.job_id);
14457
+ if (completed.status === "failed") {
14458
+ throw new Error(`[transcription] job ${completed.job_id} failed: ${completed.error || "unknown error"}`);
14459
+ }
14460
+ const metadata = completed.output?.metadata;
14461
+ const text = metadata?.text ?? "";
14462
+ const words = metadata?.words ?? [];
14463
+ const segments = (metadata?.segments ?? []).map((s) => ({
14464
+ text: s.text,
14465
+ startSecond: s.start,
14466
+ endSecond: s.end
14467
+ }));
14468
+ return {
14469
+ text,
14470
+ segments,
14471
+ language: metadata?.language,
14472
+ durationInSeconds: metadata?.duration,
14473
+ warnings,
14474
+ response: {
14475
+ timestamp: new Date,
14476
+ modelId: this.modelId,
14477
+ headers: undefined,
14478
+ body: metadata
14479
+ },
14480
+ providerMetadata: metadata?.words ? { varg: { words: metadata.words } } : undefined
14481
+ };
14482
+ }
14483
+ }
14379
14484
  export {
14485
+ varg_provider as varg,
14380
14486
  createVarg,
14381
14487
  VideoRequest as VideoRequestSchema,
14382
14488
  VargGatewayError,
14383
14489
  VargClient,
14490
+ TranscriptionRequest as TranscriptionRequestSchema,
14384
14491
  SpeechRequest as SpeechRequestSchema,
14385
14492
  MusicRequest as MusicRequestSchema,
14386
14493
  JobStatus as JobStatusSchema,
@@ -1,4 +1,4 @@
1
- import { type ImageModelV3, type ProviderV3, type SpeechModelV3 } from "@ai-sdk/provider";
1
+ import { type ImageModelV3, type ProviderV3, type SpeechModelV3, type TranscriptionModelV3 } from "@ai-sdk/provider";
2
2
  import type { MusicModelV3, VideoModelV3 } from "vargai/ai";
3
3
  import { type VargClientConfig } from "./client.ts";
4
4
  export interface VargProvider extends ProviderV3 {
@@ -6,6 +6,9 @@ export interface VargProvider extends ProviderV3 {
6
6
  imageModel(modelId: string): ImageModelV3;
7
7
  speechModel(modelId: string): SpeechModelV3;
8
8
  musicModel(modelId: string): MusicModelV3;
9
+ transcriptionModel(modelId: string): TranscriptionModelV3;
9
10
  }
10
11
  export declare function createVarg(config: VargClientConfig): VargProvider;
12
+ declare const varg_provider: VargProvider;
13
+ export { varg_provider as varg };
11
14
  //# sourceMappingURL=provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EAIjB,KAAK,UAAU,EAEf,KAAK,aAAa,EAEnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,YAAY,EAEZ,YAAY,EAEb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAAC;IAC1C,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAAC;IAC1C,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAAC;IAC5C,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAAC;CAC3C;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,YAAY,CAgBjE"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EAIjB,KAAK,UAAU,EAEf,KAAK,aAAa,EAElB,KAAK,oBAAoB,EAE1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,YAAY,EAEZ,YAAY,EAEb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAAC;IAC1C,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAAC;IAC1C,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAAC;IAC5C,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAAC;IAC1C,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB,CAAC;CAC3D;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,YAAY,CAiBjE;AAwED,QAAA,MAAM,aAAa,cAAyD,CAAC;AAC7E,OAAO,EAAE,aAAa,IAAI,IAAI,EAAE,CAAC"}
package/dist/schemas.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { ErrorResponse as ErrorResponseSchema, FileInput as FileInputSchema, FileUploadResponse as FileUploadResponseSchema, ImageRequest as ImageRequestSchema, JobResponse as JobResponseSchema, JobStatus as JobStatusSchema, MusicRequest as MusicRequestSchema, SpeechRequest as SpeechRequestSchema, VideoRequest as VideoRequestSchema, } from "@vargai/schemas";
2
- export type { ErrorResponse, FileInput, FileUploadResponse, ImageRequest, JobResponse, JobStatus, MusicRequest, SpeechRequest, VideoRequest, } from "@vargai/schemas";
1
+ export { ErrorResponse as ErrorResponseSchema, FileInput as FileInputSchema, FileUploadResponse as FileUploadResponseSchema, ImageRequest as ImageRequestSchema, JobResponse as JobResponseSchema, JobStatus as JobStatusSchema, MusicRequest as MusicRequestSchema, SpeechRequest as SpeechRequestSchema, TranscriptionRequest as TranscriptionRequestSchema, VideoRequest as VideoRequestSchema, } from "@vargai/schemas";
2
+ export type { ErrorResponse, FileInput, FileUploadResponse, ImageRequest, JobResponse, JobStatus, MusicRequest, SpeechRequest, TranscriptionRequest, VideoRequest, } from "@vargai/schemas";
3
3
  //# sourceMappingURL=schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,mBAAmB,EACpC,SAAS,IAAI,eAAe,EAC5B,kBAAkB,IAAI,wBAAwB,EAC9C,YAAY,IAAI,kBAAkB,EAClC,WAAW,IAAI,iBAAiB,EAChC,SAAS,IAAI,eAAe,EAC5B,YAAY,IAAI,kBAAkB,EAClC,aAAa,IAAI,mBAAmB,EACpC,YAAY,IAAI,kBAAkB,GACnC,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,SAAS,EACT,YAAY,EACZ,aAAa,EACb,YAAY,GACb,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,mBAAmB,EACpC,SAAS,IAAI,eAAe,EAC5B,kBAAkB,IAAI,wBAAwB,EAC9C,YAAY,IAAI,kBAAkB,EAClC,WAAW,IAAI,iBAAiB,EAChC,SAAS,IAAI,eAAe,EAC5B,YAAY,IAAI,kBAAkB,EAClC,aAAa,IAAI,mBAAmB,EACpC,oBAAoB,IAAI,0BAA0B,EAClD,YAAY,IAAI,kBAAkB,GACnC,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,SAAS,EACT,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,YAAY,GACb,MAAM,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vargai/gateway",
3
- "version": "0.1.6",
3
+ "version": "0.2.0",
4
4
  "description": "typescript client for varg gateway api",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",