/**
* Token Pricing Configuration
*
* Pattern Matching
* ================
* `findMatchingPattern` uses `modelName.includes(key)` and selects the **longest**
* matching key. If a key's length equals the model name's length (exact match), it
* returns immediately — no further keys are checked.
*
* For keys of different lengths, definition order does not affect the result — the
* longest match always wins. For **same-length ties**, the function iterates in
* reverse, so the last-defined key wins. Key ordering therefore matters for:
* 1. **Performance**: list older/legacy models first, newer models last — newer
* models are more commonly used and will match earlier in the reverse scan.
* 2. **Same-length tie-breaking**: when two keys of equal length both match,
* the last-defined key wins.
*/
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
export interface TxDeps {
/** From @librechat/api — matches a model name to a canonical key. */
matchModelName: (model: string, endpoint?: string) => string | undefined;
/** From @librechat/api — finds the longest key in `values` whose key is a substring of `model`. */
findMatchingPattern: (model: string, values: Record>) => string | undefined;
}
export declare const defaultRate = 6;
/**
* Mapping of model token sizes to their respective multipliers for prompt and completion.
* The rates are 1 USD per 1M tokens.
*/
export declare const tokenValues: Record;
/**
* Mapping of model token sizes to their respective multipliers for cached input, read and write.
* The rates are 1 USD per 1M tokens.
*/
export declare const cacheTokenValues: Record;
/**
* Premium (tiered) pricing for models whose rates change based on prompt size.
*/
export declare const premiumTokenValues: Record;
export declare function createTxMethods(_mongoose: typeof import('mongoose'), txDeps: TxDeps): {
tokenValues: Record;
premiumTokenValues: Record;
getValueKey: (model: string, endpoint?: string) => string | undefined;
getMultiplier: ({ model, valueKey, endpoint, tokenType, inputTokenCount, endpointTokenConfig, }: {
model?: string | undefined;
valueKey?: string | undefined;
endpoint?: string | undefined;
tokenType?: "prompt" | "completion" | undefined;
inputTokenCount?: number | undefined;
endpointTokenConfig?: Record> | undefined;
}) => number;
getPremiumRate: (valueKey: string, tokenType: string, inputTokenCount?: number | null) => number | null;
getCacheMultiplier: ({ valueKey, cacheType, model, endpoint, endpointTokenConfig, }: {
valueKey?: string | undefined;
cacheType?: "read" | "write" | undefined;
model?: string | undefined;
endpoint?: string | undefined;
endpointTokenConfig?: Record> | undefined;
}) => number | null;
defaultRate: number;
cacheTokenValues: Record;
};
export type TxMethods = ReturnType;