Imp.Core.LMResponse (Imp v0.16.1)

Copy Markdown View Source

Provider-neutral LM response: normalized outputs, usage, cost, and raw data.

cost is the charge the client reported for this call, in USD, as a non-negative float, or nil when none was reported. nil means the charge is unknown, not that the call was free.

estimated_cost is ReqLLM's estimate for the call: the reported token counts priced from its model catalog, as a non-negative float, or nil when the catalog has no price for the model. It is a different number from the charge whenever prices have changed, the provider routed to an endpoint with other prices, or the provider prices caching and reasoning differently from the catalog, so a host that falls back on it when cost is nil is choosing to count an estimate as spend.

Either figure may arrive as a bare number, a string, a Decimal or a breakdown map carrying a total, and Imp reads the number out of each, so a host reading a call's money never has to learn a provider library's private shape.

billing is the breakdown behind estimated_cost — ReqLLM's catalog line items and input, output and reasoning splits — untouched, when there is one, and nil otherwise. Its shape belongs to ReqLLM, so it is evidence to inspect rather than a contract to depend on.

Summary

Types

t()

@type t() :: %Imp.Core.LMResponse{
  billing: map() | nil,
  cost: float() | nil,
  estimated_cost: float() | nil,
  metadata: map(),
  outputs: list(),
  raw: term(),
  usage: map()
}