@urun-sh/openai 0.5.6 → 0.6.1

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.
Files changed (52) hide show
  1. package/dist/{ResponsesClient-BE3-hx3m.d.ts → ResponsesClient-CSSrOYD8.d.ts} +5 -1
  2. package/dist/{ResponsesClient-DjZWjlFH.d.cts → ResponsesClient-_OZERUjH.d.cts} +9 -1
  3. package/dist/{chunk-7M6LY6DR.js → chunk-3JWYIKHM.js} +1 -1
  4. package/dist/{chunk-BSHT6RZZ.js → chunk-6M5JK4YC.js} +1 -1
  5. package/dist/chunk-76BZLCGT.js +1 -0
  6. package/dist/chunk-7V2JKPIG.js +1 -0
  7. package/dist/{chunk-5HKWNK3O.js → chunk-K23AZPI4.js} +1 -1
  8. package/dist/chunk-T2LNHDPS.js +7 -0
  9. package/dist/chunk-TMQJY56F.js +4 -0
  10. package/dist/chunk-WEBOBE7Z.js +58 -0
  11. package/dist/chunk-X3GLH2HQ.js +1 -0
  12. package/dist/gemini-live.cjs +2 -2
  13. package/dist/gemini-live.d.cts +75 -7
  14. package/dist/gemini-live.d.ts +30 -7
  15. package/dist/gemini-live.js +1 -1
  16. package/dist/hosted/bin.cjs +37 -35
  17. package/dist/hosted/bin.js +1 -1
  18. package/dist/hosted/index.cjs +33 -31
  19. package/dist/hosted/index.d.cts +70 -4
  20. package/dist/hosted/index.d.ts +21 -4
  21. package/dist/hosted/index.js +1 -1
  22. package/dist/index.cjs +1 -1
  23. package/dist/index.d.cts +4 -4
  24. package/dist/index.d.ts +4 -4
  25. package/dist/index.js +1 -1
  26. package/dist/pi-extension/index.cjs +7 -7
  27. package/dist/pi-extension/index.d.cts +2 -2
  28. package/dist/pi-extension/index.d.ts +2 -2
  29. package/dist/pi-extension/index.js +1 -1
  30. package/dist/pi-extension/standalone.cjs +53 -53
  31. package/dist/proxy/cli.cjs +48 -46
  32. package/dist/proxy/cli.js +15 -14
  33. package/dist/proxy/index.cjs +25 -24
  34. package/dist/proxy/index.d.cts +142 -25
  35. package/dist/proxy/index.d.ts +22 -11
  36. package/dist/proxy/index.js +1 -1
  37. package/dist/{responses-turn-Dr37N3kH.d.ts → responses-turn-EwxfRJJg.d.ts} +187 -7
  38. package/dist/{responses-turn-tNUHq5b0.d.cts → responses-turn-vMefRdgJ.d.cts} +707 -23
  39. package/dist/{translator-Bh0Bp_Ie.d.cts → translator-CO8W_hmJ.d.cts} +1 -1
  40. package/dist/{translator-BCoRFaTs.d.ts → translator-Ddd65sXR.d.ts} +1 -1
  41. package/dist/{types-lsVTbNcH.d.cts → types-CHPtJx6d.d.cts} +13 -0
  42. package/dist/{types-lsVTbNcH.d.ts → types-CHPtJx6d.d.ts} +4 -0
  43. package/dist/{video-out-CCksIcj8.d.cts → video-out-BsuLqlID.d.cts} +1 -1
  44. package/dist/{video-out-IGQ4YQ-c.d.ts → video-out-Cawtm7SF.d.ts} +1 -1
  45. package/package.json +4 -2
  46. package/dist/chunk-2T2YYBVX.js +0 -1
  47. package/dist/chunk-3WAJD62J.js +0 -4
  48. package/dist/chunk-FP4RSAIE.js +0 -1
  49. package/dist/chunk-HR5H6S7L.js +0 -1
  50. package/dist/chunk-NY23USZF.js +0 -57
  51. package/dist/chunk-VLRMJRLS.js +0 -6
  52. /package/dist/{chunk-5CCJUNH7.js → chunk-YSFSRI3D.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { C as CatalogRow } from './models-DUdx_Y6X.js';
2
2
  import { IncomingMessage } from 'node:http';
3
- import { a as AudioBridge, h as VideoFrameLane, j as VideoOutLane } from './video-out-IGQ4YQ-c.js';
3
+ import { a as AudioBridge, h as VideoFrameLane, j as VideoOutLane } from './video-out-Cawtm7SF.js';
4
4
 
5
5
  interface ProxyIdentity {
6
6
  app: string;
@@ -74,11 +74,26 @@ interface SharedEndpointRow {
74
74
  warm?: number | null;
75
75
 
76
76
  compat_default?: boolean | null;
77
+
78
+ output_free?: boolean | null;
79
+
80
+ ready?: boolean | null;
81
+
82
+ ready_runtimes?: number | null;
83
+
84
+ ready_since?: string | null;
77
85
  }
78
86
 
79
87
  interface SharedCatalogBlock {
80
88
  shared_org_id: string;
81
89
  endpoints: SharedEndpointRow[];
90
+
91
+ regions?: string[] | null;
92
+
93
+ compliance?: {
94
+ zdr: boolean;
95
+ hipaa: boolean;
96
+ } | null;
82
97
  }
83
98
 
84
99
  interface TokenPricing {
@@ -104,6 +119,16 @@ interface ModelPriceRow {
104
119
  type OpenRouterProviderDoc = {
105
120
  data: OpenRouterProviderModel[];
106
121
  };
122
+
123
+ interface OpenRouterDatacenter {
124
+ country_code: string;
125
+ region?: string;
126
+ }
127
+
128
+ interface OpenRouterCompliance {
129
+ zdr: boolean;
130
+ hipaa: boolean;
131
+ }
107
132
  interface OpenRouterProviderModel {
108
133
  schema_version: '2.4';
109
134
 
@@ -112,17 +137,36 @@ interface OpenRouterProviderModel {
112
137
  created: number;
113
138
 
114
139
  quantization: string | null;
140
+
141
+ tokenizer?: string;
115
142
  description: string;
116
143
  hugging_face_id: string;
144
+
145
+ is_ready: boolean;
146
+
147
+ is_free: boolean;
117
148
  input_modalities: Array<Record<string, unknown>>;
118
149
  output_modalities: Array<Record<string, unknown>>;
150
+
151
+ datacenters?: OpenRouterDatacenter[];
152
+
153
+ compliance?: OpenRouterCompliance;
154
+ }
155
+
156
+ interface SpeechVoicesResolution {
157
+
158
+ readonly published: readonly string[];
159
+
160
+ readonly defect: string | null;
119
161
  }
120
162
 
121
163
  interface DeployedApp {
122
164
  app_slug: string;
165
+
123
166
  function_name?: string | null;
167
+
168
+ serves?: string | null;
124
169
  deployment_status?: string | null;
125
- [k: string]: unknown;
126
170
  }
127
171
 
128
172
  declare class UnknownModelError extends Error {
@@ -152,6 +196,12 @@ interface RouterModelEntry {
152
196
  pricing?: TokenPricing;
153
197
 
154
198
  warm?: number;
199
+
200
+ voices?: string[];
201
+
202
+ capabilities?: {
203
+ reasoning: boolean;
204
+ };
155
205
  }
156
206
  interface RouterModelList {
157
207
  object: 'list';
@@ -176,6 +226,8 @@ interface RouteTarget {
176
226
  modelId?: string;
177
227
 
178
228
  variant?: string;
229
+
230
+ sharedOrgId?: string;
179
231
  }
180
232
  interface ModelRouterOptions<S> {
181
233
 
@@ -183,7 +235,7 @@ interface ModelRouterOptions<S> {
183
235
 
184
236
  fnName: string;
185
237
 
186
- openSession: (target: RouteTarget) => S | Promise<S>;
238
+ openSession: (target: RouteTarget, poolKey: string) => S | Promise<S>;
187
239
 
188
240
  closeSession: (entry: S) => Promise<void>;
189
241
 
@@ -200,6 +252,8 @@ interface ModelRouterOptions<S> {
200
252
  sessionKey?: (entry: S) => string;
201
253
 
202
254
  shared?: (() => Promise<SharedCatalogBlock | null>) | null;
255
+
256
+ sharedOnlyListing?: boolean;
203
257
  }
204
258
 
205
259
  type ImageCapabilityMode = 'generation' | 'edit';
@@ -224,6 +278,8 @@ declare class ModelRouter<S> {
224
278
 
225
279
  private pricesForListing;
226
280
 
281
+ private outputFreeKeys;
282
+
227
283
  private warn;
228
284
 
229
285
  private servable;
@@ -240,6 +296,8 @@ declare class ModelRouter<S> {
240
296
 
241
297
  servingAppSlugFor(model: string | undefined): Promise<string>;
242
298
 
299
+ targetFor(model: string | undefined): Promise<RouteTarget>;
300
+
243
301
  resolveApp(model: string | undefined): Promise<string>;
244
302
 
245
303
  sessionFor(model: string | undefined): Promise<{
@@ -247,6 +305,14 @@ declare class ModelRouter<S> {
247
305
  entry: S;
248
306
  identity: TurnCatalogIdentity;
249
307
  }>;
308
+
309
+ speechSessionFor(model: string | undefined): Promise<{
310
+ app: string;
311
+ entry: S;
312
+ identity: TurnCatalogIdentity;
313
+ }>;
314
+
315
+ private acquire;
250
316
  private keyOf;
251
317
 
252
318
  handleFor(model: string | undefined): Promise<{
@@ -254,6 +320,11 @@ declare class ModelRouter<S> {
254
320
  handle: string;
255
321
  }>;
256
322
 
323
+ speechHandleFor(model: string | undefined): Promise<{
324
+ app: string;
325
+ handle: string;
326
+ }>;
327
+
257
328
  sessionForHandle(handle: string): Promise<{
258
329
  app: string;
259
330
  entry: S;
@@ -269,11 +340,86 @@ declare class ModelRouter<S> {
269
340
 
270
341
  supportsAudio(model: string | undefined): Promise<boolean>;
271
342
 
343
+ supportsSpeech(model: string | undefined): Promise<boolean>;
344
+
345
+ supportsTranscription(model: string | undefined): Promise<boolean>;
346
+
347
+ speechVoices(model: string | undefined): Promise<SpeechVoicesResolution>;
348
+
272
349
  imageModelList(): Promise<RouterImageModelList>;
273
350
 
351
+ speechToTextModelList(): Promise<RouterModelList>;
352
+
274
353
  closeAll(): Promise<void>;
275
354
  }
276
355
 
356
+ interface RuntimePresenceRow {
357
+ runtime_id: string;
358
+
359
+ address: string;
360
+ ready: boolean;
361
+
362
+ last_seen: string;
363
+ status?: string | null;
364
+ }
365
+
366
+ interface DialTarget {
367
+ appSlug: string;
368
+ fnName?: string;
369
+ sharedApp?: boolean;
370
+ modelId?: string;
371
+ variant?: string;
372
+ sharedOrgId?: string;
373
+ }
374
+ interface StatelessDecisionDialOptions {
375
+
376
+ targetFor: (model: string | undefined) => Promise<DialTarget>;
377
+ apiUrl: string;
378
+ apiKey: string;
379
+
380
+ orgId: string;
381
+
382
+ fnName: string;
383
+
384
+ secret: string;
385
+
386
+ shared?: {
387
+ apiKey: string;
388
+ };
389
+ fetchImpl?: typeof fetch;
390
+ nowMs?: () => number;
391
+
392
+ timeoutMs?: number;
393
+ }
394
+
395
+ declare class StatelessDecisionDial {
396
+ private readonly opts;
397
+ private readonly replicas;
398
+ private readonly nowMs;
399
+
400
+ private readonly presenceCache;
401
+ constructor(opts: StatelessDecisionDialOptions);
402
+
403
+ get enabled(): boolean;
404
+
405
+ targetFor(model: string | undefined): Promise<DialTarget | null>;
406
+
407
+ decide(body: Record<string, unknown>, model: string | undefined): Promise<{
408
+ status: number;
409
+ body: unknown;
410
+ completed: unknown;
411
+ target: DialTarget & {
412
+ fnName: string;
413
+ };
414
+ }>;
415
+
416
+ private ensureRows;
417
+ private readPresence;
418
+
419
+ pick(rows: RuntimePresenceRow[]): string | null;
420
+ private post;
421
+ }
422
+
277
423
  interface InferenceUsageRecord {
278
424
 
279
425
  inference_id: string;
@@ -338,6 +484,10 @@ interface LedgerWrite {
338
484
  prefill_ms: number | null;
339
485
  decode_ms: number | null;
340
486
  total_ms: number | null;
487
+
488
+ ttft_ms: number | null;
489
+
490
+ e2e_ms: number | null;
341
491
  }
342
492
 
343
493
  interface LedgerRecorded {
@@ -360,16 +510,19 @@ interface LedgerFailure {
360
510
  declare const LEDGER_SKIP_REASONS: readonly ["no_response_head", "no_org", "model_unresolved", "no_model_named", "queue_full"];
361
511
  type LedgerSkipReason = (typeof LEDGER_SKIP_REASONS)[number];
362
512
 
513
+ declare const LEDGER_PRICING_STATES: readonly ["priced", "unpriced"];
514
+ type LedgerPricingState = (typeof LEDGER_PRICING_STATES)[number];
515
+
363
516
  type LedgerOutcome =
364
517
 
365
518
  {
366
519
  outcome: 'written';
367
- reason: 'priced' | 'unpriced';
520
+ reason: LedgerPricingState;
368
521
  }
369
522
 
370
523
  | {
371
524
  outcome: 'already_written';
372
- reason: 'priced' | 'unpriced';
525
+ reason: LedgerPricingState;
373
526
  }
374
527
 
375
528
  | {
@@ -408,6 +561,10 @@ interface ResponsesCreateParams {
408
561
  chat_template_kwargs?: Record<string, unknown>;
409
562
 
410
563
  response_format?: unknown;
564
+
565
+ voice?: string;
566
+
567
+ language?: string;
411
568
  }
412
569
 
413
570
  interface SessionEndInfo {
@@ -431,8 +588,16 @@ interface ProxyClients {
431
588
 
432
589
  supportsAudio?(model: string | undefined): Promise<boolean>;
433
590
 
591
+ supportsSpeech?(model: string | undefined): Promise<boolean>;
592
+
593
+ supportsTranscription?(model: string | undefined): Promise<boolean>;
594
+
595
+ speechVoices?(model: string | undefined): Promise<SpeechVoicesResolution>;
596
+
434
597
  listImageModels?(): Promise<unknown>;
435
598
 
599
+ listSpeechToTextModels?(): Promise<unknown>;
600
+
436
601
  catalogIdentity(model: string | undefined): Promise<{
437
602
  model_id: string;
438
603
  variant: string;
@@ -440,7 +605,9 @@ interface ProxyClients {
440
605
 
441
606
  servingAppSlug?(model: string | undefined): Promise<string | null>;
442
607
 
443
- openAudio?(model: string | undefined): Promise<ProxyAudioLane>;
608
+ openAudio?(model: string | undefined, signal?: AbortSignal): Promise<ProxyAudioLane>;
609
+
610
+ openAudioOn?(handle: string, signal?: AbortSignal): Promise<PinnedAudioLane>;
444
611
 
445
612
  openVideo?(model: string | undefined): Promise<ProxyVideoLane>;
446
613
 
@@ -448,12 +615,25 @@ interface ProxyClients {
448
615
 
449
616
  sessionHandle(model: string | undefined): Promise<string>;
450
617
 
618
+ speechSessionHandle?(model: string | undefined): Promise<string>;
619
+
620
+ evictSpeechSession?(handle: string): Promise<void>;
621
+
451
622
  createResponseOn(handle: string, params: ResponsesCreateParams): Promise<AsyncIterable<unknown>> | AsyncIterable<unknown>;
452
623
 
453
624
  onSessionEnd(handle: string, cb: (end: SessionEndInfo) => void): Promise<() => void>;
625
+
626
+ readonly stateless?: StatelessDecisionDial;
454
627
  }
455
628
 
456
- type ProxyAudioLane = Pick<AudioBridge, 'appendInputAudio' | 'onOutputAudio'>;
629
+ type ProxyAudioLane = Pick<AudioBridge, 'appendInputAudio' | 'onOutputAudio'> & {
630
+ sessionId?: string | null;
631
+ };
632
+
633
+ interface PinnedAudioLane extends ProxyAudioLane {
634
+
635
+ readonly sessionId: string | null;
636
+ }
457
637
 
458
638
  type ProxyVideoLane = Pick<VideoFrameLane, 'sendInputFrame'>;
459
639