@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
27 lines (26 loc) • 1.36 kB
TypeScript
import type { TokenUsage } from "../types/index.js";
/**
* Calculate the dollar cost of a generate/stream call based on token usage.
* Returns 0 if the provider/model combination is not in the pricing table.
*/
export declare function calculateCost(provider: string, model: string, usage: TokenUsage): number;
/**
* Check if pricing is available for a provider/model combination.
* Checks the rate table directly instead of computing a cost,
* so even very cheap models (e.g. gemini-1.5-flash) are detected correctly.
*
* Zero-rate entries (the local-provider `_default` for lm-studio / llamacpp)
* count as "no pricing" — those providers explicitly don't have an upstream
* USD price, and any caller gated by `hasPricing()` should treat them as
* non-billable rather than zero-cost-billable.
*/
/**
* Whether a model's rates came from an exact table entry or were inferred.
*
* `findRates` falls back to a longest-prefix match, so an unlisted model can
* silently inherit a listed one's rates — e.g. "gpt-5.6-sol" matches the
* "gpt-5" entry and is billed at its price. That is a guess, not a quote, and
* a caller reporting spend needs to be able to say which it had.
*/
export declare function isExactPricingMatch(provider: string, model: string): boolean;
export declare function hasPricing(provider: string, model: string): boolean;