llmledger

v0.2.2
io.github.pouriaetab/llmledger Checked 4 days ago Published 14 days ago

Which AI model, and what it costs: LiteLLM prices, Arena ratings and price history.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

find_models Find Models

List the highest rated models for a kind of work within price, prompt size, ability and maker limits, each at its cheapest listing with its rating; or, with `name`, look one model up and list every host that offers it. Use when browsing or filtering the catalogue, or to find a model's exact name. Not for choosing between named models (compare_models), for a prompt you have in hand (suggest_for_project), or for a budget (estimate_cost).

ParameterTypeDescription
limitintegerHow many models to list (up to 200 for the whole catalogue)
makerOnly this maker, for example anthropic or openai
max_output_priceHighest answer price, dollars per 1M tokens
min_contextSmallest prompt size the model must take, in tokens
nameLook up one model by name instead of browsing: all its listings
needsarrayWhat the model must be able to do
taskstringThe kind of work, as Arena rates it

compare_models Compare Models

Compare 2 to 6 named models for a kind of work: rating, prices, cost per task (or how fast each uses a Claude or ChatGPT plan), the pick, and for each model the share of answer tokens at which it would beat the pick. Use when the user already has candidate models in mind. Not for finding candidates (find_models), for reading a prompt to guess the work (suggest_for_project), or for a monthly budget (estimate_cost).

ParameterTypeDescription
models *array2 to 6 model names, for example claude-opus-5.5, gpt-6.1-sol
answer_tokensAnswer tokens per model when they differ, by the names given
input_tokensintegerPrompt tokens per task
output_tokensintegerAnswer tokens per task, including hidden thinking
paystringapi: dollars; claude or chatgpt: how fast each uses that plan
taskstringThe kind of work, as Arena rates it

estimate_cost Estimate Cost

Price a workload on 1 to 10 models at each one's cheapest listing: dollars per call, per day and per 30 days, and with cache tokens the saving the cache makes. Use when the question is a budget or a bill: token counts and calls a day are known. Not for deciding which model is better (compare_models) or for pricing past usage from an export (price_my_usage).

ParameterTypeDescription
input_tokens *integerPrompt tokens per call
models *array1 to 10 model names
output_tokens *integerAnswer tokens per call, including hidden thinking
cache_write_tokensintegerHow many of the prompt tokens are written to the cache
cached_tokensintegerHow many of the prompt tokens are read from the cache
calls_per_daynumberCalls per day

price_history Price History

Show one model's price history: every price and retirement date change since 2023 on every host, each with the LiteLLM change behind it, the chance of a price change, retirement or removal in the next 90 days and year, and with `date`, the prices on that day. Use when the question is about one model over time, a past price, or how likely a price is to move. Not for today's cheapest price of several models (find_models or estimate_cost).

ParameterTypeDescription
model *stringA model name, for example claude-opus-5.5, or one listing such as bedrock/anthropic.claude-opus-5-5
dateA day as YYYY-MM-DD: each listing's prices that day and the change that set them

suggest_for_project Suggest For Project

Suggest a model and effort level for a prompt or a described project: it guesses the kind of work and names the best value (the cheapest model the votes cannot tell apart from the top), the top rated and the cheapest rated, each with its cost per task. Use when the user asks "which model should I use for this" and the work itself is in hand. Not for named candidates (compare_models) or for browsing by limits (find_models).

ParameterTypeDescription
prompt *stringThe project's starting prompt, or a description of the work
answerstringTypical answer length
paystringapi: dollars; claude or chatgpt: compare within that plan

not_yet_priced Not Yet Priced

List the models Arena has rated that LiteLLM's catalogue does not price yet, with how soon the catalogue usually prices a maker's models after Arena first shows them. Use when a brand-new model is missing from the other tools' answers, or to ask what is coming. Not for models that already have a price (find_models).

ParameterTypeDescription
makerOnly this maker, for example meta or ibm

estimate_time Estimate Time

Estimate how long one call and a whole job take, as a usual time and a slow day, from the user's own timed runs of that model called that way (kept by log_run). Use when the question is time, not money, and some runs have been logged; it says so when none have. Not for cost (estimate_cost) or for a job you have a promptfoo sample of (forecast_job gives time and cost together).

