@kreuzberg/liter-llm-node 1.4.1 → 1.5.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/index.d.ts CHANGED
@@ -1,16 +1,10 @@
1
1
  // This file is auto-generated by alef — DO NOT EDIT.
2
- // alef:hash:6e12ad2d0caa62df184195809bd0a5a989fc00f996ba000a83e5a6241f40da7b
2
+ // alef:hash:93a82f0d43d1c6af3f54574908a88a952d597f9e2cca238de810ede5a8948e48
3
3
  // To regenerate: alef generate
4
4
  // To verify freshness: alef verify --exit-code
5
5
  /* eslint-disable */
6
6
 
7
- export type JsonValue =
8
- | string
9
- | number
10
- | boolean
11
- | null
12
- | JsonValue[]
13
- | { [key: string]: JsonValue };
7
+ export type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };
14
8
 
15
9
  /**
16
10
  * Return all provider configs from the registry.
@@ -30,11 +24,7 @@ export declare function allProviders(): Array<ProviderConfig>;
30
24
  * are tried by stripping from the last `-` or `.` separator. For example,
31
25
  * `gpt-4-0613` will match `gpt-4` if no `gpt-4-0613` entry exists.
32
26
  */
33
- export declare function completionCost(
34
- model: string,
35
- promptTokens: number,
36
- completionTokens: number,
37
- ): number | null;
27
+ export declare function completionCost(model: string, promptTokens: number, completionTokens: number): number | null;
38
28
 
39
29
  /**
40
30
  * Calculate the estimated cost of a completion, accounting for cached
@@ -50,12 +40,7 @@ export declare function completionCost(
50
40
  * Returns `None` if the model is not present in the embedded pricing
51
41
  * registry, mirroring [`completion_cost`].
52
42
  */
53
- export declare function completionCostWithCache(
54
- model: string,
55
- promptTokens: number,
56
- cachedTokens: number,
57
- completionTokens: number,
58
- ): number | null;
43
+ export declare function completionCostWithCache(model: string, promptTokens: number, cachedTokens: number, completionTokens: number): number | null;
59
44
 
60
45
  /**
61
46
  * Return the set of complex provider names.
@@ -77,10 +62,7 @@ export declare function complexProviderNames(): Array<string>;
77
62
  * @throws Returns [`LiterLlmError::BadRequest`] if the tokenizer cannot be loaded or
78
63
  * if tokenization fails for any message.
79
64
  */
80
- export declare function countRequestTokens(
81
- model: string,
82
- req?: ChatCompletionRequest | undefined | null,
83
- ): number;
65
+ export declare function countRequestTokens(model: string, req?: ChatCompletionRequest | undefined | null): number;
84
66
 
85
67
  /**
86
68
  * Count tokens in a text string using the tokenizer for the given model.
@@ -102,13 +84,7 @@ export declare function countTokens(model: string, text: string): number;
102
84
  * @throws Returns [`LiterLlmError`] if the underlying HTTP client cannot be
103
85
  * constructed, or if the resolved provider configuration is invalid.
104
86
  */
105
- export declare function createClient(
106
- apiKey: string,
107
- baseUrl?: string | undefined | null,
108
- timeoutSecs?: number | undefined | null,
109
- maxRetries?: number | undefined | null,
110
- modelHint?: string | undefined | null,
111
- ): DefaultClient;
87
+ export declare function createClient(apiKey: string, baseUrl?: string | undefined | null, timeoutSecs?: number | undefined | null, maxRetries?: number | undefined | null, modelHint?: string | undefined | null): DefaultClient;
112
88
 
113
89
  /**
114
90
  * Create a new LLM client from a JSON string.
@@ -142,34 +118,34 @@ export declare function ensureCryptoProvider(): void;
142
118
  /** Assistant's response to a user message. */
143
119
  export interface AssistantMessage {
144
120
  /** The assistant's text response. Absent if tool calls are returned instead. */
145
- readonly content?: string;
121
+ readonly content?: string
146
122
  /** Optional name for the assistant. */
147
- readonly name?: string;
123
+ readonly name?: string
148
124
  /** Tool calls the model wants to execute, if any. */
149
- readonly toolCalls?: Array<ToolCall>;
125
+ readonly toolCalls?: Array<ToolCall>
150
126
  /** Refusal reason, if the model declined to respond per safety policies. */
151
- readonly refusal?: string;
127
+ readonly refusal?: string
152
128
  /** Deprecated legacy function_call field; retained for API compatibility. */
153
- readonly functionCall?: FunctionCall;
129
+ readonly functionCall?: FunctionCall
154
130
  }
155
131
 
156
132
  /** Audio content part for speech-capable models. */
157
133
  export interface AudioContent {
158
134
  /** Base64-encoded audio data. */
159
- readonly data?: string;
135
+ readonly data?: string
160
136
  /** Audio format (e.g., "wav", "mp3", "ogg"). */
161
- readonly format?: string;
137
+ readonly format?: string
162
138
  }
163
139
 
164
140
  /** Auth configuration block. */
165
141
  export interface AuthConfig {
166
142
  /** Auth scheme classification. */
167
- readonly authType: AuthType;
143
+ readonly authType: AuthType
168
144
  /**
169
145
  * Name of the environment variable that holds the API key (e.g. `"OPENAI_API_KEY"`).
170
146
  * Holds the variable name, never the secret value.
171
147
  */
172
- readonly envVar?: string;
148
+ readonly envVar?: string
173
149
  }
174
150
 
175
151
  /** How the API key is sent in the HTTP request. */
