sliftutils 1.2.4 → 1.2.5
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 +1 -0
- package/misc/openrouter.d.ts +1 -0
- package/misc/openrouter.ts +3 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
package/misc/openrouter.d.ts
CHANGED
package/misc/openrouter.ts
CHANGED
|
@@ -22,6 +22,8 @@ export function getTotalCost() {
|
|
|
22
22
|
return totalCost;
|
|
23
23
|
}
|
|
24
24
|
type OpenRouterOptions = {
|
|
25
|
+
// If not provided, we'll pop up a modal to ask the user for it, Or, if we're on the server, we'll try to read it from the user folder.
|
|
26
|
+
apiKey?: string;
|
|
25
27
|
provider?: {
|
|
26
28
|
sort?: "throughput" | "price" | "latency",
|
|
27
29
|
// https://openrouter.ai/docs/features/provider-routing#ordering-specific-providers
|
|
@@ -90,7 +92,7 @@ export async function openRouterCallBase(config: {
|
|
|
90
92
|
retries?: number;
|
|
91
93
|
}): Promise<string> {
|
|
92
94
|
let { model, messages, options, onCost } = config;
|
|
93
|
-
let openrouterKey = await getAPIKey("openrouter.json");
|
|
95
|
+
let openrouterKey = options?.apiKey || await getAPIKey("openrouter.json");
|
|
94
96
|
console.log(`Calling ${model} with ${messages.length} messages`);
|
|
95
97
|
let time = Date.now();
|
|
96
98
|
let stillRunning = true;
|