@xberg-io/liter-llm 1.9.0 → 1.9.2

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // This file is auto-generated by alef — DO NOT EDIT.
2
- // alef:hash:8c6394307ee786542760e258bcc70a27da623ca905384e09eb87f8ddb8d7e534
2
+ // alef:hash:990a8effc943d1d0f9c7ef763981d4cd9b10eefb9c9b4f11e1222eac8fca8442
3
3
  // To regenerate: alef generate
4
4
  // To verify freshness: alef verify --exit-code
5
5
  /* eslint-disable */
@@ -70,7 +70,12 @@ export declare function completionCost(model: string, promptTokens: number, comp
70
70
  * Returns `None` if the model is not present in the embedded pricing
71
71
  * registry, mirroring [`completion_cost`].
72
72
  */
73
- export declare function completionCostWithCache(model: string, promptTokens: number, cachedTokens: number, completionTokens: number): number | null;
73
+ export declare function completionCostWithCache(
74
+ model: string,
75
+ promptTokens: number,
76
+ cachedTokens: number,
77
+ completionTokens: number,
78
+ ): number | null;
74
79
 
75
80
  /**
76
81
  * Return the set of complex provider names.
@@ -114,7 +119,13 @@ export declare function countTokens(model: string, text: string): number;
114
119
  * @throws Returns [`LiterLlmError`] if the underlying HTTP client cannot be
115
120
  * constructed, or if the resolved provider configuration is invalid.
116
121
  */
117
- export declare function createClient(apiKey: string, baseUrl?: string | undefined | null, timeoutSecs?: number | undefined | null, maxRetries?: number | undefined | null, modelHint?: string | undefined | null): DefaultClient;
122
+ export declare function createClient(
123
+ apiKey: string,
124
+ baseUrl?: string | undefined | null,
125
+ timeoutSecs?: number | undefined | null,
126
+ maxRetries?: number | undefined | null,
127
+ modelHint?: string | undefined | null,
128
+ ): DefaultClient;
118
129
 
119
130
  /**
120
131
  * Create a new LLM client from a JSON string.
@@ -187,15 +198,15 @@ export interface AssistantMessage {
187
198
  *
188
199
  * `None` is valid when the model replies with tool calls only.
189
200
  */
190
- readonly content?: AssistantContent
201
+ readonly content?: AssistantContent;
191
202
  /** Optional name for the assistant. */
192
- readonly name?: string
203
+ readonly name?: string;
193
204
  /** Tool calls the model wants to execute, if any. */
194
- readonly toolCalls?: Array<ToolCall>
205
+ readonly toolCalls?: Array<ToolCall>;
195
206
  /** Refusal reason, if the model declined to respond per safety policies. */
196
- readonly refusal?: string
207
+ readonly refusal?: string;
197
208
  /** Deprecated legacy function_call field; retained for API compatibility. */
198
- readonly functionCall?: FunctionCall
209
+ readonly functionCall?: FunctionCall;
199
210
  }
200
211
 
201
212
  /**
@@ -205,28 +216,28 @@ export interface AssistantMessage {
205
216
  * parts-spec discriminator (`"type": "text"`, `"type": "output_image"`, …).
206
217
  */
207
218
  export type AssistantPart =
208
- | { type: 'text'; text: string }
209
- | { type: 'refusal'; refusal: string }
210
- | { type: 'output_image'; imageUrl: ImageUrl }
211
- | { type: 'output_audio'; audio: AudioContent }
219
+ | { type: "text"; text: string }
220
+ | { type: "refusal"; refusal: string }
221
+ | { type: "output_image"; imageUrl: ImageUrl }
222
+ | { type: "output_audio"; audio: AudioContent };
212
223
 
213
224
  /** Audio content part for speech-capable models. */
214
225
  export interface AudioContent {
215
226
  /** Base64-encoded audio data. */
216
- readonly data?: string
227
+ readonly data?: string;
217
228
  /** Audio format (e.g., "wav", "mp3", "ogg"). */
218
- readonly format?: string
229
+ readonly format?: string;
219
230
  }
220
231
 
221
232
  /** Auth configuration block. */
222
233
  export interface AuthConfig {
223
234
  /** Auth scheme classification. */
224
- readonly authType: AuthType
235
+ readonly authType: AuthType;
225
236
  /**
226
237
  * Name of the environment variable that holds the API key (e.g. `"OPENAI_API_KEY"`).
227
238
  * Holds the variable name, never the secret value.
228
239
  */
229
- readonly envVar?: string
240
+ readonly envVar?: string;
230
241
  }
231
242
 
232
243
  /** How the API key is sent in the HTTP request. */
