import type { AiModelPrice } from './ai-model-price.js'; /** * The price of the models in use, and what a usage row cost (ADR-0061 decision 6 amendment 1). * * No provider answers its prices through an API, so prices are read from the one list LiteLLM publishes - only for a * model in use, and only when it has none. A row already in the table is never changed on its own. */ /** The one price list prices are read from. Prices in it are USD per token. */ export declare const MODEL_PRICE_LIST_URL = "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json"; export interface ModelRef { provider: string; model: string; } export interface ModelPriceValues { inputPerMTok: number; outputPerMTok: number; cacheReadPerMTok?: number; cacheWritePerMTok?: number; } export interface ListedPrice extends ModelPriceValues { /** The name the list had the model under. */ listedAs: string; } export interface UsageTokens { inputTokens: number; outputTokens: number; cacheReadTokens?: number; cacheWriteTokens?: number; } /** * The names a model is looked for under, in order (amendment 1-3): `/`, ``, then both without * a date at the end - a provider answers with a dated name (`gpt-5-2025-08-07`) the list may only have undated. */ export declare function listNamesOf({ provider, model }: ModelRef): string[]; /** The model's prices per million tokens, from the list - or nothing when it is not there with both prices. */ export declare function priceInList(list: Record, ref: ModelRef): ListedPrice | undefined; /** * What tokens cost at a price, in USD (amendment 1-6). The cached parts of the input are charged at the cache prices, * the input price when the model has none; the rest of the input at the input price. */ export declare function costOf(tokens: UsageTokens, price: ModelPriceValues): number; export declare const modelKey: ({ provider, model }: ModelRef) => string; /** Every price in the table, by model. */ export declare function readModelPrices(): Promise>; /** Reads the LiteLLM list. A list that cannot be read is a refusal that names it. */ export declare function fetchModelPriceList(): Promise>; /** * Gives the models that have no price one from the list (amendment 1-2). A model already priced is left as it is; a * model the list does not have stays unpriced. Never throws: a failure is logged and the models stay unpriced. */ export declare function fillMissingModelPrices(models: ModelRef[]): Promise; /** Reads one model's prices from the list again, over what the table has - the administrator's own act. */ export declare function refreshModelPriceFromList(ref: ModelRef, user: { id: string; }): Promise; export interface ModelPriceRefresh { /** Read from the list - new, or changed to the list's prices. */ updated: ModelRef[]; /** Entered by hand, so left as they are. */ kept: ModelRef[]; /** Not in the list; a row they had stays. */ unlisted: ModelRef[]; } /** * Reads the prices of these models from the list again, in one fetch (amendment 1-8). A price entered by hand is left * as it is; every other row takes the list's prices. Anyone who may change the domain's settings may ask for it, since * the values can only be the list's. A list that cannot be read is a refusal. */ export declare function refreshModelPricesFromList(models: ModelRef[], user: { id: string; }): Promise; /** The administrator's own prices for a model. */ export declare function saveModelPrice(ref: ModelRef & ModelPriceValues, user: { id: string; }): Promise; /** The models of every domain's agents and of every usage row - what the server prices when it starts. */ export declare function readModelsInUse(domainIds?: string[]): Promise;