@@ -197,65 +173,65 @@ export declare enum AuthType {
197
173
  /** Query parameters for listing batches. */
198
174
  export interface BatchListQuery {
199
175
  /** Maximum number of results to return. Defaults to 20. */
200
- readonly limit?: number;
176
+ readonly limit?: number
201
177
  /** Pagination cursor: return results after this batch ID. */
202
- readonly after?: string;
178
+ readonly after?: string
203
179
  }
204
180
 
205
181
  /** Response from listing batches. */
206
182
  export interface BatchListResponse {
207
183
  /** Object type (always `"list"`). */
208
- readonly object?: string;
184
+ readonly object?: string
209
185
  /** List of batch objects. */
210
- readonly data?: Array<BatchObject>;
186
+ readonly data?: Array<BatchObject>
211
187
  /** Whether more results are available. */
212
- readonly hasMore?: boolean;
188
+ readonly hasMore?: boolean
213
189
  /** First batch ID in the result set (for pagination). */
214
- readonly firstId?: string;
190
+ readonly firstId?: string
215
191
  /** Last batch ID in the result set (for pagination). */
216
- readonly lastId?: string;
192
+ readonly lastId?: string
217
193
  }
218
194
 
219
195
  /** A batch job object. */
220
196
  export interface BatchObject {
221
197
  /** Unique batch ID. */
222
- readonly id?: string;
198
+ readonly id?: string
223
199
  /** Object type (always `"batch"`). */
224
- readonly object?: string;
200
+ readonly object?: string
225
201
  /** API endpoint (e.g., `"/v1/chat/completions"`). */
226
- readonly endpoint?: string;
202
+ readonly endpoint?: string
227
203
  /** ID of the input file. */
228
- readonly inputFileId?: string;
204
+ readonly inputFileId?: string
229
205
  /** Completion window (e.g., `"24h"`). */
230
- readonly completionWindow?: string;
206
+ readonly completionWindow?: string
231
207
  /** Current job status. */
232
- readonly status?: BatchStatus;
208
+ readonly status?: BatchStatus
233
209
  /** ID of the output file (present when completed). */
234
- readonly outputFileId?: string;
210
+ readonly outputFileId?: string
235
211
  /** ID of the error file (present if some requests failed). */
236
- readonly errorFileId?: string;
212
+ readonly errorFileId?: string
237
213
  /** Unix timestamp of batch creation. */
238
- readonly createdAt?: number;
214
+ readonly createdAt?: number
239
215
  /** Unix timestamp of completion (if completed). */
240
- readonly completedAt?: number;
216
+ readonly completedAt?: number
241
217
  /** Unix timestamp of failure (if failed). */
242
- readonly failedAt?: number;
218
+ readonly failedAt?: number
243
219
  /** Unix timestamp of expiration (if expired). */
244
- readonly expiredAt?: number;
220
+ readonly expiredAt?: number
245
221
  /** Request processing counts. */
246
- readonly requestCounts?: BatchRequestCounts;
222
+ readonly requestCounts?: BatchRequestCounts
247
223
  /** Metadata attached to the batch. */
248
- readonly metadata?: JsonValue;
224
+ readonly metadata?: JsonValue
249
225
  }
250
226
 
251
227
  /** Request processing counts for a batch. */
252
228
  export interface BatchRequestCounts {
253
229
  /** Total requests in the batch. */
254
- readonly total?: number;
230
+ readonly total?: number
255
231
  /** Completed requests. */
256
- readonly completed?: number;
232
+ readonly completed?: number
257
233
  /** Failed requests. */
258
- readonly failed?: number;
234
+ readonly failed?: number
259
235
  }
260
236
 
261
237
  /** Status of a batch job. */
@@ -281,256 +257,256 @@ export declare enum BatchStatus {
281
257
  /** Configuration for budget enforcement. */
282
258
  export interface BudgetConfig {
283
259
  /** Maximum total spend across all models, in USD. `None` means unlimited. */
284
- readonly globalLimit?: number;
260
+ readonly globalLimit?: number
285
261
  /**
286
262
  * Per-model spending limits in USD. Models not listed here are only
287
263
  * constrained by `global_limit`.
288
264
  */
289
- readonly modelLimits?: Record<string, number>;
265
+ readonly modelLimits?: Record<string, number>
290
266
  /** Whether to reject requests or merely warn when a limit is exceeded. */
291
- readonly enforcement?: Enforcement;
267
+ readonly enforcement?: Enforcement
292
268
  }
293
269
 
294
270
  /** Storage backend for the response cache. */
295
271
  export type CacheBackend =
296
- | { type: "memory" }
297
- | { type: "open_dal"; scheme: string; config: Record<string, string> };
272
+ | { type: 'memory' }
273
+ | { type: 'open_dal'; scheme: string; config: Record<string, string> }
298
274
 
299
275
  /** Configuration for the response cache. */
300
276
  export interface CacheConfig {
301
277
  /** Maximum number of cached entries. */
302
- readonly maxEntries?: number;
278
+ readonly maxEntries?: number
303
279
  /** Time-to-live for each cached entry. */
304
- readonly ttl?: number;
280
+ readonly ttl?: number
305
281
  /** Storage backend to use. */
306
- readonly backend?: CacheBackend;
282
+ readonly backend?: CacheBackend
307
283
  }
308
284
 
309
285
  /** A streamed chunk of a chat completion response. */
310
286
  export interface ChatCompletionChunk {
311
287
  /** Unique identifier for this stream. */
312
- readonly id?: string;
288
+ readonly id?: string
313
289
  /**
314
290
  * Always `"chat.completion.chunk"` from OpenAI-compatible APIs. Stored
315
291
  * as a plain `String` so non-standard provider values do not fail parsing.
316
292
  */
317
- readonly object?: string;
293
+ readonly object?: string
318
294
  /** Unix timestamp of chunk creation. */
319
- readonly created?: number;
295
+ readonly created?: number
320
296
  /** Model used to generate the chunk. */
321
- readonly model?: string;
297
+ readonly model?: string
322
298
  /** Streaming choices (delta updates). */
323
- readonly choices?: Array<StreamChoice>;
299
+ readonly choices?: Array<StreamChoice>
324
300
  /** Token usage (typically only in the final chunk). */
325
- readonly usage?: Usage;
301
+ readonly usage?: Usage
326
302
  /** Fingerprint of the system configuration (OpenAI-specific). */
327
- readonly systemFingerprint?: string;
303
+ readonly systemFingerprint?: string
328
304
  /** Service tier used (OpenAI-specific). */
329
- readonly serviceTier?: string;
305
+ readonly serviceTier?: string
330
306
  }
331
307
 
332
308
  /** Chat completion request (compatible with OpenAI and similar APIs). */
333
309
  export interface ChatCompletionRequest {
334
310
  /** Model ID (e.g., `"gpt-4o-mini"`, `"claude-3-5-sonnet"`). */
335
- readonly model?: string;
311
+ readonly model?: string
336
312
  /** Conversation history from oldest to newest. */
337
- readonly messages?: Array<Message>;
313
+ readonly messages?: Array<Message>
338
314
  /** Sampling temperature in `[0.0, 2.0]`. Higher increases randomness. Defaults to 1.0. */
339
- readonly temperature?: number;
315
+ readonly temperature?: number
340
316
  /** Nucleus sampling parameter in `[0.0, 1.0]`. Lower is more focused. */
341
- readonly topP?: number;
317
+ readonly topP?: number
342
318
  /** Number of chat completions to generate. Defaults to 1. */
343
- readonly n?: number;
319
+ readonly n?: number
344
320
  /**
345
321
  * Whether to stream the response.
346
322
  *
347
323
  * Managed by the client layer — do not set directly.
348
324
  */
349
- readonly stream?: boolean;
325
+ readonly stream?: boolean
350
326
  /** Stop sequence(s) that halt token generation. */
351
- readonly stop?: StopSequence;
327
+ readonly stop?: StopSequence
352
328
  /** Max output tokens. Different from max_completion_tokens in some providers. */
353
- readonly maxTokens?: number;
329
+ readonly maxTokens?: number
354
330
  /** Presence penalty in `[-2.0, 2.0]`. Positive discourages repeated topics. */
355
- readonly presencePenalty?: number;
331
+ readonly presencePenalty?: number
356
332
  /** Frequency penalty in `[-2.0, 2.0]`. Positive discourages repeated tokens. */
357
- readonly frequencyPenalty?: number;
333
+ readonly frequencyPenalty?: number
358
334
  /**
359
335
  * Token bias map. Uses `BTreeMap` (sorted keys) for deterministic
360
336
  * serialization order — important when hashing or signing requests.
361
337
  */
362
- readonly logitBias?: Record<string, number>;
338
+ readonly logitBias?: Record<string, number>
363
339
  /** User identifier for request tracking and abuse detection. */
364
- readonly user?: string;
340
+ readonly user?: string
365
341
  /** Tools the model can invoke. */
366
- readonly tools?: Array<ChatCompletionTool>;
342
+ readonly tools?: Array<ChatCompletionTool>
367
343
  /** Tool usage mode (auto, required, none, or specific tool). */
368
- readonly toolChoice?: ToolChoice;
344
+ readonly toolChoice?: ToolChoice
369
345
  /** Whether the model can call multiple tools in parallel. Defaults to true. */
370
- readonly parallelToolCalls?: boolean;
346
+ readonly parallelToolCalls?: boolean
371
347
  /** Output format constraint (text, JSON, JSON schema). */
372
- readonly responseFormat?: ResponseFormat;
348
+ readonly responseFormat?: ResponseFormat
373
349
  /** Streaming options (e.g., include_usage). */
374
- readonly streamOptions?: StreamOptions;
350
+ readonly streamOptions?: StreamOptions
375
351
  /** Random seed for reproducible outputs. Provider support varies. */
376
- readonly seed?: number;
352
+ readonly seed?: number
377
353
  /** Reasoning effort level (low, medium, high) for extended-thinking models. */
378
- readonly reasoningEffort?: ReasoningEffort;
354
+ readonly reasoningEffort?: ReasoningEffort
379
355
  /**
380
356
  * Provider-specific extra parameters merged into the request body.
381
357
  * Use for guardrails, safety settings, grounding config, etc.
382
358
  */
383
- readonly extraBody?: JsonValue;
359
+ readonly extraBody?: JsonValue
384
360
  }
385
361
 
386
362
  /** Chat completion response from the API. */
387
363
  export interface ChatCompletionResponse {
388
364
  /** Unique identifier for this response. */
389
- readonly id?: string;
365
+ readonly id?: string
390
366
  /**
391
367
  * Always `"chat.completion"` from OpenAI-compatible APIs. Stored as a
392
368
  * plain `String` so non-standard provider values do not break deserialization.
393
369
  */
394
- readonly object?: string;
370
+ readonly object?: string
395
371
  /** Unix timestamp of response creation. */
396
- readonly created?: number;
372
+ readonly created?: number
397
373
  /** Model used to generate the response. */
398
- readonly model?: string;
374
+ readonly model?: string
399
375
  /** List of completion choices. */
400
- readonly choices?: Array<Choice>;
376
+ readonly choices?: Array<Choice>
401
377
  /** Token usage statistics. */
402
- readonly usage?: Usage;
378
+ readonly usage?: Usage
403
379
  /** Fingerprint of the system configuration (OpenAI-specific). */
404
- readonly systemFingerprint?: string;
380
+ readonly systemFingerprint?: string
405
381
  /** Service tier used (OpenAI-specific). */
406
- readonly serviceTier?: string;
382
+ readonly serviceTier?: string
407
383
  }
408
384
 
409
385
  /** A tool the model can invoke (currently, all tools are functions). */
410
386
  export interface ChatCompletionTool {
411
387
  /** Tool type (always "function" in OpenAI spec). */
412
- readonly toolType: ToolType;
388
+ readonly toolType: ToolType
413
389
  /** Function definition with name, description, and JSON schema parameters. */
414
- readonly function: FunctionDefinition;
390
+ readonly function: FunctionDefinition
415
391
  }
416
392
 
417
393
  /** A single completion choice. */
418
394
  export interface Choice {
419
395
  /** Index of this choice in the choices array. */
420
- readonly index?: number;
396
+ readonly index?: number
421
397
  /** The assistant's message response. */
422
- readonly message?: AssistantMessage;
398
+ readonly message?: AssistantMessage
423
399
  /** Why the model stopped generating (stop, length, tool_calls, content_filter, etc.). */
424
- readonly finishReason?: FinishReason;
400
+ readonly finishReason?: FinishReason
425
401
  }
426
402
 
427
403
  /** A single content part in a user message — text, image, document, or audio. */
428
404
  export type ContentPart =
429
- | { type: "text"; text: string }
430
- | { type: "image_url"; imageUrl: ImageUrl }
431
- | { type: "document"; document: DocumentContent }
432
- | { type: "input_audio"; inputAudio: AudioContent };
405
+ | { type: 'text'; text: string }
406
+ | { type: 'image_url'; imageUrl: ImageUrl }
407
+ | { type: 'document'; document: DocumentContent }
408
+ | { type: 'input_audio'; inputAudio: AudioContent }
433
409
 
434
410
  /** Request to create a batch job. */
435
411
  export interface CreateBatchRequest {
436
412
  /** ID of the uploaded input file (JSONL format). */
437
- readonly inputFileId?: string;
413
+ readonly inputFileId?: string
438
414
  /** API endpoint (e.g., `"/v1/chat/completions"`). */
439
- readonly endpoint?: string;
415
+ readonly endpoint?: string
440
416
  /** Completion window (e.g., `"24h"`). */
441
- readonly completionWindow?: string;
417
+ readonly completionWindow?: string
442
418
  /** Optional metadata to attach to the batch. */
443
- readonly metadata?: JsonValue;
419
+ readonly metadata?: JsonValue
444
420
  }
445
421
 
446
422
  /** Request to upload a file. */
447
423
  export interface CreateFileRequest {
448
424
  /** Base64-encoded file data. */
449
- readonly file?: string;
425
+ readonly file?: string
450
426
  /** Purpose for the file. */
451
- readonly purpose?: FilePurpose;
427
+ readonly purpose?: FilePurpose
452
428
  /** Optional filename to associate with the upload. */
453
- readonly filename?: string;
429
+ readonly filename?: string
454
430
  }
455
431
 
456
432
  /** Request to create images from a text prompt. */
457
433
  export interface CreateImageRequest {
458
434
  /** Text description of the image to generate. */
459
- readonly prompt?: string;
435
+ readonly prompt?: string
460
436
  /** Model ID (e.g., `"dall-e-3"`). Optional; API may use default if unset. */
461
- readonly model?: string;
437
+ readonly model?: string
462
438
  /** Number of images to generate. Defaults to 1. */
463
- readonly n?: number;
439
+ readonly n?: number
464
440
  /** Image size (e.g., `"1024x1024"`, `"1792x1024"`). */
465
- readonly size?: string;
441
+ readonly size?: string
466
442
  /** Image quality: `"standard"` or `"hd"`. */
467
- readonly quality?: string;
443
+ readonly quality?: string
468
444
  /** Style: `"natural"` or `"vivid"` (DALL-E 3 only). */
469
- readonly style?: string;
445
+ readonly style?: string
470
446
  /** Response format: `"url"` or `"b64_json"`. */
471
- readonly responseFormat?: string;
447
+ readonly responseFormat?: string
472
448
  /** User identifier for request tracking. */
473
- readonly user?: string;
449
+ readonly user?: string
474
450
  }
475
451
 
476
452
  /** Request to create a structured response. */
477
453
  export interface CreateResponseRequest {
478
454
  /** Model ID. */
479
- readonly model?: string;
455
+ readonly model?: string
480
456
  /** Input data to process (e.g., a document to extract from). */
481
- readonly input?: JsonValue;
457
+ readonly input?: JsonValue
482
458
  /** Instructions for processing the input. */
483
- readonly instructions?: string;
459
+ readonly instructions?: string
484
460
  /** Available tools the model can use. */
485
- readonly tools?: Array<ResponseTool>;
461
+ readonly tools?: Array<ResponseTool>
486
462
  /** Sampling temperature in `[0.0, 2.0]`. Defaults to 1.0. */
487
- readonly temperature?: number;
463
+ readonly temperature?: number
488
464
  /** Maximum output tokens. */
489
- readonly maxOutputTokens?: number;
465
+ readonly maxOutputTokens?: number
490
466
  /** Optional metadata. */
491
- readonly metadata?: JsonValue;
467
+ readonly metadata?: JsonValue
492
468
  }
493
469
 
494
470
  /** Request to generate speech audio from text. */
495
471
  export interface CreateSpeechRequest {
496
472
  /** Model ID (e.g., `"tts-1"`, `"tts-1-hd"`). */
497
- readonly model?: string;
473
+ readonly model?: string
498
474
  /** Text to synthesize into speech. */
499
- readonly input?: string;
475
+ readonly input?: string
500
476
  /** Voice name (e.g., `"alloy"`, `"echo"`, `"fable"`, `"onyx"`, `"nova"`, `"shimmer"`). */
501
- readonly voice?: string;
477
+ readonly voice?: string
502
478
  /** Audio format (e.g., `"mp3"`, `"opus"`, `"aac"`, `"flac"`, `"wav"`, `"pcm"`). */
503
- readonly responseFormat?: string;
479
+ readonly responseFormat?: string
504
480
  /** Playback speed in `[0.25, 4.0]`. Defaults to 1.0. */
505
- readonly speed?: number;
481
+ readonly speed?: number
506
482
  }
507
483
 
508
484
  /** Request to transcribe audio into text. */
509
485
  export interface CreateTranscriptionRequest {
510
486
  /** Model ID (e.g., `"whisper-1"`). */
511
- readonly model?: string;
487
+ readonly model?: string
512
488
  /** Base64-encoded audio file data. */
513
- readonly file?: string;
489
+ readonly file?: string
514
490
  /** Language ISO-639-1 code (e.g., `"en"`, `"fr"`, `"de"`). Optional; model auto-detects. */
515
- readonly language?: string;
491
+ readonly language?: string
516
492
  /** Optional text to guide the model (improves accuracy for domain-specific terms). */
517
- readonly prompt?: string;
493
+ readonly prompt?: string
518
494
  /** Output format (e.g., `"json"`, `"text"`, `"vtt"`, `"srt"`, `"verbose_json"`). */
519
- readonly responseFormat?: string;
495
+ readonly responseFormat?: string
520
496
  /** Sampling temperature in `[0.0, 1.0]`. Higher increases variability. Defaults to 0. */
521
- readonly temperature?: number;
497
+ readonly temperature?: number
522
498
  }
523
499
 
524
500
  /** Configuration for registering a custom LLM provider at runtime. */
525
501
  export interface CustomProviderConfig {
526
502
  /** Unique name for this provider (e.g., "my-provider"). */
527
- readonly name: string;
503
+ readonly name: string
528
504
  /** Base URL for the provider's API (e.g., "https://api.my-provider.com/v1"). */
529
- readonly baseUrl: string;
505
+ readonly baseUrl: string
530
506
  /** Authentication header format. */
531
- readonly authHeader: AuthHeaderFormat;
507
+ readonly authHeader: AuthHeaderFormat
532
508
  /** Model name prefixes that route to this provider (e.g., `["my-"]`). */
533
- readonly modelPrefixes: Array<string>;
509
+ readonly modelPrefixes: Array<string>
534
510
  }
535
511
 
536
512
  /**
@@ -551,57 +527,55 @@ export interface CustomProviderConfig {
551
527
  * headers are cached at construction to avoid redundant encoding on every request.
552
528
  */
553
529
  export declare class DefaultClient {
554
- chat(req?: ChatCompletionRequest | undefined | null): Promise<ChatCompletionResponse>;
555
- chatStream(
556
- req?: ChatCompletionRequest | undefined | null,
557
- ): Promise<AsyncGenerator<ChatCompletionChunk, void, undefined>>;
558
- embed(req?: EmbeddingRequest | undefined | null): Promise<EmbeddingResponse>;
559
- listModels(): Promise<ModelsListResponse>;
560
- imageGenerate(req?: CreateImageRequest | undefined | null): Promise<ImagesResponse>;
561
- speech(req?: CreateSpeechRequest | undefined | null): Promise<Uint8Array>;
562
- transcribe(req?: CreateTranscriptionRequest | undefined | null): Promise<TranscriptionResponse>;
563
- moderate(req?: ModerationRequest | undefined | null): Promise<ModerationResponse>;
564
- rerank(req?: RerankRequest | undefined | null): Promise<RerankResponse>;
565
- search(req?: SearchRequest | undefined | null): Promise<SearchResponse>;
566
- ocr(req?: OcrRequest | undefined | null): Promise<OcrResponse>;
567
- createFile(req?: CreateFileRequest | undefined | null): Promise<FileObject>;
568
- retrieveFile(fileId: string): Promise<FileObject>;
569
- deleteFile(fileId: string): Promise<DeleteResponse>;
570
- listFiles(query?: FileListQuery | undefined | null): Promise<FileListResponse>;
571
- fileContent(fileId: string): Promise<Uint8Array>;
572
- createBatch(req?: CreateBatchRequest | undefined | null): Promise<BatchObject>;
573
- retrieveBatch(batchId: string): Promise<BatchObject>;
574
- listBatches(query?: BatchListQuery | undefined | null): Promise<BatchListResponse>;
575
- cancelBatch(batchId: string): Promise<BatchObject>;
576
- createResponse(req?: CreateResponseRequest | undefined | null): Promise<ResponseObject>;
577
- retrieveResponse(responseId: string): Promise<ResponseObject>;
578
- cancelResponse(responseId: string): Promise<ResponseObject>;
530
+ chat(req?: ChatCompletionRequest | undefined | null): Promise<ChatCompletionResponse>
531
+ chatStream(req?: ChatCompletionRequest | undefined | null): Promise<AsyncGenerator<ChatCompletionChunk, void, undefined>>
532
+ embed(req?: EmbeddingRequest | undefined | null): Promise<EmbeddingResponse>
533
+ listModels(): Promise<ModelsListResponse>
534
+ imageGenerate(req?: CreateImageRequest | undefined | null): Promise<ImagesResponse>
535
+ speech(req?: CreateSpeechRequest | undefined | null): Promise<Uint8Array>
536
+ transcribe(req?: CreateTranscriptionRequest | undefined | null): Promise<TranscriptionResponse>
537
+ moderate(req?: ModerationRequest | undefined | null): Promise<ModerationResponse>
538
+ rerank(req?: RerankRequest | undefined | null): Promise<RerankResponse>
539
+ search(req?: SearchRequest | undefined | null): Promise<SearchResponse>
540
+ ocr(req?: OcrRequest | undefined | null): Promise<OcrResponse>
541
+ createFile(req?: CreateFileRequest | undefined | null): Promise<FileObject>
542
+ retrieveFile(fileId: string): Promise<FileObject>
543
+ deleteFile(fileId: string): Promise<DeleteResponse>
544
+ listFiles(query?: FileListQuery | undefined | null): Promise<FileListResponse>
545
+ fileContent(fileId: string): Promise<Uint8Array>
546
+ createBatch(req?: CreateBatchRequest | undefined | null): Promise<BatchObject>
547
+ retrieveBatch(batchId: string): Promise<BatchObject>
548
+ listBatches(query?: BatchListQuery | undefined | null): Promise<BatchListResponse>
549
+ cancelBatch(batchId: string): Promise<BatchObject>
550
+ createResponse(req?: CreateResponseRequest | undefined | null): Promise<ResponseObject>
551
+ retrieveResponse(responseId: string): Promise<ResponseObject>
552
+ cancelResponse(responseId: string): Promise<ResponseObject>
579
553
  }
580
554
 
581
555
  /** Response from a delete operation. */
582
556
  export interface DeleteResponse {
583
557
  /** ID of the deleted resource. */
584
- readonly id?: string;
558
+ readonly id?: string
585
559
  /** Object type. */
586
- readonly object?: string;
560
+ readonly object?: string
587
561
  /** Confirmation that the resource was deleted. */
588
- readonly deleted?: boolean;
562
+ readonly deleted?: boolean
589
563
  }
590
564
 
591
565
  /** Developer message (system-like message for Claude models). */
592
566
  export interface DeveloperMessage {
593
567
  /** Developer-specific instructions or context. */
594
- readonly content?: string;
568
+ readonly content?: string
595
569
  /** Optional name for the developer message source. */
596
- readonly name?: string;
570
+ readonly name?: string
597
571
  }
598
572
 
599
573
  /** PDF/document content part for vision-capable models. */
600
574
  export interface DocumentContent {
601
575
  /** Base64-encoded document data or URL. */
602
- readonly data?: string;
576
+ readonly data?: string
603
577
  /** MIME type (e.g., "application/pdf", "text/csv"). */
604
- readonly mediaType?: string;
578
+ readonly mediaType?: string
605
579
  }
606
580
 
607
581
  /** The format in which the embedding vectors are returned. */
@@ -626,25 +600,25 @@ export interface EmbeddingObject {
626
600
  * Always `"embedding"` from OpenAI-compatible APIs. Stored as a plain
627
601
  * `String` so non-standard provider values do not break deserialization.
628
602
  */
629
- readonly object: string;
603
+ readonly object: string
630
604
  /** The embedding vector. */
631
- readonly embedding: Array<number>;
605
+ readonly embedding: Array<number>
632
606
  /** Index in the batch (corresponds to input order). */
633
- readonly index: number;
607
+ readonly index: number
634
608
  }
635
609
 
636
610
  /** Embedding request. */
637
611
  export interface EmbeddingRequest {
638
612
  /** Model ID (e.g., `"text-embedding-3-small"`). */
639
- readonly model?: string;
613
+ readonly model?: string
640
614
  /** Text or texts to embed. */
641
- readonly input?: EmbeddingInput;
615
+ readonly input?: EmbeddingInput
642
616
  /** Output format: float (native) or base64. */
643
- readonly encodingFormat?: EmbeddingFormat;
617
+ readonly encodingFormat?: EmbeddingFormat
644
618
  /** Requested embedding dimensions (if supported by the model). */
645
- readonly dimensions?: number;
619
+ readonly dimensions?: number
646
620
  /** User identifier for request tracking. */
647
- readonly user?: string;
621
+ readonly user?: string
648
622
  }
649
623
 
650
624
  /** Embedding response. */
@@ -653,13 +627,13 @@ export interface EmbeddingResponse {
653
627
  * Always `"list"` from OpenAI-compatible APIs. Stored as a plain
654
628
  * `String` so non-standard provider values do not break deserialization.
655
629
  */
656
- readonly object: string;
630
+ readonly object: string
657
631
  /** List of embeddings. */
658
- readonly data: Array<EmbeddingObject>;
632
+ readonly data: Array<EmbeddingObject>
659
633
  /** Model used to generate embeddings. */
660
- readonly model: string;
634
+ readonly model: string
661
635
  /** Token usage (input tokens only; embeddings have zero output tokens). */
662
- readonly usage?: Usage;
636
+ readonly usage?: Usage
663
637
  }
664
638
 
665
639
  /** How budget limits are enforced. */
@@ -679,39 +653,39 @@ export declare enum Enforcement {
679
653
  /** Query parameters for listing files. */
680
654
  export interface FileListQuery {
681
655
  /** Filter by file purpose (e.g., `"batch"`, `"fine-tune"`). */
682
- readonly purpose?: string;
656
+ readonly purpose?: string
683
657
  /** Maximum number of results to return. Defaults to 20. */
684
- readonly limit?: number;
658
+ readonly limit?: number
685
659
  /** Pagination cursor: return results after this file ID. */
686
- readonly after?: string;
660
+ readonly after?: string
687
661
  }
688
662
 
689
663
  /** Response from listing files. */
690
664
  export interface FileListResponse {
691
665
  /** Object type (always `"list"`). */
692
- readonly object?: string;
666
+ readonly object?: string
693
667
  /** List of file objects. */
694
- readonly data?: Array<FileObject>;
668
+ readonly data?: Array<FileObject>
695
669
  /** Whether more results are available. */
696
- readonly hasMore?: boolean;
670
+ readonly hasMore?: boolean
697
671
  }
698
672
 
699
673
  /** An uploaded file object. */
700
674
  export interface FileObject {
701
675
  /** Unique file ID. */
702
- readonly id?: string;
676
+ readonly id?: string
703
677
  /** Object type (always `"file"`). */
704
- readonly object?: string;
678
+ readonly object?: string
705
679
  /** File size in bytes. */
706
- readonly bytes?: number;
680
+ readonly bytes?: number
707
681
  /** Unix timestamp of file creation. */
708
- readonly createdAt?: number;
682
+ readonly createdAt?: number
709
683
  /** Filename. */
710
- readonly filename?: string;
684
+ readonly filename?: string
711
685
  /** File purpose. */
712
- readonly purpose?: string;
686
+ readonly purpose?: string
713
687
  /** Processing status (e.g., `"uploaded"`, `"processed"`). */
714
- readonly status?: string;
688
+ readonly status?: string
715
689
  }
716
690
 
717
691
  /** Purpose of an uploaded file. */
@@ -749,37 +723,37 @@ export declare enum FinishReason {
749
723
  /** Function call details. */
750
724
  export interface FunctionCall {
751
725
  /** Function name. */
752
- readonly name: string;
726
+ readonly name: string
753
727
  /** Arguments as a JSON string (parse with serde_json::from_str). */
754
- readonly arguments: string;
728
+ readonly arguments: string
755
729
  }
756
730
 
757
731
  /** Function definition exposed to the model. */
758
732
  export interface FunctionDefinition {
759
733
  /** Name of the function. Required and must be alphanumeric + underscores. */
760
- readonly name: string;
734
+ readonly name: string
761
735
  /** Human-readable description explaining what the function does. */
762
- readonly description?: string;
736
+ readonly description?: string
763
737
  /** JSON Schema defining the function's parameters. */
764
- readonly parameters?: JsonValue;
738
+ readonly parameters?: JsonValue
765
739
  /** If true, enforce strict JSON schema validation for arguments. */
766
- readonly strict?: boolean;
740
+ readonly strict?: boolean
767
741
  }
768
742
 
769
743
  /** Deprecated legacy function-role message body. */
770
744
  export interface FunctionMessage {
771
- readonly content?: string;
772
- readonly name?: string;
745
+ readonly content?: string
746
+ readonly name?: string
773
747
  }
774
748
 
775
749
  /** A single generated image, returned as either a URL or base64 data. */
776
750
  export interface Image {
777
751
  /** Image URL (if response_format was "url"). */
778
- readonly url?: string;
752
+ readonly url?: string
779
753
  /** Base64-encoded image data (if response_format was "b64_json"). */
780
- readonly b64Json?: string;
754
+ readonly b64Json?: string
781
755
  /** The final prompt used to generate the image (DALL-E 3). */
782
- readonly revisedPrompt?: string;
756
+ readonly revisedPrompt?: string
783
757
  }
784
758
 
785
759
  /** Image detail level controlling token cost and processing. */
@@ -795,53 +769,53 @@ export declare enum ImageDetail {
795
769
  /** Response containing generated images. */
796
770
  export interface ImagesResponse {
797
771
  /** Unix timestamp of image creation. */
798
- readonly created?: number;
772
+ readonly created?: number
799
773
  /** List of generated images. */
800
- readonly data?: Array<Image>;
774
+ readonly data?: Array<Image>
801
775
  }
802
776
 
803
777
  /** An image URL reference with optional detail level for processing. */
804
778
  export interface ImageUrl {
805
779
  /** URL of the image (data URI or HTTP/HTTPS URL). */
806
- readonly url?: string;
780
+ readonly url?: string
807
781
  /** Detail level: low (512x512), high (2x2 tiles), or auto (model-selected). */
808
- readonly detail?: ImageDetail;
782
+ readonly detail?: ImageDetail
809
783
  }
810
784
 
811
785
  /** JSON Schema specification for constrained output. */
812
786
  export interface JsonSchemaFormat {
813
787
  /** Name of the schema (must be unique in the request). */
814
- readonly name?: string;
788
+ readonly name?: string
815
789
  /** Description of what the schema represents. */
816
- readonly description?: string;
790
+ readonly description?: string
817
791
  /** JSON Schema object defining the output structure. */
818
- readonly schema?: JsonValue;
792
+ readonly schema?: JsonValue
819
793
  /** If true, enforce strict schema validation. */
820
- readonly strict?: boolean;
794
+ readonly strict?: boolean
821
795
  }
822
796
 
823
797
  /** A chat message in a conversation. */
824
798
  export type Message =
825
- | { role: "system"; 0: SystemMessage }
826
- | { role: "user"; 0: UserMessage }
827
- | { role: "assistant"; 0: AssistantMessage }
828
- | { role: "tool"; 0: ToolMessage }
829
- | { role: "developer"; 0: DeveloperMessage }
830
- | { role: "function"; 0: FunctionMessage };
799
+ | { role: 'system'; 0: SystemMessage }
800
+ | { role: 'user'; 0: UserMessage }
801
+ | { role: 'assistant'; 0: AssistantMessage }
802
+ | { role: 'tool'; 0: ToolMessage }
803
+ | { role: 'developer'; 0: DeveloperMessage }
804
+ | { role: 'function'; 0: FunctionMessage }
831
805
 
832
806
  /** A model available from the API. */
833
807
  export interface ModelObject {
834
808
  /** Model ID (e.g., `"gpt-4o"`, `"claude-3-5-sonnet"`). */
835
- readonly id?: string;
809
+ readonly id?: string
836
810
  /**
837
811
  * Always `"model"` from OpenAI-compatible APIs. Stored as a plain
838
812
  * `String` so non-standard provider values do not break deserialization.
839
813
  */
840
- readonly object?: string;
814
+ readonly object?: string
841
815
  /** Unix timestamp of model creation (or release date). */
842
- readonly created?: number;
816
+ readonly created?: number
843
817
  /** Organization or entity that owns the model. */
844
- readonly ownedBy?: string;
818
+ readonly ownedBy?: string
845
819
  }
846
820
 
847
821
  /** Response listing available models. */
@@ -850,61 +824,61 @@ export interface ModelsListResponse {
850
824
  * Always `"list"` from OpenAI-compatible APIs. Stored as a plain
851
825
  * `String` so non-standard provider values do not break deserialization.
852
826
  */
853
- readonly object?: string;
827
+ readonly object?: string
854
828
  /** List of available models. */
855
- readonly data?: Array<ModelObject>;
829
+ readonly data?: Array<ModelObject>
856
830
  }
857
831
 
858
832
  /** Boolean flags for each moderation category. */
859
833
  export interface ModerationCategories {
860
834
  /** Sexual content. */
861
- readonly sexual?: boolean;
835
+ readonly sexual?: boolean
862
836
  /** Hate speech. */
863
- readonly hate?: boolean;
837
+ readonly hate?: boolean
864
838
  /** Harassment. */
865
- readonly harassment?: boolean;
839
+ readonly harassment?: boolean
866
840
  /** Self-harm content. */
867
- readonly selfHarm?: boolean;
841
+ readonly selfHarm?: boolean
868
842
  /** Sexual content involving minors. */
869
- readonly sexualMinors?: boolean;
843
+ readonly sexualMinors?: boolean
870
844
  /** Hate speech that threatens violence. */
871
- readonly hateThreatening?: boolean;
845
+ readonly hateThreatening?: boolean
872
846
  /** Graphic violence. */
873
- readonly violenceGraphic?: boolean;
847
+ readonly violenceGraphic?: boolean
874
848
  /** Intent to self-harm. */
875
- readonly selfHarmIntent?: boolean;
849
+ readonly selfHarmIntent?: boolean
876
850
  /** Instructions for self-harm. */
877
- readonly selfHarmInstructions?: boolean;
851
+ readonly selfHarmInstructions?: boolean
878
852
  /** Harassment that threatens violence. */
879
- readonly harassmentThreatening?: boolean;
853
+ readonly harassmentThreatening?: boolean
880
854
  /** Non-graphic violence. */
881
- readonly violence?: boolean;
855
+ readonly violence?: boolean
882
856
  }
883
857
 
884
858
  /** Confidence scores for each moderation category. */
885
859
  export interface ModerationCategoryScores {
886
860
  /** Sexual content score. */
887
- readonly sexual?: number;
861
+ readonly sexual?: number
888
862
  /** Hate speech score. */
889
- readonly hate?: number;
863
+ readonly hate?: number
890
864
  /** Harassment score. */
891
- readonly harassment?: number;
865
+ readonly harassment?: number
892
866
  /** Self-harm content score. */
893
- readonly selfHarm?: number;
867
+ readonly selfHarm?: number
894
868
  /** Sexual content involving minors score. */
895
- readonly sexualMinors?: number;
869
+ readonly sexualMinors?: number
896
870
  /** Hate speech that threatens violence score. */
897
- readonly hateThreatening?: number;
871
+ readonly hateThreatening?: number
898
872
  /** Graphic violence score. */
899
- readonly violenceGraphic?: number;
873
+ readonly violenceGraphic?: number
900
874
  /** Intent to self-harm score. */
901
- readonly selfHarmIntent?: number;
875
+ readonly selfHarmIntent?: number
902
876
  /** Instructions for self-harm score. */
903
- readonly selfHarmInstructions?: number;
877
+ readonly selfHarmInstructions?: number
904
878
  /** Harassment that threatens violence score. */
905
- readonly harassmentThreatening?: number;
879
+ readonly harassmentThreatening?: number
906
880
  /** Non-graphic violence score. */
907
- readonly violence?: number;
881
+ readonly violence?: number
908
882
  }
909
883
 
910
884
  /** Input to the moderation endpoint — a single string or multiple strings. */
@@ -918,84 +892,84 @@ export declare enum ModerationInput {
918
892
  /** Request to classify content for policy violations. */
919
893
  export interface ModerationRequest {
920
894
  /** Text or texts to check. */
921
- readonly input?: ModerationInput;
895
+ readonly input?: ModerationInput
922
896
  /** Model ID (e.g., `"text-moderation-latest"`). Optional; API uses default if unset. */
923
- readonly model?: string;
897
+ readonly model?: string
924
898
  }
925
899
 
926
900
  /** Response from the moderation endpoint. */
927
901
  export interface ModerationResponse {
928
902
  /** Unique identifier for this moderation request. */
929
- readonly id: string;
903
+ readonly id: string
930
904
  /** Model used for classification. */
931
- readonly model: string;
905
+ readonly model: string
932
906
  /** Results for each input string. */
933
- readonly results: Array<ModerationResult>;
907
+ readonly results: Array<ModerationResult>
934
908
  }
935
909
 
936
910
  /** A single moderation classification result. */
937
911
  export interface ModerationResult {
938
912
  /** True if any category was flagged. */
939
- readonly flagged: boolean;
913
+ readonly flagged: boolean
940
914
  /** Boolean flags for each moderation category. */
941
- readonly categories: ModerationCategories;
915
+ readonly categories: ModerationCategories
942
916
  /** Confidence scores for each category. */
943
- readonly categoryScores: ModerationCategoryScores;
917
+ readonly categoryScores: ModerationCategoryScores
944
918
  }
945
919
 
946
920
  /** Document input for OCR — either a URL or inline base64 data. */
947
921
  export type OcrDocument =
948
- | { type: "document_url"; url: string }
949
- | { type: "base64"; data: string; mediaType: string };
922
+ | { type: 'document_url'; url: string }
923
+ | { type: 'base64'; data: string; mediaType: string }
950
924
 
951
925
  /** An image extracted from an OCR page. */
952
926
  export interface OcrImage {
953
927
  /** Unique image identifier within the document. */
954
- readonly id: string;
928
+ readonly id: string
955
929
  /** Base64-encoded image data (if `include_image_base64` was true). */
956
- readonly imageBase64?: string;
930
+ readonly imageBase64?: string
957
931
  }
958
932
 
959
933
  /** A single page of OCR output. */
960
934
  export interface OcrPage {
961
935
  /** Page index (0-based). */
962
- readonly index: number;
936
+ readonly index: number
963
937
  /** Extracted page content as Markdown. */
964
- readonly markdown: string;
938
+ readonly markdown: string
965
939
  /** Embedded images extracted from the page (if `include_image_base64` was true). */
966
- readonly images?: Array<OcrImage>;
940
+ readonly images?: Array<OcrImage>
967
941
  /** Page dimensions in pixels, if available. */
968
- readonly dimensions?: PageDimensions;
942
+ readonly dimensions?: PageDimensions
969
943
  }
970
944
 
971
945
  /** An OCR request. */
972
946
  export interface OcrRequest {
973
947
  /** The model/provider to use (e.g. `"mistral/mistral-ocr-latest"`). */
974
- readonly model?: string;
948
+ readonly model?: string
975
949
  /** The document to process (URL or base64). */
976
- readonly document?: OcrDocument;
950
+ readonly document?: OcrDocument
977
951
  /** Specific pages to process (1-indexed). `None` means all pages. */
978
- readonly pages?: Array<number>;
952
+ readonly pages?: Array<number>
979
953
  /** Whether to include base64-encoded images of each processed page. */
980
- readonly includeImageBase64?: boolean;
954
+ readonly includeImageBase64?: boolean
981
955
  }
982
956
 
983
957
  /** An OCR response. */
984
958
  export interface OcrResponse {
985
959
  /** Extracted pages in order. */
986
- readonly pages: Array<OcrPage>;
960
+ readonly pages: Array<OcrPage>
987
961
  /** Model/provider used for OCR. */
988
- readonly model: string;
962
+ readonly model: string
989
963
  /** Token usage, if reported by the provider. */
990
- readonly usage?: Usage;
964
+ readonly usage?: Usage
991
965
  }
992
966
 
993
967
  /** Page dimensions in pixels. */
994
968
  export interface PageDimensions {
995
969
  /** Width in pixels. */
996
- readonly width: number;
970
+ readonly width: number
997
971
  /** Height in pixels. */
998
- readonly height: number;
972
+ readonly height: number
999
973
  }
1000
974
 
1001
975
  /**
@@ -1008,25 +982,25 @@ export interface PageDimensions {
1008
982
  */
1009
983
  export interface PromptTokensDetails {
1010
984
  /** Cached tokens present in the prompt. Defaults to 0 when absent. */
1011
- readonly cachedTokens?: number;
985
+ readonly cachedTokens?: number
1012
986
  /** Audio input tokens present in the prompt. Defaults to 0 when absent. */
1013
- readonly audioTokens?: number;
987
+ readonly audioTokens?: number
1014
988
  }
1015
989
 
1016
990
  /** Static configuration for a single provider entry in providers.json. */
1017
991
  export interface ProviderConfig {
1018
992
  /** Provider identifier (matches the entry key in providers.json). */
1019
- readonly name: string;
993
+ readonly name: string
1020
994
  /** Human-readable provider name shown in UIs. */
1021
- readonly displayName?: string;
995
+ readonly displayName?: string
1022
996
  /** Base URL used as the default for this provider's HTTP client. */
1023
- readonly baseUrl?: string;
997
+ readonly baseUrl?: string
1024
998
  /** Authentication scheme metadata (auth type + env var holding the key). */
1025
- readonly auth?: AuthConfig;
999
+ readonly auth?: AuthConfig
1026
1000
  /** Supported endpoint kinds (e.g. `chat`, `embeddings`). */
1027
- readonly endpoints?: Array<string>;
1001
+ readonly endpoints?: Array<string>
1028
1002
  /** Model-name prefixes claimed by this provider (e.g. `["gpt-", "o1-"]`). */
1029
- readonly modelPrefixes?: Array<string>;
1003
+ readonly modelPrefixes?: Array<string>
1030
1004
  /**
1031
1005
  * Parameter key renaming for this provider.
1032
1006
  *
@@ -1034,17 +1008,17 @@ export interface ProviderConfig {
1034
1008
  * to the name this provider expects (e.g. `"max_tokens"`). Applied
1035
1009
  * automatically by [`ConfigDrivenProvider::transform_request`].
1036
1010
  */
1037
- readonly paramMappings?: Record<string, string>;
1011
+ readonly paramMappings?: Record<string, string>
1038
1012
  }
1039
1013
 
1040
1014
  /** Configuration for per-model rate limits. */
1041
1015
  export interface RateLimitConfig {
1042
1016
  /** Maximum requests per window. `None` means unlimited. */
1043
- readonly rpm?: number;
1017
+ readonly rpm?: number
1044
1018
  /** Maximum tokens per window. `None` means unlimited. */
1045
- readonly tpm?: number;
1019
+ readonly tpm?: number
1046
1020
  /** Fixed window duration (defaults to 60 s). */
1047
- readonly window?: number;
1021
+ readonly window?: number
1048
1022
  }
1049
1023
 
1050
1024
  /** Controls how much reasoning effort the model should use. */
@@ -1065,141 +1039,141 @@ export declare enum RerankDocument {
1065
1039
  /** Request to rerank documents by relevance to a query. */
1066
1040
  export interface RerankRequest {
1067
1041
  /** Model ID (e.g., `"cohere/rerank-english-v3.0"`). */
1068
- readonly model?: string;
1042
+ readonly model?: string
1069
1043
  /** The search query. */
1070
- readonly query?: string;
1044
+ readonly query?: string
1071
1045
  /** Documents to rerank. */
1072
- readonly documents?: Array<RerankDocument>;
1046
+ readonly documents?: Array<RerankDocument>
1073
1047
  /** Return only the top N results. Optional. */
1074
- readonly topN?: number;
1048
+ readonly topN?: number
1075
1049
  /** Include the document content in results. Defaults to false. */
1076
- readonly returnDocuments?: boolean;
1050
+ readonly returnDocuments?: boolean
1077
1051
  }
1078
1052
 
1079
1053
  /** Response from the rerank endpoint. */
1080
1054
  export interface RerankResponse {
1081
1055
  /** Unique identifier for this rerank request. */
1082
- readonly id?: string;
1056
+ readonly id?: string
1083
1057
  /** Reranked documents in order of relevance. */
1084
- readonly results: Array<RerankResult>;
1058
+ readonly results: Array<RerankResult>
1085
1059
  /** Optional metadata about the reranking operation. */
1086
- readonly meta?: JsonValue;
1060
+ readonly meta?: JsonValue
1087
1061
  }
1088
1062
 
1089
1063
  /** A single reranked document with its relevance score. */
1090
1064
  export interface RerankResult {
1091
1065
  /** Original document index in the input list. */
1092
- readonly index: number;
1066
+ readonly index: number
1093
1067
  /** Relevance score in `[0, 1]`. Higher indicates more relevant. */
1094
- readonly relevanceScore: number;
1068
+ readonly relevanceScore: number
1095
1069
  /** Original document content (if `return_documents` was true). */
1096
- readonly document?: RerankResultDocument;
1070
+ readonly document?: RerankResultDocument
1097
1071
  }
1098
1072
 
1099
1073
  /** The text content of a reranked document, returned when `return_documents` is true. */
1100
1074
  export interface RerankResultDocument {
1101
1075
  /** Document text. */
1102
- readonly text: string;
1076
+ readonly text: string
1103
1077
  }
1104
1078
 
1105
1079
  /** Response format constraint. */
1106
1080
  export type ResponseFormat =
1107
- | { type: "text" }
1108
- | { type: "json_object" }
1109
- | { type: "json_schema"; jsonSchema: JsonSchemaFormat };
1081
+ | { type: 'text' }
1082
+ | { type: 'json_object' }
1083
+ | { type: 'json_schema'; jsonSchema: JsonSchemaFormat }
1110
1084
 
1111
1085
  /** Response from a structured response request. */
1112
1086
  export interface ResponseObject {
1113
1087
  /** Unique response ID. */
1114
- readonly id?: string;
1088
+ readonly id?: string
1115
1089
  /** Object type (e.g., `"response"`). */
1116
- readonly object?: string;
1090
+ readonly object?: string
1117
1091
  /** Unix timestamp of response creation. */
1118
- readonly createdAt?: number;
1092
+ readonly createdAt?: number
1119
1093
  /** Model used to generate the response. */
1120
- readonly model?: string;
1094
+ readonly model?: string
1121
1095
  /** Status (e.g., `"succeeded"`, `"failed"`). */
1122
- readonly status?: string;
1096
+ readonly status?: string
1123
1097
  /** Output items from the response. */
1124
- readonly output?: Array<ResponseOutputItem>;
1098
+ readonly output?: Array<ResponseOutputItem>
1125
1099
  /** Token usage. */
1126
- readonly usage?: ResponseUsage;
1100
+ readonly usage?: ResponseUsage
1127
1101
  /** Error details (if status is "failed"). */
1128
- readonly error?: JsonValue;
1102
+ readonly error?: JsonValue
1129
1103
  }
1130
1104
 
1131
1105
  /** A single output item from the response. */
1132
1106
  export interface ResponseOutputItem {
1133
1107
  /** Output type (e.g., `"text"`, `"object"`, `"error"`). */
1134
- readonly itemType?: string;
1108
+ readonly itemType?: string
1135
1109
  /** Output content (flattened into the object). */
1136
- readonly content?: JsonValue;
1110
+ readonly content?: JsonValue
1137
1111
  }
1138
1112
 
1139
1113
  /** A tool available for the response request. */
1140
1114
  export interface ResponseTool {
1141
1115
  /** Tool type (e.g., "extractor", "search"). */
1142
- readonly toolType?: string;
1116
+ readonly toolType?: string
1143
1117
  /** Tool configuration (flattened into the object). */
1144
- readonly config?: JsonValue;
1118
+ readonly config?: JsonValue
1145
1119
  }
1146
1120
 
1147
1121
  /** Token usage for a response. */
1148
1122
  export interface ResponseUsage {
1149
1123
  /** Input tokens used. */
1150
- readonly inputTokens?: number;
1124
+ readonly inputTokens?: number
1151
1125
  /** Output tokens used. */
1152
- readonly outputTokens?: number;
1126
+ readonly outputTokens?: number
1153
1127
  /** Total tokens used. */
1154
- readonly totalTokens?: number;
1128
+ readonly totalTokens?: number
1155
1129
  }
1156
1130
 
1157
1131
  /** A search request. */
1158
1132
  export interface SearchRequest {
1159
1133
  /** The model/provider to use (e.g. `"brave/web-search"`, `"tavily/search"`). */
1160
- readonly model?: string;
1134
+ readonly model?: string
1161
1135
  /** The search query string. */
1162
- readonly query?: string;
1136
+ readonly query?: string
1163
1137
  /** Maximum number of results to return. */
1164
- readonly maxResults?: number;
1138
+ readonly maxResults?: number
1165
1139
  /** Domain filter — restrict results to specific domains. */
1166
- readonly searchDomainFilter?: Array<string>;
1140
+ readonly searchDomainFilter?: Array<string>
1167
1141
  /** Country code for localized results (ISO 3166-1 alpha-2, e.g., `"US"`, `"FR"`). */
1168
- readonly country?: string;
1142
+ readonly country?: string
1169
1143
  }
1170
1144
 
1171
1145
  /** A search response. */
1172
1146
  export interface SearchResponse {
1173
1147
  /** List of search results. */
1174
- readonly results: Array<SearchResult>;
1148
+ readonly results: Array<SearchResult>
1175
1149
  /** Model/provider that performed the search. */
1176
- readonly model: string;
1150
+ readonly model: string
1177
1151
  }
1178
1152
 
1179
1153
  /** An individual search result. */
1180
1154
  export interface SearchResult {
1181
1155
  /** Result title. */
1182
- readonly title: string;
1156
+ readonly title: string
1183
1157
  /** Result URL. */
1184
- readonly url: string;
1158
+ readonly url: string
1185
1159
  /** Text snippet or excerpt from the page. */
1186
- readonly snippet: string;
1160
+ readonly snippet: string
1187
1161
  /** Publication or last-updated date, if available. */
1188
- readonly date?: string;
1162
+ readonly date?: string
1189
1163
  }
1190
1164
 
1191
1165
  /** Name of the specific function to invoke. */
1192
1166
  export interface SpecificFunction {
1193
1167
  /** Function name. */
1194
- readonly name?: string;
1168
+ readonly name?: string
1195
1169
  }
1196
1170
 
1197
1171
  /** Directive to call a specific tool. */
1198
1172
  export interface SpecificToolChoice {
1199
1173
  /** Tool type (always "function"). */
1200
- readonly choiceType?: ToolType;
1174
+ readonly choiceType?: ToolType
1201
1175
  /** The specific function to invoke. */
1202
- readonly function?: SpecificFunction;
1176
+ readonly function?: SpecificFunction
1203
1177
  }
1204
1178
 
1205
1179
  /** Stop sequence(s) that cause the model to stop generating. */
@@ -1213,69 +1187,69 @@ export declare enum StopSequence {
1213
1187
  /** A streaming choice with incremental delta. */
1214
1188
  export interface StreamChoice {
1215
1189
  /** Index of this choice in the choices array. */
1216
- readonly index?: number;
1190
+ readonly index?: number
1217
1191
  /** Incremental update to the message (content, tool calls, etc.). */
1218
- readonly delta?: StreamDelta;
1192
+ readonly delta?: StreamDelta
1219
1193
  /** Why the stream ended (present only in final chunk). */
1220
- readonly finishReason?: FinishReason;
1194
+ readonly finishReason?: FinishReason
1221
1195
  }
1222
1196
 
1223
1197
  /** Incremental delta in a stream chunk. */
1224
1198
  export interface StreamDelta {
1225
1199
  /** Role (typically present only in the first chunk). */
1226
- readonly role?: string;
1200
+ readonly role?: string
1227
1201
  /** Partial content chunk (e.g., a few words of the response). */
1228
- readonly content?: string;
1202
+ readonly content?: string
1229
1203
  /** Partial tool calls being streamed. */
1230
- readonly toolCalls?: Array<StreamToolCall>;
1204
+ readonly toolCalls?: Array<StreamToolCall>
1231
1205
  /** Deprecated legacy function_call delta; retained for API compatibility. */
1232
- readonly functionCall?: StreamFunctionCall;
1206
+ readonly functionCall?: StreamFunctionCall
1233
1207
  /** Partial refusal message. */
1234
- readonly refusal?: string;
1208
+ readonly refusal?: string
1235
1209
  }
1236
1210
 
1237
1211
  /** Partial function call details in a stream. */
1238
1212
  export interface StreamFunctionCall {
1239
1213
  /** Function name (typically in the first chunk). */
1240
- readonly name?: string;
1214
+ readonly name?: string
1241
1215
  /** Partial JSON arguments chunk. */
1242
- readonly arguments?: string;
1216
+ readonly arguments?: string
1243
1217
  }
1244
1218
 
1245
1219
  /** Options for streaming responses. */
1246
1220
  export interface StreamOptions {
1247
1221
  /** If true, include token usage in the final stream chunk. */
1248
- readonly includeUsage?: boolean;
1222
+ readonly includeUsage?: boolean
1249
1223
  }
1250
1224
 
1251
1225
  /** A streaming tool call being built incrementally. */
1252
1226
  export interface StreamToolCall {
1253
1227
  /** Index of this tool call in the tool_calls array. */
1254
- readonly index?: number;
1228
+ readonly index?: number
1255
1229
  /** Tool call ID (typically in the first chunk for this call). */
1256
- readonly id?: string;
1230
+ readonly id?: string
1257
1231
  /** Tool type (typically "function"). */
1258
- readonly callType?: ToolType;
1232
+ readonly callType?: ToolType
1259
1233
  /** Partial function name and arguments. */
1260
- readonly function?: StreamFunctionCall;
1234
+ readonly function?: StreamFunctionCall
1261
1235
  }
1262
1236
 
1263
1237
  /** System message guiding model behavior for the entire conversation. */
1264
1238
  export interface SystemMessage {
1265
1239
  /** Instructions or context that apply throughout the conversation. */
1266
- readonly content?: string;
1240
+ readonly content?: string
1267
1241
  /** Optional name for the system message source. */
1268
- readonly name?: string;
1242
+ readonly name?: string
1269
1243
  }
1270
1244
 
1271
1245
  /** A tool call the model wants to execute. */
1272
1246
  export interface ToolCall {
1273
1247
  /** Unique ID for this call, used to reference in tool result messages. */
1274
- readonly id: string;
1248
+ readonly id: string
1275
1249
  /** Tool type (always "function"). */
1276
- readonly callType: ToolType;
1250
+ readonly callType: ToolType
1277
1251
  /** Function name and arguments. */
1278
- readonly function: FunctionCall;
1252
+ readonly function: FunctionCall
1279
1253
  }
1280
1254
 
1281
1255
  /** Tool usage mode or a specific tool to call. */
@@ -1299,11 +1273,11 @@ export declare enum ToolChoiceMode {
1299
1273
  /** Tool execution result returned to the model. */
1300
1274
  export interface ToolMessage {
1301
1275
  /** Result of the tool execution. */
1302
- readonly content?: string;
1276
+ readonly content?: string
1303
1277
  /** ID of the tool call this result responds to. */
1304
- readonly toolCallId?: string;
1278
+ readonly toolCallId?: string
1305
1279
  /** Optional tool/function name. */
1306
- readonly name?: string;
1280
+ readonly name?: string
1307
1281
  }
1308
1282
 
1309
1283
  /**
@@ -1320,41 +1294,41 @@ export declare enum ToolType {
1320
1294
  /** Response from a transcription request. */
1321
1295
  export interface TranscriptionResponse {
1322
1296
  /** The transcribed text. */
1323
- readonly text?: string;
1297
+ readonly text?: string
1324
1298
  /** Detected language (ISO-639-1 code). */
1325
- readonly language?: string;
1299
+ readonly language?: string
1326
1300
  /** Total audio duration in seconds. */
1327
- readonly duration?: number;
1301
+ readonly duration?: number
1328
1302
  /** Detailed segment-level transcription (if response_format is "verbose_json"). */
1329
- readonly segments?: Array<TranscriptionSegment>;
1303
+ readonly segments?: Array<TranscriptionSegment>
1330
1304
  }
1331
1305
 
1332
1306
  /** A segment of transcribed audio with timing information. */
1333
1307
  export interface TranscriptionSegment {
1334
1308
  /** Segment index (0-based). */
1335
- readonly id?: number;
1309
+ readonly id?: number
1336
1310
  /** Start time in seconds. */
1337
- readonly start?: number;
1311
+ readonly start?: number
1338
1312
  /** End time in seconds. */
1339
- readonly end?: number;
1313
+ readonly end?: number
1340
1314
  /** Transcribed text for this segment. */
1341
- readonly text?: string;
1315
+ readonly text?: string
1342
1316
  }
1343
1317
 
1344
1318
  /** Token-usage accounting returned by the provider on each completion / embedding call. */
1345
1319
  export interface Usage {
1346
1320
  /** Prompt tokens used. Defaults to 0 when absent (some providers omit this). */
1347
- readonly promptTokens?: number;
1321
+ readonly promptTokens?: number
1348
1322
  /** Completion tokens used. Defaults to 0 when absent (e.g. embedding responses). */
1349
- readonly completionTokens?: number;
1323
+ readonly completionTokens?: number
1350
1324
  /** Total tokens used. Defaults to 0 when absent (some providers omit this). */
1351
- readonly totalTokens?: number;
1325
+ readonly totalTokens?: number
1352
1326
  /**
1353
1327
  * Breakdown of tokens used in the prompt, including cached tokens served
1354
1328
  * at the provider's discounted cache-read rate. Absent when the provider
1355
1329
  * does not return prompt-token details.
1356
1330
  */
1357
- readonly promptTokensDetails?: PromptTokensDetails;
1331
+ readonly promptTokensDetails?: PromptTokensDetails
1358
1332
  }
1359
1333
 
1360
1334
  /** User message content as either plain text or a list of multimodal parts. */
@@ -1368,9 +1342,9 @@ export declare enum UserContent {
1368
1342
  /** User message in the conversation. */
1369
1343
  export interface UserMessage {
1370
1344
  /** Message content as plain text or array of content parts (text, images, documents, audio). */
1371
- readonly content?: UserContent;
1345
+ readonly content?: UserContent
1372
1346
  /** Optional name for the user. */
1373
- readonly name?: string;
1347
+ readonly name?: string
1374
1348
  }
1375
1349
 
1376
1350
  /**
@@ -1393,12 +1367,12 @@ export declare function registerCustomProvider(config: CustomProviderConfig): vo
1393
1367
  export declare function unregisterCustomProvider(name: string): boolean;
1394
1368
 
1395
1369
  export declare class ChatStreamIterator {
1396
- next(value?: undefined): Promise<IteratorResult<ChatCompletionChunk, void>>;
1397
- [Symbol.asyncIterator](): AsyncGenerator<ChatCompletionChunk, void, undefined>;
1370
+ next(value?: undefined): Promise<IteratorResult<ChatCompletionChunk, void>>
1371
+ [Symbol.asyncIterator](): AsyncGenerator<ChatCompletionChunk, void, undefined>
1398
1372
  }
1399
1373
 
1400
1374
  export declare class LiterLlmErrorInfo {
1401
- statusCode(): number;
1402
- isTransient(): boolean;
1403
- errorType(): string;
1375
+ statusCode(): number
1376
+ isTransient(): boolean
1377
+ errorType(): string
1404
1378
  }