ParameterTypeDescription
input_tokens *integerPrompt tokens per call
model *stringA model name, as the catalogue or Ollama names it
output_tokens *integerAnswer tokens per call, including hidden thinking
callsintegerHow many calls the job makes
concurrencyintegerCalls running at once
thinkingbooleanThinking turned on
waystringHow the model is called

log_run Log Run

Record a timed run (model, tokens, seconds, how it was called), or every result of a promptfoo results file, in a file on this computer so estimate_time can learn from it. Use right after a call or a promptfoo run whose time is known. Not a query: it stores and returns what it stored. Nothing is sent anywhere.

ParameterTypeDescription
input_tokensPrompt tokens of the call
modelThe model that ran
output_tokensAnswer tokens of the call, hidden thinking included
promptfoo_resultsPath of a promptfoo results file (promptfoo eval -o results.json): every result becomes a run
secondsHow long the call took
taskThe kind of work, if known
thinkingbooleanThinking was on (a promptfoo result that counts thinking tokens is marked on by itself)
wayHow the model was called (default api; for a promptfoo file, read from each provider)

forecast_job Forecast Job

Estimate a whole job's time, cost and accuracy from a promptfoo run of a sample of it: for each model in the sample, the time as a usual time and a slow day, the cost at its cheapest listing next to the listing the sample used, the 90-day chance of a price change, how often it was right (95% range) and the break-even against the pick. Use when a promptfoo results file of a sample exists and the whole job's size is known. Not for a job with no sample (estimate_cost for money, estimate_time for time).

ParameterTypeDescription
items *integerHow many tests the whole job has
promptfoo_results *stringPath of a promptfoo results file from a sample of the job (promptfoo eval --filter-sample 20 -o sample.json)
concurrencyCalls running at once in the whole job (default: as the sample ran)
thinkingbooleanThinking turned on
wayHow the models are called (default: read from each provider)
wrong_answer_costDollars a wrong answer costs you to catch and fix; the pick then counts it

local_or_cloud Local Or Cloud

Compare running an open model on a computer you buy with paying a cloud model per call: the cost a month each way, the month the computer pays for itself, and whether it keeps up with the load. Use when the question is whether to buy hardware for a local model. Needs timed runs of the local model (log_run) and the computer's price; electricity comes from EIA or the user's own rate. Not for cloud-only comparisons (compare_models or estimate_cost).

ParameterTypeDescription
calls_per_month *numberCalls a month
cloud_models *array1 to 5 cloud models to compare with
hardware_price *numberWhat the computer costs you, in dollars
input_tokens *integerPrompt tokens per call
local_model *stringThe open model you would run at home, as Ollama names it, for example llama3.1:8b
output_tokens *integerAnswer tokens per call, including hidden thinking
cached_tokensintegerPrompt tokens read from the cloud model's cache
electricity_priceYour electricity price, dollars per kWh (default: EIA's average for homes)
local_waystringHow the local model is called
monthsintegerHow many months to compare over
stateA US state, for EIA's average there, for example Texas
thinkingbooleanThinking turned on for the local model
wattsPower the computer draws while it answers, in watts

price_my_usage Price My Usage

Price the user's own past coding agent usage, from a ccusage or codeburn export, on every rated model: each session at the price of its day, the models that keep the rating and cost less, a 95% range for the cost per session, and whether two models differ for real or the data cannot tell. Use when a usage export (or a list of token mixes) exists and the question is what the same work would have cost elsewhere. Not for a future workload (estimate_cost) or for a prompt (suggest_for_project). Reads token counts, names and dates only; nothing leaves the computer.

ParameterTypeDescription
compareTwo models to test against each other on the same sessions
exportPath of a token export on this computer: `ccusage daily --json > f.json`, `ccusage session --json > f.json`, or `codeburn export -f json -o f.json`
limitintegerHow many models to list in every_model (the cheapest first)
mixInstead of a file: token mixes as {model, date, input, output, cache_read, cache_write, session?}
taskThe kind of work the sessions were (default: codeburn's categories, else coding)