sentinelayer-cli 0.27.0 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/ai/client.js +29 -2
- package/src/billing/ledger-entry.js +3 -0
package/package.json
CHANGED
package/src/ai/client.js
CHANGED
|
@@ -413,10 +413,18 @@ export class MultiProviderApiClient {
|
|
|
413
413
|
* prompt?: string,
|
|
414
414
|
* stream?: boolean,
|
|
415
415
|
* apiKey?: string,
|
|
416
|
+
* apiUrl?: string,
|
|
416
417
|
* env?: NodeJS.ProcessEnv,
|
|
417
|
-
* onChunk?: (chunk: string) => void
|
|
418
|
+
* onChunk?: (chunk: string) => void,
|
|
419
|
+
* sessionId?: string,
|
|
420
|
+
* agentId?: string,
|
|
421
|
+
* action?: string,
|
|
422
|
+
* usageIdempotencyKey?: string,
|
|
423
|
+
* billingTier?: string,
|
|
424
|
+
* customerPricingPolicy?: string,
|
|
425
|
+
* metadata?: object
|
|
418
426
|
* }} [options]
|
|
419
|
-
* @returns {Promise<{ provider: string, model: string, text: string }>}
|
|
427
|
+
* @returns {Promise<{ provider: string, model: string, text: string, usage?: object, usageLedger?: object | null }>}
|
|
420
428
|
*/
|
|
421
429
|
async invoke({
|
|
422
430
|
provider,
|
|
@@ -424,8 +432,16 @@ export class MultiProviderApiClient {
|
|
|
424
432
|
prompt,
|
|
425
433
|
stream = false,
|
|
426
434
|
apiKey,
|
|
435
|
+
apiUrl = "",
|
|
427
436
|
env = process.env,
|
|
428
437
|
onChunk,
|
|
438
|
+
sessionId = "",
|
|
439
|
+
agentId = "",
|
|
440
|
+
action = "",
|
|
441
|
+
usageIdempotencyKey = "",
|
|
442
|
+
billingTier = "",
|
|
443
|
+
customerPricingPolicy = "",
|
|
444
|
+
metadata = null,
|
|
429
445
|
} = {}) {
|
|
430
446
|
const resolvedProvider = resolveProvider({ provider, env });
|
|
431
447
|
const resolvedModel = resolveModel({ provider: resolvedProvider, model });
|
|
@@ -437,10 +453,21 @@ export class MultiProviderApiClient {
|
|
|
437
453
|
systemPrompt: "",
|
|
438
454
|
model: resolvedModel,
|
|
439
455
|
maxTokens: 4096,
|
|
456
|
+
apiUrl,
|
|
457
|
+
token: apiKey,
|
|
458
|
+
sessionId,
|
|
459
|
+
agentId,
|
|
460
|
+
action,
|
|
461
|
+
usageIdempotencyKey,
|
|
462
|
+
billingTier,
|
|
463
|
+
customerPricingPolicy,
|
|
464
|
+
metadata,
|
|
465
|
+
fetchImpl: this.fetchImpl,
|
|
440
466
|
});
|
|
441
467
|
return {
|
|
442
468
|
text: result.text,
|
|
443
469
|
usage: result.usage,
|
|
470
|
+
usageLedger: result.usageLedger,
|
|
444
471
|
provider: "sentinelayer",
|
|
445
472
|
model: resolvedModel,
|
|
446
473
|
};
|