session_cost() adds up the tokens and estimated cost of the model calls
in the prompt history (see inspect_history()), overall and per model.
Value
A list of class dsprrr_session_cost with n_calls, tokens_in,
tokens_out, total_tokens, cost (in US dollars; NA if any call's
cost is unknown) and by_model, a tibble with the same totals per model.
Details
The prompt history keeps the most recent 100 calls by default
(options(dsprrr.prompt_history_max = )), so older calls drop out of the
totals, and clear_prompt_history() resets them. Only calls recorded in
the history count: see inspect_history() for which ones are. Costs are
ellmer's estimates.
See also
Other inspection:
accessors,
clear_prompt_history(),
clear_traces(),
export_traces(),
get_last_prompt(),
inspect_history(),
summarize_traces()