@@ -254,65 +265,65 @@ export declare enum AuthType {
254
265
  /** Query parameters for listing batches. */
255
266
  export interface BatchListQuery {
256
267
  /** Maximum number of results to return. Defaults to 20. */
257
- readonly limit?: number
268
+ readonly limit?: number;
258
269
  /** Pagination cursor: return results after this batch ID. */
259
- readonly after?: string
270
+ readonly after?: string;
260
271
  }
261
272
 
262
273
  /** Response from listing batches. */
263
274
  export interface BatchListResponse {
264
275
  /** Object type (always `"list"`). */
265
- readonly object?: string
276
+ readonly object?: string;
266
277
  /** List of batch objects. */
267
- readonly data?: Array<BatchObject>
278
+ readonly data?: Array<BatchObject>;
268
279
  /** Whether more results are available. */
269
- readonly hasMore?: boolean
280
+ readonly hasMore?: boolean;
270
281
  /** First batch ID in the result set (for pagination). */
271
- readonly firstId?: string
282
+ readonly firstId?: string;
272
283
  /** Last batch ID in the result set (for pagination). */
273
- readonly lastId?: string
284
+ readonly lastId?: string;
274
285
  }
275
286
 
276
287
  /** A batch job object. */
277
288
  export interface BatchObject {
278
289
  /** Unique batch ID. */
279
- readonly id?: string
290
+ readonly id?: string;
280
291
  /** Object type (always `"batch"`). */
281
- readonly object?: string
292
+ readonly object?: string;
282
293
  /** API endpoint (e.g., `"/v1/chat/completions"`). */
283
- readonly endpoint?: string
294
+ readonly endpoint?: string;
284
295
  /** ID of the input file. */
285
- readonly inputFileId?: string
296
+ readonly inputFileId?: string;
286
297
  /** Completion window (e.g., `"24h"`). */
287
- readonly completionWindow?: string
298
+ readonly completionWindow?: string;
288
299
  /** Current job status. */
289
- readonly status?: BatchStatus
300
+ readonly status?: BatchStatus;
290
301
  /** ID of the output file (present when completed). */
291
- readonly outputFileId?: string
302
+ readonly outputFileId?: string;
292
303
  /** ID of the error file (present if some requests failed). */
293
- readonly errorFileId?: string
304
+ readonly errorFileId?: string;
294
305
  /** Unix timestamp of batch creation. */
295
- readonly createdAt?: number
306
+ readonly createdAt?: number;
296
307
  /** Unix timestamp of completion (if completed). */
297
- readonly completedAt?: number
308
+ readonly completedAt?: number;
298
309
  /** Unix timestamp of failure (if failed). */
299
- readonly failedAt?: number
310
+ readonly failedAt?: number;
300
311
  /** Unix timestamp of expiration (if expired). */
301
- readonly expiredAt?: number
312
+ readonly expiredAt?: number;
302
313
  /** Request processing counts. */
303
- readonly requestCounts?: BatchRequestCounts
314
+ readonly requestCounts?: BatchRequestCounts;
304
315
  /** Metadata attached to the batch. */
305
- readonly metadata?: JsonValue
316
+ readonly metadata?: JsonValue;
306
317
  }
307
318
 
308
319
  /** Request processing counts for a batch. */
309
320
  export interface BatchRequestCounts {
310
321
  /** Total requests in the batch. */
311
- readonly total?: number
322
+ readonly total?: number;
312
323
  /** Completed requests. */
313
- readonly completed?: number
324
+ readonly completed?: number;
314
325
  /** Failed requests. */
315
- readonly failed?: number
326
+ readonly failed?: number;
316
327
  }
317
328
 
318
329
  /** Status of a batch job. */
@@ -338,154 +349,152 @@ export declare enum BatchStatus {
338
349
  /** Configuration for budget enforcement. */
339
350
  export interface BudgetConfig {
340
351
  /** Maximum total spend across all models, in USD. `None` means unlimited. */
341
- readonly globalLimit?: number
352
+ readonly globalLimit?: number;
342
353
  /**
343
354
  * Per-model spending limits in USD. Models not listed here are only
344
355
  * constrained by `global_limit`.
345
356
  */
346
- readonly modelLimits?: Record<string, number>
357
+ readonly modelLimits?: Record<string, number>;
347
358
  /** Whether to reject requests or merely warn when a limit is exceeded. */
348
- readonly enforcement?: Enforcement
359
+ readonly enforcement?: Enforcement;
349
360
  }
350
361
 
351
362
  /** Storage backend for the response cache. */
352
- export type CacheBackend =
353
- | { type: 'memory' }
354
- | { type: 'open_dal'; scheme: string; config: Record<string, string> }
363
+ export type CacheBackend = { type: "memory" } | { type: "open_dal"; scheme: string; config: Record<string, string> };
355
364
 
356
365
  /** Configuration for the response cache. */
357
366
  export interface CacheConfig {
358
367
  /** Maximum number of cached entries. */
359
- readonly maxEntries?: number
368
+ readonly maxEntries?: number;
360
369
  /** Time-to-live for each cached entry. */
361
- readonly ttl?: number
370
+ readonly ttl?: number;
362
371
  /** Storage backend to use. */
363
- readonly backend?: CacheBackend
372
+ readonly backend?: CacheBackend;
364
373
  }
365
374
 
366
375
  /** A streamed chunk of a chat completion response. */
367
376
  export interface ChatCompletionChunk {
368
377
  /** Unique identifier for this stream. */
369
- readonly id?: string
378
+ readonly id?: string;
370
379
  /**
371
380
  * Always `"chat.completion.chunk"` from OpenAI-compatible APIs. Stored
372
381
  * as a plain `String` so non-standard provider values do not fail parsing.
373
382
  */
374
- readonly object?: string
383
+ readonly object?: string;
375
384
  /** Unix timestamp of chunk creation. */
376
- readonly created?: number
385
+ readonly created?: number;
377
386
  /** Model used to generate the chunk. */
378
- readonly model?: string
387
+ readonly model?: string;
379
388
  /** Streaming choices (delta updates). */
380
- readonly choices?: Array<StreamChoice>
389
+ readonly choices?: Array<StreamChoice>;
381
390
  /** Token usage (typically only in the final chunk). */
382
- readonly usage?: Usage
391
+ readonly usage?: Usage;
383
392
  /** Fingerprint of the system configuration (OpenAI-specific). */
384
- readonly systemFingerprint?: string
393
+ readonly systemFingerprint?: string;
385
394
  /** Service tier used (OpenAI-specific). */
386
- readonly serviceTier?: string
395
+ readonly serviceTier?: string;
387
396
  }
388
397
 
389
398
  /** Chat completion request (compatible with OpenAI and similar APIs). */
390
399
  export interface ChatCompletionRequest {
391
400
  /** Model ID (e.g., `"gpt-4o-mini"`, `"claude-3-5-sonnet"`). */
392
- readonly model?: string
401
+ readonly model?: string;
393
402
  /** Conversation history from oldest to newest. */
394
- readonly messages?: Array<Message>
403
+ readonly messages?: Array<Message>;
395
404
  /** Sampling temperature in `[0.0, 2.0]`. Higher increases randomness. Defaults to 1.0. */
396
- readonly temperature?: number
405
+ readonly temperature?: number;
397
406
  /** Nucleus sampling parameter in `[0.0, 1.0]`. Lower is more focused. */
398
- readonly topP?: number
407
+ readonly topP?: number;
399
408
  /** Number of chat completions to generate. Defaults to 1. */
400
- readonly n?: number
409
+ readonly n?: number;
401
410
  /**
402
411
  * Whether to stream the response.
403
412
  *
404
413
  * Managed by the client layer — do not set directly.
405
414
  */
406
- readonly stream?: boolean
415
+ readonly stream?: boolean;
407
416
  /** Stop sequence(s) that halt token generation. */
408
- readonly stop?: StopSequence
417
+ readonly stop?: StopSequence;
409
418
  /** Max output tokens. Different from max_completion_tokens in some providers. */
410
- readonly maxTokens?: number
419
+ readonly maxTokens?: number;
411
420
  /** Presence penalty in `[-2.0, 2.0]`. Positive discourages repeated topics. */
412
- readonly presencePenalty?: number
421
+ readonly presencePenalty?: number;
413
422
  /** Frequency penalty in `[-2.0, 2.0]`. Positive discourages repeated tokens. */
414
- readonly frequencyPenalty?: number
423
+ readonly frequencyPenalty?: number;
415
424
  /**
416
425
  * Token bias map. Uses `BTreeMap` (sorted keys) for deterministic
417
426
  * serialization order — important when hashing or signing requests.
418
427
  */
419
- readonly logitBias?: Record<string, number>
428
+ readonly logitBias?: Record<string, number>;
420
429
  /** User identifier for request tracking and abuse detection. */
421
- readonly user?: string
430
+ readonly user?: string;
422
431
  /** Tools the model can invoke. */
423
- readonly tools?: Array<ChatCompletionTool>
432
+ readonly tools?: Array<ChatCompletionTool>;
424
433
  /** Tool usage mode (auto, required, none, or specific tool). */
425
- readonly toolChoice?: ToolChoice
434
+ readonly toolChoice?: ToolChoice;
426
435
  /** Whether the model can call multiple tools in parallel. Defaults to true. */
427
- readonly parallelToolCalls?: boolean
436
+ readonly parallelToolCalls?: boolean;
428
437
  /** Output format constraint (text, JSON, JSON schema). */
429
- readonly responseFormat?: ResponseFormat
438
+ readonly responseFormat?: ResponseFormat;
430
439
  /** Streaming options (e.g., include_usage). */
431
- readonly streamOptions?: StreamOptions
440
+ readonly streamOptions?: StreamOptions;
432
441
  /** Random seed for reproducible outputs. Provider support varies. */
433
- readonly seed?: number
442
+ readonly seed?: number;
434
443
  /** Reasoning effort level (low, medium, high) for extended-thinking models. */
435
- readonly reasoningEffort?: ReasoningEffort
444
+ readonly reasoningEffort?: ReasoningEffort;
436
445
  /**
437
446
  * Output modalities to request from the model.
438
447
  *
439
448
  * For OpenAI audio models, pass `["text", "audio"]`. Vertex AI / Gemini
440
449
  * translates these to `generationConfig.responseModalities` (uppercase).
441
450
  */
442
- readonly modalities?: Array<Modality>
451
+ readonly modalities?: Array<Modality>;
443
452
  /**
444
453
  * Provider-specific extra parameters merged into the request body.
445
454
  * Use for guardrails, safety settings, grounding config, etc.
446
455
  */
447
- readonly extraBody?: JsonValue
456
+ readonly extraBody?: JsonValue;
448
457
  }
449
458
 
450
459
  /** Chat completion response from the API. */
451
460
  export interface ChatCompletionResponse {
452
461
  /** Unique identifier for this response. */
453
- readonly id?: string
462
+ readonly id?: string;
454
463
  /**
455
464
  * Always `"chat.completion"` from OpenAI-compatible APIs. Stored as a
456
465
  * plain `String` so non-standard provider values do not break deserialization.
457
466
  */
458
- readonly object?: string
467
+ readonly object?: string;
459
468
  /** Unix timestamp of response creation. */
460
- readonly created?: number
469
+ readonly created?: number;
461
470
  /** Model used to generate the response. */
462
- readonly model?: string
471
+ readonly model?: string;
463
472
  /** List of completion choices. */
464
- readonly choices?: Array<Choice>
473
+ readonly choices?: Array<Choice>;
465
474
  /** Token usage statistics. */
466
- readonly usage?: Usage
475
+ readonly usage?: Usage;
467
476
  /** Fingerprint of the system configuration (OpenAI-specific). */
468
- readonly systemFingerprint?: string
477
+ readonly systemFingerprint?: string;
469
478
  /** Service tier used (OpenAI-specific). */
470
- readonly serviceTier?: string
479
+ readonly serviceTier?: string;
471
480
  }
472
481
 
473
482
  /** A tool the model can invoke (currently, all tools are functions). */
474
483
  export interface ChatCompletionTool {
475
484
  /** Tool type (always "function" in OpenAI spec). */
476
- readonly toolType: ToolType
485
+ readonly toolType: ToolType;
477
486
  /** Function definition with name, description, and JSON schema parameters. */
478
- readonly function: FunctionDefinition
487
+ readonly function: FunctionDefinition;
479
488
  }
480
489
 
481
490
  /** A single completion choice. */
482
491
  export interface Choice {
483
492
  /** Index of this choice in the choices array. */
484
- readonly index?: number
493
+ readonly index?: number;
485
494
  /** The assistant's message response. */
486
- readonly message?: AssistantMessage
495
+ readonly message?: AssistantMessage;
487
496
  /** Why the model stopped generating (stop, length, tool_calls, content_filter, etc.). */
488
- readonly finishReason?: FinishReason
497
+ readonly finishReason?: FinishReason;
489
498
  }
490
499
 
491
500
  /**
@@ -506,7 +515,7 @@ export interface ChunkMiddleware {
506
515
  * - `Ok(None)` — drop this chunk silently.
507
516
  * - `Err(e)` — propagate as a stream error.
508
517
  */
509
- process(chunk?: ChatCompletionChunk | undefined | null): ChatCompletionChunk | null
518
+ process(chunk?: ChatCompletionChunk | undefined | null): ChatCompletionChunk | null;
510
519
  }
511
520
 
512
521
  /** Observable state of a circuit breaker. */
@@ -521,111 +530,111 @@ export declare enum CircuitState {
521
530
 
522
531
  /** A single content part in a user message — text, image, document, or audio. */
523
532
  export type ContentPart =
524
- | { type: 'text'; text: string }
525
- | { type: 'image_url'; imageUrl: ImageUrl }
526
- | { type: 'document'; document: DocumentContent }
527
- | { type: 'input_audio'; inputAudio: AudioContent }
533
+ | { type: "text"; text: string }
534
+ | { type: "image_url"; imageUrl: ImageUrl }
535
+ | { type: "document"; document: DocumentContent }
536
+ | { type: "input_audio"; inputAudio: AudioContent };
528
537
 
529
538
  /** Request to create a batch job. */
530
539
  export interface CreateBatchRequest {
531
540
  /** ID of the uploaded input file (JSONL format). */
532
- readonly inputFileId?: string
541
+ readonly inputFileId?: string;
533
542
  /** API endpoint (e.g., `"/v1/chat/completions"`). */
534
- readonly endpoint?: string
543
+ readonly endpoint?: string;
535
544
  /** Completion window (e.g., `"24h"`). */
536
- readonly completionWindow?: string
545
+ readonly completionWindow?: string;
537
546
  /** Optional metadata to attach to the batch. */
538
- readonly metadata?: JsonValue
547
+ readonly metadata?: JsonValue;
539
548
  }
540
549
 
541
550
  /** Request to upload a file. */
542
551
  export interface CreateFileRequest {
543
552
  /** Base64-encoded file data. */
544
- readonly file?: string
553
+ readonly file?: string;
545
554
  /** Purpose for the file. */
546
- readonly purpose?: FilePurpose
555
+ readonly purpose?: FilePurpose;
547
556
  /** Optional filename to associate with the upload. */
548
- readonly filename?: string
557
+ readonly filename?: string;
549
558
  }
550
559
 
551
560
  /** Request to create images from a text prompt. */
552
561
  export interface CreateImageRequest {
553
562
  /** Text description of the image to generate. */
554
- readonly prompt?: string
563
+ readonly prompt?: string;
555
564
  /** Model ID (e.g., `"dall-e-3"`). Optional; API may use default if unset. */
556
- readonly model?: string
565
+ readonly model?: string;
557
566
  /** Number of images to generate. Defaults to 1. */
558
- readonly n?: number
567
+ readonly n?: number;
559
568
  /** Image size (e.g., `"1024x1024"`, `"1792x1024"`). */
560
- readonly size?: string
569
+ readonly size?: string;
561
570
  /** Image quality: `"standard"` or `"hd"`. */
562
- readonly quality?: string
571
+ readonly quality?: string;
563
572
  /** Style: `"natural"` or `"vivid"` (DALL-E 3 only). */
564
- readonly style?: string
573
+ readonly style?: string;
565
574
  /** Response format: `"url"` or `"b64_json"`. */
566
- readonly responseFormat?: string
575
+ readonly responseFormat?: string;
567
576
  /** User identifier for request tracking. */
568
- readonly user?: string
577
+ readonly user?: string;
569
578
  }
570
579
 
571
580
  /** Request to create a structured response. */
572
581
  export interface CreateResponseRequest {
573
582
  /** Model ID. */
574
- readonly model?: string
583
+ readonly model?: string;
575
584
  /** Input data to process (e.g., a document to extract from). */
576
- readonly input?: JsonValue
585
+ readonly input?: JsonValue;
577
586
  /** Instructions for processing the input. */
578
- readonly instructions?: string
587
+ readonly instructions?: string;
579
588
  /** Available tools the model can use. */
580
- readonly tools?: Array<ResponseTool>
589
+ readonly tools?: Array<ResponseTool>;
581
590
  /** Sampling temperature in `[0.0, 2.0]`. Defaults to 1.0. */
582
- readonly temperature?: number
591
+ readonly temperature?: number;
583
592
  /** Maximum output tokens. */
584
- readonly maxOutputTokens?: number
593
+ readonly maxOutputTokens?: number;
585
594
  /** Optional metadata. */
586
- readonly metadata?: JsonValue
595
+ readonly metadata?: JsonValue;
587
596
  }
588
597
 
589
598
  /** Request to generate speech audio from text. */
590
599
  export interface CreateSpeechRequest {
591
600
  /** Model ID (e.g., `"tts-1"`, `"tts-1-hd"`). */
592
- readonly model?: string
601
+ readonly model?: string;
593
602
  /** Text to synthesize into speech. */
594
- readonly input?: string
603
+ readonly input?: string;
595
604
  /** Voice name (e.g., `"alloy"`, `"echo"`, `"fable"`, `"onyx"`, `"nova"`, `"shimmer"`). */
596
- readonly voice?: string
605
+ readonly voice?: string;
597
606
  /** Audio format (e.g., `"mp3"`, `"opus"`, `"aac"`, `"flac"`, `"wav"`, `"pcm"`). */
598
- readonly responseFormat?: string
607
+ readonly responseFormat?: string;
599
608
  /** Playback speed in `[0.25, 4.0]`. Defaults to 1.0. */
600
- readonly speed?: number
609
+ readonly speed?: number;
601
610
  }
602
611
 
603
612
  /** Request to transcribe audio into text. */
604
613
  export interface CreateTranscriptionRequest {
605
614
  /** Model ID (e.g., `"whisper-1"`). */
606
- readonly model?: string
615
+ readonly model?: string;
607
616
  /** Base64-encoded audio file data. */
608
- readonly file?: string
617
+ readonly file?: string;
609
618
  /** Language ISO-639-1 code (e.g., `"en"`, `"fr"`, `"de"`). Optional; model auto-detects. */
610
- readonly language?: string
619
+ readonly language?: string;
611
620
  /** Optional text to guide the model (improves accuracy for domain-specific terms). */
612
- readonly prompt?: string
621
+ readonly prompt?: string;
613
622
  /** Output format (e.g., `"json"`, `"text"`, `"vtt"`, `"srt"`, `"verbose_json"`). */
614
- readonly responseFormat?: string
623
+ readonly responseFormat?: string;
615
624
  /** Sampling temperature in `[0.0, 1.0]`. Higher increases variability. Defaults to 0. */
616
- readonly temperature?: number
625
+ readonly temperature?: number;
617
626
  }
618
627
 
619
628
  /** Configuration for registering a custom LLM provider at runtime. */
620
629
  export interface CustomProviderConfig {
621
630
  /** Unique name for this provider (e.g., "my-provider"). */
622
- readonly name: string
631
+ readonly name: string;
623
632
  /** Base URL for the provider's API (e.g., `<https://api.my-provider.com/v1>`). */
624
- readonly baseUrl: string
633
+ readonly baseUrl: string;
625
634
  /** Authentication header format. */
626
- readonly authHeader: AuthHeaderFormat
635
+ readonly authHeader: AuthHeaderFormat;
627
636
  /** Model name prefixes that route to this provider (e.g., `["my-"]`). */
628
- readonly modelPrefixes: Array<string>
637
+ readonly modelPrefixes: Array<string>;
629
638
  }
630
639
 
631
640
  /**
@@ -636,9 +645,9 @@ export interface CustomProviderConfig {
636
645
  */
637
646
  export interface DecodedDataUrl {
638
647
  /** MIME type extracted from the URL prefix (verbatim, not normalised). */
639
- readonly mime?: string
648
+ readonly mime?: string;
640
649
  /** Decoded base64 payload. */
641
- readonly data?: Uint8Array
650
+ readonly data?: Uint8Array;
642
651
  }
643
652
 
644
653
  /**
@@ -659,27 +668,29 @@ export interface DecodedDataUrl {
659
668
  * headers are cached at construction to avoid redundant encoding on every request.
660
669
  */
661
670
  export declare class DefaultClient {
662
- chat(req?: ChatCompletionRequest | undefined | null): Promise<ChatCompletionResponse>
663
- chatStream(req?: ChatCompletionRequest | undefined | null): Promise<AsyncGenerator<ChatCompletionChunk, void, undefined>>
664
- embed(req?: EmbeddingRequest | undefined | null): Promise<EmbeddingResponse>
665
- listModels(): Promise<ModelsListResponse>
666
- imageGenerate(req?: CreateImageRequest | undefined | null): Promise<ImagesResponse>
667
- speech(req?: CreateSpeechRequest | undefined | null): Promise<Uint8Array>
668
- transcribe(req?: CreateTranscriptionRequest | undefined | null): Promise<TranscriptionResponse>
669
- moderate(req?: ModerationRequest | undefined | null): Promise<ModerationResponse>
670
- rerank(req?: RerankRequest | undefined | null): Promise<RerankResponse>
671
- search(req?: SearchRequest | undefined | null): Promise<SearchResponse>
672
- ocr(req?: OcrRequest | undefined | null): Promise<OcrResponse>
673
- createFile(req?: CreateFileRequest | undefined | null): Promise<FileObject>
674
- retrieveFile(fileId: string): Promise<FileObject>
675
- deleteFile(fileId: string): Promise<DeleteResponse>
676
- listFiles(query?: FileListQuery | undefined | null): Promise<FileListResponse>
677
- fileContent(fileId: string): Promise<Uint8Array>
678
- createBatch(req?: CreateBatchRequest | undefined | null): Promise<BatchObject>
679
- retrieveBatch(batchId: string): Promise<BatchObject>
680
- listBatches(query?: BatchListQuery | undefined | null): Promise<BatchListResponse>
681
- cancelBatch(batchId: string): Promise<BatchObject>
682
- fetchBatchForPolling(batchId: string): Promise<BatchObject>
671
+ chat(req?: ChatCompletionRequest | undefined | null): Promise<ChatCompletionResponse>;
672
+ chatStream(
673
+ req?: ChatCompletionRequest | undefined | null,
674
+ ): Promise<AsyncGenerator<ChatCompletionChunk, void, undefined>>;
675
+ embed(req?: EmbeddingRequest | undefined | null): Promise<EmbeddingResponse>;
676
+ listModels(): Promise<ModelsListResponse>;
677
+ imageGenerate(req?: CreateImageRequest | undefined | null): Promise<ImagesResponse>;
678
+ speech(req?: CreateSpeechRequest | undefined | null): Promise<Uint8Array>;
679
+ transcribe(req?: CreateTranscriptionRequest | undefined | null): Promise<TranscriptionResponse>;
680
+ moderate(req?: ModerationRequest | undefined | null): Promise<ModerationResponse>;
681
+ rerank(req?: RerankRequest | undefined | null): Promise<RerankResponse>;
682
+ search(req?: SearchRequest | undefined | null): Promise<SearchResponse>;
683
+ ocr(req?: OcrRequest | undefined | null): Promise<OcrResponse>;
684
+ createFile(req?: CreateFileRequest | undefined | null): Promise<FileObject>;
685
+ retrieveFile(fileId: string): Promise<FileObject>;
686
+ deleteFile(fileId: string): Promise<DeleteResponse>;
687
+ listFiles(query?: FileListQuery | undefined | null): Promise<FileListResponse>;
688
+ fileContent(fileId: string): Promise<Uint8Array>;
689
+ createBatch(req?: CreateBatchRequest | undefined | null): Promise<BatchObject>;
690
+ retrieveBatch(batchId: string): Promise<BatchObject>;
691
+ listBatches(query?: BatchListQuery | undefined | null): Promise<BatchListResponse>;
692
+ cancelBatch(batchId: string): Promise<BatchObject>;
693
+ fetchBatchForPolling(batchId: string): Promise<BatchObject>;
683
694
  /**
684
695
  * Poll a batch until it reaches a terminal status (Completed, Failed, Expired, Cancelled).
685
696
  *
@@ -689,36 +700,36 @@ export declare class DefaultClient {
689
700
  * Returns `BatchWaitError::Timeout` if the configured timeout is exceeded.
690
701
  * Returns `BatchWaitError::Client` for underlying client errors.
691
702
  */
692
- waitForBatch(batchId: string, config?: WaitForBatchConfig | undefined | null): Promise<BatchObject>
693
- createResponse(req?: CreateResponseRequest | undefined | null): Promise<ResponseObject>
694
- retrieveResponse(responseId: string): Promise<ResponseObject>
695
- cancelResponse(responseId: string): Promise<ResponseObject>
703
+ waitForBatch(batchId: string, config?: WaitForBatchConfig | undefined | null): Promise<BatchObject>;
704
+ createResponse(req?: CreateResponseRequest | undefined | null): Promise<ResponseObject>;
705
+ retrieveResponse(responseId: string): Promise<ResponseObject>;
706
+ cancelResponse(responseId: string): Promise<ResponseObject>;
696
707
  }
697
708
 
698
709
  /** Response from a delete operation. */
699
710
  export interface DeleteResponse {
700
711
  /** ID of the deleted resource. */
701
- readonly id?: string
712
+ readonly id?: string;
702
713
  /** Object type. */
703
- readonly object?: string
714
+ readonly object?: string;
704
715
  /** Confirmation that the resource was deleted. */
705
- readonly deleted?: boolean
716
+ readonly deleted?: boolean;
706
717
  }
707
718
 
708
719
  /** Developer message (system-like message for Claude models). */
709
720
  export interface DeveloperMessage {
710
721
  /** Developer-specific instructions or context. */
711
- readonly content?: string
722
+ readonly content?: string;
712
723
  /** Optional name for the developer message source. */
713
- readonly name?: string
724
+ readonly name?: string;
714
725
  }
715
726
 
716
727
  /** PDF/document content part for vision-capable models. */
717
728
  export interface DocumentContent {
718
729
  /** Base64-encoded document data or URL. */
719
- readonly data?: string
730
+ readonly data?: string;
720
731
  /** MIME type (e.g., "application/pdf", "text/csv"). */
721
- readonly mediaType?: string
732
+ readonly mediaType?: string;
722
733
  }
723
734
 
724
735
  /** The format in which the embedding vectors are returned. */
@@ -743,25 +754,25 @@ export interface EmbeddingObject {
743
754
  * Always `"embedding"` from OpenAI-compatible APIs. Stored as a plain
744
755
  * `String` so non-standard provider values do not break deserialization.
745
756
  */
746
- readonly object: string
757
+ readonly object: string;
747
758
  /** The embedding vector. */
748
- readonly embedding: Array<number>
759
+ readonly embedding: Array<number>;
749
760
  /** Index in the batch (corresponds to input order). */
750
- readonly index: number
761
+ readonly index: number;
751
762
  }
752
763
 
753
764
  /** Embedding request. */
754
765
  export interface EmbeddingRequest {
755
766
  /** Model ID (e.g., `"text-embedding-3-small"`). */
756
- readonly model?: string
767
+ readonly model?: string;
757
768
  /** Text or texts to embed. */
758
- readonly input?: EmbeddingInput
769
+ readonly input?: EmbeddingInput;
759
770
  /** Output format: float (native) or base64. */
760
- readonly encodingFormat?: EmbeddingFormat
771
+ readonly encodingFormat?: EmbeddingFormat;
761
772
  /** Requested embedding dimensions (if supported by the model). */
762
- readonly dimensions?: number
773
+ readonly dimensions?: number;
763
774
  /** User identifier for request tracking. */
764
- readonly user?: string
775
+ readonly user?: string;
765
776
  }
766
777
 
767
778
  /** Embedding response. */
@@ -770,13 +781,13 @@ export interface EmbeddingResponse {
770
781
  * Always `"list"` from OpenAI-compatible APIs. Stored as a plain
771
782
  * `String` so non-standard provider values do not break deserialization.
772
783
  */
773
- readonly object: string
784
+ readonly object: string;
774
785
  /** List of embeddings. */
775
- readonly data: Array<EmbeddingObject>
786
+ readonly data: Array<EmbeddingObject>;
776
787
  /** Model used to generate embeddings. */
777
- readonly model: string
788
+ readonly model: string;
778
789
  /** Token usage (input tokens only; embeddings have zero output tokens). */
779
- readonly usage?: Usage
790
+ readonly usage?: Usage;
780
791
  }
781
792
 
782
793
  /** How budget limits are enforced. */
@@ -796,39 +807,39 @@ export declare enum Enforcement {
796
807
  /** Query parameters for listing files. */
797
808
  export interface FileListQuery {
798
809
  /** Filter by file purpose (e.g., `"batch"`, `"fine-tune"`). */
799
- readonly purpose?: string
810
+ readonly purpose?: string;
800
811
  /** Maximum number of results to return. Defaults to 20. */
801
- readonly limit?: number
812
+ readonly limit?: number;
802
813
  /** Pagination cursor: return results after this file ID. */
803
- readonly after?: string
814
+ readonly after?: string;
804
815
  }
805
816
 
806
817
  /** Response from listing files. */
807
818
  export interface FileListResponse {
808
819
  /** Object type (always `"list"`). */
809
- readonly object?: string
820
+ readonly object?: string;
810
821
  /** List of file objects. */
811
- readonly data?: Array<FileObject>
822
+ readonly data?: Array<FileObject>;
812
823
  /** Whether more results are available. */
813
- readonly hasMore?: boolean
824
+ readonly hasMore?: boolean;
814
825
  }
815
826
 
816
827
  /** An uploaded file object. */
817
828
  export interface FileObject {
818
829
  /** Unique file ID. */
819
- readonly id?: string
830
+ readonly id?: string;
820
831
  /** Object type (always `"file"`). */
821
- readonly object?: string
832
+ readonly object?: string;
822
833
  /** File size in bytes. */
823
- readonly bytes?: number
834
+ readonly bytes?: number;
824
835
  /** Unix timestamp of file creation. */
825
- readonly createdAt?: number
836
+ readonly createdAt?: number;
826
837
  /** Filename. */
827
- readonly filename?: string
838
+ readonly filename?: string;
828
839
  /** File purpose. */
829
- readonly purpose?: string
840
+ readonly purpose?: string;
830
841
  /** Processing status (e.g., `"uploaded"`, `"processed"`). */
831
- readonly status?: string
842
+ readonly status?: string;
832
843
  }
833
844
 
834
845
  /** Purpose of an uploaded file. */
@@ -866,27 +877,27 @@ export declare enum FinishReason {
866
877
  /** Function call details. */
867
878
  export interface FunctionCall {
868
879
  /** Function name. */
869
- readonly name: string
880
+ readonly name: string;
870
881
  /** Arguments as a JSON string (parse with serde_json::from_str). */
871
- readonly arguments: string
882
+ readonly arguments: string;
872
883
  }
873
884
 
874
885
  /** Function definition exposed to the model. */
875
886
  export interface FunctionDefinition {
876
887
  /** Name of the function. Required and must be alphanumeric + underscores. */
877
- readonly name: string
888
+ readonly name: string;
878
889
  /** Human-readable description explaining what the function does. */
879
- readonly description?: string
890
+ readonly description?: string;
880
891
  /** JSON Schema defining the function's parameters. */
881
- readonly parameters?: JsonValue
892
+ readonly parameters?: JsonValue;
882
893
  /** If true, enforce strict JSON schema validation for arguments. */
883
- readonly strict?: boolean
894
+ readonly strict?: boolean;
884
895
  }
885
896
 
886
897
  /** Deprecated legacy function-role message body. */
887
898
  export interface FunctionMessage {
888
- readonly content?: string
889
- readonly name?: string
899
+ readonly content?: string;
900
+ readonly name?: string;
890
901
  }
891
902
 
892
903
  /**
@@ -903,7 +914,7 @@ export interface HealthChecker {
903
914
  * move it into the returned future without a clone, making the
904
915
  * `'static + Send` bound on the future trivially satisfiable.
905
916
  */
906
- check(upstream: string): Promise<HealthStatus>
917
+ check(upstream: string): Promise<HealthStatus>;
907
918
  }
908
919
 
909
920
  /** The result of a single health probe. */
@@ -917,11 +928,11 @@ export declare enum HealthStatus {
917
928
  /** A single generated image, returned as either a URL or base64 data. */
918
929
  export interface Image {
919
930
  /** Image URL (if response_format was "url"). */
920
- readonly url?: string
931
+ readonly url?: string;
921
932
  /** Base64-encoded image data (if response_format was "b64_json"). */
922
- readonly b64Json?: string
933
+ readonly b64Json?: string;
923
934
  /** The final prompt used to generate the image (DALL-E 3). */
924
- readonly revisedPrompt?: string
935
+ readonly revisedPrompt?: string;
925
936
  }
926
937
 
927
938
  /** Image detail level controlling token cost and processing. */
@@ -937,49 +948,49 @@ export declare enum ImageDetail {
937
948
  /** Response containing generated images. */
938
949
  export interface ImagesResponse {
939
950
  /** Unix timestamp of image creation. */
940
- readonly created?: number
951
+ readonly created?: number;
941
952
  /** List of generated images. */
942
- readonly data?: Array<Image>
953
+ readonly data?: Array<Image>;
943
954
  }
944
955
 
945
956
  /** An image URL reference with optional detail level for processing. */
946
957
  export interface ImageUrl {
947
958
  /** URL of the image (data URI or HTTP/HTTPS URL). */
948
- readonly url?: string
959
+ readonly url?: string;
949
960
  /** Detail level: low (512x512), high (2x2 tiles), or auto (model-selected). */
950
- readonly detail?: ImageDetail
961
+ readonly detail?: ImageDetail;
951
962
  }
952
963
 
953
964
  /** An intent prototype: `(intent_name, prototype_embedding, target_model_id)`. */
954
965
  export interface IntentPrototype {
955
966
  /** Human-readable name for the intent (used in logs/metrics). */
956
- readonly name: string
967
+ readonly name: string;
957
968
  /** Pre-computed embedding vector for this intent. */
958
- readonly embedding: Array<number>
969
+ readonly embedding: Array<number>;
959
970
  /** Model to route to when this intent is detected. */
960
- readonly model: string
971
+ readonly model: string;
961
972
  }
962
973
 
963
974
  /** JSON Schema specification for constrained output. */
964
975
  export interface JsonSchemaFormat {
965
976
  /** Name of the schema (must be unique in the request). */
966
- readonly name?: string
977
+ readonly name?: string;
967
978
  /** Description of what the schema represents. */
968
- readonly description?: string
979
+ readonly description?: string;
969
980
  /** JSON Schema object defining the output structure. */
970
- readonly schema?: JsonValue
981
+ readonly schema?: JsonValue;
971
982
  /** If true, enforce strict schema validation. */
972
- readonly strict?: boolean
983
+ readonly strict?: boolean;
973
984
  }
974
985
 
975
986
  /** A chat message in a conversation. */
976
987
  export type Message =
977
- | { role: 'system'; 0: SystemMessage }
978
- | { role: 'user'; 0: UserMessage }
979
- | { role: 'assistant'; 0: AssistantMessage }
980
- | { role: 'tool'; 0: ToolMessage }
981
- | { role: 'developer'; 0: DeveloperMessage }
982
- | { role: 'function'; 0: FunctionMessage }
988
+ | { role: "system"; 0: SystemMessage }
989
+ | { role: "user"; 0: UserMessage }
990
+ | { role: "assistant"; 0: AssistantMessage }
991
+ | { role: "tool"; 0: ToolMessage }
992
+ | { role: "developer"; 0: DeveloperMessage }
993
+ | { role: "function"; 0: FunctionMessage };
983
994
 
984
995
  /**
985
996
  * Output modality requested from the model.
@@ -999,16 +1010,16 @@ export declare enum Modality {
999
1010
  /** A model available from the API. */
1000
1011
  export interface ModelObject {
1001
1012
  /** Model ID (e.g., `"gpt-4o"`, `"claude-3-5-sonnet"`). */
1002
- readonly id?: string
1013
+ readonly id?: string;
1003
1014
  /**
1004
1015
  * Always `"model"` from OpenAI-compatible APIs. Stored as a plain
1005
1016
  * `String` so non-standard provider values do not break deserialization.
1006
1017
  */
1007
- readonly object?: string
1018
+ readonly object?: string;
1008
1019
  /** Unix timestamp of model creation (or release date). */
1009
- readonly created?: number
1020
+ readonly created?: number;
1010
1021
  /** Organization or entity that owns the model. */
1011
- readonly ownedBy?: string
1022
+ readonly ownedBy?: string;
1012
1023
  }
1013
1024
 
1014
1025
  /** Response listing available models. */
@@ -1017,61 +1028,61 @@ export interface ModelsListResponse {
1017
1028
  * Always `"list"` from OpenAI-compatible APIs. Stored as a plain
1018
1029
  * `String` so non-standard provider values do not break deserialization.
1019
1030
  */
1020
- readonly object?: string
1031
+ readonly object?: string;
1021
1032
  /** List of available models. */
1022
- readonly data?: Array<ModelObject>
1033
+ readonly data?: Array<ModelObject>;
1023
1034
  }
1024
1035
 
1025
1036
  /** Boolean flags for each moderation category. */
1026
1037
  export interface ModerationCategories {
1027
1038
  /** Sexual content. */
1028
- readonly sexual?: boolean
1039
+ readonly sexual?: boolean;
1029
1040
  /** Hate speech. */
1030
- readonly hate?: boolean
1041
+ readonly hate?: boolean;
1031
1042
  /** Harassment. */
1032
- readonly harassment?: boolean
1043
+ readonly harassment?: boolean;
1033
1044
  /** Self-harm content. */
1034
- readonly selfHarm?: boolean
1045
+ readonly selfHarm?: boolean;
1035
1046
  /** Sexual content involving minors. */
1036
- readonly sexualMinors?: boolean
1047
+ readonly sexualMinors?: boolean;
1037
1048
  /** Hate speech that threatens violence. */
1038
- readonly hateThreatening?: boolean
1049
+ readonly hateThreatening?: boolean;
1039
1050
  /** Graphic violence. */
1040
- readonly violenceGraphic?: boolean
1051
+ readonly violenceGraphic?: boolean;
1041
1052
  /** Intent to self-harm. */
1042
- readonly selfHarmIntent?: boolean
1053
+ readonly selfHarmIntent?: boolean;
1043
1054
  /** Instructions for self-harm. */
1044
- readonly selfHarmInstructions?: boolean
1055
+ readonly selfHarmInstructions?: boolean;
1045
1056
  /** Harassment that threatens violence. */
1046
- readonly harassmentThreatening?: boolean
1057
+ readonly harassmentThreatening?: boolean;
1047
1058
  /** Non-graphic violence. */
1048
- readonly violence?: boolean
1059
+ readonly violence?: boolean;
1049
1060
  }
1050
1061
 
1051
1062
  /** Confidence scores for each moderation category. */
1052
1063
  export interface ModerationCategoryScores {
1053
1064
  /** Sexual content score. */
1054
- readonly sexual?: number
1065
+ readonly sexual?: number;
1055
1066
  /** Hate speech score. */
1056
- readonly hate?: number
1067
+ readonly hate?: number;
1057
1068
  /** Harassment score. */
1058
- readonly harassment?: number
1069
+ readonly harassment?: number;
1059
1070
  /** Self-harm content score. */
1060
- readonly selfHarm?: number
1071
+ readonly selfHarm?: number;
1061
1072
  /** Sexual content involving minors score. */
1062
- readonly sexualMinors?: number
1073
+ readonly sexualMinors?: number;
1063
1074
  /** Hate speech that threatens violence score. */
1064
- readonly hateThreatening?: number
1075
+ readonly hateThreatening?: number;
1065
1076
  /** Graphic violence score. */
1066
- readonly violenceGraphic?: number
1077
+ readonly violenceGraphic?: number;
1067
1078
  /** Intent to self-harm score. */
1068
- readonly selfHarmIntent?: number
1079
+ readonly selfHarmIntent?: number;
1069
1080
  /** Instructions for self-harm score. */
1070
- readonly selfHarmInstructions?: number
1081
+ readonly selfHarmInstructions?: number;
1071
1082
  /** Harassment that threatens violence score. */
1072
- readonly harassmentThreatening?: number
1083
+ readonly harassmentThreatening?: number;
1073
1084
  /** Non-graphic violence score. */
1074
- readonly violence?: number
1085
+ readonly violence?: number;
1075
1086
  }
1076
1087
 
1077
1088
  /** Input to the moderation endpoint — a single string or multiple strings. */
@@ -1085,84 +1096,82 @@ export declare enum ModerationInput {
1085
1096
  /** Request to classify content for policy violations. */
1086
1097
  export interface ModerationRequest {
1087
1098
  /** Text or texts to check. */
1088
- readonly input?: ModerationInput
1099
+ readonly input?: ModerationInput;
1089
1100
  /** Model ID (e.g., `"text-moderation-latest"`). Optional; API uses default if unset. */
1090
- readonly model?: string
1101
+ readonly model?: string;
1091
1102
  }
1092
1103
 
1093
1104
  /** Response from the moderation endpoint. */
1094
1105
  export interface ModerationResponse {
1095
1106
  /** Unique identifier for this moderation request. */
1096
- readonly id: string
1107
+ readonly id: string;
1097
1108
  /** Model used for classification. */
1098
- readonly model: string
1109
+ readonly model: string;
1099
1110
  /** Results for each input string. */
1100
- readonly results: Array<ModerationResult>
1111
+ readonly results: Array<ModerationResult>;
1101
1112
  }
1102
1113
 
1103
1114
  /** A single moderation classification result. */
1104
1115
  export interface ModerationResult {
1105
1116
  /** True if any category was flagged. */
1106
- readonly flagged: boolean
1117
+ readonly flagged: boolean;
1107
1118
  /** Boolean flags for each moderation category. */
1108
- readonly categories: ModerationCategories
1119
+ readonly categories: ModerationCategories;
1109
1120
  /** Confidence scores for each category. */
1110
- readonly categoryScores: ModerationCategoryScores
1121
+ readonly categoryScores: ModerationCategoryScores;
1111
1122
  }
1112
1123
 
1113
1124
  /** Document input for OCR — either a URL or inline base64 data. */
1114
- export type OcrDocument =
1115
- | { type: 'document_url'; url: string }
1116
- | { type: 'base64'; data: string; mediaType: string }
1125
+ export type OcrDocument = { type: "document_url"; url: string } | { type: "base64"; data: string; mediaType: string };
1117
1126
 
1118
1127
  /** An image extracted from an OCR page. */
1119
1128
  export interface OcrImage {
1120
1129
  /** Unique image identifier within the document. */
1121
- readonly id: string
1130
+ readonly id: string;
1122
1131
  /** Base64-encoded image data (if `include_image_base64` was true). */
1123
- readonly imageBase64?: string
1132
+ readonly imageBase64?: string;
1124
1133
  }
1125
1134
 
1126
1135
  /** A single page of OCR output. */
1127
1136
  export interface OcrPage {
1128
1137
  /** Page index (0-based). */
1129
- readonly index: number
1138
+ readonly index: number;
1130
1139
  /** Extracted page content as Markdown. */
1131
- readonly markdown: string
1140
+ readonly markdown: string;
1132
1141
  /** Embedded images extracted from the page (if `include_image_base64` was true). */
1133
- readonly images?: Array<OcrImage>
1142
+ readonly images?: Array<OcrImage>;
1134
1143
  /** Page dimensions in pixels, if available. */
1135
- readonly dimensions?: PageDimensions
1144
+ readonly dimensions?: PageDimensions;
1136
1145
  }
1137
1146
 
1138
1147
  /** An OCR request. */
1139
1148
  export interface OcrRequest {
1140
1149
  /** The model/provider to use (e.g. `"mistral/mistral-ocr-latest"`). */
1141
- readonly model?: string
1150
+ readonly model?: string;
1142
1151
  /** The document to process (URL or base64). */
1143
- readonly document?: OcrDocument
1152
+ readonly document?: OcrDocument;
1144
1153
  /** Specific pages to process (1-indexed). `None` means all pages. */
1145
- readonly pages?: Array<number>
1154
+ readonly pages?: Array<number>;
1146
1155
  /** Whether to include base64-encoded images of each processed page. */
1147
- readonly includeImageBase64?: boolean
1156
+ readonly includeImageBase64?: boolean;
1148
1157
  }
1149
1158
 
1150
1159
  /** An OCR response. */
1151
1160
  export interface OcrResponse {
1152
1161
  /** Extracted pages in order. */
1153
- readonly pages: Array<OcrPage>
1162
+ readonly pages: Array<OcrPage>;
1154
1163
  /** Model/provider used for OCR. */
1155
- readonly model: string
1164
+ readonly model: string;
1156
1165
  /** Token usage, if reported by the provider. */
1157
- readonly usage?: Usage
1166
+ readonly usage?: Usage;
1158
1167
  }
1159
1168
 
1160
1169
  /** Page dimensions in pixels. */
1161
1170
  export interface PageDimensions {
1162
1171
  /** Width in pixels. */
1163
- readonly width: number
1172
+ readonly width: number;
1164
1173
  /** Height in pixels. */
1165
- readonly height: number
1174
+ readonly height: number;
1166
1175
  }
1167
1176
 
1168
1177
  /**
@@ -1175,9 +1184,9 @@ export interface PageDimensions {
1175
1184
  */
1176
1185
  export interface PromptTokensDetails {
1177
1186
  /** Cached tokens present in the prompt. Defaults to 0 when absent. */
1178
- readonly cachedTokens?: number
1187
+ readonly cachedTokens?: number;
1179
1188
  /** Audio input tokens present in the prompt. Defaults to 0 when absent. */
1180
- readonly audioTokens?: number
1189
+ readonly audioTokens?: number;
1181
1190
  }
1182
1191
 
1183
1192
  /**
@@ -1207,19 +1216,19 @@ export interface PromptTokensDetails {
1207
1216
  */
1208
1217
  export interface ProviderCapabilities {
1209
1218
  /** The provider accepts image input in chat messages. */
1210
- readonly vision?: boolean
1219
+ readonly vision?: boolean;
1211
1220
  /** The provider supports extended-thinking / reasoning tokens. */
1212
- readonly reasoning?: boolean
1221
+ readonly reasoning?: boolean;
1213
1222
  /** The provider supports JSON-mode or `response_format` structured output. */
1214
- readonly structuredOutput?: boolean
1223
+ readonly structuredOutput?: boolean;
1215
1224
  /** The provider supports tool / function calling. */
1216
- readonly functionCalling?: boolean
1225
+ readonly functionCalling?: boolean;
1217
1226
  /** The provider accepts audio as input. */
1218
- readonly audioIn?: boolean
1227
+ readonly audioIn?: boolean;
1219
1228
  /** The provider can generate audio / TTS output. */
1220
- readonly audioOut?: boolean
1229
+ readonly audioOut?: boolean;
1221
1230
  /** The provider accepts video as input. */
1222
- readonly videoIn?: boolean
1231
+ readonly videoIn?: boolean;
1223
1232
  }
1224
1233
 
1225
1234
  /**
@@ -1230,17 +1239,17 @@ export interface ProviderCapabilities {
1230
1239
  */
1231
1240
  export interface ProviderConfig {
1232
1241
  /** Provider identifier (matches the entry key in providers.json). */
1233
- readonly name: string
1242
+ readonly name: string;
1234
1243
  /** Human-readable provider name shown in UIs. */
1235
- readonly displayName?: string
1244
+ readonly displayName?: string;
1236
1245
  /** Base URL used as the default for this provider's HTTP client. */
1237
- readonly baseUrl?: string
1246
+ readonly baseUrl?: string;
1238
1247
  /** Authentication scheme metadata (auth type + env var holding the key). */
1239
- readonly auth?: AuthConfig
1248
+ readonly auth?: AuthConfig;
1240
1249
  /** Supported endpoint kinds (e.g. `chat`, `embeddings`). */
1241
- readonly endpoints?: Array<string>
1250
+ readonly endpoints?: Array<string>;
1242
1251
  /** Model-name prefixes claimed by this provider (e.g. `["gpt-", "o1-"]`). */
1243
- readonly modelPrefixes?: Array<string>
1252
+ readonly modelPrefixes?: Array<string>;
1244
1253
  /**
1245
1254
  * Parameter key renaming for this provider.
1246
1255
  *
@@ -1248,17 +1257,17 @@ export interface ProviderConfig {
1248
1257
  * to the name this provider expects (e.g. `"max_tokens"`). Applied
1249
1258
  * automatically by `ConfigDrivenProvider::transform_request`.
1250
1259
  */
1251
- readonly paramMappings?: Record<string, string>
1260
+ readonly paramMappings?: Record<string, string>;
1252
1261
  }
1253
1262
 
1254
1263
  /** Configuration for per-model rate limits. */
1255
1264
  export interface RateLimitConfig {
1256
1265
  /** Maximum requests per window. `None` means unlimited. */
1257
- readonly rpm?: number
1266
+ readonly rpm?: number;
1258
1267
  /** Maximum tokens per window. `None` means unlimited. */
1259
- readonly tpm?: number
1268
+ readonly tpm?: number;
1260
1269
  /** Fixed window duration (defaults to 60 s). */
1261
- readonly window?: number
1270
+ readonly window?: number;
1262
1271
  }
1263
1272
 
1264
1273
  /** Controls how much reasoning effort the model should use. */
@@ -1279,41 +1288,41 @@ export declare enum RerankDocument {
1279
1288
  /** Request to rerank documents by relevance to a query. */
1280
1289
  export interface RerankRequest {
1281
1290
  /** Model ID (e.g., `"cohere/rerank-english-v3.0"`). */
1282
- readonly model?: string
1291
+ readonly model?: string;
1283
1292
  /** The search query. */
1284
- readonly query?: string
1293
+ readonly query?: string;
1285
1294
  /** Documents to rerank. */
1286
- readonly documents?: Array<RerankDocument>
1295
+ readonly documents?: Array<RerankDocument>;
1287
1296
  /** Return only the top N results. Optional. */
1288
- readonly topN?: number
1297
+ readonly topN?: number;
1289
1298
  /** Include the document content in results. Defaults to false. */
1290
- readonly returnDocuments?: boolean
1299
+ readonly returnDocuments?: boolean;
1291
1300
  }
1292
1301
 
1293
1302
  /** Response from the rerank endpoint. */
1294
1303
  export interface RerankResponse {
1295
1304
  /** Unique identifier for this rerank request. */
1296
- readonly id?: string
1305
+ readonly id?: string;
1297
1306
  /** Reranked documents in order of relevance. */
1298
- readonly results: Array<RerankResult>
1307
+ readonly results: Array<RerankResult>;
1299
1308
  /** Optional metadata about the reranking operation. */
1300
- readonly meta?: JsonValue
1309
+ readonly meta?: JsonValue;
1301
1310
  }
1302
1311
 
1303
1312
  /** A single reranked document with its relevance score. */
1304
1313
  export interface RerankResult {
1305
1314
  /** Original document index in the input list. */
1306
- readonly index: number
1315
+ readonly index: number;
1307
1316
  /** Relevance score in `[0, 1]`. Higher indicates more relevant. */
1308
- readonly relevanceScore: number
1317
+ readonly relevanceScore: number;
1309
1318
  /** Original document content (if `return_documents` was true). */
1310
- readonly document?: RerankResultDocument
1319
+ readonly document?: RerankResultDocument;
1311
1320
  }
1312
1321
 
1313
1322
  /** The text content of a reranked document, returned when `return_documents` is true. */
1314
1323
  export interface RerankResultDocument {
1315
1324
  /** Document text. */
1316
- readonly text: string
1325
+ readonly text: string;
1317
1326
  }
1318
1327
 
1319
1328
  /**
@@ -1335,88 +1344,88 @@ export interface RerankResultDocument {
1335
1344
  * returned JSON if the schema is load-bearing.
1336
1345
  */
1337
1346
  export type ResponseFormat =
1338
- | { type: 'text' }
1339
- | { type: 'json_object' }
1340
- | { type: 'json_schema'; jsonSchema: JsonSchemaFormat }
1347
+ | { type: "text" }
1348
+ | { type: "json_object" }
1349
+ | { type: "json_schema"; jsonSchema: JsonSchemaFormat };
1341
1350
 
1342
1351
  /** Response from a structured response request. */
1343
1352
  export interface ResponseObject {
1344
1353
  /** Unique response ID. */
1345
- readonly id?: string
1354
+ readonly id?: string;
1346
1355
  /** Object type (e.g., `"response"`). */
1347
- readonly object?: string
1356
+ readonly object?: string;
1348
1357
  /** Unix timestamp of response creation. */
1349
- readonly createdAt?: number
1358
+ readonly createdAt?: number;
1350
1359
  /** Model used to generate the response. */
1351
- readonly model?: string
1360
+ readonly model?: string;
1352
1361
  /** Status (e.g., `"succeeded"`, `"failed"`). */
1353
- readonly status?: string
1362
+ readonly status?: string;
1354
1363
  /** Output items from the response. */
1355
- readonly output?: Array<ResponseOutputItem>
1364
+ readonly output?: Array<ResponseOutputItem>;
1356
1365
  /** Token usage. */
1357
- readonly usage?: ResponseUsage
1366
+ readonly usage?: ResponseUsage;
1358
1367
  /** Error details (if status is "failed"). */
1359
- readonly error?: JsonValue
1368
+ readonly error?: JsonValue;
1360
1369
  }
1361
1370
 
1362
1371
  /** A single output item from the response. */
1363
1372
  export interface ResponseOutputItem {
1364
1373
  /** Output type (e.g., `"text"`, `"object"`, `"error"`). */
1365
- readonly itemType?: string
1374
+ readonly itemType?: string;
1366
1375
  /** Output content (flattened into the object). */
1367
- readonly content?: JsonValue
1376
+ readonly content?: JsonValue;
1368
1377
  }
1369
1378
 
1370
1379
  /** A tool available for the response request. */
1371
1380
  export interface ResponseTool {
1372
1381
  /** Tool type (e.g., "extractor", "search"). */
1373
- readonly toolType?: string
1382
+ readonly toolType?: string;
1374
1383
  /** Tool configuration (flattened into the object). */
1375
- readonly config?: JsonValue
1384
+ readonly config?: JsonValue;
1376
1385
  }
1377
1386
 
1378
1387
  /** Token usage for a response. */
1379
1388
  export interface ResponseUsage {
1380
1389
  /** Input tokens used. */
1381
- readonly inputTokens?: number
1390
+ readonly inputTokens?: number;
1382
1391
  /** Output tokens used. */
1383
- readonly outputTokens?: number
1392
+ readonly outputTokens?: number;
1384
1393
  /** Total tokens used. */
1385
- readonly totalTokens?: number
1394
+ readonly totalTokens?: number;
1386
1395
  }
1387
1396
 
1388
1397
  /** A search request. */
1389
1398
  export interface SearchRequest {
1390
1399
  /** The model/provider to use (e.g. `"brave/web-search"`, `"tavily/search"`). */
1391
- readonly model?: string
1400
+ readonly model?: string;
1392
1401
  /** The search query string. */
1393
- readonly query?: string
1402
+ readonly query?: string;
1394
1403
  /** Maximum number of results to return. */
1395
- readonly maxResults?: number
1404
+ readonly maxResults?: number;
1396
1405
  /** Domain filter — restrict results to specific domains. */
1397
- readonly searchDomainFilter?: Array<string>
1406
+ readonly searchDomainFilter?: Array<string>;
1398
1407
  /** Country code for localized results (ISO 3166-1 alpha-2, e.g., `"US"`, `"FR"`). */
1399
- readonly country?: string
1408
+ readonly country?: string;
1400
1409
  }
1401
1410
 
1402
1411
  /** A search response. */
1403
1412
  export interface SearchResponse {
1404
1413
  /** List of search results. */
1405
- readonly results: Array<SearchResult>
1414
+ readonly results: Array<SearchResult>;
1406
1415
  /** Model/provider that performed the search. */
1407
- readonly model: string
1416
+ readonly model: string;
1408
1417
  }
1409
1418
 
1410
1419
  /** An individual search result. */
1411
1420
  export interface SearchResult {
1412
1421
  /** Result title. */
1413
- readonly title: string
1422
+ readonly title: string;
1414
1423
  /** Result URL. */
1415
- readonly url: string
1424
+ readonly url: string;
1416
1425
  /** Text snippet or excerpt from the page. */
1417
- readonly snippet: string
1426
+ readonly snippet: string;
1418
1427
  /** Publication or last-updated date, if available. */
1419
- readonly date?: string
1428
+ readonly date?: string;
1420
1429
  }
1421
1430
 
1422
1431
  /**
@@ -1425,21 +1434,20 @@ export interface SearchResult {
1425
1434
  * The error value is shared so every follower receives the same upstream
1426
1435
  * failure without cloning the underlying error.
1427
1436
  */
1428
- export declare class SingleflightResult {
1429
- }
1437
+ export declare class SingleflightResult {}
1430
1438
 
1431
1439
  /** Name of the specific function to invoke. */
1432
1440
  export interface SpecificFunction {
1433
1441
  /** Function name. */
1434
- readonly name?: string
1442
+ readonly name?: string;
1435
1443
  }
1436
1444
 
1437
1445
  /** Directive to call a specific tool. */
1438
1446
  export interface SpecificToolChoice {
1439
1447
  /** Tool type (always "function"). */
1440
- readonly choiceType?: ToolType
1448
+ readonly choiceType?: ToolType;
1441
1449
  /** The specific function to invoke. */
1442
- readonly function?: SpecificFunction
1450
+ readonly function?: SpecificFunction;
1443
1451
  }
1444
1452
 
1445
1453
  /** Stop sequence(s) that cause the model to stop generating. */
@@ -1453,25 +1461,25 @@ export declare enum StopSequence {
1453
1461
  /** A streaming choice with incremental delta. */
1454
1462
  export interface StreamChoice {
1455
1463
  /** Index of this choice in the choices array. */
1456
- readonly index?: number
1464
+ readonly index?: number;
1457
1465
  /** Incremental update to the message (content, tool calls, etc.). */
1458
- readonly delta?: StreamDelta
1466
+ readonly delta?: StreamDelta;
1459
1467
  /** Why the stream ended (present only in final chunk). */
1460
- readonly finishReason?: FinishReason
1468
+ readonly finishReason?: FinishReason;
1461
1469
  }
1462
1470
 
1463
1471
  /** Incremental delta in a stream chunk. */
1464
1472
  export interface StreamDelta {
1465
1473
  /** Role (typically present only in the first chunk). */
1466
- readonly role?: string
1474
+ readonly role?: string;
1467
1475
  /** Partial content chunk (e.g., a few words of the response). */
1468
- readonly content?: string
1476
+ readonly content?: string;
1469
1477
  /** Partial tool calls being streamed. */
1470
- readonly toolCalls?: Array<StreamToolCall>
1478
+ readonly toolCalls?: Array<StreamToolCall>;
1471
1479
  /** Deprecated legacy function_call delta; retained for API compatibility. */
1472
- readonly functionCall?: StreamFunctionCall
1480
+ readonly functionCall?: StreamFunctionCall;
1473
1481
  /** Partial refusal message. */
1474
- readonly refusal?: string
1482
+ readonly refusal?: string;
1475
1483
  }
1476
1484
 
1477
1485
  /**
@@ -1492,27 +1500,27 @@ export declare enum StreamFormat {
1492
1500
  /** Partial function call details in a stream. */
1493
1501
  export interface StreamFunctionCall {
1494
1502
  /** Function name (typically in the first chunk). */
1495
- readonly name?: string
1503
+ readonly name?: string;
1496
1504
  /** Partial JSON arguments chunk. */
1497
- readonly arguments?: string
1505
+ readonly arguments?: string;
1498
1506
  }
1499
1507
 
1500
1508
  /** Options for streaming responses. */
1501
1509
  export interface StreamOptions {
1502
1510
  /** If true, include token usage in the final stream chunk. */
1503
- readonly includeUsage?: boolean
1511
+ readonly includeUsage?: boolean;
1504
1512
  }
1505
1513
 
1506
1514
  /** A streaming tool call being built incrementally. */
1507
1515
  export interface StreamToolCall {
1508
1516
  /** Index of this tool call in the tool_calls array. */
1509
- readonly index?: number
1517
+ readonly index?: number;
1510
1518
  /** Tool call ID (typically in the first chunk for this call). */
1511
- readonly id?: string
1519
+ readonly id?: string;
1512
1520
  /** Tool type (typically "function"). */
1513
- readonly callType?: ToolType
1521
+ readonly callType?: ToolType;
1514
1522
  /** Partial function name and arguments. */
1515
- readonly function?: StreamFunctionCall
1523
+ readonly function?: StreamFunctionCall;
1516
1524
  }
1517
1525
 
1518
1526
  /** System message guiding model behavior for the entire conversation. */
@@ -1523,19 +1531,19 @@ export interface SystemMessage {
1523
1531
  * Accepts either a plain text string or an array of content parts,
1524
1532
  * mirroring [`UserContent`] so that `Message::system_with_parts` works.
1525
1533
  */
1526
- readonly content?: UserContent
1534
+ readonly content?: UserContent;
1527
1535
  /** Optional name for the system message source. */
1528
- readonly name?: string
1536
+ readonly name?: string;
1529
1537
  }
1530
1538
 
1531
1539
  /** A tool call the model wants to execute. */
1532
1540
  export interface ToolCall {
1533
1541
  /** Unique ID for this call, used to reference in tool result messages. */
1534
- readonly id: string
1542
+ readonly id: string;
1535
1543
  /** Tool type (always "function"). */
1536
- readonly callType: ToolType
1544
+ readonly callType: ToolType;
1537
1545
  /** Function name and arguments. */
1538
- readonly function: FunctionCall
1546
+ readonly function: FunctionCall;
1539
1547
  }
1540
1548
 
1541
1549
  /** Tool usage mode or a specific tool to call. */
@@ -1559,11 +1567,11 @@ export declare enum ToolChoiceMode {
1559
1567
  /** Tool execution result returned to the model. */
1560
1568
  export interface ToolMessage {
1561
1569
  /** Result of the tool execution. */
1562
- readonly content?: string
1570
+ readonly content?: string;
1563
1571
  /** ID of the tool call this result responds to. */
1564
- readonly toolCallId?: string
1572
+ readonly toolCallId?: string;
1565
1573
  /** Optional tool/function name. */
1566
- readonly name?: string
1574
+ readonly name?: string;
1567
1575
  }
1568
1576
 
1569
1577
  /**
@@ -1580,41 +1588,41 @@ export declare enum ToolType {
1580
1588
  /** Response from a transcription request. */
1581
1589
  export interface TranscriptionResponse {
1582
1590
  /** The transcribed text. */
1583
- readonly text?: string
1591
+ readonly text?: string;
1584
1592
  /** Detected language (ISO-639-1 code). */
1585
- readonly language?: string
1593
+ readonly language?: string;
1586
1594
  /** Total audio duration in seconds. */
1587
- readonly duration?: number
1595
+ readonly duration?: number;
1588
1596
  /** Detailed segment-level transcription (if response_format is "verbose_json"). */
1589
- readonly segments?: Array<TranscriptionSegment>
1597
+ readonly segments?: Array<TranscriptionSegment>;
1590
1598
  }
1591
1599
 
1592
1600
  /** A segment of transcribed audio with timing information. */
1593
1601
  export interface TranscriptionSegment {
1594
1602
  /** Segment index (0-based). */
1595
- readonly id?: number
1603
+ readonly id?: number;
1596
1604
  /** Start time in seconds. */
1597
- readonly start?: number
1605
+ readonly start?: number;
1598
1606
  /** End time in seconds. */
1599
- readonly end?: number
1607
+ readonly end?: number;
1600
1608
  /** Transcribed text for this segment. */
1601
- readonly text?: string
1609
+ readonly text?: string;
1602
1610
  }
1603
1611
 
1604
1612
  /** Token-usage accounting returned by the provider on each completion / embedding call. */
1605
1613
  export interface Usage {
1606
1614
  /** Prompt tokens used. Defaults to 0 when absent (some providers omit this). */
1607
- readonly promptTokens?: number
1615
+ readonly promptTokens?: number;
1608
1616
  /** Completion tokens used. Defaults to 0 when absent (e.g. embedding responses). */
1609
- readonly completionTokens?: number
1617
+ readonly completionTokens?: number;
1610
1618
  /** Total tokens used. Defaults to 0 when absent (some providers omit this). */
1611
- readonly totalTokens?: number
1619
+ readonly totalTokens?: number;
1612
1620
  /**
1613
1621
  * Breakdown of tokens used in the prompt, including cached tokens served
1614
1622
  * at the provider's discounted cache-read rate. Absent when the provider
1615
1623
  * does not return prompt-token details.
1616
1624
  */
1617
- readonly promptTokensDetails?: PromptTokensDetails
1625
+ readonly promptTokensDetails?: PromptTokensDetails;
1618
1626
  }
1619
1627
 
1620
1628
  /** User message content as either plain text or a list of multimodal parts. */
@@ -1628,9 +1636,9 @@ export declare enum UserContent {
1628
1636
  /** User message in the conversation. */
1629
1637
  export interface UserMessage {
1630
1638
  /** Message content as plain text or array of content parts (text, images, documents, audio). */
1631
- readonly content?: UserContent
1639
+ readonly content?: UserContent;
1632
1640
  /** Optional name for the user. */
1633
- readonly name?: string
1641
+ readonly name?: string;
1634
1642
  }
1635
1643
 
1636
1644
  /**
@@ -1641,13 +1649,13 @@ export interface UserMessage {
1641
1649
  */
1642
1650
  export interface WaitForBatchConfig {
1643
1651
  /** Initial interval between polls, in seconds. */
1644
- readonly initialIntervalSecs?: number
1652
+ readonly initialIntervalSecs?: number;
1645
1653
  /** Maximum interval between polls (backoff plateau), in seconds. */
1646
- readonly maxIntervalSecs?: number
1654
+ readonly maxIntervalSecs?: number;
1647
1655
  /** Exponential backoff multiplier (e.g., 1.5 increases delay by 50% each poll). */
1648
- readonly backoffMultiplier?: number
1656
+ readonly backoffMultiplier?: number;
1649
1657
  /** Optional timeout in seconds — polling fails if this duration is exceeded. */
1650
- readonly timeoutSecs?: number
1658
+ readonly timeoutSecs?: number;
1651
1659
  }
1652
1660
 
1653
1661
  /**
@@ -1670,12 +1678,12 @@ export declare function registerCustomProvider(config: CustomProviderConfig): vo
1670
1678
  export declare function unregisterCustomProvider(name: string): boolean;
1671
1679
 
1672
1680
  export declare class ChatStreamIterator {
1673
- next(value?: undefined): Promise<IteratorResult<ChatCompletionChunk, void>>
1674
- [Symbol.asyncIterator](): AsyncGenerator<ChatCompletionChunk, void, undefined>
1681
+ next(value?: undefined): Promise<IteratorResult<ChatCompletionChunk, void>>;
1682
+ [Symbol.asyncIterator](): AsyncGenerator<ChatCompletionChunk, void, undefined>;
1675
1683
  }
1676
1684
 
1677
1685
  export declare class LiterLlmErrorInfo {
1678
- statusCode(): number
1679
- isTransient(): boolean
1680
- errorType(): string
1686
+ statusCode(): number;
1687
+ isTransient(): boolean;
1688
+ errorType(): string;
1681
1689
  }