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