@routstr/sdk 0.2.4 → 0.2.6
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 +10 -2
- package/dist/client/index.d.mts +38 -11
- package/dist/client/index.d.ts +38 -11
- package/dist/client/index.js +1771 -391
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +1771 -392
- package/dist/client/index.mjs.map +1 -1
- package/dist/discovery/index.d.mts +2 -2
- package/dist/discovery/index.d.ts +2 -2
- package/dist/discovery/index.js +1 -4
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/index.mjs +1 -4
- package/dist/discovery/index.mjs.map +1 -1
- package/dist/index.d.mts +26 -22
- package/dist/index.d.ts +26 -22
- package/dist/index.js +3005 -2107
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2997 -2108
- package/dist/index.mjs.map +1 -1
- package/dist/{interfaces-B85Wx7ni.d.mts → interfaces-B62Rw-dd.d.ts} +20 -15
- package/dist/{interfaces-DGdP8fQp.d.mts → interfaces-BWJJTCXO.d.mts} +1 -1
- package/dist/{interfaces-CC0LT9p9.d.ts → interfaces-BxDEka72.d.ts} +1 -1
- package/dist/{interfaces-BVNyAmKu.d.ts → interfaces-C5fLD3jB.d.mts} +20 -15
- package/dist/storage/index.d.mts +38 -142
- package/dist/storage/index.d.ts +38 -142
- package/dist/storage/index.js +852 -158
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/index.mjs +846 -159
- package/dist/storage/index.mjs.map +1 -1
- package/dist/store-BJlwiDX5.d.ts +151 -0
- package/dist/store-C5lnyX8k.d.mts +151 -0
- package/dist/{types-BlHjmWRK.d.mts → types-BYj_8c5c.d.mts} +3 -0
- package/dist/{types-BlHjmWRK.d.ts → types-BYj_8c5c.d.ts} +3 -0
- package/dist/wallet/index.d.mts +24 -26
- package/dist/wallet/index.d.ts +24 -26
- package/dist/wallet/index.js +130 -259
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/index.mjs +130 -259
- package/dist/wallet/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { M as Model } from './types-
|
|
2
|
-
export { A as APIErrorVerdict, b as AnnotationData, C as CandidateProvider, F as FetchAIResponseParams, I as ImageData, a as Message, c as MessageContentType, d as MintDiscoveryResult, e as MintSelection, f as ModelArchitecture, g as ModelDiscoveryResult, h as ModelPricing, i as ModelSatsPricing, j as PendingTokenEntry, k as PerRequestLimits, P as ProviderInfo, R as RefundResult, S as SpendResult, l as StreamingResult, m as TopUpResult, T as TransactionHistory, U as UsageStats } from './types-
|
|
3
|
-
import { D as DiscoveryAdapter } from './interfaces-
|
|
1
|
+
import { M as Model } from './types-BYj_8c5c.js';
|
|
2
|
+
export { A as APIErrorVerdict, b as AnnotationData, C as CandidateProvider, F as FetchAIResponseParams, I as ImageData, a as Message, c as MessageContentType, d as MintDiscoveryResult, e as MintSelection, f as ModelArchitecture, g as ModelDiscoveryResult, h as ModelPricing, i as ModelSatsPricing, j as PendingTokenEntry, k as PerRequestLimits, P as ProviderInfo, R as RefundResult, S as SpendResult, l as StreamingResult, m as TopUpResult, T as TransactionHistory, U as UsageStats } from './types-BYj_8c5c.js';
|
|
3
|
+
import { D as DiscoveryAdapter } from './interfaces-BxDEka72.js';
|
|
4
4
|
import { ModelManager } from './discovery/index.js';
|
|
5
5
|
export { MintDiscovery, ModelManagerConfig } from './discovery/index.js';
|
|
6
|
-
import { W as WalletAdapter, S as StorageAdapter, P as ProviderRegistry } from './interfaces-
|
|
7
|
-
export { A as ApiKeyEntry, C as ChildKeyEntry, R as RoutstrClientOptions, a as StreamingCallbacks } from './interfaces-
|
|
8
|
-
export { BalanceManager, BalanceState, CashuSpender, CreateProviderTokenOptions, ProviderTokenResult, RefundApiKeyOptions,
|
|
9
|
-
import { DebugLevel } from './client/index.js';
|
|
10
|
-
export { AlertLevel, FetchOptions, ModelProviderPrice, ProviderManager, RouteRequestParams, RoutstrClient, RoutstrClientMode, StreamCallbacks, StreamProcessor } from './client/index.js';
|
|
11
|
-
export { SDK_STORAGE_KEYS,
|
|
6
|
+
import { W as WalletAdapter, S as StorageAdapter, P as ProviderRegistry } from './interfaces-B62Rw-dd.js';
|
|
7
|
+
export { A as ApiKeyEntry, C as ChildKeyEntry, R as RoutstrClientOptions, a as StreamingCallbacks, X as XCashuTokenEntry } from './interfaces-B62Rw-dd.js';
|
|
8
|
+
export { BalanceManager, BalanceState, CashuSpender, CreateProviderTokenOptions, ProviderTokenResult, RefundApiKeyOptions, SpendOptions, TopUpOptions } from './wallet/index.js';
|
|
9
|
+
import { DebugLevel, RouteRequestToNodeResponseParams } from './client/index.js';
|
|
10
|
+
export { AlertLevel, FetchOptions, ModelProviderPrice, ProviderManager, RouteRequestParams, RoutstrClient, RoutstrClientConfig, RoutstrClientMode, StreamCallbacks, StreamProcessor, createSSEParserTransform } from './client/index.js';
|
|
11
|
+
export { SDK_STORAGE_KEYS, createBunSqliteDriver, createBunSqliteUsageTrackingDriver, createIndexedDBDriver, createIndexedDBUsageTrackingDriver, createMemoryDriver, createMemoryUsageTrackingDriver, createSqliteDriver, createSqliteUsageTrackingDriver, getDefaultDiscoveryAdapter, getDefaultProviderRegistry, getDefaultSdkDriver, getDefaultSdkStore, getDefaultStorageAdapter, getDefaultUsageTrackingDriver, localStorageDriver, setDefaultUsageTrackingDriver } from './storage/index.js';
|
|
12
|
+
import { U as UsageTrackingDriver, S as SdkStore } from './store-BJlwiDX5.js';
|
|
13
|
+
export { L as ListUsageTrackingOptions, a as StorageDriver, b as UsageTrackingEntry, c as createDiscoveryAdapterFromStore, d as createProviderRegistryFromStore, e as createSdkStore, f as createStorageAdapterFromStore } from './store-BJlwiDX5.js';
|
|
14
|
+
import 'http';
|
|
15
|
+
import 'stream';
|
|
12
16
|
import 'zustand/vanilla';
|
|
13
17
|
|
|
14
18
|
/**
|
|
@@ -124,6 +128,8 @@ interface RouteRequestOptions {
|
|
|
124
128
|
requestBody: unknown;
|
|
125
129
|
/** Optional: API path (defaults to /v1/chat/completions) */
|
|
126
130
|
path?: string;
|
|
131
|
+
/** Optional: request headers to forward upstream */
|
|
132
|
+
headers?: Record<string, string>;
|
|
127
133
|
/** Optional: force a specific provider base URL */
|
|
128
134
|
forcedProvider?: string;
|
|
129
135
|
/** Wallet adapter for Cashu operations */
|
|
@@ -144,8 +150,15 @@ interface RouteRequestOptions {
|
|
|
144
150
|
modelManager?: ModelManager;
|
|
145
151
|
/** Optional: set RoutstrClient debug level */
|
|
146
152
|
debugLevel?: DebugLevel;
|
|
147
|
-
/** Optional: client mode (xcashu
|
|
148
|
-
mode?: "xcashu" | "
|
|
153
|
+
/** Optional: client mode (xcashu or apikeys) */
|
|
154
|
+
mode?: "xcashu" | "apikeys";
|
|
155
|
+
/** Optional: explicit usage tracking driver */
|
|
156
|
+
usageTrackingDriver?: UsageTrackingDriver;
|
|
157
|
+
/** Optional: explicit SDK store (for using correct DB path) */
|
|
158
|
+
sdkStore?: SdkStore;
|
|
159
|
+
}
|
|
160
|
+
interface RouteRequestToNodeResponseOptions extends RouteRequestOptions {
|
|
161
|
+
res: RouteRequestToNodeResponseParams["res"];
|
|
149
162
|
}
|
|
150
163
|
/**
|
|
151
164
|
* Result from routeRequests function
|
|
@@ -171,17 +184,8 @@ interface RouteRequestResult {
|
|
|
171
184
|
}
|
|
172
185
|
/**
|
|
173
186
|
* Route an OpenAI-compatible request to the cheapest provider
|
|
174
|
-
*
|
|
175
|
-
* This function:
|
|
176
|
-
* 1. Bootstraps providers and fetches models
|
|
177
|
-
* 2. Discovers available mints
|
|
178
|
-
* 3. Selects the cheapest provider for the requested model
|
|
179
|
-
* 4. Handles Cashu send/receive via RoutstrClient
|
|
180
|
-
* 5. Proxies the request and returns the response
|
|
181
|
-
*
|
|
182
|
-
* @param options - Routing options
|
|
183
|
-
* @returns The provider response
|
|
184
187
|
*/
|
|
185
188
|
declare function routeRequests(options: RouteRequestOptions): Promise<Response>;
|
|
189
|
+
declare function routeRequestsToNodeResponse(options: RouteRequestToNodeResponseOptions): Promise<void>;
|
|
186
190
|
|
|
187
|
-
export { DebugLevel, DiscoveryAdapter, FailoverError, InsufficientBalanceError, MintDiscoveryError, MintUnreachableError, Model, ModelManager, ModelNotFoundError, NoProvidersAvailableError, ProviderBootstrapError, type ProviderDirectoryEntry, ProviderError, ProviderRegistry, type RouteRequestOptions, type RouteRequestResult, StorageAdapter, StreamingError, TokenOperationError, WalletAdapter, filterBaseUrlsForTor, getProviderEndpoints, isOnionUrl, isTorContext, normalizeProviderUrl, routeRequests };
|
|
191
|
+
export { DebugLevel, DiscoveryAdapter, FailoverError, InsufficientBalanceError, MintDiscoveryError, MintUnreachableError, Model, ModelManager, ModelNotFoundError, NoProvidersAvailableError, ProviderBootstrapError, type ProviderDirectoryEntry, ProviderError, ProviderRegistry, type RouteRequestOptions, type RouteRequestResult, type RouteRequestToNodeResponseOptions, RouteRequestToNodeResponseParams, SdkStore, StorageAdapter, StreamingError, TokenOperationError, UsageTrackingDriver, WalletAdapter, filterBaseUrlsForTor, getProviderEndpoints, isOnionUrl, isTorContext, normalizeProviderUrl, routeRequests, routeRequestsToNodeResponse };
|